changeset 97826:f1d6d439f960

Include composite.h. (ftfont_resolve_generic_family): Add langset "en" to pattern. (ftfont_shape_by_flt): Use LGSTRING_GLYPH_LEN, not LGSTRING_LENGTH.
author Kenichi Handa <handa@m17n.org>
date Fri, 29 Aug 2008 07:56:10 +0000
parents 2f7d54ce5f2a
children 36198ccea250
files src/ftfont.c
diffstat 1 files changed, 12 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/ftfont.c	Fri Aug 29 07:55:54 2008 +0000
+++ b/src/ftfont.c	Fri Aug 29 07:56:10 2008 +0000
@@ -32,6 +32,7 @@
 #include "character.h"
 #include "charset.h"
 #include "coding.h"
+#include "composite.h"
 #include "fontset.h"
 #include "font.h"
 #include "ftfont.h"
@@ -207,6 +208,7 @@
   Lisp_Object slot;
   FcPattern *match;
   FcResult result;
+  FcLangSet *langset;
 
   family = Fintern (Fdowncase (SYMBOL_NAME (family)), Qnil);
   if (EQ (family, Qmono))
@@ -224,6 +226,14 @@
   FcPatternDel (pattern, FC_FOUNDRY);
   FcPatternDel (pattern, FC_FAMILY);
   FcPatternAddString (pattern, FC_FAMILY, SYMBOL_FcChar8 (family));
+  if (FcPatternGetLangSet (pattern, FC_LANG, 0, &langset) != FcResultMatch)
+    {
+      /* This is to avoid the effect of locale.  */
+      langset = FcLangSetCreate ();
+      FcLangSetAdd (langset, "en");
+      FcPatternAddLangSet (pattern, FC_LANG, langset);
+      FcLangSetDestroy (langset);
+    }
   FcConfigSubstitute (NULL, pattern, FcMatchPattern);
   FcDefaultSubstitute (pattern);
   match = FcFontMatch (NULL, pattern, &result);
@@ -1769,7 +1779,7 @@
      FT_Face ft_face;
      OTF *otf;
 {
-  EMACS_UINT len = LGSTRING_LENGTH (lgstring);
+  EMACS_UINT len = LGSTRING_GLYPH_LEN (lgstring);
   EMACS_UINT i;
   struct MFLTFontFT flt_font_ft;
 
@@ -1829,7 +1839,7 @@
       gstring.glyphs = realloc (gstring.glyphs,
 				sizeof (MFLTGlyph) * gstring.allocated);
     }
-  if (gstring.used > LGSTRING_LENGTH (lgstring))
+  if (gstring.used > LGSTRING_GLYPH_LEN (lgstring))
     return Qnil;
   for (i = 0; i < gstring.used; i++)
     {