On Tue, Jun 16, 2020 at 9:50 AM Werner LEMBERG <[email protected]> wrote: > >>> - Your handling of two edges meeting at a corner is solid. That's > >>> exactly what we do in GLyphy. However, I'm also now convinced > >>> that there is no way to produce SDF from contours that might > >>> overlap. Imagine a "+" sign that is two straight contours. You > >>> cannot find the distance around the intersection. That's really > >>> bad news :(. Removing overlaps is extremely tricky and so far > >>> we've stayed away from adding to FreeType. > > This is an interesting idea. I'm very open to add an API for removing > overlaps. > > >>> SkiaPathOps seems to be the most solid Open Source implementation. > > URL, please. A quick search on Google only shows video results. >
Watch this video first so you appreciate the level of finesse that has gone into it: https://www.youtube.com/watch?v=OmfliNQsk88 The code is part of Skia. In FontTools we needed that so Cosimo & others wrapped that into Python: https://github.com/fonttools/skia-pathops SkiaPathOps can be compiled separately from the rest of Skia. That was by design. When we started using this for font production, we hit a couple of problems. If I remember correctly, it didn't necessarily retain the direction of contours. Ie. it worked for even-odd only. They were open to addressing those issues so it can be used for font production. And I know fontmake pipeline uses it now. I've CC'ed Cosimo & Ben who can comment. And yes, that library removes overlaps on curves directly. b > >>> I don't have any suggestion as to how to proceed. I can only say > >>> do your work without overlaps and document that as a caveat. > > Sounds like a good suggestion. > > > Werner > -- behdad http://behdad.org/
