Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CTFontCreateWithName returning ".LastResort" font


I have multiple custom fonts provided with my app, all defined in the app's plist correctly. I can load UIFonts with those custom fonts with no problems. UILabels using [UIFont fontWithName:@"some-custom-font" size:14] as font work flawlessly.

What doesn't work is CoreText methods.
I need to use those fonts in attributed strings, so I absolutely need the CTFontRef. Till iOS 5 I had no problem what-so-ever. Now, CTFontCreateWithName tends to return a font called .LastResort, instead of what I need. If I kill the app and relaunch, some of the fonts that failed last time do work now, but others don't. Seemingly random. If I call CTFontCreateWithName immediately on app launch, that specific font works later, but again most of the others do not.

I never encountered this kind of behavior before. My app isn't very memory heavy. This feels like some iOS 5 bug. Any help or advice will be very welcome.

like image 482
unexpectedvalue Avatar asked Feb 03 '26 07:02

unexpectedvalue


1 Answers

I've only used custom fonts via UIKit. You may want to contact DTS, or definitely bugreport.apple.com

like image 122
David Dunham Avatar answered Feb 04 '26 19:02

David Dunham