Commit 45aee637 authored by Arkadiusz Hiler's avatar Arkadiusz Hiler Committed by Alexandre Julliard

gdi32: Limit GetGlyphOutlineW(uChar) to a WORD.

parent 2ee75bf9
......@@ -2911,6 +2911,8 @@ DWORD WINAPI GetGlyphOutlineW( HDC hdc, UINT uChar, UINT fuFormat,
dc = get_dc_ptr(hdc);
if(!dc) return GDI_ERROR;
uChar &= 0xffff;
dev = GET_DC_PHYSDEV( dc, pGetGlyphOutline );
ret = dev->funcs->pGetGlyphOutline( dev, uChar, fuFormat, lpgm, cbBuffer, lpBuffer, lpmat2 );
release_dc_ptr( dc );
......
......@@ -5823,6 +5823,57 @@ todo_wine
ReleaseDC(NULL, hdc);
}
static void test_GetGlyphOutline_character(void)
{
HFONT hfont, hfont_old;
LOGFONTA lf;
HDC hdc;
DWORD ret;
GLYPHMETRICS gm1, gm2, gmn;
char test_chars[] = { 'A', 'D', '!', '\0' };
char *current_char;
memset(&lf, 0, sizeof(lf));
lf.lfHeight = 72;
lstrcpyA(lf.lfFaceName, "wine_test");
hfont = CreateFontIndirectA(&lf);
ok(hfont != 0, "CreateFontIndirectA error %u\n", GetLastError());
hdc = GetDC(NULL);
hfont_old = SelectObject(hdc, hfont);
ok(hfont_old != NULL, "SelectObject failed\n");
ret = GetGlyphOutlineW(hdc, 'Z', GGO_METRICS, &gmn, 0, NULL, &mat);
ok(ret != GDI_ERROR, "GetGlyphOutlineW failed to default to .notdef for character 'Z'\n");
for (current_char = test_chars; *current_char != '\0'; current_char++)
{
ret = GetGlyphOutlineW(hdc, *current_char, GGO_METRICS, &gm1, 0, NULL, &mat);
ok(ret != GDI_ERROR, "GetGlyphOutlineW failed for '%c'\n", *current_char);
ok(memcmp(&gm1, &gmn, sizeof(gmn)) != 0, "the test character '%c' matches .notdef\n", *current_char);
ret = GetGlyphOutlineW(hdc, 0x10000 + *current_char, GGO_METRICS, &gm2, 0, NULL, &mat);
ok(ret != GDI_ERROR, "GetGlyphOutlineW failed for 0x10000 + '%c'\n", *current_char);
ok(memcmp(&gm1, &gm2, sizeof(gmn)) == 0, "GetGlyphOutlineW returned wrong metrics for character 0x10000 + '%c'\n", *current_char);
}
ret = GetGlyphOutlineW(hdc, 0x3, GGO_METRICS|GGO_GLYPH_INDEX, &gm1, 0, NULL, &mat);
ok(ret != GDI_ERROR, "GetGlyphOutlineW failed for glyph index 0x3\n");
ret = GetGlyphOutlineW(hdc, 0xFFFF, GGO_METRICS|GGO_GLYPH_INDEX, &gm2, 0, NULL, &mat);
ok(ret == GDI_ERROR, "GetGlyphOutlineW for nonexistent glyph index 0xFFFF has succeded\n");
ret = GetGlyphOutlineW(hdc, 0x10003, GGO_METRICS|GGO_GLYPH_INDEX, &gm2, 0, NULL, &mat);
ok(ret != GDI_ERROR, "GetGlyphOutlineW for index 0x10003 has failed\n");
ok(memcmp(&gm1, &gm2, sizeof(gmn)) == 0, "GetGlyphOutlineW returned wrong metrics for glyph 0x10003\n");
SelectObject(hdc, hfont_old);
DeleteObject(hfont);
ReleaseDC(NULL, hdc);
}
static void test_fstype_fixup(void)
{
HDC hdc;
......@@ -5945,6 +5996,7 @@ static void test_CreateScalableFontResource(void)
test_GetGlyphOutline_empty_contour();
test_GetGlyphOutline_metric_clipping();
test_GetGlyphOutline_character();
test_fstype_fixup();
ret = pRemoveFontResourceExA(fot_name, FR_PRIVATE, 0);
......
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