mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-05-08 02:08:03 +02:00
DWrite: Inflate glyph bounds 1px vertically too
The most top and bottom lines of glyphs were clipped in some fonts and conditions. The glyph bounds were inflated 1px horizontally. It should inflate vertically too. Fixes cairo/cairo#569
This commit is contained in:
parent
83db2efe0a
commit
5ae029c2cc
1 changed files with 9 additions and 4 deletions
|
|
@ -716,10 +716,15 @@ _cairo_dwrite_scaled_font_init_glyph_metrics(cairo_dwrite_scaled_font_t *scaled_
|
|||
// We pad the extents here because GetDesignGlyphMetrics returns "ideal" metrics
|
||||
// for the glyph outline, without accounting for hinting/gridfitting/antialiasing,
|
||||
// and therefore it does not always cover all pixels that will actually be touched.
|
||||
if (scaled_font->base.options.antialias != CAIRO_ANTIALIAS_NONE &&
|
||||
extents.width > 0 && extents.height > 0) {
|
||||
extents.width += scaled_font->mat_inverse.xx * 2;
|
||||
extents.x_bearing -= scaled_font->mat_inverse.xx;
|
||||
if (extents.width > 0 && extents.height > 0) {
|
||||
double x = 1, y = 1;
|
||||
cairo_matrix_transform_distance (&scaled_font->mat_inverse, &x, &y);
|
||||
x = fabs(x);
|
||||
y = fabs(y);
|
||||
extents.width += x * 2;
|
||||
extents.x_bearing -= x;
|
||||
extents.height += y * 2;
|
||||
extents.y_bearing -= y;
|
||||
}
|
||||
|
||||
_cairo_scaled_glyph_set_metrics (scaled_glyph,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue