aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPo Lu2023-02-08 20:03:19 +0800
committerPo Lu2023-02-08 20:03:19 +0800
commit7fb0df0ce2858eeb03ec18b540acf49a5b8d90c9 (patch)
treec8ff7878b6a6b680fdef03031a858f99879dc9ca /src
parentad3def330cd0696c832f338dcf8b913e0d8e2b35 (diff)
downloademacs-7fb0df0ce2858eeb03ec18b540acf49a5b8d90c9.tar.gz
emacs-7fb0df0ce2858eeb03ec18b540acf49a5b8d90c9.zip
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.
Diffstat (limited to 'src')
-rw-r--r--src/sfntfont.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/sfntfont.c b/src/sfntfont.c
index 607ab30afd5..9ab76a3082b 100644
--- a/src/sfntfont.c
+++ b/src/sfntfont.c
@@ -1457,7 +1457,7 @@ sfntfont_dereference_outline (struct sfnt_glyph_outline *outline)
1457 LOCA_LONG and LOCA_SHORT, whichever is set. 1457 LOCA_LONG and LOCA_SHORT, whichever is set.
1458 1458
1459 If INTERPRETER is non-NULL, then possibly use the unscaled glyph 1459 If INTERPRETER is non-NULL, then possibly use the unscaled glyph
1460 metrics in METRICS when instructing the glyph. 1460 metrics in METRICS and the interpreter STATE to instruct the glyph.
1461 1461
1462 Return the outline with an incremented reference count and enter 1462 Return the outline with an incremented reference count and enter
1463 the generated outline into CACHE upon success, possibly discarding 1463 the generated outline into CACHE upon success, possibly discarding
@@ -1472,7 +1472,8 @@ sfntfont_get_glyph_outline (sfnt_glyph glyph_code,
1472 struct sfnt_loca_table_short *loca_short, 1472 struct sfnt_loca_table_short *loca_short,
1473 struct sfnt_loca_table_long *loca_long, 1473 struct sfnt_loca_table_long *loca_long,
1474 struct sfnt_interpreter *interpreter, 1474 struct sfnt_interpreter *interpreter,
1475 struct sfnt_glyph_metrics *metrics) 1475 struct sfnt_glyph_metrics *metrics,
1476 struct sfnt_graphics_state *state)
1476{ 1477{
1477 struct sfnt_outline_cache *start; 1478 struct sfnt_outline_cache *start;
1478 struct sfnt_glyph_outline *outline; 1479 struct sfnt_glyph_outline *outline;
@@ -1518,6 +1519,10 @@ sfntfont_get_glyph_outline (sfnt_glyph glyph_code,
1518 1519
1519 if (interpreter && glyph->simple) 1520 if (interpreter && glyph->simple)
1520 { 1521 {
1522 /* Restore the interpreter state from the snapshot taken after
1523 loading the preprogram. */
1524 interpreter->state = *state;
1525
1521 error = sfnt_interpret_simple_glyph (glyph, interpreter, 1526 error = sfnt_interpret_simple_glyph (glyph, interpreter,
1522 metrics, &value); 1527 metrics, &value);
1523 1528
@@ -2269,7 +2274,8 @@ sfntfont_measure_instructed_pcm (struct sfnt_font_info *font, sfnt_glyph glyph,
2269 font->glyf, font->head, 2274 font->glyf, font->head,
2270 font->loca_short, 2275 font->loca_short,
2271 font->loca_long, 2276 font->loca_long,
2272 font->interpreter, &metrics); 2277 font->interpreter, &metrics,
2278 &font->state);
2273 2279
2274 if (!outline) 2280 if (!outline)
2275 return 1; 2281 return 1;
@@ -2316,7 +2322,8 @@ sfntfont_measure_pcm (struct sfnt_font_info *font, sfnt_glyph glyph,
2316 &font->outline_cache_size, 2322 &font->outline_cache_size,
2317 font->glyf, font->head, 2323 font->glyf, font->head,
2318 font->loca_short, 2324 font->loca_short,
2319 font->loca_long, NULL, NULL); 2325 font->loca_long, NULL, NULL,
2326 NULL);
2320 2327
2321 if (!outline) 2328 if (!outline)
2322 return 1; 2329 return 1;
@@ -2465,7 +2472,8 @@ sfntfont_draw (struct glyph_string *s, int from, int to,
2465 info->loca_short, 2472 info->loca_short,
2466 info->loca_long, 2473 info->loca_long,
2467 info->interpreter, 2474 info->interpreter,
2468 &metrics); 2475 &metrics,
2476 &info->state);
2469 x_coords[i - from] = 0; 2477 x_coords[i - from] = 0;
2470 2478
2471 if (!outline) 2479 if (!outline)