gdi32/PATH_ExtTextOut should handle non-printable glyphs

Massimo Del Fedele max at veneto.com
Sun Mar 15 12:16:10 CDT 2009


---
 dlls/gdi32/path.c |   19 ++++++++++++-------
 1 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/dlls/gdi32/path.c b/dlls/gdi32/path.c
index 3ad551e..ba57661 100644
--- a/dlls/gdi32/path.c
+++ b/dlls/gdi32/path.c
@@ -1460,16 +1460,21 @@ BOOL PATH_ExtTextOut(DC *dc, INT x, INT y, UINT flags, const RECT *lprc,
         void *outline;
 
         dwSize = GetGlyphOutlineW(hdc, str[idx], GGO_GLYPH_INDEX | GGO_NATIVE, &gm, 0, NULL, &identity);
-        if (!dwSize) return FALSE;
-
-        outline = HeapAlloc(GetProcessHeap(), 0, dwSize);
-        if (!outline) return FALSE;
+        if(dwSize)
+        {
+            outline = HeapAlloc(GetProcessHeap(), 0, dwSize);
+            if (!outline) return FALSE;
 
-        GetGlyphOutlineW(hdc, str[idx], GGO_GLYPH_INDEX | GGO_NATIVE, &gm, dwSize, outline, &identity);
+            GetGlyphOutlineW(hdc, str[idx], GGO_GLYPH_INDEX | GGO_NATIVE, &gm, dwSize, outline, &identity);
 
-        PATH_add_outline(dc, org.x + x + xoff, org.x + y + yoff, outline, dwSize);
+            PATH_add_outline(dc, org.x + x + xoff, org.x + y + yoff, outline, dwSize);
 
-        HeapFree(GetProcessHeap(), 0, outline);
+            HeapFree(GetProcessHeap(), 0, outline);
+        }
+        /* 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;
 
         if (dx)
         {
-- 
1.5.6.3


--------------020704040402030503080602--




More information about the wine-patches mailing list