diff src/font-mgr.h @ 3659:98af8a976fc3

[xemacs-hg @ 2006-11-05 22:31:31 by aidan] Support specifying fonts for particular character sets in Mule; support translation to ISO 10646-1 for Mule character sets without an otherwise matching font; move to a vector of X11-charset-X11-registry instead of a regex for the charset-registry property.
author aidan
date Sun, 05 Nov 2006 22:31:46 +0000
parents 316fddbf58e2
children 5724b7632db3
line wrap: on
line diff
--- a/src/font-mgr.h	Sat Nov 04 22:51:03 2006 +0000
+++ b/src/font-mgr.h	Sun Nov 05 22:31:46 2006 +0000
@@ -68,4 +68,73 @@
 #define CONCHECK_FCPATTERN(x) CONCHECK_RECORD (x, fc_pattern)
 #define XFCPATTERN_PTR(x) (XFCPATTERN(x)->fcpatPtr)
 
+#ifdef USE_XFT
+/*
+  The format of a fontname (as returned by fontconfig) is not well-documented,
+  But the character repertoire is represented in an ASCII-compatible way.  See
+  fccharset.c (FcCharSetUnparse).  So we can use UTF-8 for long names.
+
+  Currently we have a hack where different versions of the unparsed name are
+  used in different contexts fairly arbitrarily.  I don't think this is close
+  to coherency; even without the charset and lang properties fontconfig names
+  are too unwieldy to use.  We need to rethink the approach here.  I think
+  probably Lisp_Font_Instance.name should contain the font name as specified
+  to Lisp (almost surely much shorter than shortname, even, and most likely
+  wildcarded), while Lisp_Font_Instance.truename should contain the longname.
+  For now, I'm going to #ifdef the return values defaulting to short. -- sjt
+*/
+
+/*                DEBUGGING STUFF                */
+
+/* print message to stderr: one internal-format string argument */
+#define DEBUG_XFT0(level,s)		\
+  if (debug_xft > level) stderr_out (s)
+
+/* print message to stderr: one formatted argument */
+#define DEBUG_XFT1(level,format,x1)		\
+  if (debug_xft > level) stderr_out (format, x1)
+
+/* print message to stderr: two formatted arguments */
+#define DEBUG_XFT2(level,format,x1,x2)			\
+  if (debug_xft > level) stderr_out (format, x1, x2)
+
+/* print message to stderr: three formatted arguments */
+#define DEBUG_XFT3(level,format,x1,x2,x3)			\
+  if (debug_xft > level) stderr_out (format, x1, x2, x3)
+
+/* print message to stderr: four formatted arguments */
+#define DEBUG_XFT4(level,format,x1,x2,x3,x4)			\
+  if (debug_xft > level) stderr_out (format, x1, x2, x3, x4)
+
+/* print an Xft pattern to stderr
+   LEVEL is the debug level (to compare to debug_xft)
+   FORMAT is a newline-terminated printf format with one %s for the pattern
+     and must be internal format (eg, pure ASCII)
+   PATTERN is an FcPattern *. */
+#define PRINT_XFT_PATTERN(level,format,pattern)			\
+  do {								\
+    DECLARE_EISTRING (eistrpxft_name);				\
+    FcChar8 *name = FcNameUnparse (pattern);			\
+								\
+    eicpy_ext(eistrpxft_name, name, Qfc_font_name_encoding);	\
+    DEBUG_XFT1 (level, format, eidata(eistrpxft_name));		\
+    free (name);						\
+  } while (0)
+
+/* print a progress message
+   LEVEL is the debug level (to compare to debug_xft)
+   FONT is the Xft font name in UTF-8 (the native encoding of Xft)
+   LANG is the language being checked for support (must be ASCII). */
+#define CHECKING_LANG(level,font,lang)					\
+  do {									\
+    DECLARE_EISTRING (eistrcl_name);					\
+    eicpy_ext(eistrcl_name, font, Qfc_font_name_encoding);		\
+    DEBUG_XFT2 (level, "checking if %s handles %s\n",			\
+			eidata(eistrcl_name), lang);			\
+  } while (0)
+
+#else /* USE_XFT */
+
+#endif /* USE_XFT */
+
 #endif /* INCLUDED_font_mgr_h_ */