Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

draw.text((50,5),str(d['类型']), font=font25bd, fill='#eaca67') #5346

Closed
kerwinxu opened this issue Mar 20, 2021 · 2 comments
Closed

draw.text((50,5),str(d['类型']), font=font25bd, fill='#eaca67') #5346

kerwinxu opened this issue Mar 20, 2021 · 2 comments
Labels
Anaconda Issues with Anaconda's Pillow

Comments

@kerwinxu
Copy link

kerwinxu commented Mar 20, 2021

What did you do?

draw.text((50,5),str(d['类型']), font=font25bd, fill='#eaca67')

What did you expect to happen?

What actually happened?

  File "批量添加文字.py", line 108, in draw_content
    draw.text((50,5),str(d['类型']), font=font25bd, fill='#eaca67')
  File "d:\anaconda3\lib\site-packages\PIL\ImageDraw.py", line 379, in text
    draw_text(ink)
  File "d:\anaconda3\lib\site-packages\PIL\ImageDraw.py", line 324, in draw_text
    mask, offset = font.getmask2(
  File "d:\anaconda3\lib\site-packages\PIL\ImageFont.py", line 667, in getmask2
    size, offset = self.font.getsize(
OSError: invalid face handle

What are your OS, Python and Pillow versions?

  • OS: win10
  • Python: anaconda 3.8
  • Pillow: 8.1.2
@radarhere
Copy link
Member

If your error is "OSError: invalid face handle", then you might be experiencing the same problem as #3066 and #4225.

If so, #5062 is an upcoming solution.

@kerwinxu
Copy link
Author

kerwinxu commented Mar 20, 2021

If your error is "OSError: invalid face handle", then you might be experiencing the same problem as #3066 and #4225.

If so, #5062 is an upcoming solution.

Thank you ,

Here's how to fix it

fnt = ImageFont.truetype('../fonts/georgiai.ttf', 36, layout_engine=ImageFont.LAYOUT_BASIC)

@aclark4life aclark4life added the Anaconda Issues with Anaconda's Pillow label May 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Anaconda Issues with Anaconda's Pillow
Projects
None yet
Development

No branches or pull requests

3 participants