M13ProgressSuite icon indicating copy to clipboard operation
M13ProgressSuite copied to clipboard

iOS13 Font system name access

Open fabiosoft opened this issue 5 years ago • 0 comments

Since iOS13 you cannot get system font name by string.

The console outputs a note: 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:].

One use case is into maximumFontSizeThatFitsInRect method of M13ProgressViewBar.m

textRect = [@"100%" boundingRectWithSize:frame.size options:(NSStringDrawingUsesLineFragmentOrigin|NSStringDrawingUsesFontLeading) attributes:@{NSFontAttributeName : [UIFont fontWithName:((__bridge UIFont*)_percentageLabel.font).fontName size:fontSize]} context:nil];

I think it should be changed in [UIFont systemFontOfSize: fontSize]

fabiosoft avatar Oct 21 '19 10:10 fabiosoft