|
From: | Byeongsik Jeon |
Subject: | Re: [ft-devel] [PATCH v2] Improve FT_Outline_Embolden for the unintended artifacts problem (#45596). |
Date: | Tue, 9 Oct 2018 13:26:53 +0900 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.0 |
On Mon, 8 Oct 2018 21:38:42 -0400, Alexei Podtelezhnikov <address@hidden> wrote:
Yes. I was trying to do a solution this way. The problem is that this method alone can eliminate the intended design of the font.I want to hear your opinion on this approach.The original glyph shape is usually smooth: the contours have no self-intersections. The emboldening might result in self-intersecting contours. This is the main reason for majority of artifacts. You already figured out that corners slide along bisectors, assuming symmetric strength.x == strength.y. It is easy to see that self intersections happen when a segment flips its orientation under certain condition. This condition is easy to formulate but it involves both corners at the segment termini and the length of the segment. Nothing short of resolving these will work: such segments have to be removed. To put it differently, the outline has to be simplified by removing self-intersecting segments and replacing them with a point at the intersection of the flanking segments. That is it and then you apply emboldening cleanly.
So, how about using the newly introduced shifter to implement it? k==2.3 is almost similar to the existing shifter between 90 and 270 degrees, and I think it is appropriate for the rest.
The other issue is sharp corners that are left. The standard solution for them is bevel or round join of lines in the emboldened outline. This is totally separate. I do not see other reasons for artifacts and very much doubt that any easier solution exists. By the way, we has glyph stroker https://www.freetype.org/freetype2/docs/reference/ft2-glyph_stroker.html. This should be a sister algorithm, but it is implemented separately with a bunch of trigonometry. I personally would love to have a single FreeType module handle both, implemented using bisectors. So this is a big project altogether: I would estimate at least 100 hours of programing.
[Prev in Thread] | Current Thread | [Next in Thread] |