changeset 90500:60e0667ab709

(ftfont_list): Handle properties dpi, spacing, and scalable.
author Kenichi Handa <handa@m17n.org>
date Wed, 28 Jun 2006 05:40:15 +0000
parents 32b8f672da38
children 2ef165ebcc7d
files src/ftfont.c
diffstat 1 files changed, 28 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/ftfont.c	Wed Jun 28 05:39:02 2006 +0000
+++ b/src/ftfont.c	Wed Jun 28 05:40:15 2006 +0000
@@ -312,6 +312,9 @@
   FcObjectSet *objset = NULL;
   Lisp_Object registry = Qunicode_bmp;
   int weight = 0;
+  double dpi = -1;
+  int spacing = -1;
+  int scalable = -1;
   
   val = null_vector;
 
@@ -347,6 +350,13 @@
   font_name = Qnil;
   if (CONSP (extra))
     {
+      tmp = assq_no_quit (QCname, extra);
+      if (CONSP (tmp))
+	{
+	  font_name = XCDR (tmp);
+	  if (SDATA (font_name)[0] != ':')
+	    return val;
+	}
       tmp = assq_no_quit (QCotf, extra);
       if (! NILP (tmp))
 	return val;
@@ -371,9 +381,6 @@
 		tmp = XCDR (tmp);
 	      }
 	}
-      tmp = Fassq (QCname, extra);
-      if (CONSP (tmp))
-	font_name = XCDR (tmp);
       tmp = assq_no_quit (QCscript, extra);
       if (CONSP (tmp) && ! charset)
 	{
@@ -392,6 +399,15 @@
 		  goto err;
 	    }
 	}
+      tmp = assq_no_quit (QCdpi, extra);
+      if (CONSP (tmp))
+	dpi = XINT (XCDR (tmp));
+      tmp = assq_no_quit (QCspacing, extra);
+      if (CONSP (tmp))
+	spacing = XINT (XCDR (tmp));
+      tmp = assq_no_quit (QCscalable, extra);
+      if (CONSP (tmp))
+	spacing = ! NILP (XCDR (tmp));
     }
 
   if (STRINGP (font_name))
@@ -430,6 +446,15 @@
   if (langset
       && ! FcPatternAddLangSet (pattern, FC_LANG, langset))
     goto err;
+  if (dpi >= 0
+      && ! FcPatternAddDouble (pattern, FC_DPI, dpi))
+    goto err;
+  if (spacing >= 0
+      && ! FcPatternAddInteger (pattern, FC_SPACING, spacing))
+    goto err;
+  if (scalable >= 0
+      && ! FcPatternAddBool (pattern, FC_SPACING, spacing ? FcTrue : FcFalse))
+    goto err;
 
   objset = FcObjectSetBuild (FC_FOUNDRY, FC_FAMILY, FC_WEIGHT, FC_SLANT,
 			     FC_WIDTH, FC_PIXEL_SIZE, FC_SPACING,