mirror of
https://github.com/JGRennison/OpenTTD-patches.git
synced 2024-11-11 13:10:45 +00:00
Fix: Unable to choose a font containing hyphen. (#12684)
FcNameParse may require some characters be escaped. Instead, pass name as FC_FAMILY.
(cherry picked from commit ca52da6c95
)
This commit is contained in:
parent
c5f49ba0e8
commit
06b84f7c00
@ -55,8 +55,9 @@ FT_Error GetFontByFaceName(const char *font_name, FT_Face *face)
|
||||
auto [font_family, font_style] = SplitFontFamilyAndStyle(font_name);
|
||||
|
||||
/* Resolve the name and populate the information structure */
|
||||
FcPattern *pat = FcNameParse((FcChar8 *)font_family.data());
|
||||
if (!font_style.empty()) FcPatternAddString(pat, FC_STYLE, (FcChar8 *)font_style.data());
|
||||
FcPattern *pat = FcPatternCreate();
|
||||
if (!font_family.empty()) FcPatternAddString(pat, FC_FAMILY, reinterpret_cast<const FcChar8 *>(font_family.c_str()));
|
||||
if (!font_style.empty()) FcPatternAddString(pat, FC_STYLE, reinterpret_cast<const FcChar8 *>(font_style.c_str()));
|
||||
FcConfigSubstitute(nullptr, pat, FcMatchPattern);
|
||||
FcDefaultSubstitute(pat);
|
||||
FcFontSet *fs = FcFontSetCreate();
|
||||
|
Loading…
Reference in New Issue
Block a user