aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPo Lu2024-01-03 13:42:27 +0800
committerPo Lu2024-01-03 13:53:39 +0800
commitb1380af072d5a76a6f95726fee0eb378dc26849b (patch)
treeca1e495ddc9a37c99f4804cd1164d0f03671eca8 /src
parentef71ff4c7e27a04344d8ddcca7e7d3e2822e38bf (diff)
downloademacs-b1380af072d5a76a6f95726fee0eb378dc26849b.tar.gz
emacs-b1380af072d5a76a6f95726fee0eb378dc26849b.zip
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.
Diffstat (limited to 'src')
-rw-r--r--src/sfnt.c22
1 files 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,
15411 d1 = (glyph->simple->x_coordinates[pair_start] 15411 d1 = (glyph->simple->x_coordinates[pair_start]
15412 - x[pair_start]); 15412 - x[pair_start]);
15413 d2 = (glyph->simple->x_coordinates[pair_end] 15413 d2 = (glyph->simple->x_coordinates[pair_end]
15414 - x[pair_start]); 15414 - x[pair_end]);
15415 15415
15416 if (d1 == d2) 15416 if (d1 == d2)
15417 glyph->simple->x_coordinates[j] += d1; 15417 glyph->simple->x_coordinates[j] += d1;
@@ -15483,7 +15483,7 @@ sfnt_infer_deltas_2 (struct sfnt_glyph *glyph, size_t pair_start,
15483 d1 = (glyph->simple->y_coordinates[pair_start] 15483 d1 = (glyph->simple->y_coordinates[pair_start]
15484 - y[pair_start]); 15484 - y[pair_start]);
15485 d2 = (glyph->simple->y_coordinates[pair_end] 15485 d2 = (glyph->simple->y_coordinates[pair_end]
15486 - y[pair_start]); 15486 - y[pair_end]);
15487 15487
15488 if (d1 == d2) 15488 if (d1 == d2)
15489 glyph->simple->y_coordinates[j] += d1; 15489 glyph->simple->y_coordinates[j] += d1;
@@ -15915,14 +15915,20 @@ sfnt_vary_simple_glyph (struct sfnt_blend *blend, sfnt_glyph id,
15915 * glyph->simple->number_of_points); 15915 * glyph->simple->number_of_points);
15916 15916
15917 original_y = original_x + glyph->simple->number_of_points; 15917 original_y = original_x + glyph->simple->number_of_points;
15918 memcpy (original_x, glyph->simple->x_coordinates,
15919 (sizeof *original_x
15920 * glyph->simple->number_of_points));
15921 memcpy (original_y, glyph->simple->y_coordinates,
15922 (sizeof *original_y
15923 * glyph->simple->number_of_points));
15924 } 15918 }
15925 15919
15920 /* The array of original coordinates should reflect the
15921 state of the glyph immediately before deltas from this
15922 tuple are applied, in contrast to the state before any
15923 deltas are applied. */
15924
15925 memcpy (original_x, glyph->simple->x_coordinates,
15926 (sizeof *original_x
15927 * glyph->simple->number_of_points));
15928 memcpy (original_y, glyph->simple->y_coordinates,
15929 (sizeof *original_y
15930 * glyph->simple->number_of_points));
15931
15926 memset (touched, 0, (sizeof *touched 15932 memset (touched, 0, (sizeof *touched
15927 * glyph->simple->number_of_points)); 15933 * glyph->simple->number_of_points));
15928 15934