Henri Verbeet : usp10: Replace zero-width glyphs with 0x20 when psa-> fNoGlyphIndex is set in ScriptShapeOpenType().
Alexandre Julliard
julliard at winehq.org
Mon Jun 13 11:11:31 CDT 2016
Module: wine
Branch: master
Commit: 5098bddf90033fdbfd82e9d3c55a9dd63505eba9
URL: http://source.winehq.org/git/wine.git/?a=commit;h=5098bddf90033fdbfd82e9d3c55a9dd63505eba9
Author: Henri Verbeet <hverbeet at codeweavers.com>
Date: Fri Jun 10 00:44:39 2016 +0200
usp10: Replace zero-width glyphs with 0x20 when psa->fNoGlyphIndex is set in ScriptShapeOpenType().
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Aric Stewart <aric at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/usp10/tests/usp10.c | 21 ++++++++++++++++-----
dlls/usp10/usp10.c | 14 +++++++++++++-
2 files changed, 29 insertions(+), 6 deletions(-)
diff --git a/dlls/usp10/tests/usp10.c b/dlls/usp10/tests/usp10.c
index d68b515..bb044ce 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 7038e8c..f5eba8d 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)
More information about the wine-cvs
mailing list