summaryrefslogtreecommitdiffstats
path: root/gfx/cairo/dwrite-glyph-extents.patch
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /gfx/cairo/dwrite-glyph-extents.patch
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'gfx/cairo/dwrite-glyph-extents.patch')
-rw-r--r--gfx/cairo/dwrite-glyph-extents.patch44
1 files changed, 44 insertions, 0 deletions
diff --git a/gfx/cairo/dwrite-glyph-extents.patch b/gfx/cairo/dwrite-glyph-extents.patch
new file mode 100644
index 000000000..d3625e198
--- /dev/null
+++ b/gfx/cairo/dwrite-glyph-extents.patch
@@ -0,0 +1,44 @@
+diff --git a/gfx/cairo/cairo/src/cairo-dwrite-font.cpp b/gfx/cairo/cairo/src/cairo-dwrite-font.cpp
+--- a/gfx/cairo/cairo/src/cairo-dwrite-font.cpp
++++ b/gfx/cairo/cairo/src/cairo-dwrite-font.cpp
+@@ -582,22 +582,37 @@ _cairo_dwrite_scaled_font_init_glyph_met
+ DWRITE_FONT_METRICS fontMetrics;
+ font_face->dwriteface->GetMetrics(&fontMetrics);
+ HRESULT hr = font_face->dwriteface->GetDesignGlyphMetrics(&charIndex, 1, &metrics);
+ if (FAILED(hr)) {
+ return CAIRO_INT_STATUS_UNSUPPORTED;
+ }
+
+ // TODO: Treat swap_xy.
+- extents.width = (FLOAT)(metrics.advanceWidth - metrics.leftSideBearing - metrics.rightSideBearing) / fontMetrics.designUnitsPerEm;
+- extents.height = (FLOAT)(metrics.advanceHeight - metrics.topSideBearing - metrics.bottomSideBearing) / fontMetrics.designUnitsPerEm;
++ extents.width = (FLOAT)(metrics.advanceWidth - metrics.leftSideBearing - metrics.rightSideBearing) /
++ fontMetrics.designUnitsPerEm;
++ extents.height = (FLOAT)(metrics.advanceHeight - metrics.topSideBearing - metrics.bottomSideBearing) /
++ fontMetrics.designUnitsPerEm;
+ extents.x_advance = (FLOAT)metrics.advanceWidth / fontMetrics.designUnitsPerEm;
+ extents.x_bearing = (FLOAT)metrics.leftSideBearing / fontMetrics.designUnitsPerEm;
+ extents.y_advance = 0.0;
+- extents.y_bearing = (FLOAT)(metrics.topSideBearing - metrics.verticalOriginY) / fontMetrics.designUnitsPerEm;
++ extents.y_bearing = (FLOAT)(metrics.topSideBearing - metrics.verticalOriginY) /
++ fontMetrics.designUnitsPerEm;
++
++ // 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;
++ extents.height += scaled_font->mat_inverse.yy * 2;
++ extents.y_bearing -= scaled_font->mat_inverse.yy;
++ }
++
+ _cairo_scaled_glyph_set_metrics (scaled_glyph,
+ &scaled_font->base,
+ &extents);
+ return CAIRO_INT_STATUS_SUCCESS;
+ }
+
+ /**
+ * Stack-based helper implementing IDWriteGeometrySink.