-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
draw_svg_path: auto-close open sub-paths when drawing svg paths with …
…fonttools pen The draw_svg_path function which we use to convert SVG paths to FontTools pen commands to create UFO glyphs from them, uses the presence/absence of 'z' to decide whether to call a pen's endPath (for open contours) and closePath (for closed ones). If a filled subpath does not explicily ends with 'z' (which is the case for some of our source files, e.g. 'one-o-clock.svg'), then upon converting it to UFO glyph using the FontTools pen protocol, the subpath is kept 'open' (i.e. the UFO GLIF contour's first point type is set to 'move'). Then, when the UFO glyph is converted to TrueType by ufo2ft with the TTGlyphPointPen, if the starting 'move' point and the last point of such 'open' contours are on top of each other (i.e. contour does a full loop despite being marked as 'open'), the result is a duplicate point at the end/start of the TrueType contour. We fix this by adding an optional `close_subpath=False` parameter to draw_svg_path function, which when True signals that we want to interpret the SVG subpaths as if they were closed by an explicit 'z' command, which avoids the duplicate end/start points in the converted TrueType glyphs. TrueType contours are always filled and automatically closed by an implicit line back to their staring point.
- Loading branch information
1 parent
53ba29c
commit 87dcae5
Showing
4 changed files
with
28 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters