2 commits - src/win32

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Jul 14 14:41:43 UTC 2025


 src/win32/cairo-win32-surface.c |    9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

New commits:
commit 6ac5348308b283e2cf54ef6b38bad28ca0a72af9
Merge: 2f21b3874 503505666
Author: Emmanuele Bassi <ebassi at gmail.com>
Date:   Mon Jul 14 14:41:40 2025 +0000

    The GDI coordinate system is inverted compared to cairo's here, so the
    delta-y value needs to be negated, otherwise glyph runs with non-zero
    y-advances will shift in the wrong direction.
    
    See mozilla bug https://bugzilla.mozilla.org/show_bug.cgi?id=1962816 and
    earlier https://bugzilla.mozilla.org/show_bug.cgi?id=454098 where this was
    first discovered & fixed, but unfortunately was not upstreamed at that
    time.

commit 503505666f9a322b23f1d53f9dafed0083c9eb7a
Author: Jonathan Kew <jfkthame at googlemail.com>
Date:   Mon Jul 14 14:41:40 2025 +0000

    Fix sign of delta-y for ExtTextOutW

diff --git a/src/win32/cairo-win32-surface.c b/src/win32/cairo-win32-surface.c
index e1ac51558..488690e90 100644
--- a/src/win32/cairo-win32-surface.c
+++ b/src/win32/cairo-win32-surface.c
@@ -263,7 +263,14 @@ _cairo_win32_surface_emit_glyphs (cairo_win32_surface_t *dst,
             next_logical_y = _cairo_lround (next_user_y);
 
             dxy_buf[j] = _cairo_lround (next_logical_x - logical_x);
-            dxy_buf[j+1] = _cairo_lround (next_logical_y - logical_y);
+            /* When delta-y values are present in dxy_buf (the ETO_PDY flag is used), these
+             * represent "displacement along the vertical direction of the font" (per MSDN:
+             * https://learn.microsoft.com/en-us/windows/win32/api/wingdi/nf-wingdi-exttextoutw)
+             * with positive values being upward (observed behavior, not explicitly documented).
+             * This is the opposite of the top-to-bottom logical coordinate space used here,
+             * so the subtraction is reversed compared to what would otherwise be expected.
+             */
+            dxy_buf[j+1] = _cairo_lround (logical_y - next_logical_y);
 
             logical_x = next_logical_x;
             logical_y = next_logical_y;


More information about the cairo-commit mailing list