-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Absent pixels when drawing font #4569
Comments
Are you able to replicate this problem with a font that you can link to? |
@radarhere I place a zip here. |
As a note for future investigation of this, here's a clear way to demonstrate that this is a bug - removing the '0' from '0123456789' causes the missing pixels to be drawn without a problem. |
I have seen this before in some previous tests. I believe the cause is #185, as the solution there seems to be to count the text distance from the bottom instead of from the top. (Confusingly, this patch made the |
@nulano Nice! |
I have run the code below on pillow version 7.1.1 and 8.0.1 respectively, and the bug seems to be fixed. from PIL import Image, ImageFont, ImageDraw
ttf_path = "vista-hei-all.ttf"
text = "0123456789"
text_size = 35
font = ImageFont.truetype(ttf_path, text_size)
text_width, text_height = font.getsize(text)
canvas = Image.new("RGBA", [text_width, text_height], (255, 0, 0, 255))
draw = ImageDraw.Draw(canvas)
draw.text((0, 0), text, font=font, fill="#000000")
canvas.show()
|
Thanks for letting us know! |
What did you do?
What actually happened?
0
,2
,3
,8
,9
.What are your OS, Python and Pillow versions?
The text was updated successfully, but these errors were encountered: