summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian Johnson <ajohnson@redneon.com>2023-02-20 22:07:16 +0000
committerAdrian Johnson <ajohnson@redneon.com>2023-02-20 22:07:16 +0000
commit6a5f2140d78f1ccff8642c33eac3b0a8b86a5723 (patch)
tree52829347f90166bfa2911354f8986ee752056641
parent7a8aa5eb97215810f408f0d29334c1a9abf1945a (diff)
parent5ae029c2ccc92cb72bb4b23510dc819a0c364a33 (diff)
downloadcairo-6a5f2140d78f1ccff8642c33eac3b0a8b86a5723.tar.gz
Merge branch 'issue-569-dwrite-inflate-glyph-bounds' into 'master'
DWrite: Inflate glyph bounds 1px vertically too Closes #569 See merge request cairo/cairo!461
-rw-r--r--src/win32/cairo-dwrite-font.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/win32/cairo-dwrite-font.cpp b/src/win32/cairo-dwrite-font.cpp
index 438bfb15d..33c976e08 100644
--- a/src/win32/cairo-dwrite-font.cpp
+++ b/src/win32/cairo-dwrite-font.cpp
@@ -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,