[1/2] gdi32: GetGlyphOutline should fail for a bitmap font.
Dmitry Timoshkov
dmitry at baikal.ru
Sat Apr 28 03:52:13 CDT 2012
---
dlls/gdi32/freetype.c | 6 ++++++
dlls/gdi32/tests/font.c | 17 ++++++++++++-----
2 files changed, 18 insertions(+), 5 deletions(-)
diff --git a/dlls/gdi32/freetype.c b/dlls/gdi32/freetype.c
index 3de31f6..f5a60d0 100644
--- a/dlls/gdi32/freetype.c
+++ b/dlls/gdi32/freetype.c
@@ -6871,6 +6871,12 @@ static DWORD freetype_GetGlyphOutline( PHYSDEV dev, UINT glyph, UINT format,
return dev->funcs->pGetGlyphOutline( dev, glyph, format, lpgm, buflen, buf, lpmat );
}
+ if (!FT_IS_SCALABLE( physdev->font->ft_face ))
+ {
+ SetLastError( ERROR_CAN_NOT_COMPLETE );
+ return GDI_ERROR;
+ }
+
GDI_CheckNotLock();
EnterCriticalSection( &freetype_cs );
ret = get_glyph_outline( physdev->font, glyph, format, lpgm, buflen, buf, lpmat );
diff --git a/dlls/gdi32/tests/font.c b/dlls/gdi32/tests/font.c
index 1708c49..b0c6e73 100644
--- a/dlls/gdi32/tests/font.c
+++ b/dlls/gdi32/tests/font.c
@@ -876,6 +876,7 @@ static void test_bitmap_font_metrics(void)
for(bit = 0; bit < 32; bit++)
{
+ GLYPHMETRICS gm;
DWORD fs[2];
BOOL bRet;
@@ -904,16 +905,11 @@ static void test_bitmap_font_metrics(void)
hfont = create_font(lf.lfFaceName, &lf);
old_hfont = SelectObject(hdc, hfont);
- bRet = GetTextMetrics(hdc, &tm);
- ok(bRet, "GetTextMetrics error %d\n", GetLastError());
SetLastError(0xdeadbeef);
ret = GetTextFace(hdc, sizeof(face_name), face_name);
ok(ret, "GetTextFace error %u\n", GetLastError());
- SetLastError(0xdeadbeef);
- ret = GetTextCharset(hdc);
-
if (lstrcmp(face_name, fd[i].face_name) != 0)
{
ok(ret != ANSI_CHARSET, "font charset should not be ANSI_CHARSET\n");
@@ -924,6 +920,17 @@ static void test_bitmap_font_metrics(void)
continue;
}
+ memset(&gm, 0, sizeof(gm));
+ SetLastError(0xdeadbeef);
+ ret = GetGlyphOutline(hdc, 'A', GGO_METRICS, &gm, 0, NULL, &mat);
+ ok(ret == GDI_ERROR, "GetGlyphOutline should fail for a bitmap font\n");
+ ok(GetLastError() == ERROR_CAN_NOT_COMPLETE, "expected ERROR_CAN_NOT_COMPLETE, got %u\n", GetLastError());
+
+ bRet = GetTextMetrics(hdc, &tm);
+ ok(bRet, "GetTextMetrics error %d\n", GetLastError());
+
+ SetLastError(0xdeadbeef);
+ ret = GetTextCharset(hdc);
ok(ret == expected_cs, "got charset %d, expected %d\n", ret, expected_cs);
trace("created %s, height %d charset %x dpi %d\n", face_name, tm.tmHeight, tm.tmCharSet, tm.tmDigitizedAspectX);
--
1.7.9.4
More information about the wine-patches
mailing list