Closed verstaen closed 4 years ago
I stumbled upon this issue while migrating to iOS 13, and prepared a workaround in my fork. It changes FontProperties
API to take a ready-made UIFont
object, instead of name and size. It's not thoroughly tested but it does the job for me.
Have a look at this commit if you like.
Thanks @ayoy , this is very helpful. I worked around this by checking after instantiating UIFont if the resulting font name is the expected one, if not then use the system font and not a random one. I'll work on a PR. I believe both these fixes can be useful.
Starting with iOS 13, the system default font can't be accessed using fontName. This breaks the default font used on device.
More precisely, this code:
prints the expected .SFUIText on Simulator and on device with iOS 12, but TimesNewRomanPSMT on device with iOS 13.
As a consequence, in attributedStringFromString(), when attempting to load the default font (stored through its name, .SFUIText), iOS 13 returns TimesNewRoman...
We could either special case .SFUIText (not my favorite, this will break if Apple modifies this name for any reason), or handle the "system default" font case. I'd be happy to work on a PR.