emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master b1380af072d: Don't magnify extent of shifts by variable glyph int


From: Po Lu
Subject: master b1380af072d: Don't magnify extent of shifts by variable glyph interpolation
Date: Wed, 3 Jan 2024 00:53:55 -0500 (EST)

branch: master
commit b1380af072d5a76a6f95726fee0eb378dc26849b
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>

    Don't magnify extent of shifts by variable glyph interpolation
    
    * src/sfnt.c (sfnt_infer_deltas_2): Correctly index
    x_coordinates and y_coordinates computing deltas for plain
    shift.
    (sfnt_vary_simple_glyph): Copy glyph contents to original_x and
    original_y not the first time is create, but before each tuple
    is applied.
---
 src/sfnt.c | 22 ++++++++++++++--------
 1 file changed, 14 insertions(+), 8 deletions(-)

diff --git a/src/sfnt.c b/src/sfnt.c
index e66292c6ad8..aa8b49a9ecd 100644
--- a/src/sfnt.c
+++ b/src/sfnt.c
@@ -15411,7 +15411,7 @@ sfnt_infer_deltas_2 (struct sfnt_glyph *glyph, size_t 
pair_start,
              d1 = (glyph->simple->x_coordinates[pair_start]
                    - x[pair_start]);
              d2 = (glyph->simple->x_coordinates[pair_end]
-                   - x[pair_start]);
+                   - x[pair_end]);
 
              if (d1 == d2)
                glyph->simple->x_coordinates[j] += d1;
@@ -15483,7 +15483,7 @@ sfnt_infer_deltas_2 (struct sfnt_glyph *glyph, size_t 
pair_start,
              d1 = (glyph->simple->y_coordinates[pair_start]
                    - y[pair_start]);
              d2 = (glyph->simple->y_coordinates[pair_end]
-                   - y[pair_start]);
+                   - y[pair_end]);
 
              if (d1 == d2)
                glyph->simple->y_coordinates[j] += d1;
@@ -15915,14 +15915,20 @@ sfnt_vary_simple_glyph (struct sfnt_blend *blend, 
sfnt_glyph id,
                                     * glyph->simple->number_of_points);
 
              original_y = original_x + glyph->simple->number_of_points;
-             memcpy (original_x, glyph->simple->x_coordinates,
-                     (sizeof *original_x
-                      * glyph->simple->number_of_points));
-             memcpy (original_y, glyph->simple->y_coordinates,
-                     (sizeof *original_y
-                      * glyph->simple->number_of_points));
            }
 
+         /* The array of original coordinates should reflect the
+            state of the glyph immediately before deltas from this
+            tuple are applied, in contrast to the state before any
+            deltas are applied.  */
+
+         memcpy (original_x, glyph->simple->x_coordinates,
+                 (sizeof *original_x
+                  * glyph->simple->number_of_points));
+         memcpy (original_y, glyph->simple->y_coordinates,
+                 (sizeof *original_y
+                  * glyph->simple->number_of_points));
+
          memset (touched, 0, (sizeof *touched
                               * glyph->simple->number_of_points));
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]