gdi32/path.c -- Allow PATH_ExtTextOut() handle nonprintablecharacters
Massimo Del Fedele
max at veneto.com
Tue Mar 17 02:43:23 CDT 2009
Dmitry Timoshkov ha scritto:
> "Massimo Del Fedele" <max at veneto.com> wrote:
>
>>> This patch doesn't match the normal logic of ExtTextOut implemented
>>> in dlls/winex11.drv/xrender.c, also this requires a test case for
>>> both code paths.
>>>
>>
>> Why ? As is it now PATH_ExtTextOut() simply returns FALSE on first
>> space or non-printable glyph, you can see easily printing something like
>> "THIS IS A TEST" on an open path.
>> BTW, this behaviour (GetGlyphOutlineW returning NULL on spaces) is
>> quite well known, and is NOT an error value, simply there's no glyph
>> outline for non-printable characters, so the requested buffer size is
>> NULL; the function just outputs the metrics.
>
> You need to make PATH_ExtTextOut() behave like dlls/winex11.drv/xrender.c,
> X11DRV_XRender_ExtTextOut() does, i.e. treat GDI_ERROR as an error case,
> not 0.
I do :
dwSize = GetGlyphOutlineW(hdc, str[idx], GGO_GLYPH_INDEX | GGO_NATIVE,
&gm, 0, NULL, &identity);
if(dwSize)
{
/* get and process glyph data */
............
}
else if(GetGlyphOutlineW(hdc, str[idx], GGO_GLYPH_INDEX | GGO_METRICS,
&gm, 0, NULL, &identity) == GDI_ERROR) <== HERE !
return FALSE;
The check against GDI_ERROR was indeed missing on original code, which
just checked for 0 result when asking for buffer size, returning FALSE
if found.
It could be done the way around, first getting the metrics and then if
no error the buffer size and the glyph data, but you'd have an
unnecessary added call to GetGlyphOutlineW() for printable chars.
>
>> Also, I don't know how to make a testcase with no graphic output....
>> If you have some suggestion about, I can make one.
>
> GetGlyphOutlineW doesn't produce any graphic output.
>
Yep, of course, but we don't need to check for GetGlyphOutlineW()
correctness (well, not for this case, at least). It IS correct.
If you ask for buffer size (as done on first call) it returns 0 on error
AND on unprintable glyphs. The GDI_ERROR value is returned ONLY when
asking just for metrics or trying to get the glyph data, NOT when asking
for buffer size (on which GDI_ERROR could be a valid buffer size), as
well documented on MSDN :
http://msdn.microsoft.com/en-us/library/dd144891(VS.85).aspx
(see return value)
The only test case I can see here is a graphic one, showing the missing
text after the space char on wine.
Ciao
Max
More information about the wine-devel
mailing list