Remove overlaps guesses wrong about inside and outside #473

Closed
mskala opened this Issue Mar 22, 2013 · 5 comments

3 participants

@mskala
fontforge member
  1. Load the file from https://github.com/fontforge/debugfonts/blob/master/rmo-we.sfd
  2. Select the one glyph it contains
  3. Remove overlaps

This glyph is a single stroke that bounces around a bit and forms a loop. Removing overlaps fills in the counter of the loop and destroys everything else. The bug seems to be similar in nature to #402, but it's to do with guessing wrong about which curves are "inside" and which are "outside" rather than deleting control points, so I'm filing it separately.

@ultrasquid

There is something weird going on here that I can't quite explain. I can confirm the erroneous behavior, but when I add extrema and simplify before removing overlaps, overlaps are removed in the expected way. Still, though those additional steps are part of my routine, they shouldn't be necessary to avoid this error.

@mskala
fontforge member

It's often been my experience that varying the order and combinations of add extrema, simplify, remove overlaps, rounding, and find intersections will fix this kind of problem for any given glyph. However, then other glyphs break. I've yet to find a sequence that reliably works for all glyphs.

@ultrasquid
@frank-trampe

This isn't directly about guessing wrong about inside and outside. There were several problems in the overlap removal code.

One problem was assuming in certain places that two intersections were identical (due to rounding) but assuming them to be non-identical due to different intersection objects with slightly different coordinates being present.

The other problem caused a segment being divided to fail to connect to an intersection at its end correctly. (The first segment would remain connected to the end even after being replaced by the second segment on that side of the division.)

Pull request #1485 addresses both of these issues.

@frank-trampe

Closed by #1485.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment