diff --git a/dlls/usp10/tests/usp10.c b/dlls/usp10/tests/usp10.c index d68b515a372..bb044ce635f 100644 --- a/dlls/usp10/tests/usp10.c +++ b/dlls/usp10/tests/usp10.c @@ -1696,7 +1696,8 @@ static void test_ScriptShape(HDC hdc) for (i = 0; i < 2; i++) { static const WCHAR space[] = {' ', 0}; - static const WCHAR blanks[] = {'\t', '\r', '\n', 0x001c, 0x001d, 0x001e, 0x001f, 0x200e, 0x200f, /* LRM, RLM */ + static const WCHAR blanks[] = {'\t', '\r', '\n', 0x001c, 0x001d, 0x001e, 0x001f, + 0x200b, 0x200c, 0x200d, 0x200e, 0x200f, /* ZWSP, ZWNJ, ZWJ, LRM, RLM */ 0x202a, 0x202b, 0x202c, 0x202d, 0x202e, 0}; /* LRE, RLE, PDF, LRO, RLO */ HFONT font, oldfont = NULL; LOGFONTA lf; @@ -1740,10 +1741,20 @@ static void test_ScriptShape(HDC hdc) ok(hr == S_OK, "%s: [%02x] expected S_OK, got %08x\n", lf.lfFaceName, blanks[j], hr); ok(nb == 1, "%s: [%02x] expected 1, got %d\n", lf.lfFaceName, blanks[j], nb); - ok(glyphs2[0] == blanks[j], - "%s: [%02x] got unexpected %04x.\n", lf.lfFaceName, blanks[j], glyphs2[0]); - ok(!attrs[0].fZeroWidth, "%s: [%02x] got unexpected fZeroWidth %#x.\n", - lf.lfFaceName, blanks[j], attrs[0].fZeroWidth); + if (blanks[j] == 0x200b || blanks[j] == 0x200c || blanks[j] == 0x200d) + { + ok(glyphs2[0] == 0x0020, + "%s: [%02x] got unexpected %04x.\n", lf.lfFaceName, blanks[j], glyphs2[0]); + ok(attrs[0].fZeroWidth, "%s: [%02x] got unexpected fZeroWidth %#x.\n", + lf.lfFaceName, blanks[j], attrs[0].fZeroWidth); + } + else + { + ok(glyphs2[0] == blanks[j], + "%s: [%02x] got unexpected %04x.\n", lf.lfFaceName, blanks[j], glyphs2[0]); + ok(!attrs[0].fZeroWidth, "%s: [%02x] got unexpected fZeroWidth %#x.\n", + lf.lfFaceName, blanks[j], attrs[0].fZeroWidth); + } } if (oldfont) DeleteObject(SelectObject(hdc, oldfont)); diff --git a/dlls/usp10/usp10.c b/dlls/usp10/usp10.c index 7038e8c1acd..f5eba8d67eb 100644 --- a/dlls/usp10/usp10.c +++ b/dlls/usp10/usp10.c @@ -1266,6 +1266,7 @@ static HRESULT _ItemizeInternal(const WCHAR *pwcInChars, int cInChars, { #define Numeric_space 0x0020 +#define ZWSP 0x200B #define ZWNJ 0x200C #define ZWJ 0x200D @@ -3176,8 +3177,19 @@ HRESULT WINAPI ScriptShapeOpenType( HDC hdc, SCRIPT_CACHE *psc, if (rtl) idx = cChars - 1 - i; pwOutGlyphs[i] = pwcChars[idx]; + if (!psa) + continue; + /* overwrite some basic control glyphs to blank */ - if (psa && !psa->fNoGlyphIndex && psa->eScript == Script_Control) + if (psa->fNoGlyphIndex) + { + if (pwcChars[idx] == ZWSP || pwcChars[idx] == ZWNJ || pwcChars[idx] == ZWJ) + { + pwOutGlyphs[i] = 0x20; + pOutGlyphProps[i].sva.fZeroWidth = 1; + } + } + else if (psa->eScript == Script_Control) { if (pwcChars[idx] == 0x0009 || pwcChars[idx] == 0x000A || pwcChars[idx] == 0x000D || pwcChars[idx] >= 0x001C)