Massimo Del Fedele max@veneto.com writes:
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.
There's no reason to believe that some errors would return 0, but that's what test cases are for.
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.
No, you don't handle GDI_ERROR correctly.