Hi.
+ det = i.y * o.x - i.x * o.y , det != 0
+ shift.x = strength * ( i.x - o.x ) / det
+ shift.y = strength * ( i.y - o.y ) / det
So your algorithm is exactly the same as the one implemented
currently. The tricky part is how you deal with very short collapsing
segments, the segments of zero length, and your threshold on the
determinant. Can you please elaborate on that and explain why your
algorithm is superior?
https://savannah.nongnu.org/bugs/?45596
https://savannah.nongnu.org/bugs/download.php?file_id=34479
03963_BAUHAUS.ttf is a very bad font for real use. However, it is a suitable
font to test the stability of the Embolden algorithm.
[0]
bauhaus_256px_0_gedit_non_patched.png:
This is a problem that appears in FreeType, which is not patched.
[1]
bauhaus_256px_1_gedit_ftsynth_patched.png:
It's only applied the fetsynth Embolden patch. The overlaped shape was found in
its original shape, and the size of the artifact was reduced. The overall stem
thickness or advance is correctly organized.
[2]
bauhaus_256px_2_gedit_ftsynth+shift_limit_patched.pcrushng:
Additional shift limitation patch have been applied.
shift.x = FT_MAX( FT_MIN( shift.x, strength.x ), -strength.x );
shift.y = FT_MAX( FT_MIN( shift.y, strength.y ), -strength.y );
The sharpen edge of the 'X' has been removed.
[3]
bauhaus_256px_3_gedit_all_patched.png:
The remaining patches were applied. You can see that all the artifacts are
removed. The middle stem of the "$" character is rendered to the right thickness.
It was so difficult to modify the existing code that I rewrite it. But it's
based on the existing code idea.
l_out = (FT_Fixed)FT_Vector_NormLen( &out );
if ( l_out == 0 )
continue;
While the existing code focuses on skipping only the zero-length segment, the
new code skips the zero-determinant segment.
det = FT_MulFix( in.y, out.x ) - FT_MulFix( in.x, out.y );
if ( det == 0 ) continue;
Zero-determinant segments include these things:
- zero-length segment: |in| == 0 or |out| == 0 ( normalized vector in, out )
- plain straight segment: in == out
- forward-backward mixed straight segment: in + out == 0
"( det = in.y * out.x - in.x * out.y ) == 0" checks all of these.
The "forward-backward mixed straight segment" are particularly important.
Because their shift vectors are in the opposite direction, they produce a
prominent artifact.
The good thing about the improved code is that "det" is part of the formula for
obtaining shift vectors. Also, since improved code is not difficult, it is easy
to track even if new problems are found.
Unless "strength" is zero, it is inevitable that shift vectors intersect or
sharpen edge generation. The appropriate values of "strength" and "shift limit
code" complement this deficiencies.
[4]
bauhaus_256px_4_win7ie9_virtualbox.png:
The artifact that appears here is obviously a bug in Windows. Potentially, this
problem can appear on any font.
What we should note is that the rendered letter shape, except for the artifacts,
is almost identical to our results.
Thanks.
FreeType-Bugs: https://savannah.nongnu.org/bugs/?45596
---
  src/base/ftoutln.c | 177 ++++++++++++++++++++++++++++++++++++++++++++-
  1 file changed, 176 insertions(+), 1 deletion(-)
_______________________________________________
Freetype-devel mailing list
https://lists.nongnu.org/mailman/listinfo/freetype-devel