-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Fix TrueType to Type-3 font conversion #905
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
Looks good -- all tests are passing, so it doesn't seem to have inadvertently changed anything about the fonts we already ship. Any thoughts about how to add a test case this, short of including FreeSans? (We can't include it because it's GPL'd). |
I created a fake font with FontForge and made a test case that renders it in a large size. Interestingly, if you enable svg output in the test, there are artifacts there that look like the svg version is not handling correctly the case where contours consist of control points only. |
The png and pdf output are offset horizontally, but I suspect that the metrics of my fake font are just garbage, which could be causing different handling in different backends. |
Nice. All I would add is that maybe the test font should go under the test tree, rather than installing it alongside the other fonts. You can pass a full path to the ttf file to the font manager mechanism to load it without it being in the font cache. |
The code did not handle correctly glyph contours where the first point was off-path. This changes the conversion algorithm to a hopefully clearer one, which explicitly inserts all implicit on-path points between off-path ones as a first step before outputting the PostScript code.
If I enable svg, I see artifacts in the resulting file that look like there are similar bugs as matplotlib#903 in svg.
…s freetype versions, and also it doesn't actually test ttconv, wihch is not used by the Agg backend.
Great! I think this is good to merge. |
Fix TrueType to Type-3 font conversion
… their last point as an initial MOVETO. This is the SVG-specific corrolory to matplotlib#905.
…t point as an initial MOVETO. This is the SVG-specific corrolory to #905.
The code did not handle correctly glyph contours where the first
point was off-path. This changes the conversion algorithm to a
hopefully clearer one, which explicitly inserts all implicit on-path
points between off-path ones as a first step before outputting the
PostScript code.
I hope this fixes issue #903.