Massimo Del Fedele ha scritto:

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


Hmmmmm... even better :


if(dwSize == GDI_ERROR)
     return FALSE;
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 will work on evey possible case....

Max



Reply via email to