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
It seems that font rendering changed for the worse between 7.2.0 and 8.x, not sure which version exactly. (edit, it changed between 7.2 and 8.0). I had this issue a few years ago when I tried to upgrade to 8.x so I had to revert, but now I really have a need to upgrade.
Below is a comparison image, with the caption text rendered with draw.text() in Pillow 7.2.0 on the left and 10.2 on the right. On the right, you can see that the text appears to have lost it's softer anti-aliased look and kerning in some spots - some letters are touching each other.
I searched up and down and couldn't find any other reports of anything like this, I did try a few suggestions like setting draw.textmode = 'L' and enabling the kern feature, but nothing worked.
All I'm looking for is a solution or suggestions to get the old look back. The font used is msgothic.ttc, index 1.
What are your OS, Python and Pillow versions?
OS: Windows 10
Python: 3.10.11
Pillow: 10.2
base=Image.open('assets/misc/bg_new.png').convert('RGB')
draw=ImageDraw.Draw(base)
draw.fontmode='L'caption_font=ImageFont.truetype("assets/font/msgothic.ttc", size=12, index=1)
text="Warrior with a fan. She fights with the force of\nthe wind. She has a very strong personality,..."draw.text((171, 780), text, (164, 144, 64), font=caption_font)
base.show()
Small update, tried changing the layout engine for this font object to layout_engine=ImageFont.Layout.BASIC. That seems to kind of fixed the kerning issue, but the antialias setting with draw.fontmode = 'L' still does nothing, no difference from setting it to '1'.
I don't think antialias will fix the overall look of it being completely different... it almost doesn't look like the same font?
changed the title [-]Font rendering changed after 7.2.0, looks worse now. [/-][+]Font rendering changed after 7.2.0, not rendering TTC font correctly.[/+]on Mar 12, 2024
changed the title [-]Font rendering changed after 7.2.0, not rendering TTC font correctly.[/-][+]Font rendering changed after 7.2.0, not rendering TTC font correctly[/+]on Mar 12, 2024
It seems like you're uploading screenshots of the images, rather than the images themselves. Moving forward, I think it would be more helpful to have the images themselves.
I'm guessing that you're installing Pillow from the wheels, using something like python3 -m pip install Pillow?
font rendering changed for the worse between 7.2.0 and 8.x, not sure which version exactly.
If you could figure out exactly which version, that would be interesting.
I uploaded screenshots because the rest of the image is much larger and irrelevant, I really only needed to show the affected area, but if I do more tests I guess I'll just try to make a smaller canvas with text only that can be uploaded here.
changed the title [-]Font rendering changed after 7.2.0, not rendering TTC font correctly[/-][+]Font rendering issue with ttc font in 10.1.0 onwards[/+]on Mar 12, 2024
Based on the images, this is almost certainly caused by #4955 fixing #891. The previous behaviour was caused by a bug where Pillow was ignoring embedded bitmaps in a font.
OpenType fonts can contain embedded bitmaps in the EBDT table. This is supposed to provide better quality when rendering at small font sizes. Unfortunately, it seems that the font you are using did not implement this very well. You may be able to remove the embedded bitmap table with a tool such as FontForge.
Activity
camprevail commentedon Mar 12, 2024
Small update, tried changing the layout engine for this font object to layout_engine=ImageFont.Layout.BASIC. That seems to kind of fixed the kerning issue, but the antialias setting with draw.fontmode = 'L' still does nothing, no difference from setting it to '1'.

I don't think antialias will fix the overall look of it being completely different... it almost doesn't look like the same font?
camprevail commentedon Mar 12, 2024
Tried switching to arial and it looks much better. Perhaps this is a problem with the msgothic TTC, or TTC font rendering specifically?

[-]Font rendering changed after 7.2.0, looks worse now. [/-][+]Font rendering changed after 7.2.0, not rendering TTC font correctly.[/+][-]Font rendering changed after 7.2.0, not rendering TTC font correctly.[/-][+]Font rendering changed after 7.2.0, not rendering TTC font correctly[/+]radarhere commentedon Mar 12, 2024
It seems like you're uploading screenshots of the images, rather than the images themselves. Moving forward, I think it would be more helpful to have the images themselves.
I'm guessing that you're installing Pillow from the wheels, using something like
python3 -m pip install Pillow?If you could figure out exactly which version, that would be interesting.
camprevail commentedon Mar 12, 2024
I uploaded screenshots because the rest of the image is much larger and irrelevant, I really only needed to show the affected area, but if I do more tests I guess I'll just try to make a smaller canvas with text only that can be uploaded here.
And yeah I installed via pip.
radarhere commentedon Mar 12, 2024
You could also just crop the original image? I think the screenshots are introducing an element of blurriness.
camprevail commentedon Mar 12, 2024
I'm pretty confident they aren't, do you not see the difference between the two images? It looks pretty clear to me, even on my phone
radarhere commentedon Mar 12, 2024
I do see a difference. I was just trying to improve the quality of what we were looking at here - I don't think it's worth discussing further.
[-]Font rendering changed after 7.2.0, not rendering TTC font correctly[/-][+]Font rendering issue with ttc font in 10.1.0 onwards[/+][-]Font rendering issue with ttc font in 10.1.0 onwards[/-][+]Font rendering issue with ttc font[/+]camprevail commentedon Mar 12, 2024
Sorry, forgot to add the


fontarg to draw.text. Looks like it changed between 7.2 and 8.0. Here's the comparison imagesMy code is:
camprevail commentedon Mar 12, 2024
Here's a much better test revealing that something is happening between 22 and 23pt sizes.


nulano commentedon Mar 12, 2024
Based on the images, this is almost certainly caused by #4955 fixing #891. The previous behaviour was caused by a bug where Pillow was ignoring embedded bitmaps in a font.
OpenType fonts can contain embedded bitmaps in the EBDT table. This is supposed to provide better quality when rendering at small font sizes. Unfortunately, it seems that the font you are using did not implement this very well. You may be able to remove the embedded bitmap table with a tool such as FontForge.
camprevail commentedon Mar 12, 2024
Alright thanks for the suggestion, that worked and was very easy.

radarhere commentedon Mar 12, 2024
Thanks very much nulano.
Is this resolved then?
camprevail commentedon Mar 12, 2024
Yeah I suppose so. I'll close it