changeset 96076:bd3f48456ac7

(ftfont_pattern_entity): New arg extra. Caller changed. (ftfont_spec_pattern): Don't check QCfc_unknown_spec and QCname. (ftfont_list) [FC_FONTFORMAT]: Include FC_FONTFORMAT in objset.
author Kenichi Handa <handa@m17n.org>
date Thu, 19 Jun 2008 00:42:11 +0000
parents 3376493a3ad4
children 86e3f462b0c2
files src/ftfont.c
diffstat 1 files changed, 13 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/src/ftfont.c	Thu Jun 19 00:41:48 2008 +0000
+++ b/src/ftfont.c	Thu Jun 19 00:42:11 2008 +0000
@@ -68,7 +68,8 @@
 #endif	/* HAVE_LIBOTF */
 };
 
-static Lisp_Object ftfont_pattern_entity P_ ((FcPattern *, Lisp_Object, int));
+static Lisp_Object ftfont_pattern_entity P_ ((FcPattern *, Lisp_Object,
+					      Lisp_Object, int));
 
 static Lisp_Object ftfont_resolve_generic_family P_ ((Lisp_Object));
 Lisp_Object ftfont_font_format P_ ((FcPattern *));
@@ -128,9 +129,9 @@
 extern Lisp_Object Qc, Qm, Qp, Qd;
 
 static Lisp_Object
-ftfont_pattern_entity (p, registry, fc_charset_idx)
+ftfont_pattern_entity (p, registry, extra, fc_charset_idx)
      FcPattern *p;
-     Lisp_Object registry;
+     Lisp_Object registry, extra;
      int fc_charset_idx;
 {
   Lisp_Object entity;
@@ -181,6 +182,7 @@
       && b == FcTrue)
     ASET (entity, FONT_AVGWIDTH_INDEX, make_number (0));
 
+  ASET (entity, FONT_EXTRA_INDEX, Fcopy_sequence (extra));
   font_put_extra (entity, QCfont_entity,
 		  Fcons (make_unibyte_string ((char *) file,
 					      strlen ((char *) file)),
@@ -469,7 +471,6 @@
   int n;
   int dpi = -1;
   int scalable = -1;
-  Lisp_Object name = Qnil;
   Lisp_Object script = Qnil;
   Lisp_Object registry;
 
@@ -512,8 +513,6 @@
       key = XCAR (XCAR (extra)), val = XCDR (XCAR (extra));
       if (EQ (key, QCdpi))
 	dpi = XINT (val);
-      else if (EQ (key, QCfc_unknown_spec))
-	name = val;
       else if (EQ (key, QClang))
 	{
 	  langset = FcLangSetCreate ();
@@ -530,8 +529,6 @@
 		  && ! FcLangSetAdd (langset, SYMBOL_FcChar8 (XCAR (val))))
 		goto err;
 	}
-      else if (EQ (key, QCname))
-	name = val;
       else if (EQ (key, QCotf))
 	{
 	  *otspec = ftfont_get_open_type_spec (val);
@@ -563,13 +560,9 @@
 	}
     }
 
-  pattern = NILP (name) ? FcPatternCreate () : FcNameParse (SDATA (name));
+  pattern = FcPatternCreate ();
   if (! pattern)
     goto err;
-  FcPatternDel (pattern, FC_SIZE);
-  FcPatternDel (pattern, FC_PIXEL_SIZE);
-  FcPatternDel (pattern, FC_FOUNDRY);
-  FcPatternDel (pattern, FC_FAMILY);
   tmp = AREF (spec, FONT_FOUNDRY_INDEX);
   if (! NILP (tmp)
       && ! FcPatternAddString (pattern, FC_FOUNDRY, SYMBOL_FcChar8 (tmp)))
@@ -663,6 +656,9 @@
 #ifdef FC_CAPABILITY
 			     FC_CAPABILITY,
 #endif	/* FC_CAPABILITY */
+#ifdef FC_FONTFORMAT
+			     FC_FONTFORMAT,
+#endif
 			     NULL);
   if (! objset)
     goto err;
@@ -746,6 +742,7 @@
 	}
 #endif	/* HAVE_LIBOTF */
       entity = ftfont_pattern_entity (fontset->fonts[i], registry,
+				      AREF (spec, FONT_EXTRA_INDEX),
 				      fc_charset_idx);
       if (! NILP (entity))
 	val = Fcons (entity, val);
@@ -800,7 +797,9 @@
       match = FcFontMatch (NULL, pattern, &result);
       if (match)
 	{
-	  entity = ftfont_pattern_entity (match, Qunicode_bmp, fc_charset_idx);
+	  entity = ftfont_pattern_entity (match, Qunicode_bmp,
+					  AREF (spec, FONT_EXTRA_INDEX),
+					  fc_charset_idx);
 	  FcPatternDestroy (match);
 	  if (! NILP (AREF (spec, FONT_FAMILY_INDEX))
 	      && NILP (assq_no_quit (AREF (spec, FONT_FAMILY_INDEX),