Mercurial > emacs
comparison src/ftfont.c @ 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 | 6434da51a24b |
children | 464a00cca3cf |
comparison
equal
deleted
inserted
replaced
97825:2f7d54ce5f2a | 97826:f1d6d439f960 |
---|---|
30 #include "frame.h" | 30 #include "frame.h" |
31 #include "blockinput.h" | 31 #include "blockinput.h" |
32 #include "character.h" | 32 #include "character.h" |
33 #include "charset.h" | 33 #include "charset.h" |
34 #include "coding.h" | 34 #include "coding.h" |
35 #include "composite.h" | |
35 #include "fontset.h" | 36 #include "fontset.h" |
36 #include "font.h" | 37 #include "font.h" |
37 #include "ftfont.h" | 38 #include "ftfont.h" |
38 | 39 |
39 /* Symbolic type of this font-driver. */ | 40 /* Symbolic type of this font-driver. */ |
205 FcPattern *pattern; | 206 FcPattern *pattern; |
206 { | 207 { |
207 Lisp_Object slot; | 208 Lisp_Object slot; |
208 FcPattern *match; | 209 FcPattern *match; |
209 FcResult result; | 210 FcResult result; |
211 FcLangSet *langset; | |
210 | 212 |
211 family = Fintern (Fdowncase (SYMBOL_NAME (family)), Qnil); | 213 family = Fintern (Fdowncase (SYMBOL_NAME (family)), Qnil); |
212 if (EQ (family, Qmono)) | 214 if (EQ (family, Qmono)) |
213 family = Qmonospace; | 215 family = Qmonospace; |
214 else if (EQ (family, Qsans) || EQ (family, Qsans__serif)) | 216 else if (EQ (family, Qsans) || EQ (family, Qsans__serif)) |
222 if (! pattern) | 224 if (! pattern) |
223 goto err; | 225 goto err; |
224 FcPatternDel (pattern, FC_FOUNDRY); | 226 FcPatternDel (pattern, FC_FOUNDRY); |
225 FcPatternDel (pattern, FC_FAMILY); | 227 FcPatternDel (pattern, FC_FAMILY); |
226 FcPatternAddString (pattern, FC_FAMILY, SYMBOL_FcChar8 (family)); | 228 FcPatternAddString (pattern, FC_FAMILY, SYMBOL_FcChar8 (family)); |
229 if (FcPatternGetLangSet (pattern, FC_LANG, 0, &langset) != FcResultMatch) | |
230 { | |
231 /* This is to avoid the effect of locale. */ | |
232 langset = FcLangSetCreate (); | |
233 FcLangSetAdd (langset, "en"); | |
234 FcPatternAddLangSet (pattern, FC_LANG, langset); | |
235 FcLangSetDestroy (langset); | |
236 } | |
227 FcConfigSubstitute (NULL, pattern, FcMatchPattern); | 237 FcConfigSubstitute (NULL, pattern, FcMatchPattern); |
228 FcDefaultSubstitute (pattern); | 238 FcDefaultSubstitute (pattern); |
229 match = FcFontMatch (NULL, pattern, &result); | 239 match = FcFontMatch (NULL, pattern, &result); |
230 if (match) | 240 if (match) |
231 { | 241 { |
1767 Lisp_Object lgstring; | 1777 Lisp_Object lgstring; |
1768 struct font *font; | 1778 struct font *font; |
1769 FT_Face ft_face; | 1779 FT_Face ft_face; |
1770 OTF *otf; | 1780 OTF *otf; |
1771 { | 1781 { |
1772 EMACS_UINT len = LGSTRING_LENGTH (lgstring); | 1782 EMACS_UINT len = LGSTRING_GLYPH_LEN (lgstring); |
1773 EMACS_UINT i; | 1783 EMACS_UINT i; |
1774 struct MFLTFontFT flt_font_ft; | 1784 struct MFLTFontFT flt_font_ft; |
1775 | 1785 |
1776 if (! m17n_flt_initialized) | 1786 if (! m17n_flt_initialized) |
1777 { | 1787 { |
1827 break; | 1837 break; |
1828 gstring.allocated += gstring.allocated; | 1838 gstring.allocated += gstring.allocated; |
1829 gstring.glyphs = realloc (gstring.glyphs, | 1839 gstring.glyphs = realloc (gstring.glyphs, |
1830 sizeof (MFLTGlyph) * gstring.allocated); | 1840 sizeof (MFLTGlyph) * gstring.allocated); |
1831 } | 1841 } |
1832 if (gstring.used > LGSTRING_LENGTH (lgstring)) | 1842 if (gstring.used > LGSTRING_GLYPH_LEN (lgstring)) |
1833 return Qnil; | 1843 return Qnil; |
1834 for (i = 0; i < gstring.used; i++) | 1844 for (i = 0; i < gstring.used; i++) |
1835 { | 1845 { |
1836 MFLTGlyph *g = gstring.glyphs + i; | 1846 MFLTGlyph *g = gstring.glyphs + i; |
1837 | 1847 |