[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
feature/android 7fb0df0ce2 3/7: Fix graphics state when instructing glyp
From: |
Po Lu |
Subject: |
feature/android 7fb0df0ce2 3/7: Fix graphics state when instructing glyphs |
Date: |
Wed, 8 Feb 2023 10:42:54 -0500 (EST) |
branch: feature/android
commit 7fb0df0ce2858eeb03ec18b540acf49a5b8d90c9
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>
Fix graphics state when instructing glyphs
* src/sfntfont.c (sfntfont_get_glyph_outline): Take new argument
STATE and restore it prior to instructing the glyph.
(sfntfont_measure_instructed_pcm, sfntfont_measure_pcm)
(sfntfont_draw): Adjust accordingly.
---
src/sfntfont.c | 18 +++++++++++++-----
1 file changed, 13 insertions(+), 5 deletions(-)
diff --git a/src/sfntfont.c b/src/sfntfont.c
index 607ab30afd..9ab76a3082 100644
--- a/src/sfntfont.c
+++ b/src/sfntfont.c
@@ -1457,7 +1457,7 @@ sfntfont_dereference_outline (struct sfnt_glyph_outline
*outline)
LOCA_LONG and LOCA_SHORT, whichever is set.
If INTERPRETER is non-NULL, then possibly use the unscaled glyph
- metrics in METRICS when instructing the glyph.
+ metrics in METRICS and the interpreter STATE to instruct the glyph.
Return the outline with an incremented reference count and enter
the generated outline into CACHE upon success, possibly discarding
@@ -1472,7 +1472,8 @@ sfntfont_get_glyph_outline (sfnt_glyph glyph_code,
struct sfnt_loca_table_short *loca_short,
struct sfnt_loca_table_long *loca_long,
struct sfnt_interpreter *interpreter,
- struct sfnt_glyph_metrics *metrics)
+ struct sfnt_glyph_metrics *metrics,
+ struct sfnt_graphics_state *state)
{
struct sfnt_outline_cache *start;
struct sfnt_glyph_outline *outline;
@@ -1518,6 +1519,10 @@ sfntfont_get_glyph_outline (sfnt_glyph glyph_code,
if (interpreter && glyph->simple)
{
+ /* Restore the interpreter state from the snapshot taken after
+ loading the preprogram. */
+ interpreter->state = *state;
+
error = sfnt_interpret_simple_glyph (glyph, interpreter,
metrics, &value);
@@ -2269,7 +2274,8 @@ sfntfont_measure_instructed_pcm (struct sfnt_font_info
*font, sfnt_glyph glyph,
font->glyf, font->head,
font->loca_short,
font->loca_long,
- font->interpreter, &metrics);
+ font->interpreter, &metrics,
+ &font->state);
if (!outline)
return 1;
@@ -2316,7 +2322,8 @@ sfntfont_measure_pcm (struct sfnt_font_info *font,
sfnt_glyph glyph,
&font->outline_cache_size,
font->glyf, font->head,
font->loca_short,
- font->loca_long, NULL, NULL);
+ font->loca_long, NULL, NULL,
+ NULL);
if (!outline)
return 1;
@@ -2465,7 +2472,8 @@ sfntfont_draw (struct glyph_string *s, int from, int to,
info->loca_short,
info->loca_long,
info->interpreter,
- &metrics);
+ &metrics,
+ &info->state);
x_coords[i - from] = 0;
if (!outline)
- feature/android updated (bd55cca4b8 -> c201043b4b), Po Lu, 2023/02/08
- feature/android 7fb0df0ce2 3/7: Fix graphics state when instructing glyphs,
Po Lu <=
- feature/android ad3def330c 2/7: Correctly round bearing values while computing pcm, Po Lu, 2023/02/08
- feature/android 6de4deb47e 6/7: Update Android port, Po Lu, 2023/02/08
- feature/android c201043b4b 7/7: Update Android port, Po Lu, 2023/02/08
- feature/android 1a70941c8e 1/7: Improve text display on Android port, Po Lu, 2023/02/08
- feature/android 0bd4b7fdab 4/7: Update Android port, Po Lu, 2023/02/08
- feature/android 2c5e36e00b 5/7: Merge remote-tracking branch 'origin/master' into feature/android, Po Lu, 2023/02/08