-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bridge CTFontRef directly to UIFont when converting attributes on NSAttributedString #1579
Conversation
In iOS13, there is an issue with the font returned from "-[UIFontj fontWithName:size:]". When asking for "SFUI-Regular" returns "Times New Roman" font. It seems like a reasonable default would be to return the system font in the case that the requested font was not respected.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Wondering if you filed a radar since this seems to be an issue in UIFont itself.
@nguyenhuy - Yep! Radar has been filed under FB6592770 |
somewhere, somehow, someone consciously put Times New Roman in an catch/else case |
@maicki @nguyenhuy - I updated the title since the change is more than updating the fallback. It isn't clear why we were trying to create a new font instance when CTFontRef toll-free bridges to UIFont. This appears to pass tests both internally at Pinterest and Texture so I feel like the change is pretty safe and should also solve the iOS 13 regression users are experiencing |
Great change, @rahul-malik! Yeah, I think it's safe and we should just get it in. The original logic is pretty old -- dates back to the initial commit. Perhaps @appleguy has some context on why it's done that way. |
Hey! Any ETA to new release with this fix? This is pretty heavy issue. |
Hey! We’re actively working on creating a new release now. |
In iOS13, there is an issue with the font returned from "-[UIFontj fontWithName:size:]". When asking for "SFUI-Regular" returns "Times New Roman" font. It seems like a reasonable default would be to return the system font in the case that the requested font was not respected.