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.


    Bizarre bug in Pythonista 3.4

    Pythonista
    3
    4
    95
    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.
    • upwart
      upwart last edited by

      I ran into a bizarre bug with the latest version of Pythonista.
      It took me quite a long time to discover the cause of a Pythonista crash.
      Here's a MWE (minimal working example), showing the bug:

      from PIL import ImageFont, Image, ImageDraw
      font = ImageFont.truetype(font="calibri.ttf", size=15)
      im = Image.new("RGBA", (100, 100), (0, 0, 0, 0))
      draw = ImageDraw.Draw(im)
      draw.text(xy=(0, 0), text="a", font=font)
      print("never reached")
      

      In this script, a text is written into a Pillow message.
      When I run this, the system crashes and the crash log shows:

      Fatal Python error: Aborted
      
      Current thread 0x000000016d847000 (most recent call first):
        File "/var/containers/Bundle/Application/A061EDB8-1B89-41D2-B706-1F4E042DE8E4/Pythonista3.app/Frameworks/Py3Kit.framework/pylib/site-packages/PIL/ImageFont.py", line 666 in getmask2
        File "/var/containers/Bundle/Application/A061EDB8-1B89-41D2-B706-1F4E042DE8E4/Pythonista3.app/Frameworks/Py3Kit.framework/pylib/site-packages/PIL/ImageDraw.py", line 429 in draw_text
        File "/var/containers/Bundle/Application/A061EDB8-1B89-41D2-B706-1F4E042DE8E4/Pythonista3.app/Frameworks/Py3Kit.framework/pylib/site-packages/PIL/ImageDraw.py", line 484 in text
        File "/private/var/mobile/Containers/Shared/AppGroup/11021B83-B419-4F67-A331-D54B9BAFC718/Pythonista3/Documents/salabim/a1_1.py", line 6 in <module>
      
      Extension modules: pykit_io, _ui, _appex, _frameworksimporter, console, _debugger_ui (total: 6)
      

      The strange thing is that this seems to happen only with this specific font (calibri.ttf) and only with font sizes between 13 and 17!
      The code used to run fine on Python 3.3 and works well on all other platforms, I have used.

      I found a workaround by using the Arial font instead of calibri.ttf. But it is very strange!

      cvp 1 Reply Last reply Reply Quote 0
      • cvp
        cvp @upwart last edited by cvp

        @upwart I don't have your font but I tried with another one without any problem.

        Downloaded a calibri.ttf and same error

        Error for size between 12 and 17 included, not 13 for me !!!???

        upwart 1 Reply Last reply Reply Quote 0
        • upwart
          upwart @cvp last edited by

          @cvp
          12 till 17 (including 13) causes crash here.

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

            https://github.com/python-pillow/Pillow/issues/5033

            @omz, take a look. Looks like maybe we need raqm?

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