freetype-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Freetype-devel] Re: GSOC - Distance Fields


From: Anuj Verma
Subject: Re: [Freetype-devel] Re: GSOC - Distance Fields
Date: Fri, 7 Aug 2020 10:23:59 +0530

Hello Alexei,

> Can you describe discontinuities with the same sign if I overlook them?

So, I found there are two types of discontinuities due to overlapping contours:

A) Discontinuity in sign. (i.e. there is a sudden jump from negative to positive)
B) Discontinuity in distances. (i.e. the points that should be at infinity/spread have smaller distances)

Here is an example of a SDF generated from glyph with overlaps: https://i.imgur.com/3pqHZWd.png
In that image the right side is correct (generated from bitmap), and the left side has both A and B
types of  discontinuities.

What you are saying about detecting sudden jump from large negative to large
positive can work for discontinuities in sign. I tried that and here is an example: https://i.imgur.com/unRB23Z.png
(ignore the weird lines in the image, that can be fixed). But even after fixing the
sign there are pixels inside the outline which have shortest distance to the curves
inside the outline. (basically the pixels around the overlap points to the overlapping
curve, which causes discontinuous distances). Moreover they interpolate smoothly
so there is no way to find the actual distance which will be to some curve at the border
of the outline instead of inside the outline.

Also, I looked at a library (msdfgen) which handles overlapping contours without
removing the overlaps. It works well, but it doesn't work for self-intersecting contours,
that is why I'm not sure whether it's worth implementing.

Finally, I can find and fix signs such that all points inside a shape are positive and
all points outside are negative. But I don't know how I can fix the incorrect distances
caused by the overlaps. Here is one final example: https://i.imgur.com/jiaqiBS.png
In this the point `P' has a positive sign and it points to a line inside the shape, which
is not correct, instead it should point to the corner. Moreover there is no corner in the
shape because they are two separate contours, so I think removing the overlaps is
the best way to handle this.

Thanks,
Anuj

reply via email to

[Prev in Thread] Current Thread [Next in Thread]