Codechange: Pass face index as font os_handle for FreeType fonts. (#11073)

This allows fallback font detection to test the specific face within the
font rather instead of only the first.
This commit is contained in:
PeterN
2023-06-27 12:30:46 +01:00
committed by GitHub
parent 794b642b9a
commit 8465559488
2 changed files with 14 additions and 5 deletions

View File

@@ -141,7 +141,9 @@ void LoadFreeTypeFont(FontSize fs)
FT_Face face = nullptr;
/* If font is an absolute path to a ttf, try loading that first. */
FT_Error error = FT_New_Face(_library, font_name, 0, &face);
int32_t index = 0;
if (settings->os_handle != nullptr) index = *static_cast<const int32_t *>(settings->os_handle);
FT_Error error = FT_New_Face(_library, font_name, index, &face);
if (error != FT_Err_Ok) {
/* Check if font is a relative filename in one of our search-paths. */