diff options
| author | Po Lu | 2023-12-18 22:14:22 +0800 |
|---|---|---|
| committer | Po Lu | 2023-12-18 22:14:22 +0800 |
| commit | 1d5d2f16c330e98a42c94fbea3728802f7535918 (patch) | |
| tree | 37787da76cba21afecccc9b8e1dd920719083e2c /src | |
| parent | 1abba7bfa4518923109ae95055ca268909f0ae98 (diff) | |
| download | emacs-1d5d2f16c330e98a42c94fbea3728802f7535918.tar.gz emacs-1d5d2f16c330e98a42c94fbea3728802f7535918.zip | |
Further fixes for problems uncovered by the previous fix
* src/sfnt.c (sfnt_deltap): Enable deltap instructions again,
since they now serve a purpose.
(sfnt_compute_phantom_points): Round phantom points to match the
behavior of other TrueType scalers.
Diffstat (limited to 'src')
| -rw-r--r-- | src/sfnt.c | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/src/sfnt.c b/src/sfnt.c index f67857c1893..131b4fd409c 100644 --- a/src/sfnt.c +++ b/src/sfnt.c | |||
| @@ -6829,7 +6829,7 @@ sfnt_interpret_trap (struct sfnt_interpreter *interpreter, | |||
| 6829 | ? (TRAP ("stack underflow"), 0) \ | 6829 | ? (TRAP ("stack underflow"), 0) \ |
| 6830 | : *(interpreter->SP - 1)) | 6830 | : *(interpreter->SP - 1)) |
| 6831 | 6831 | ||
| 6832 | #if !defined TEST || !0 | 6832 | #if !defined TEST |
| 6833 | 6833 | ||
| 6834 | #define PUSH(value) \ | 6834 | #define PUSH(value) \ |
| 6835 | { \ | 6835 | { \ |
| @@ -6847,7 +6847,7 @@ sfnt_interpret_trap (struct sfnt_interpreter *interpreter, | |||
| 6847 | interpreter->SP++; \ | 6847 | interpreter->SP++; \ |
| 6848 | } | 6848 | } |
| 6849 | 6849 | ||
| 6850 | #else /* TEST && 0 */ | 6850 | #else /* TEST */ |
| 6851 | 6851 | ||
| 6852 | #define PUSH(value) \ | 6852 | #define PUSH(value) \ |
| 6853 | { \ | 6853 | { \ |
| @@ -9799,12 +9799,10 @@ sfnt_interpret_mdap (struct sfnt_interpreter *interpreter, | |||
| 9799 | 9799 | ||
| 9800 | static void | 9800 | static void |
| 9801 | sfnt_deltap (int number, struct sfnt_interpreter *interpreter, | 9801 | sfnt_deltap (int number, struct sfnt_interpreter *interpreter, |
| 9802 | unsigned char operand, unsigned int index) | 9802 | unsigned char operand, unsigned int p) |
| 9803 | { | 9803 | { |
| 9804 | int ppem, delta; | 9804 | int ppem, delta; |
| 9805 | 9805 | ||
| 9806 | return; | ||
| 9807 | |||
| 9808 | /* Extract the ppem from OPERAND. The format is the same as in | 9806 | /* Extract the ppem from OPERAND. The format is the same as in |
| 9809 | sfnt_deltac. */ | 9807 | sfnt_deltac. */ |
| 9810 | 9808 | ||
| @@ -9908,8 +9906,8 @@ sfnt_deltap (int number, struct sfnt_interpreter *interpreter, | |||
| 9908 | delta *= 1l << (6 - interpreter->state.delta_shift); | 9906 | delta *= 1l << (6 - interpreter->state.delta_shift); |
| 9909 | 9907 | ||
| 9910 | /* Move the point. */ | 9908 | /* Move the point. */ |
| 9911 | sfnt_check_zp0 (interpreter, index); | 9909 | sfnt_check_zp0 (interpreter, p); |
| 9912 | sfnt_move_zp0 (interpreter, index, 1, delta); | 9910 | sfnt_move_zp0 (interpreter, p, 1, delta); |
| 9913 | } | 9911 | } |
| 9914 | 9912 | ||
| 9915 | /* Needed by sfnt_interpret_call. */ | 9913 | /* Needed by sfnt_interpret_call. */ |
| @@ -12239,6 +12237,7 @@ sfnt_compute_phantom_points (struct sfnt_glyph *glyph, | |||
| 12239 | sfnt_f26dot6 *x2, sfnt_f26dot6 *y2) | 12237 | sfnt_f26dot6 *x2, sfnt_f26dot6 *y2) |
| 12240 | { | 12238 | { |
| 12241 | sfnt_fword f1, f2; | 12239 | sfnt_fword f1, f2; |
| 12240 | sfnt_fixed s1, s2; | ||
| 12242 | 12241 | ||
| 12243 | /* Two ``phantom points'' are appended to each outline by the scaler | 12242 | /* Two ``phantom points'' are appended to each outline by the scaler |
| 12244 | prior to instruction interpretation. One of these points | 12243 | prior to instruction interpretation. One of these points |
| @@ -12256,8 +12255,14 @@ sfnt_compute_phantom_points (struct sfnt_glyph *glyph, | |||
| 12256 | f2 += glyph->advance_distortion; | 12255 | f2 += glyph->advance_distortion; |
| 12257 | 12256 | ||
| 12258 | /* Next, scale both up. */ | 12257 | /* Next, scale both up. */ |
| 12259 | *x1 = sfnt_mul_f26dot6_fixed (f1 * 64, scale); | 12258 | s1 = sfnt_mul_f26dot6_fixed (f1 * 64, scale); |
| 12260 | *x2 = sfnt_mul_f26dot6_fixed (f2 * 64, scale); | 12259 | s2 = sfnt_mul_f26dot6_fixed (f2 * 64, scale); |
| 12260 | |||
| 12261 | /* While not expressly provided in the manual, the phantom points | ||
| 12262 | (at times termed the advance and origin points) represent pixel | ||
| 12263 | coordinates within the raster, and are therefore rounded. */ | ||
| 12264 | *x1 = sfnt_round_f26dot6 (s1); | ||
| 12265 | *x2 = sfnt_round_f26dot6 (s2); | ||
| 12261 | 12266 | ||
| 12262 | /* Clear y1 and y2. */ | 12267 | /* Clear y1 and y2. */ |
| 12263 | *y1 = 0; | 12268 | *y1 = 0; |