Fix faux bold logic in font collector for Fontconfig

Based on libass's logic (a requested weight of over 150 more than
the matching font).
This commit is contained in:
Myaamori 2021-03-05 16:24:48 +00:00 committed by Ryan Lucia
parent 4b2cd7f170
commit 3dfc553880
1 changed files with 3 additions and 5 deletions

View File

@ -109,11 +109,9 @@ CollectionResult FontConfigFontFileLister::GetFontPaths(std::string const& facen
}
}
if (weight > 80) {
int actual_weight = weight;
if (FcPatternGetInteger(match, FC_WEIGHT, 0, &actual_weight) == FcResultMatch)
ret.fake_bold = actual_weight <= 80;
}
int actual_weight = 0;
if (FcPatternGetInteger(match, FC_WEIGHT, 0, &actual_weight) == FcResultMatch)
ret.fake_bold = weight > FcWeightToOpenType(actual_weight) + 150;
int actual_slant = slant;
if (FcPatternGetInteger(match, FC_SLANT, 0, &actual_slant) == FcResultMatch)