Commit 37040729 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

dwrite: Mirror characters in case of RTL direction.

parent 1843972e
......@@ -11,6 +11,7 @@ C_SRCS = \
layout.c \
linebreak.c \
main.c \
mirror.c \
opentype.c \
scripts.c \
shape.c
......@@ -897,8 +897,7 @@ static HRESULT WINAPI dwritetextanalyzer_GetGlyphs(IDWriteTextAnalyzer2 *iface,
if (!update_cluster) {
codepoint = decode_surrogate_pair(text, i, length);
if (!codepoint) {
/* FIXME: mirror in RTL case */
codepoint = text[i];
codepoint = is_rtl ? bidi_get_mirrored_char(text[i]) : text[i];
string[i] = codepoint;
}
else {
......
......@@ -198,6 +198,12 @@ static void bidi_classify(const WCHAR *string, UINT8 *chartype, UINT32 count)
}
}
WCHAR bidi_get_mirrored_char(WCHAR ch)
{
extern const WCHAR wine_mirror_map[];
return ch + wine_mirror_map[wine_mirror_map[ch >> 8] + (ch & 0xff)];
}
/* RESOLVE EXPLICIT */
static inline UINT8 get_greater_even_level(UINT8 level)
......
......@@ -112,6 +112,7 @@ extern VOID OpenType_CMAP_GetGlyphIndex(LPVOID data, DWORD utf32c, LPWORD pgi, D
extern VOID get_font_properties(LPCVOID os2, LPCVOID head, LPCVOID post, DWRITE_FONT_METRICS *metrics, DWRITE_FONT_STRETCH *stretch, DWRITE_FONT_WEIGHT *weight, DWRITE_FONT_STYLE *style) DECLSPEC_HIDDEN;
extern HRESULT bidi_computelevels(const WCHAR*,UINT32,UINT8,UINT8*,UINT8*);
extern WCHAR bidi_get_mirrored_char(WCHAR);
/* Glyph shaping */
enum SCRIPT_JUSTIFY
......
......@@ -1149,6 +1149,21 @@ static void test_GetGlyphs(void)
ok(actual_count == 4, "got %d\n", actual_count);
ok(glyphs1[2] != glyphs2[2], "got %d\n", glyphs1[2]);
/* check that mirroring works */
maxglyphcount = 10;
actual_count = 0;
hr = IDWriteTextAnalyzer_GetGlyphs(analyzer, test1W, lstrlenW(test1W), fontface, FALSE, FALSE, &sa, NULL,
NULL, NULL, NULL, 0, maxglyphcount, clustermap, props, glyphs1, shapingprops, &actual_count);
ok(hr == S_OK, "got 0x%08x\n", hr);
ok(actual_count == 4, "got %d\n", actual_count);
actual_count = 0;
hr = IDWriteTextAnalyzer_GetGlyphs(analyzer, test1W, lstrlenW(test1W), fontface, FALSE, TRUE, &sa, NULL,
NULL, NULL, NULL, 0, maxglyphcount, clustermap, props, glyphs2, shapingprops, &actual_count);
ok(hr == S_OK, "got 0x%08x\n", hr);
ok(actual_count == 4, "got %d\n", actual_count);
ok(glyphs1[0] != glyphs2[0], "got %d\n", glyphs1[0]);
IDWriteTextAnalyzer_Release(analyzer);
IDWriteFontFace_Release(fontface);
}
......
......@@ -2383,6 +2383,7 @@ DUMP_SORTKEYS( "libs/wine/collation.c", READ_SORTKEYS_FILE() );
DUMP_COMPOSE_TABLES( "libs/wine/compose.c" );
DUMP_CTYPE_TABLES( "libs/wine/wctype.c" );
dump_mirroring( "dlls/usp10/mirror.c" );
dump_mirroring( "dlls/dwrite/mirror.c" );
dump_bracket( "dlls/usp10/bracket.c" );
dump_bracket( "dlls/dwrite/bracket.c" );
dump_shaping( "dlls/usp10/shaping.c" );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment