Working on an update of my app i notice that i get tons of warnings in the log when running the app in Xcode 11.2 on IOS13.
CoreText note: Client requested name ".SFUI-Regular", it will get TimesNewRomanPSMT rather than the intended font. All system UI font access should be through proper APIs such as CTFontCreateUIFontForLanguage() or +[UIFont systemFontOfSize:].
I dug around a bit and found this quote from WWDC:
As mentioned in numerous WWDC sessions, dot-prefixed font names are not to be directly used.
I am myself almost exclusively using IB and nibs to set fonts for textfields etc., and there is no reference to "SFUI-Regular" in my code anywhere, so i am not sure how to find the actual reason for these warnings (i have something like 20-30 rows of these in the logs).
Does anyone have any tips on how i can find where the warning comes from, and how to fix it?
There is another output in console, you can try to add a symbolic breakpoint
CoreText note: Set a breakpoint on CTFontLogSystemFontNameRequest to debug.
I started experiencing this warning in the console starting with Xcode 11, with both MacOS and iOS targets.
You will receive ".SFUI-Regular" from UIFont.systemFont(ofSize: X).fontName
.
The warning will then occur if you try to instantiate using UIFont(name: fontName, size: size)
.
In my case I am letting the user customize the display font, but the default was ".SFUI-Regular", so I have changed that to "TimesNewRomanPSMT"
let defaultFont = UIFont.systemFont(ofSize: X).fontName
// replace with
let defaultFont = "TimesNewRomanPSMT"
UIFont(name: defaultFont, size: size)
Having the same issue and no reference to dot-prefixed font in my code either. Set a symbolic breakpoint but nothing of any use
I got this if I blindly used:
UIFont(name: fontName, size: fontSize)
and the fontName was "System Font", which was part of a list I got from:
let fontFamilyNames = UIFont.familyNames.sorted()
Workaround was to check the name.
let isSystemFont = fontName == "System Font"
let useFont = isSystemFont ? UIFont.systemFont(ofSize: fontSize) : UIFont(name: fontName, size: fontSize) ?? UIFont.systemFont(ofSize: fontSize)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With