Convert OpenType weight to Fontconfig weight in font collector

Fixes #108
This commit is contained in:
Myaamori 2021-03-05 15:42:37 +00:00 committed by Ryan Lucia
parent 7a27ee7823
commit 4b2cd7f170
1 changed files with 3 additions and 3 deletions

View File

@ -63,8 +63,8 @@ CollectionResult FontConfigFontFileLister::GetFontPaths(std::string const& facen
std::string family = facename[0] == '@' ? facename.substr(1) : facename;
boost::to_lower(family);
int weight = bold == 0 ? 80 :
bold == 1 ? 200 :
int weight = bold == 0 ? 400 :
bold == 1 ? 700 :
bold;
int slant = italic ? 110 : 0;
@ -74,7 +74,7 @@ CollectionResult FontConfigFontFileLister::GetFontPaths(std::string const& facen
FcPatternAddBool(pat, FC_OUTLINE, true);
FcPatternAddInteger(pat, FC_SLANT, slant);
FcPatternAddInteger(pat, FC_WEIGHT, weight);
FcPatternAddInteger(pat, FC_WEIGHT, FcWeightFromOpenType(weight));
FcDefaultSubstitute(pat);
if (!FcConfigSubstitute(config, pat, FcMatchPattern)) return ret;