Fix: [OSX] Fonts loaded directly from a file have to be registered with CoreText for proper text layout.
This commit is contained in:
@@ -565,11 +565,19 @@ static void LoadFreeTypeFont(FontSize fs)
|
||||
/* If font is an absolute path to a ttf, try loading that first. */
|
||||
FT_Error error = FT_New_Face(_library, settings->font, 0, &face);
|
||||
|
||||
#if defined(WITH_COCOA)
|
||||
extern void MacOSRegisterExternalFont(const char *file_path);
|
||||
if (error == FT_Err_Ok) MacOSRegisterExternalFont(settings->font);
|
||||
#endif
|
||||
|
||||
if (error != FT_Err_Ok) {
|
||||
/* Check if font is a relative filename in one of our search-paths. */
|
||||
std::string full_font = FioFindFullPath(BASE_DIR, settings->font);
|
||||
if (!full_font.empty()) {
|
||||
error = FT_New_Face(_library, full_font.c_str(), 0, &face);
|
||||
#if defined(WITH_COCOA)
|
||||
if (error == FT_Err_Ok) MacOSRegisterExternalFont(full_font.c_str());
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user