omz:forum

    • Register
    • Login
    • Search
    • Recent
    • Popular

    Welcome!

    This is the community forum for my apps Pythonista and Editorial.

    For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.


    Setting widget font a little wonky in Pythonista3.3/iOS13

    Pythonista
    ios13 font
    3
    6
    2494
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • shinyformica
      shinyformica last edited by

      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:

      ('.SFUI-Regular', 17.0)
      ('.SFUI-Regular', 15.0)
      ('TimesNewRomanPSMT', 15.0)

      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.

      1 Reply Last reply Reply Quote 0
      • mcriley821
        mcriley821 last edited by

        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.

        1 Reply Last reply Reply Quote 1
        • cvp
          cvp last edited by

          You are not alone, see here

          1 Reply Last reply Reply Quote 0
          • shinyformica
            shinyformica last edited by

            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?

            1 Reply Last reply Reply Quote 0
            • mcriley821
              mcriley821 last edited by

              @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

              1 Reply Last reply Reply Quote 0
              • shinyformica
                shinyformica last edited by

                @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.

                1 Reply Last reply Reply Quote 0
                • First post
                  Last post
                Powered by NodeBB Forums | Contributors