From: Kenichi Handa Date: Mon, 19 Jun 2006 01:34:55 +0000 (+0000) Subject: (ftfont_pattern_entity): Use the numeric value 100 for X-Git-Tag: emacs-pretest-23.0.90~8295^2~876 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=f63d54dc75e8e6a6fe57048e1968a139436507ea;p=emacs.git (ftfont_pattern_entity): Use the numeric value 100 for FC_WEIGHT_REGULAR. Exclude FC_SIZE and FC_PIXEL_SIZE from listing pattern. Don't force scalable. --- diff --git a/src/ftfont.c b/src/ftfont.c index 0889ee147a8..b7f3ea0b236 100644 --- a/src/ftfont.c +++ b/src/ftfont.c @@ -122,7 +122,11 @@ ftfont_pattern_entity (p, frame, registry) if (FcPatternGetString (p, FC_FAMILY, 0, (FcChar8 **) &str) == FcResultMatch) ASET (entity, FONT_FAMILY_INDEX, intern_downcase (str, strlen (str))); if (FcPatternGetInteger (p, FC_WEIGHT, 0, &numeric) == FcResultMatch) - ASET (entity, FONT_WEIGHT_INDEX, make_number (numeric)); + { + if (numeric == FC_WEIGHT_REGULAR) + numeric = 100; + ASET (entity, FONT_WEIGHT_INDEX, make_number (numeric)); + } if (FcPatternGetInteger (p, FC_SLANT, 0, &numeric) == FcResultMatch) ASET (entity, FONT_SLANT_INDEX, make_number (numeric + 100)); if (FcPatternGetInteger (p, FC_WIDTH, 0, &numeric) == FcResultMatch) @@ -384,7 +388,13 @@ ftfont_list (frame, spec) } if (STRINGP (font_name)) - pattern = FcNameParse (SDATA (font_name)); + { + pattern = FcNameParse (SDATA (font_name)); + /* Ignore these values in listing. */ + FcPatternDel (pattern, FC_PIXEL_SIZE); + FcPatternDel (pattern, FC_SIZE); + FcPatternDel (pattern, FC_FAMILY); + } else pattern = FcPatternCreate (); if (! pattern) @@ -411,8 +421,10 @@ ftfont_list (frame, spec) if (INTEGERP (tmp) && ! FcPatternAddInteger (pattern, FC_WIDTH, XINT (tmp))) goto err; +#if 0 if (! FcPatternAddBool (pattern, FC_SCALABLE, FcTrue)) goto err; +#endif if (charset && ! FcPatternAddCharSet (pattern, FC_CHARSET, charset)) @@ -426,16 +438,34 @@ ftfont_list (frame, spec) FC_CHARSET, FC_FILE, NULL); if (! objset) goto err; + fontset = FcFontList (NULL, pattern, objset); if (! fontset) goto err; if (fontset->nfont > 0) { + double pixel_size; + + if (NILP (AREF (spec, FONT_SIZE_INDEX))) + pixel_size = 0; + else + pixel_size = XINT (AREF (spec, FONT_SIZE_INDEX)); + for (i = 0, val = Qnil; i < fontset->nfont; i++) { - Lisp_Object entity = ftfont_pattern_entity (fontset->fonts[i], - frame, registry); + Lisp_Object entity; + + if (pixel_size > 0) + { + double this; + + if (FcPatternGetDouble (fontset->fonts[i], FC_PIXEL_SIZE, 0, + &this) == FcResultMatch + && this != pixel_size) + continue; + } + entity = ftfont_pattern_entity (fontset->fonts[i], frame, registry); if (! NILP (entity)) val = Fcons (entity, val); }