[ot-font] Conditionalize emboldening

This commit is contained in:
Behdad Esfahbod 2023-02-01 17:09:29 -07:00
parent 36dcc9a432
commit b087266e51
1 changed files with 8 additions and 6 deletions

View File

@ -463,12 +463,12 @@ hb_ot_draw_glyph (hb_font_t *font,
hb_draw_funcs_t *draw_funcs, void *draw_data,
void *user_data)
{
bool embolden = font->x_shift || font->y_shift;
hb_outline_t outline;
auto *pen = hb_outline_recording_pen_get_funcs ();
{ // Need draw_session to be destructed before emboldening.
hb_draw_session_t draw_session (pen, &outline, font->slant_xy);
hb_draw_session_t draw_session (embolden ? hb_outline_recording_pen_get_funcs () : draw_funcs,
embolden ? &outline : draw_data, 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))
@ -477,9 +477,11 @@ hb_ot_draw_glyph (hb_font_t *font,
{}
}
outline.embolden (font->x_shift, font->y_shift);
outline.replay (draw_funcs, draw_data);
if (embolden)
{
outline.embolden (font->x_shift, font->y_shift);
outline.replay (draw_funcs, draw_data);
}
}
#endif