diff options
author | Grigori Goronzy <greg@chown.ath.cx> | 2011-09-03 15:20:00 +0200 |
---|---|---|
committer | Grigori Goronzy <greg@chown.ath.cx> | 2015-07-10 10:42:40 +0200 |
commit | 09edb29ea61785570d612b9fb246ddea93173bac (patch) | |
tree | b766b936e3571c17afdf845fd2cf864b5fcabaa8 /libass/ass_fontconfig.c | |
parent | e87063d873b88427ffad038fcfbbe7e7a0b7437d (diff) | |
download | libass-09edb29ea61785570d612b9fb246ddea93173bac.tar.bz2 libass-09edb29ea61785570d612b9fb246ddea93173bac.tar.xz |
Add support for font width property
Add a width field to metadata. This is used for sorting fonts as
well. Fixes wrong matches with different width variants in the same
font family.
Diffstat (limited to 'libass/ass_fontconfig.c')
-rw-r--r-- | libass/ass_fontconfig.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/libass/ass_fontconfig.c b/libass/ass_fontconfig.c index a3a371a..4fbf824 100644 --- a/libass/ass_fontconfig.c +++ b/libass/ass_fontconfig.c @@ -82,6 +82,7 @@ static void scan_fonts(FcConfig *config, ASS_FontProvider *provider) // simple types result = FcPatternGetInteger(pat, FC_SLANT, 0, &meta.slant); + result |= FcPatternGetInteger(pat, FC_WIDTH, 0, &meta.width); result |= FcPatternGetInteger(pat, FC_WEIGHT, 0, &weight); result |= FcPatternGetInteger(pat, FC_INDEX, 0, &index); if (result != FcResultMatch) @@ -98,12 +99,10 @@ static void scan_fonts(FcConfig *config, ASS_FontProvider *provider) meta.weight = FONT_WEIGHT_BOLD; // family name - // HACK: get the last family name. that fixes fonts - // like Arial Narrow in some versions - int n_family = 0; - while (FcPatternGetString(pat, FC_FAMILY, n_family, - (FcChar8 **)&meta.family) == FcResultMatch) - n_family++; + result = FcPatternGetString(pat, FC_FAMILY, 0, + (FcChar8 **)&meta.family); + if (result != FcResultMatch) + continue; // path result = FcPatternGetString(pat, FC_FILE, 0, (FcChar8 **)&path); |