Werner sent me a font that broke with my code, but only when SHPIX is blocked. I stumbled over one other font, an older version of Rokkitt, that glitched out the same way after invoking ALIGNRP after a blocked SHPIX. Werner pointed out that my code prevented point creation/modification in the twilight zone which it shouldn't. The attached patch fixes the problem. What remains: Is the patch exhaustive or do I need to do more work to allow twilight modification?
>From eb3f5c2d0801ed0046d6a8b8969faf5b2692e593 Mon Sep 17 00:00:00 2001
From: Nikolaus Waxweiler <madig...@gmail.com>
Date: Sun, 29 May 2016 17:40:49 +0200
Subject: [PATCH] Let SHPIX move points in the twilight zone.

Special case: allow SHPIX to move points in the twilight zone.
Otherwise, treat SHPIX the same as DELTAP. Unbreaks various fonts such
as older versions of Rokkitt and DTL Argo T Light that would glitch
severly after calling ALIGNRP after a blocked SHPIX.
---
 src/truetype/ttinterp.c | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/src/truetype/ttinterp.c b/src/truetype/ttinterp.c
index c6df129..a18facb 100644
--- a/src/truetype/ttinterp.c
+++ b/src/truetype/ttinterp.c
@@ -5548,6 +5548,8 @@
 #ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
     FT_Int      B1, B2;
 #endif
+    FT_Bool     in_twilight = exc->GS.gep0 == 0 || exc->GS.gep1 == 0 || exc->GS.gep2 == 0;
+
 
 
     if ( exc->top < exc->GS.loop + 1 )
@@ -5656,11 +5658,14 @@
       if ( SUBPIXEL_HINTING_MINIMAL     &&
            exc->backwards_compatibility )
       {
-        /* XXX: breaks Rokkitt < v1.2                   */
-        /*      (glyphs explode vertically on ALIGNRP). */
-        if ( !( exc->iupx_called && exc->iupy_called )              &&
-             ( ( exc->is_composite && exc->GS.freeVector.y != 0 ) ||
-               ( exc->zp2.tags[point] & FT_CURVE_TAG_TOUCH_Y )    ) )
+        /* Special case: allow SHPIX to move points in the twilight zone.
+         * Otherwise, treat SHPIX the same as DELTAP. Unbreaks various fonts
+         * such as older versions of Rokkitt and DTL Argo T Light that would
+         * glitch severly after calling ALIGNRP after a blocked SHPIX. */
+        if ( in_twilight ||
+             ( !( exc->iupx_called && exc->iupy_called )              &&
+               ( ( exc->is_composite && exc->GS.freeVector.y != 0 )   ||
+                 ( exc->zp2.tags[point] & FT_CURVE_TAG_TOUCH_Y )      ) ) )
           Move_Zp2_Point( exc, point, 0, dy, TRUE );
       }
       else
-- 
2.5.5

_______________________________________________
Freetype-devel mailing list
Freetype-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/freetype-devel

Reply via email to