Merge branch 'issue-390-workaround' into 'master'

Draft: Account for rounding when subpixel positioning

See merge request cairo/cairo!485
This commit is contained in:
Emmanuele Bassi 2026-02-09 05:02:19 +00:00
commit 4e8be5a940

View file

@ -2231,6 +2231,11 @@ _cairo_scaled_font_single_glyph_device_extents (cairo_scaled_font_t *scaled_fon
box.p2.y = v + scaled_glyph->bbox.p2.y;
_cairo_box_round_to_rectangle (&box, extents);
/* Modify the extents to account for the rounding */
extents->y -= 1;
extents->width += 1;
extents->height += 1;
}
_cairo_scaled_font_thaw_cache (scaled_font);
return status;
@ -2317,6 +2322,11 @@ _cairo_scaled_font_glyph_device_extents (cairo_scaled_font_t *scaled_font,
if (box.p1.x < box.p2.x) {
_cairo_box_round_to_rectangle (&box, extents);
/* Modify the extents to account for the rounding */
extents->y -= 1;
extents->width += 1;
extents->height += 1;
} else {
extents->x = extents->y = 0;
extents->width = extents->height = 0;