gdi32: GetCharABCWidthsFloatW must succeed with non-TrueType fonts.

This commit is contained in:
Alexandre Julliard 2011-12-12 11:14:09 +01:00
parent 2455b3815a
commit 27eb63b082
3 changed files with 22 additions and 4 deletions

View File

@ -2656,6 +2656,7 @@ BOOL WINAPI GetCharABCWidthsW( HDC hdc, UINT firstChar, UINT lastChar,
PHYSDEV dev;
unsigned int i;
BOOL ret;
TEXTMETRICW tm;
if (!dc) return FALSE;
@ -2665,6 +2666,14 @@ BOOL WINAPI GetCharABCWidthsW( HDC hdc, UINT firstChar, UINT lastChar,
return FALSE;
}
/* unlike GetCharABCWidthsFloatW, this one is supposed to fail on non-TrueType fonts */
dev = GET_DC_PHYSDEV( dc, pGetTextMetrics );
if (!dev->funcs->pGetTextMetrics( dev, &tm ) || !(tm.tmPitchAndFamily & TMPF_TRUETYPE))
{
release_dc_ptr( dc );
return FALSE;
}
dev = GET_DC_PHYSDEV( dc, pGetCharABCWidths );
ret = dev->funcs->pGetCharABCWidths( dev, firstChar, lastChar, abc );
if (ret)

View File

@ -6416,9 +6416,6 @@ static BOOL freetype_GetCharABCWidths( PHYSDEV dev, UINT firstChar, UINT lastCha
TRACE("%p, %d, %d, %p\n", physdev->font, firstChar, lastChar, buffer);
if(!FT_IS_SCALABLE(physdev->font->ft_face))
return FALSE;
GDI_CheckNotLock();
EnterCriticalSection( &freetype_cs );

View File

@ -41,6 +41,7 @@ static DWORD (WINAPI *pGdiGetCodePage)(HDC hdc);
static BOOL (WINAPI *pGetCharABCWidthsI)(HDC hdc, UINT first, UINT count, LPWORD glyphs, LPABC abc);
static BOOL (WINAPI *pGetCharABCWidthsA)(HDC hdc, UINT first, UINT last, LPABC abc);
static BOOL (WINAPI *pGetCharABCWidthsW)(HDC hdc, UINT first, UINT last, LPABC abc);
static BOOL (WINAPI *pGetCharABCWidthsFloatW)(HDC hdc, UINT first, UINT last, LPABCFLOAT abc);
static DWORD (WINAPI *pGetFontUnicodeRanges)(HDC hdc, LPGLYPHSET lpgs);
static DWORD (WINAPI *pGetGlyphIndicesA)(HDC hdc, LPCSTR lpstr, INT count, LPWORD pgi, DWORD flags);
static DWORD (WINAPI *pGetGlyphIndicesW)(HDC hdc, LPCWSTR lpstr, INT count, LPWORD pgi, DWORD flags);
@ -63,6 +64,7 @@ static void init(void)
pGetCharABCWidthsI = (void *)GetProcAddress(hgdi32, "GetCharABCWidthsI");
pGetCharABCWidthsA = (void *)GetProcAddress(hgdi32, "GetCharABCWidthsA");
pGetCharABCWidthsW = (void *)GetProcAddress(hgdi32, "GetCharABCWidthsW");
pGetCharABCWidthsFloatW = (void *)GetProcAddress(hgdi32, "GetCharABCWidthsFloatW");
pGetFontUnicodeRanges = (void *)GetProcAddress(hgdi32, "GetFontUnicodeRanges");
pGetGlyphIndicesA = (void *)GetProcAddress(hgdi32, "GetGlyphIndicesA");
pGetGlyphIndicesW = (void *)GetProcAddress(hgdi32, "GetGlyphIndicesW");
@ -936,6 +938,7 @@ static void test_GetCharABCWidths(void)
LOGFONTA lf;
HFONT hfont;
ABC abc[1];
ABCFLOAT abcf[1];
WORD glyphs[1];
DWORD nb;
static const struct
@ -973,7 +976,7 @@ static void test_GetCharABCWidths(void)
};
UINT i;
if (!pGetCharABCWidthsA || !pGetCharABCWidthsW || !pGetCharABCWidthsI)
if (!pGetCharABCWidthsA || !pGetCharABCWidthsW || !pGetCharABCWidthsFloatW || !pGetCharABCWidthsI)
{
win_skip("GetCharABCWidthsA/W/I not available on this platform\n");
return;
@ -1008,6 +1011,15 @@ static void test_GetCharABCWidths(void)
ret = pGetCharABCWidthsW(hdc, 'a', 'a', abc);
ok(!ret, "GetCharABCWidthsW should have failed\n");
ret = pGetCharABCWidthsFloatW(NULL, 'a', 'a', abcf);
ok(!ret, "GetCharABCWidthsFloatW should have failed\n");
ret = pGetCharABCWidthsFloatW(hdc, 'a', 'a', NULL);
ok(!ret, "GetCharABCWidthsFloatW should have failed\n");
ret = pGetCharABCWidthsFloatW(hdc, 'a', 'a', abcf);
ok(ret, "GetCharABCWidthsFloatW should have succeeded\n");
hfont = SelectObject(hdc, hfont);
DeleteObject(hfont);