Skip to content
This repository was archived by the owner on Aug 31, 2021. It is now read-only.

Commit 42352a6

Browse files
committed
[[ Bug 17782 ]] configure gdi to draw text relative to the baseline, remove compensating transform adjustment
1 parent f1b3eb4 commit 42352a6

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

libgraphics/src/w32text.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,8 @@ static void w32_draw_text_render_transparent_buffer(HDC p_gdi_context, const uni
8989
// The text color is the inverse of what the RGB buffer has been set to.
9090
SetTextColor(p_gdi_context, p_nearest_white ? RGB(0xff, 0xff, 0xff) : RGB(0x00, 0x00, 0x00));
9191

92+
SetTextAlign(p_gdi_context, TA_BASELINE | TA_LEFT | TA_NOUPDATECP);
93+
9294
// Render the text.
9395
ExtTextOutW(p_gdi_context, 0, 0, p_rtl ? ETO_RTLREADING : 0, NULL, (LPCWSTR)p_text, p_text_length, NULL);
9496

@@ -148,6 +150,8 @@ static void w32_draw_text_render_opaque_buffer(HDC p_gdi_context, const unichar_
148150
// The text color is the fill color.
149151
SetTextColor(p_gdi_context, RGB((p_fill_color >> 16) & 0xFF, (p_fill_color >> 8) & 0xFF, (p_fill_color >> 0) & 0xFF));
150152

153+
SetTextAlign(p_gdi_context, TA_BASELINE | TA_LEFT | TA_NOUPDATECP);
154+
151155
// Render the text.
152156
ExtTextOutW(p_gdi_context, 0, 0, p_rtl ? ETO_RTLREADING : 0, NULL, (LPCWSTR)p_text, p_text_length, NULL);
153157

@@ -437,7 +441,7 @@ static void __MCGContextDrawPlatformTextScreen(MCGContextRef self, const unichar
437441
t_xform . eM21 = t_transform . c;
438442
t_xform . eM22 = t_transform . d;
439443
t_xform . eDx = t_transform . tx - (t_clipped_bounds . x);
440-
t_xform . eDy = t_transform . ty - (t_clipped_bounds . y - t_text_bounds . y);
444+
t_xform . eDy = t_transform . ty - (t_clipped_bounds . y);
441445
t_success = SetWorldTransform(s_draw_dc, &t_xform);
442446
}
443447

0 commit comments

Comments
 (0)