mirror of
https://github.com/libretro/RetroArch
synced 2025-02-28 12:40:23 +00:00
(CoreText) Fix loading fonts from a path
This commit is contained in:
parent
b42fdf3bdc
commit
b700a4e77b
@ -256,6 +256,9 @@ static void *font_renderer_ct_init(const char *font_path, float font_size)
|
||||
char err = 0;
|
||||
CFStringRef cf_font_path = NULL;
|
||||
CTFontRef face = NULL;
|
||||
CFURLRef url = NULL;
|
||||
CGDataProviderRef dataProvider = NULL;
|
||||
CGFontRef theCGFont = NULL;
|
||||
ct_font_renderer_t *handle = (ct_font_renderer_t*)
|
||||
calloc(1, sizeof(*handle));
|
||||
|
||||
@ -273,7 +276,10 @@ static void *font_renderer_ct_init(const char *font_path, float font_size)
|
||||
goto error;
|
||||
}
|
||||
|
||||
face = CTFontCreateWithName(cf_font_path, font_size, NULL);
|
||||
url = CFURLCreateWithFileSystemPath(kCFAllocatorDefault, cf_font_path, kCFURLPOSIXPathStyle, false);
|
||||
dataProvider = CGDataProviderCreateWithURL(url);
|
||||
theCGFont = CGFontCreateWithDataProvider(dataProvider);
|
||||
face = CTFontCreateWithGraphicsFont(theCGFont, font_size, NULL, NULL);
|
||||
|
||||
if (!face)
|
||||
{
|
||||
@ -304,6 +310,21 @@ error:
|
||||
CFRelease(face);
|
||||
face = NULL;
|
||||
}
|
||||
if (url)
|
||||
{
|
||||
CFRelease(url);
|
||||
url = NULL;
|
||||
}
|
||||
if (dataProvider)
|
||||
{
|
||||
CFRelease(dataProvider);
|
||||
dataProvider = NULL;
|
||||
}
|
||||
if (theCGFont)
|
||||
{
|
||||
CFRelease(theCGFont);
|
||||
theCGFont = NULL;
|
||||
}
|
||||
|
||||
return handle;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user