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

Commit 7433d16

Browse files
author
Fraser J. Gordon
committed
Some fixes for Win32 RTL rendering
1 parent 30d4243 commit 7433d16

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

engine/src/font.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,8 @@ void MCFontBreakText(MCFontRef p_font, MCStringRef p_text, MCRange p_range, MCFo
326326
t_range = MCRangeMake(t_end - t_offset - t_break_point, t_break_point);
327327
else
328328
t_range = MCRangeMake(t_offset, t_break_point);
329-
329+
330+
#if !defined(_WIN32)
330331
// This is a really ugly hack to get LTR/RTL overrides working correctly -
331332
// ATSUI and Pango think they know better than us and won't let us suppress
332333
// the BiDi algorithm they uses for text layout. So instead, we need to add
@@ -343,6 +344,9 @@ void MCFontBreakText(MCFontRef p_font, MCStringRef p_text, MCRange p_range, MCFo
343344
/* UNCHECKED */ MCStringAppendChar(*t_temp, 0x202C);
344345

345346
p_callback(p_font, *t_temp, MCRangeMake(0, MCStringGetLength(*t_temp)), p_callback_data);
347+
#else
348+
p_callback(p_font, p_text, t_range, p_callback_data);
349+
#endif
346350

347351
// Explicitly show breaking points
348352
//p_callback(p_font, MCSTR("|"), MCRangeMake(0, 1), p_callback_data);

libgraphics/src/w32text.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ static bool w32_draw_text_to_context_at_device_location(MCGContextRef p_context,
359359
SetTextColor(p_gdicontext, 0x00000000);
360360
SetBkColor(p_gdicontext, 0x00FFFFFF);
361361
SetBkMode(p_gdicontext, OPAQUE);
362-
t_success = TextOutW(p_gdicontext, 0, 0, (LPCWSTR)p_text, p_length >> 1);
362+
t_success = ExtTextOutW(p_gdicontext, 0, 0, false ? ETO_RTLREADING : 0, NULL, (LPCWSTR)p_text, p_length >> 1, NULL);
363363
}
364364

365365
if (t_success)
@@ -459,7 +459,7 @@ static bool w32_draw_opaque_text_to_context_at_device_location(MCGContextRef p_c
459459

460460
SetBkMode(p_gdicontext, TRANSPARENT);
461461
SetTextColor(p_gdicontext, RGB((p_context -> state -> fill_color >> 16) & 0xFF, (p_context -> state -> fill_color >> 8) & 0xFF, (p_context -> state -> fill_color >> 0) & 0xFF));
462-
t_success = TextOutW(p_gdicontext, 0, 0, (LPCWSTR)p_text, p_length >> 1);
462+
t_success = ExtTextOutW(p_gdicontext, 0, 0, false ? ETO_RTLREADING : 0, NULL, (LPCWSTR)p_text, p_length >> 1, NULL);
463463
}
464464

465465
if (t_success)

0 commit comments

Comments
 (0)