diff options
author | Behdad Esfahbod <behdad@behdad.org> | 2017-05-02 14:38:54 +0200 |
---|---|---|
committer | Werner Lemberg <wl@gnu.org> | 2017-05-02 14:38:54 +0200 |
commit | 60bf264ee25dc08403dddb3e4cd2bf950cda9e90 (patch) | |
tree | cc0ab3f499f68b6e86e00506876fe449da8e4757 | |
parent | ba40054c2dd9f5d3d8561de7106870ac6a920f6d (diff) | |
download | freetype2-60bf264ee25dc08403dddb3e4cd2bf950cda9e90.tar.gz |
[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.
-rw-r--r-- | ChangeLog | 15 | ||||
-rw-r--r-- | src/truetype/ttgxvar.c | 23 |
2 files changed, 20 insertions, 18 deletions
@@ -1,3 +1,18 @@ +2017-05-02 Behdad Esfahbod <behdad@behdad.org> + + [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 <wl@gnu.org> [autofit] Remove `slight' auto-hint mode again. diff --git a/src/truetype/ttgxvar.c b/src/truetype/ttgxvar.c index 6d4529ba5..0cedb6bdf 100644 --- 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++ ) |