Mercurial > emacs
changeset 90474:8627c9321afb
(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.
author | Kenichi Handa <handa@m17n.org> |
---|---|
date | Mon, 19 Jun 2006 01:34:55 +0000 |
parents | 9c75458ea910 |
children | b19205fb08bd |
files | src/ftfont.c |
diffstat | 1 files changed, 34 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ftfont.c Mon Jun 19 01:32:49 2006 +0000 +++ b/src/ftfont.c Mon Jun 19 01:34:55 2006 +0000 @@ -122,7 +122,11 @@ 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 @@ } 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 @@ 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 @@ 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); }