Fix: [OSX] Fonts loaded directly from a file have to be registered with CoreText for proper text layout.
This commit is contained in:
@@ -289,6 +289,17 @@ void MacOSResetScriptCache(FontSize size)
|
||||
_font_cache[size].reset();
|
||||
}
|
||||
|
||||
/** Register an external font file with the CoreText system. */
|
||||
void MacOSRegisterExternalFont(const char *file_path)
|
||||
{
|
||||
if (!MacOSVersionIsAtLeast(10, 6, 0)) return;
|
||||
|
||||
CFAutoRelease<CFStringRef> path(CFStringCreateWithCString(kCFAllocatorDefault, file_path, kCFStringEncodingUTF8));
|
||||
CFAutoRelease<CFURLRef> url(CFURLCreateWithFileSystemPath(kCFAllocatorDefault, path.get(), kCFURLPOSIXPathStyle, false));
|
||||
|
||||
CTFontManagerRegisterFontsForURL(url.get(), kCTFontManagerScopeProcess, nullptr);
|
||||
}
|
||||
|
||||
/** Store current language locale as a CoreFounation locale. */
|
||||
void MacOSSetCurrentLocaleName(const char *iso_code)
|
||||
{
|
||||
|
Reference in New Issue
Block a user