From 3dfc5538807928e4d730775c88b1a76c253ef1fa Mon Sep 17 00:00:00 2001 From: Myaamori Date: Fri, 5 Mar 2021 16:24:48 +0000 Subject: [PATCH] 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). --- src/font_file_lister_fontconfig.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/font_file_lister_fontconfig.cpp b/src/font_file_lister_fontconfig.cpp index f822783db..a361dea73 100644 --- a/src/font_file_lister_fontconfig.cpp +++ b/src/font_file_lister_fontconfig.cpp @@ -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)