-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Compute glyph widths similarly in Type 42 as in Type 3 #7961
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
Conversation
guinea pig for new appveyor integration |
It seems the new job got fired (https://ci.appveyor.com/project/matplotlib/matplotlib) but the CI box is still showing the link to the old one. I assume this is just transient configuration getting crossed and the next PR will only file the new one (as I turned off the webhook to Mike's account). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know where this 6 originated, but I came to the same conclusion earlier.
@@ -1040,8 +1040,9 @@ def embedTTFType42(font, characters, descriptor): | |||
for c in characters: | |||
ccode = c |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The only suggestion I have is to clean this up; ccode
can just be the name at the beginning of the loop.
Actually, was just thinking we should probably add a test for this. |
👍 for a test |
Adapted from the code samples in matplotlib#7937 by @TomDLT and @afvincent.
Added a test case, but it can only test that the results of the type-42 embedding stay the same as they are after this change, not that they are correct. |
Thanks @jkseppan ! |
Compute glyph widths similarly in Type 42 as in Type 3
backported in v2.0.x via 9b6f7c1 |
Here's my reasoning: Issue #7937 points out that text spacing is different between Type 42 and Type 3 embeddings of ttf fonts, and Type 3 looks better. One way to make them similar is to avoid the font cache and load a new
FT2Font
object, so I think the problem is that other users of these objects callset_size
and that affects the glyph widths observed by this backend. Type 3 embeddings are not affected, and they use theLOAD_NO_SCALE
flag, so here I change the Type 42 code to do the same and convert the sizes similarly.In truth I have no clue how TrueType fonts work, so please review carefully.