changeset 90680:254cfd053f9c

(ftfont_pattern_entity): Check if FC_FONTFORMAT is defined. (ftfont_list_generic_family, ftfont_list, ftfont_font_format): Likewise.
author Kenichi Handa <handa@m17n.org>
date Mon, 27 Nov 2006 04:33:07 +0000
parents 9a7955701103
children d5e93f2ba87f
files src/ftfont.c
diffstat 1 files changed, 33 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/src/ftfont.c	Fri Nov 24 01:48:49 2006 +0000
+++ b/src/ftfont.c	Mon Nov 27 04:33:07 2006 +0000
@@ -113,7 +113,9 @@
     return Qnil;
   if (FcPatternGetCharSet (p, FC_CHARSET, 0, &charset) != FcResultMatch)
     charset = NULL;
+#ifdef FC_FONTFORMAT
   if (FcPatternGetString (p, FC_FONTFORMAT, 0, &fontformat) != FcResultMatch)
+#endif	/* FC_FONTFORMAT */
     fontformat = NULL;
 
   entity = Fmake_vector (make_number (FONT_ENTITY_MAX), null_string);
@@ -155,8 +157,10 @@
   if (FcPatternAddString (p, FC_FILE, file) == FcFalse
       || (charset
 	  && FcPatternAddCharSet (p, FC_CHARSET, charset) == FcFalse)
+#ifdef FC_FONTFORMAT
       || (fontformat
 	  && FcPatternAddString (p, FC_FONTFORMAT, fontformat) == FcFalse)
+#endif	/* FC_FONTFORMAT */
       || (numeric >= 0
 	  && FcPatternAddInteger (p, FC_SPACING, numeric) == FcFalse))
     {
@@ -195,7 +199,11 @@
 
       objset = FcObjectSetBuild (FC_FOUNDRY, FC_FAMILY, FC_WEIGHT, FC_SLANT,
 				 FC_WIDTH, FC_PIXEL_SIZE, FC_SPACING,
-				 FC_CHARSET, FC_FILE, FC_FONTFORMAT, NULL);
+				 FC_CHARSET, FC_FILE,
+#ifdef FC_FONTFORMAT
+				 FC_FONTFORMAT,
+#endif	/* FC_FONTFORMAT */
+				 NULL);
       if (! objset)
 	goto err;
       pattern = FcPatternBuild (NULL, FC_FAMILY, FcTypeString,
@@ -465,7 +473,11 @@
 
   objset = FcObjectSetBuild (FC_FOUNDRY, FC_FAMILY, FC_WEIGHT, FC_SLANT,
 			     FC_WIDTH, FC_PIXEL_SIZE, FC_SPACING,
-			     FC_CHARSET, FC_FILE, FC_FONTFORMAT, NULL);
+			     FC_CHARSET, FC_FILE,
+#ifdef FC_FONTFORMAT
+			     FC_FONTFORMAT,
+#endif	/* FC_FONTFORMAT */
+			     NULL);
   if (! objset)
     goto err;
   if (otf_script[0])
@@ -940,18 +952,31 @@
 Lisp_Object
 ftfont_font_format (FcPattern *pattern)
 {
-  FcChar8 *fmt;
+  FcChar8 *str;
 
-  if (FcPatternGetString (pattern, FC_FONTFORMAT, 0, &fmt) != FcResultMatch)
+#ifdef FC_FONTFORMAT
+  if (FcPatternGetString (pattern, FC_FONTFORMAT, 0, &str) != FcResultMatch)
     return Qnil;
-  if (strcmp ((char *) fmt, "TrueType") == 0)
+  if (strcmp ((char *) str, "TrueType") == 0)
     return intern ("truetype");
-  if (strcmp ((char *) fmt, "Tyep 1") == 0)
+  if (strcmp ((char *) str, "Tyep 1") == 0)
     return intern ("type1");
-  if (strcmp ((char *) fmt, "PCF") == 0)  
+  if (strcmp ((char *) str, "PCF") == 0)  
     return intern ("pcf");
-  if (strcmp ((char *) fmt, "BDF") == 0)  
+  if (strcmp ((char *) str, "BDF") == 0)  
     return intern ("bdf");
+#else  /* not FC_FONTFORMAT */
+  if (FcPatternGetString (pattern, FC_FILE, 0, &file) != FcResultMatch)
+    return Qnil;
+  if (strcasestr ((char *) str, ".ttf") == 0)
+    return intern ("truetype");
+  if (strcasestr ((char *) str, "pfb") == 0)
+    return intern ("type1");
+  if (strcasestr ((char *) str, "pcf") == 0)  
+    return intern ("pcf");
+  if (strcasestr ((char *) str, "bdf") == 0)  
+    return intern ("bdf");
+#endif	/* not FC_FONTFORMAT */
   return intern ("unknown");
 }