dlls/gdi: fix GetGlyphOutline(resend)
TANABE Hiroshi
hirokun_dayomon at infoseek.to
Mon Feb 21 10:41:06 CST 2005
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.6
diff -u -r1.6 font.c
--- dlls/gdi/font.c 5 Jan 2005 13:24:52 -0000 1.6
+++ dlls/gdi/font.c 21 Feb 2005 16:15:08 -0000
@@ -1948,7 +1948,13 @@
UINT c;
if(!(fuFormat & GGO_GLYPH_INDEX)) {
- p = FONT_mbtowc(hdc, (char*)&uChar, 1, NULL, NULL);
+ int len;
+ if(uChar > 0xff) { /* but, 2 bytes charactor only */
+ len = 2;
+ uChar = (uChar & 0xff) << 8 | (uChar & 0xff00) >> 8;
+ } else
+ len = 1;
+ p = FONT_mbtowc(hdc, (char*)&uChar, 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 21 Feb 2005 16:15:11 -0000
@@ -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