Alexandre Julliard ha scritto:

GDI_ERROR is clearly not a valid buffer size, and must be checked
for. Please write test cases like Dmitry suggested.


Yep, right, GDI_ERROR is -1L, too large to be a buffer size.
Uhmmm... the only non-graphical testcase that occours to me is one showing that GetGlyphOutline() returns NULL buffer size on non-printable characters.... It does, both on wine and on windows, is the check inside PATH_ExtTextOut() which is wrong.
It's done as

dwSize = GetGlyphOutlineW(hdc, str[idx], GGO_GLYPH_INDEX | GGO_NATIVE, &gm, 0, NULL, &identity);
        if (!dwSize) return FALSE; <--- ERROR ON SPACE CHARACTER

which should be

dwSize = GetGlyphOutlineW(hdc, str[idx], GGO_GLYPH_INDEX | GGO_NATIVE, &gm, 0, NULL, &identity);
        if (dwSize == GDI_ERROR) return FALSE;

But then, I'm still not sure IF GetGlyphOutlineW does return GDI_ERROR when called with GGO_GLYPH_INDEX flag (msn is not clear about...) nor I know how to make a call to GetGlyphOutlineW() requesting a buffer size which simulates an error. I could do with a wrong HDC, but we will be never sure that some other kind of error wouldn't return NULL instead of GDI_ERROR. My patch simply avoided the problem with :

dwSize = GetGlyphOutlineW(hdc, str[idx], GGO_GLYPH_INDEX | GGO_NATIVE, &gm, 0, NULL, &identity);
if(dwSize)
{
   HERE NORMAL PROCESSING - BUF SIZE OK
}
/* GetGlyphOutlineW may return null size for space character,
   so we try to get the metrics for it */
else if(GetGlyphOutlineW(hdc, str[idx], GGO_GLYPH_INDEX | GGO_METRICS, &gm, 0, NULL, &identity) == GDI_ERROR)
            return FALSE;

This is guaranteed to work as by MSN description.

Ciao

Max



Reply via email to