From 36dcc9a4327f824ccaa5751412707731504e1023 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Wed, 1 Feb 2023 17:06:15 -0700 Subject: [PATCH] [ot-font] Fix emboldening CFF --- src/hb-ot-font.cc | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/hb-ot-font.cc b/src/hb-ot-font.cc index 6b188ee9e..341b4fbe1 100644 --- a/src/hb-ot-font.cc +++ b/src/hb-ot-font.cc @@ -467,13 +467,15 @@ hb_ot_draw_glyph (hb_font_t *font, hb_outline_t outline; auto *pen = hb_outline_recording_pen_get_funcs (); - hb_draw_session_t draw_session (pen, &outline, font->slant_xy); - if (!font->face->table.glyf->get_path (font, glyph, draw_session)) + { // Need draw_session to be destructed before emboldening. + hb_draw_session_t draw_session (pen, &outline, font->slant_xy); + if (!font->face->table.glyf->get_path (font, glyph, draw_session)) #ifndef HB_NO_CFF - if (!font->face->table.cff1->get_path (font, glyph, draw_session)) - if (!font->face->table.cff2->get_path (font, glyph, draw_session)) + if (!font->face->table.cff1->get_path (font, glyph, draw_session)) + if (!font->face->table.cff2->get_path (font, glyph, draw_session)) #endif - {} + {} + } outline.embolden (font->x_shift, font->y_shift); outline.replay (draw_funcs, draw_data);