Skip to content

OSError: invalid face handle #3066

@eroux

Description

@eroux

What did you do?

I ran the following code:

from PIL import Image, ImageDraw, ImageFont, features

print(features.check('raqm'))
print(Image.PILLOW_VERSION)

img = Image.new('RGB', (800, 300), color = (73, 109, 137))
d = ImageDraw.Draw(img)
fnt = ImageFont.truetype('NotoSansTibetan-Regular.ttf', 24, layout_engine=ImageFont.LAYOUT_BASIC)
d.text((10, 10), "༄༅། །སྒྲུབ།", font=fnt, fill=(255, 255, 0))
img.save('result.png')
fnt = ImageFont.truetype('NotoSansTibetan-Regular.ttf', 24, layout_engine=ImageFont.LAYOUT_RAQM)
print("things work until...")
res = fnt.getmask("༄༅། །སྒྲུབ།", features=['ccmp', 'abvs', 'blws', 'calt', 'liga', 'kern', 'abvm', 'blwm', 'mkmk'])

What did you expect to happen?

No segfault

What actually happened?

Here's the console output:

True
5.0.0
things work until...
Traceback (most recent call last):
  File "testmarche.py", line 13, in <module>
    res = fnt.getmask("༄༅། །སྒྲུབ།", features=['ccmp', 'abvs', 'blws', 'calt', 'liga', 'kern', 'abvm', 'blwm', 'mkmk'])
  File "/usr/local/lib/python3.5/dist-packages/PIL/ImageFont.py", line 163, in getmask
    return self.getmask2(text, mode, direction=direction, features=features)[0]
  File "/usr/local/lib/python3.5/dist-packages/PIL/ImageFont.py", line 166, in getmask2
    size, offset = self.font.getsize(text, direction, features)
OSError: invalid face handle
Erreur de segmentation

What versions of Pillow and Python are you using?

Metadata

Metadata

Assignees

No one assigned

    Labels

    AnacondaIssues with Anaconda's PillowBugAny unexpected behavior, until confirmed feature.FontsPlatformA catchall for platform-related

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions