Bug 1962816 - Invert sign of delta-y when computing glyph advances for ExtTextOutW, because the GDI coordinate system is inverted. a=pascalc

We used to have a sign-inversion like this in our cairo backend code:

https://searchfox.org/mozilla-central/rev/0b6a214452a91745638b03d71da86ebe45e34efe/gfx/cairo/cairo/src/cairo-win32-surface.c#1892-1893

This was previously fixed (by me!) back in bug 454098, but in the
process of updating cairo the change got lost as the code had moved
around and so our old patch file no longer applied.

(I'll see if I can get the standalone test program from that bug
working again, and file the issue upstream.)

Original Revision: https://phabricator.services.mozilla.com/D254737

Differential Revision: https://phabricator.services.mozilla.com/D254931
This commit is contained in:
Jonathan Kew
2025-06-25 07:54:18 +00:00
committed by pchevrel@mozilla.com
parent b9c7030592
commit 35cb581b72
3 changed files with 17 additions and 1 deletions

View File

@@ -0,0 +1,13 @@
diff --git a/gfx/cairo/cairo/src/win32/cairo-win32-surface.c b/gfx/cairo/cairo/src/win32/cairo-win32-surface.c
--- a/gfx/cairo/cairo/src/win32/cairo-win32-surface.c
+++ b/gfx/cairo/cairo/src/win32/cairo-win32-surface.c
@@ -347,7 +347,8 @@ cairo_int_status_t
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);
+ /* Note that GDI coordinate system is inverted! */
+ dxy_buf[j+1] = _cairo_lround (logical_y - next_logical_y);
logical_x = next_logical_x;
logical_y = next_logical_y;

View File

@@ -52,6 +52,8 @@ cff-font-creation.patch: make cairo_cff_font_t allocation consistent
27-windows-sdk-26100.patch: fix build bustage with Windows SDK 26100
28-win32-vertical-glyph-advance-direction.patch: fix sign of glyph y-advance for ExtTextOut
==== pixman patches ====
pixman-armasm.patch: add an ifdef guard around pixman-config.h include

View File

@@ -347,7 +347,8 @@ _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);
/* Note that GDI coordinate system is inverted! */
dxy_buf[j+1] = _cairo_lround (logical_y - next_logical_y);
logical_x = next_logical_x;
logical_y = next_logical_y;