dlls/gdi: fix GetGlyphOutline(resend)

TANABE Hiroshi hirokun_dayomon at infoseek.to
Tue Feb 22 08:31:30 CST 2005


I have changed the patch to using a array of two chars when converting a character.

----

This patch fixes GetGlyphOutline() related problems.

MSDN says the buffer size *or* address is zero, GetGlyphOutline() return value specifies the required buffer size, in bytes.

Changelog:
Added Multibyte charactor set support.
Remove (buf && !buflen) checking.
Fixed outline rendering with GGO_GRAY?_BITMAP option.
Improved fixed-pitch fonts detection.
-------------- next part --------------
Index: dlls/gdi/font.c
===================================================================
RCS file: /home/wine/wine/dlls/gdi/font.c,v
retrieving revision 1.7
diff -u -r1.7 font.c
--- dlls/gdi/font.c	21 Feb 2005 20:43:59 -0000	1.7
+++ dlls/gdi/font.c	22 Feb 2005 13:39:35 -0000
@@ -1935,7 +1935,18 @@
     UINT c;
 
     if(!(fuFormat & GGO_GLYPH_INDEX)) {
-        p = FONT_mbtowc(hdc, (char*)&uChar, 1, NULL, NULL);
+        int len;
+        char mbchs[2];
+        if(uChar > 0xff) { /* but, 2 bytes character only */
+            len = 2;
+	    mbchs[0] = (uChar & 0xff00) >> 8;
+	    mbchs[1] = (uChar & 0xff);
+        } else {
+            len = 1;
+	    mbchs[0] = (uChar & 0xff);
+	    mbchs[1] = 0;
+	}
+        p = FONT_mbtowc(hdc, mbchs, len, NULL, NULL);
 	c = p[0];
     } else
         c = uChar;
Index: dlls/gdi/freetype.c
===================================================================
RCS file: /home/wine/wine/dlls/gdi/freetype.c,v
retrieving revision 1.81
diff -u -r1.81 freetype.c
--- dlls/gdi/freetype.c	24 Jan 2005 19:00:10 -0000	1.81
+++ dlls/gdi/freetype.c	22 Feb 2005 13:39:35 -0000
@@ -463,9 +463,9 @@
             if(!FT_IS_SCALABLE(ft_face))
                 size = (My_FT_Bitmap_Size *)ft_face->available_sizes + bitmap_num;
 
-            len = MultiByteToWideChar(CP_ACP, 0, family_name, -1, NULL, 0);
+            len = MultiByteToWideChar(CP_UTF8, 0, family_name, -1, NULL, 0);
             FamilyW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
-            MultiByteToWideChar(CP_ACP, 0, family_name, -1, FamilyW, len);
+            MultiByteToWideChar(CP_UTF8, 0, family_name, -1, FamilyW, len);
 
             family = NULL;
             LIST_FOR_EACH(family_elem_ptr, &font_list) {
@@ -2385,10 +2385,6 @@
     if(format == GGO_METRICS)
         return 1; /* FIXME */
 
-    if (buf && !buflen){
-        return GDI_ERROR;
-    }
-
     if(ft_face->glyph->format != ft_glyph_format_outline && format != GGO_BITMAP) {
         TRACE("loaded a bitmap\n");
 	return GDI_ERROR;
@@ -2467,14 +2463,16 @@
 
 	pFT_Outline_Translate(&ft_face->glyph->outline, -left, -bottom );
 
+	memset(ft_bitmap.buffer, 0, buflen);
+
 	pFT_Outline_Get_Bitmap(library, &ft_face->glyph->outline, &ft_bitmap);
 
 	if(format == GGO_GRAY2_BITMAP)
-	    mult = 5;
+	    mult = 4;
 	else if(format == GGO_GRAY4_BITMAP)
-	    mult = 17;
+	    mult = 16;
 	else if(format == GGO_GRAY8_BITMAP)
-	    mult = 65;
+	    mult = 64;
 	else if(format == WINE_GGO_GRAY16_BITMAP)
 	    break;
 	else {
@@ -2486,7 +2484,7 @@
 	for(row = 0; row < height; row++) {
 	    ptr = start;
 	    for(col = 0; col < width; col++, ptr++) {
-	        *ptr = (*(unsigned int*)ptr * mult + 128) / 256;
+	        *ptr = (((int)*ptr) * mult + 128) / 256;
 	    }
 	    start += pitch;
 	}
@@ -2903,7 +2901,8 @@
     TM.tmStruckOut = font->strikeout;
 
     /* Yes TPMF_FIXED_PITCH is correct; braindead api */
-    if(!FT_IS_FIXED_WIDTH(ft_face))
+    if(!FT_IS_FIXED_WIDTH(ft_face) &&
+       (pOS2->version == 0xFFFFU || pOS2->panose[3]!=9))
         TM.tmPitchAndFamily = TMPF_FIXED_PITCH;
     else
         TM.tmPitchAndFamily = 0;


More information about the wine-patches mailing list