22

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?

Mathias
  • 3,215
  • 4
  • 28
  • 43

5 Answers5

7

There is another output in console, you can try to add a symbolic breakpoint

CoreText note: Set a breakpoint on CTFontLogSystemFontNameRequest to debug.

clatt
  • 106
  • 2
6

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)
gheclipse
  • 621
  • 6
  • 10
2

Having the same issue and no reference to dot-prefixed font in my code either. Set a symbolic breakpoint but nothing of any use

Tony Law
  • 271
  • 2
  • 11
  • 2
    Same issue here, in a macOS app. I'm starting to suspect SDK bug? – Jorge Leandro Perez Nov 06 '19 at 18:09
  • I traced mine to an older version of a pod I am using. – Tony Law Nov 06 '19 at 18:15
  • I see this issue too. But it's caused by me unarchiving an NSMutableString that has font references in it. Shouldn't that be ok? – Tap Forms Nov 07 '19 at 08:31
  • 6
    For the record, I've reproduced this issue in an empty macOS project, no external dependencies, and just 2 lines of code. Tech Support ticket submitted, will keep you posted, ladies and gentlemen – Jorge Leandro Perez Nov 07 '19 at 19:12
  • 1
    @Klaas apologies about being late! YES... this is the official response I got, thru Tech Support: – Jorge Leandro Perez Dec 23 '19 at 15:15
  • 2
    `Regarding the error mesage shown in your video, I view it as a system bug because I don’t see any of your code requesting “.AppleColorEmojiUI” – If your real app indeed does that, you should follow the message to correct it. Other than that, I don’t have anything worth to mentioning.` (And they didn't add anything further.... "system bug") – Jorge Leandro Perez Dec 23 '19 at 15:16
0

For me, it turns out it was a third-party library that has not been updated in a while that was the culprit.

I put a breakpoint as the user clatt suggested and found the source. In my case it was TOMSMorphingLabel.

Mathias
  • 3,215
  • 4
  • 28
  • 43
0
let fontCT = CTFontCreateUIFontForLanguage(.label, fontSize as CGFloat, nil)
attrStr.addAttribute(.font, value: fontCT as Any, range: NSMakeRange(0, text.count))

solution for uifont issue for ios 13

Olcay Ertaş
  • 5,374
  • 8
  • 71
  • 98
Jagveer Singh
  • 2,352
  • 14
  • 32