shithub: freetype+ttf2subf

Download patch

ref: 60bf264ee25dc08403dddb3e4cd2bf950cda9e90
parent: ba40054c2dd9f5d3d8561de7106870ac6a920f6d
author: Behdad Esfahbod <[email protected]>
date: Tue May 2 10:38:54 EDT 2017

[truetype] Make `IUP' gvar deltas do the same as Apple (#50832).

When points are not touched by gvar interpolation deltas, FreeType
gave a slightly different result than Apple's CoreText.

The OpenType working group will update the specification to document
the following behaviour: If the two points with deltas to the `left'
and `right' of the untouched point have the same coordinate, then
the inferred delta for the untouched point should be zero.

* src/truetype/ttgxvar.c (tt_delta_interpolate): Implement new
behaviour.

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2017-05-02  Behdad Esfahbod  <[email protected]>
+
+	[truetype] Make `IUP' gvar deltas do the same as Apple (#50832).
+
+	When points are not touched by gvar interpolation deltas, FreeType
+	gave a slightly different result than Apple's CoreText.
+
+	The OpenType working group will update the specification to document
+	the following behaviour: If the two points with deltas to the `left'
+	and `right' of the untouched point have the same coordinate, then
+	the inferred delta for the untouched point should be zero.
+
+	* src/truetype/ttgxvar.c (tt_delta_interpolate): Implement new
+	behaviour.
+
 2017-05-02  Werner Lemberg  <[email protected]>
 
 	[autofit] Remove `slight' auto-hint mode again.
--- a/src/truetype/ttgxvar.c
+++ b/src/truetype/ttgxvar.c
@@ -3081,25 +3081,12 @@
       d1   = out1 - in1;
       d2   = out2 - in2;
 
-      if ( out1 == out2 || in1 == in2 )
+      /* If the reference points have the same coordinate but different */
+      /* delta, inferred delta is zero.  Otherwise interpolate.         */
+      if ( in1 != in2 || out1 == out2 )
       {
-        for ( p = p1; p <= p2; p++ )
-        {
-          out = in_points[p].x;
-
-          if ( out <= in1 )
-            out += d1;
-          else if ( out >= in2 )
-            out += d2;
-          else
-            out = out1;
-
-          out_points[p].x = out;
-        }
-      }
-      else
-      {
-        FT_Fixed  scale = FT_DivFix( out2 - out1, in2 - in1 );
+        FT_Fixed  scale = in1 != in2 ? FT_DivFix( out2 - out1, in2 - in1 )
+                                     : 0;
 
 
         for ( p = p1; p <= p2; p++ )