-
-
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
ImageFont.truetype().getsize() result different for Windows vs Mac version of font #974
Comments
Some additional information. The difference appears to be entirely accounted for by a difference in vertical offset; 1 in the Windows case and 3 for Mac in this case. The two fonts render exactly the same in PowerPoint, so I'm wondering what could make them report different offsets in Pillow. |
Git bisect is a great tool for finding the specific commit where things changed: http://robots.thoughtbot.com/git-bisect There has been recent changes in PR #784 in July and released in Pillow 2.6.0:
|
Looks like it wasn't introduced by the recent changes, the fact that I only observed it afterwards was a coincidence. The two font files in question actually differ in their Another interesting observation is that in the Arial (Regular) font files from the same Mac and Windows installations, the From what I understand, the I've traced through the code a bit, but I'm not sure if this is a problem in Do you have any insight into the problem I'm seeing that you could offer me? |
@scanny Apparently we don't have any insight, sorry about that. Please try Stack Overflow. And please reopen if you have more to discuss. |
No worries, thanks @aclark4life :) |
I'm using
ImageFont.truetype().getsize()
to determine the rendered size of strings in a particular font as part of thepython-pptx
library (I'm the primary author).This code generates a different pixel size for a Windows .ttf file than it does for the same typeface on the Mac. This behavior does not appear to depend on the typeface. The Windows result is smaller than that for the Mac:
As you can see, the height on Windows is shorter. This causes my 'best-fit font size' algorithm to pick too large a point size.
Any clue what might be causing this? The fact that the horizontal size is identical leads me to suspect a difference in the offset calculation. It seems to have appeared with the latest release in which the offset bit was fixed in ImageFont.getsize(), but I haven't done rigorous before/after testing on that.
The text was updated successfully, but these errors were encountered: