[hb-view] Set glyph extents in render_color_glyph

Works around limitation in cairo-recording-surface unboundedness.

Extents are wrong but at least renders something now.
This commit is contained in:
Behdad Esfahbod 2022-12-18 11:08:25 -07:00
parent 6cadf280f2
commit 95ccd66481
1 changed files with 7 additions and 0 deletions

View File

@ -363,6 +363,13 @@ render_color_glyph (cairo_scaled_font_t *scaled_font,
hb_font_paint_glyph (font, glyph, get_cairo_paint_funcs (), (void *)&paint_data);
hb_glyph_extents_t hb_extents;
hb_font_get_glyph_extents (font, glyph, &hb_extents);
extents->x_bearing = (double) hb_extents.x_bearing / x_scale;
extents->y_bearing = (double) hb_extents.y_bearing / y_scale;
extents->width = (double) hb_extents.width / x_scale;
extents->height = (double) hb_extents.height / y_scale;
hb_font_destroy (paint_data.unscaled_font);
return CAIRO_STATUS_SUCCESS;