Setting widget font a little wonky in Pythonista3.3/iOS13
Could someone verify my sanity here...I was noticing some widgets in my UI were getting a different non-system font under Pythonista3.3 on iOS13. And when I investigated, it was only widgets who were setting their font to match another widget.
What I'm seeing is that code like this:
label = ui.Label() print label.font() button = ui.Button() print button.font() label.font = button.font print label.font()
will end up with label.font being set to something other than the button's font. It will instead be set to ('TimesNewRomanPSMT', 15.0). In fact, the output is:
Which is decidedly strange. It seems like it actually boils down to that '.SFUI-Regular' font name...it's being turned into 'TimesNewRomanPSMT', and the size comes across appropriately. If I directly assign a specific font, or the special '<system>' value for the font, it works as expected.
Is this some new iOS13 font name that Pythonista doesn't handle properly? Admittedly this is a rare thing to do, setting one widget's font to equal another's...but I was expecting it to work, and it did under Pythonista3.2 and iOS12, and I think it was still working under Pyhtonista3.3 and iOS12.
The problem is that with iOS 13, you’re not supposed to load system fonts by name. It’s been advised against for a while by Apple, and iOS 13 will enforce it by returning Times New Roman after asking for a system font.
You are not alone, see here
Yeah, that makes sense. I just read a stackoverflow post about something similar to this. This isn't a big deal, overall...I can do something other than setting the widget font to the font of the associated widget.
Does this qualify as a "bug" really? Should the value of the widget.font property be returning something which can't be assigned as a valid value to another widget's font property?
@shinyformica It’s not a bug. It’s just how iOS 13 enforces some silly rule from Apple. Pythonista obviously relies on iOS 13 frameworks so it will inherit all those silly rules too
@mcriley821 yeah, that's what I felt as well...just unfortunate that we don't have a way to access the font descriptors they want us to use instead of names. Well, no way via normal Pythonista python APIs, I'm sure we could do it via objc.