usp10: Fix ScriptGetCMap handling of unsupported glyphs.
This commit is contained in:
parent
6478e41b97
commit
abae85b976
|
@ -583,10 +583,12 @@ static void test_ScriptGetCMap(HDC hdc, unsigned short pwOutGlyphs[256])
|
||||||
int cInChars;
|
int cInChars;
|
||||||
int cChars;
|
int cChars;
|
||||||
unsigned short pwOutGlyphs3[256];
|
unsigned short pwOutGlyphs3[256];
|
||||||
WCHAR TestItem1[] = {'T', 'e', 's', 't', 'a', 0};
|
|
||||||
DWORD dwFlags;
|
DWORD dwFlags;
|
||||||
int cnt;
|
int cnt;
|
||||||
|
|
||||||
|
static const WCHAR TestItem1[] = {'T', 'e', 's', 't', 'a', 0};
|
||||||
|
static const WCHAR TestItem2[] = {0x202B, 'i', 'n', 0x202C,0};
|
||||||
|
|
||||||
/* Check to make sure that SCRIPT_CACHE gets allocated ok */
|
/* Check to make sure that SCRIPT_CACHE gets allocated ok */
|
||||||
dwFlags = 0;
|
dwFlags = 0;
|
||||||
cInChars = cChars = 5;
|
cInChars = cChars = 5;
|
||||||
|
@ -627,10 +629,19 @@ static void test_ScriptGetCMap(HDC hdc, unsigned short pwOutGlyphs[256])
|
||||||
for (cnt=0; cnt < cChars && pwOutGlyphs[cnt] == pwOutGlyphs3[cnt]; cnt++) {}
|
for (cnt=0; cnt < cChars && pwOutGlyphs[cnt] == pwOutGlyphs3[cnt]; cnt++) {}
|
||||||
ok (cnt == cInChars, "Translation not correct. WCHAR %d - %04x != %04x\n",
|
ok (cnt == cInChars, "Translation not correct. WCHAR %d - %04x != %04x\n",
|
||||||
cnt, pwOutGlyphs[cnt], pwOutGlyphs3[cnt]);
|
cnt, pwOutGlyphs[cnt], pwOutGlyphs3[cnt]);
|
||||||
|
|
||||||
hr = ScriptFreeCache( &psc);
|
hr = ScriptFreeCache( &psc);
|
||||||
ok (!psc, "psc is not null after ScriptFreeCache\n");
|
ok (!psc, "psc is not null after ScriptFreeCache\n");
|
||||||
|
|
||||||
|
cInChars = cChars = 4;
|
||||||
|
hr = ScriptGetCMap(hdc, &psc, TestItem2, cInChars, dwFlags, pwOutGlyphs3);
|
||||||
|
ok (hr == S_FALSE, "ScriptGetCMap should return S_FALSE not (%08x)\n", hr);
|
||||||
|
ok (psc != NULL, "psc should not be null and have SCRIPT_CACHE buffer address\n");
|
||||||
|
ok(pwOutGlyphs3[0] == 0, "Glyph 0 should be default glyph\n");
|
||||||
|
ok(pwOutGlyphs3[3] == 0, "Glyph 0 should be default glyph\n");
|
||||||
|
|
||||||
|
hr = ScriptFreeCache( &psc);
|
||||||
|
ok (!psc, "psc is not null after ScriptFreeCache\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void test_ScriptGetFontProperties(HDC hdc)
|
static void test_ScriptGetFontProperties(HDC hdc)
|
||||||
|
|
|
@ -1528,6 +1528,8 @@ HRESULT WINAPI ScriptGetCMap(HDC hdc, SCRIPT_CACHE *psc, const WCHAR *pwcInChars
|
||||||
|
|
||||||
if ((hr = init_script_cache(hdc, psc)) != S_OK) return hr;
|
if ((hr = init_script_cache(hdc, psc)) != S_OK) return hr;
|
||||||
|
|
||||||
|
hr = S_OK;
|
||||||
|
|
||||||
if ((get_cache_pitch_family(psc) & TMPF_TRUETYPE))
|
if ((get_cache_pitch_family(psc) & TMPF_TRUETYPE))
|
||||||
{
|
{
|
||||||
for (i = 0; i < cChars; i++)
|
for (i = 0; i < cChars; i++)
|
||||||
|
@ -1537,6 +1539,11 @@ HRESULT WINAPI ScriptGetCMap(HDC hdc, SCRIPT_CACHE *psc, const WCHAR *pwcInChars
|
||||||
WORD glyph;
|
WORD glyph;
|
||||||
if (!hdc) return E_PENDING;
|
if (!hdc) return E_PENDING;
|
||||||
if (GetGlyphIndicesW(hdc, &pwcInChars[i], 1, &glyph, GGI_MARK_NONEXISTING_GLYPHS) == GDI_ERROR) return S_FALSE;
|
if (GetGlyphIndicesW(hdc, &pwcInChars[i], 1, &glyph, GGI_MARK_NONEXISTING_GLYPHS) == GDI_ERROR) return S_FALSE;
|
||||||
|
if (glyph == 0xffff)
|
||||||
|
{
|
||||||
|
hr = S_FALSE;
|
||||||
|
glyph = 0x0;
|
||||||
|
}
|
||||||
pwOutGlyphs[i] = set_cache_glyph(psc, pwcInChars[i], glyph);
|
pwOutGlyphs[i] = set_cache_glyph(psc, pwcInChars[i], glyph);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1546,7 +1553,7 @@ HRESULT WINAPI ScriptGetCMap(HDC hdc, SCRIPT_CACHE *psc, const WCHAR *pwcInChars
|
||||||
TRACE("no glyph translation\n");
|
TRACE("no glyph translation\n");
|
||||||
for (i = 0; i < cChars; i++) pwOutGlyphs[i] = pwcInChars[i];
|
for (i = 0; i < cChars; i++) pwOutGlyphs[i] = pwcInChars[i];
|
||||||
}
|
}
|
||||||
return S_OK;
|
return hr;
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
|
|
Loading…
Reference in New Issue