googlefonts / googlefonts/glyphsLib

glyphsLib.filters.eraseOpenCorners creates incompatible number of segments

Open
#873 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
Python
Stars
201
Forks
56
Avg merge
17m
Merged PRs (30d)
1

Description

I am building a font where the open corners interpolate to normal segments. All glyphs are compatible in glyphs, but after the filter is applied I get:

`fontmake.errors.FontmakeError: In 'Anybody.glyphs' -> 'master_ufo/Anybody.designspace': Generating fonts from Designspace failed: fonts contains incompatible glyphs: 'G', 'M', 'N', 'V', 'V.ss01', 'W', 'a', 'f', 'four', 'four.dnom', 'lira', 'quotedblright', 'quoteleft', 'quoteright', 'seven', 'seven.dnom', 'sterling', 'v', 'w', 'y', 'z'`

preceded by a very long list of:
```
DEBUG:glyphsLib.filters.eraseOpenCorners:Considering line segment (505,154)-(505,154)
DEBUG:glyphsLib.filters.eraseOpenCorners:Crossing points (351, 154) and (653, 154) were not on same side of line segment
DEBUG:glyphsLib.filters.eraseOpenCorners:All done, count of segments now: 11
DEBUG:glyphsLib.filters.eraseOpenCorners:Segments: [((505, 154), (653, 154), (725.5, 176.0)), ((725.5, 176.0), (798, 198), (806, 240)), ((806, 240), (828, 367)), ((828, 367), (836, 408), (772.0, 430.0)), ((772.0, 430.0), (708, 452), (557, 452)), ((557, 452), (403, 452), (332.5, 430.5)), ((332.5, 430.5), (262, 409), (254, 367)), ((254, 367), (232, 240)), ((232, 240), (224, 198), (287.5, 176.0)), ((287.5, 176.0), (351, 154), (505, 154)), ((505, 154), (505, 154))]
DEBUG:ufo2ft.filters.base:Took 0.089s to run EraseOpenCornersFilter on 25 glyphs
ERROR:cu2qu.ufo:Glyphs named 'W' have different number of segments
```

Overlapping points (instead of open corners) fix the interpolation. Although this is not an ideal solution. I have no idea what would be the best practice tbh, but since it was building fine a year ago, maybe that case was not taken into account.

You can find the font here:
https://github.com/Etcetera-Type-Co/Anybody/tree/3ab60fd15f8ca89266d2bb598b9e12a805824855

Contributor guide

Open the contributing guide

Research direction

Reproduce the failure using the linked Anybody source and inspect glyphsLib.filters.eraseOpenCorners, especially its segment-count debug output. Compare the affected glyphs across masters and trace the generated designspace through fontmake and cu2qu. Done means the filter no longer produces incompatible segment counts for these glyphs and the font builds successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.