-
Notifications
You must be signed in to change notification settings - Fork 94
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
contours of zero width can't be exported into a variable font #572
Comments
What is uncompatible in this?
vs
change the second contour to this, makes it compatible... >>>
|
Cursory look: Maybe the points
get merged into one point? |
Most likely, I dont want them to get merged, what could be done, please? |
this is what Glyphs are able to export into a variable font
|
same problem with arg -o ttf-interpolatable ...overlapped startpoint gets merged UFO:
opening this master in GLYPHS, after exporting 'compatible ttfs':
This works as expected though..
|
Hm. It werks if I do |
Tracking this down to
|
This seems to be a feature (?) of fontTools'
into
The associated cu2qu test case would be def test_overlapping_points(self):
glyph = Glyph()
pen = glyph.getPointPen()
pen.beginPath()
pen.addPoint((0, 651), segmentType="line")
pen.addPoint((0, 101), segmentType="line")
pen.addPoint((0, 101), segmentType="line")
pen.addPoint((0, 651), segmentType="line")
pen.endPath()
assert glyph_to_quadratic(glyph, reverse_direction=True)
assert [(p.x, p.y) for p in glyph[0]] == [
(0, 651),
(0, 651), # is this reordering to be expected?
(0, 101),
(0, 101),
] which passes with the modification mentioned above. Not sure what to do about this one. I'd expect the contour to not change? @anthrotype |
@madig thanks for having look on that! I tried to track it, but I wasn't able to go that deep. The reordering is wrong as long as it happens per master, none of the apps out there is able to export my variable font correctly, only FontLab VI for Mac can do it. I don't know, probably they use their own version of FontTools. They have option to trun on and off these "smart features" that shift or remove points randomly |
@madig I have just checked and FontLab VI exports it correctly and is using the same |
The PointToSegmentPen translates between PointPen and (Segment)Pen protocol. In the SegmentPen protocol, closed contours always imply a final 'lineTo' segment from the last oncurve point to the starting point. So the PointToSegmentPen omits the final 'lineTo' segment for closed contours -- unless the option 'outputImpliedClosingLine' is True (it is False by default, and defcon.Glyph.draw method initializes the converter pen without this option). However, if the last oncurve point is on a "line" segment and has same coordinates as the starting point of a closed contour, the converter pen must always output the closing 'lineTo' explicitly (regardless of the value of the 'outputImpliedClosingLine' option) in order to disambiguate this case from the implied closing 'lineTo'. If it doesn't do that, a duplicate 'line' point at the end of a closed contour gets lost in the conversion. See googlefonts/fontmake#572.
@jansindl3r I fixed the issue with duplicate points being dropped in fonttools PointToSegmentPen. The fix is available in the latest fontmake v2.0.2 (which requires fonttools v4.0.1). |
@anthrotype Thanks, I have just tested it on my font using fontmake of version 2.0.2 in virtual enviroment is raising this error.
|
@jansindl3r thanks for the files. I think I found the root of the issue. I will push a fix to cu2qu soon. |
When collecting a glyph's segments, we can't simply call the glyphs' draw method with the GetSegmentsPen, but we must initialize the PointToSegmentPen explicitly with outputImpliedClosingLine=True. By default PointToSegmentPen does not outputImpliedClosingLine -- unless last and first point on closed contour are duplicated. Because we are converting multiple glyphs at the same time, we want to make sure the _get_segments function returns the same number of segments, whether or not the last and first point overlap. Fixes googlefonts/fontmake#572 Also see: fonttools/fonttools#1720
@jansindl3r I have released cu2qu 1.6.6 with the fix and verified that your test font builds successfully with latest fontmake and updated cu2qu. |
@anthrotype thanks! It works in full version of the font as well.. I am very happy that I can start implementing fontmake into my workflow.. |
The PointToSegmentPen translates between PointPen and (Segment)Pen protocol. In the SegmentPen protocol, closed contours always imply a final 'lineTo' segment from the last oncurve point to the starting point. So the PointToSegmentPen omits the final 'lineTo' segment for closed contours -- unless the option 'outputImpliedClosingLine' is True (it is False by default, and defcon.Glyph.draw method initializes the converter pen without this option). However, if the last oncurve point is on a "line" segment and has same coordinates as the starting point of a closed contour, the converter pen must always output the closing 'lineTo' explicitly (regardless of the value of the 'outputImpliedClosingLine' option) in order to disambiguate this case from the implied closing 'lineTo'. If it doesn't do that, a duplicate 'line' point at the end of a closed contour gets lost in the conversion. See googlefonts/fontmake#572.
Hello, I have a master that has all points at the same x position. It cannot be exported as variable font with fontmake -o variable -m font.designspace. Source is in ufo. I am attaching demo that reproduces this. Can I turn off compatibility check and force the export? See letter A Thanks, Jan
bug.zip
--keep-direction
and--keep-overlaps
didn't helpCLI:
fontmake -o variable -m bug.designspace --verbose WARNING
Error:
WARNING:fontTools.varLib:glyph A has incompatible masters; skipping
The text was updated successfully, but these errors were encountered: