You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I encountered an issue while trying to use the ttf2header.py script from the FabGL project with Pillow version 10.4.0. Specifically, I get the following error:
AttributeError: 'FreeTypeFont' object has no attribute 'getsize'
It seems that the getsize method was removed in newer versions of Pillow (starting from version 10.0.0). The recommended replacement is the textbbox method, which provides the bounding box of the text. By replacing the getsize call with textbbox, the issue is resolved.
Here’s an example fix:
bbox = f.getbbox(chr(i), stroke_width=stroke)
w = bbox[2] - bbox[0] # Calculate width
h = bbox[3] - bbox[1] # Calculate height
Would it be possible to update the script to support the latest versions of Pillow?
Thank you for your work on this project!
Best regards,
Andrew
The text was updated successfully, but these errors were encountered:
Hello,
I encountered an issue while trying to use the ttf2header.py script from the FabGL project with Pillow version 10.4.0. Specifically, I get the following error:
AttributeError: 'FreeTypeFont' object has no attribute 'getsize'
It seems that the getsize method was removed in newer versions of Pillow (starting from version 10.0.0). The recommended replacement is the textbbox method, which provides the bounding box of the text. By replacing the getsize call with textbbox, the issue is resolved.
Here’s an example fix:
bbox = f.getbbox(chr(i), stroke_width=stroke)
w = bbox[2] - bbox[0] # Calculate width
h = bbox[3] - bbox[1] # Calculate height
Would it be possible to update the script to support the latest versions of Pillow?
Thank you for your work on this project!
Best regards,
Andrew
The text was updated successfully, but these errors were encountered: