fixes for negative font width and multi-byte char support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





ChangeLog:

     1. Added sanity check on width logical font field in CreateFontIndirect.
     2. Added multi-bytes character support for GetGlyphOutline.

Description:

     1. Passing a negative width in the logical font to the X11drv XRender
     library will somehow produce a crash.

Warren Baird : Warren_Baird@cimmetry.com
Dave Belanger

diff -ur clean/wine/objects/font.c wine/objects/font.c
--- clean/wine/objects/font.c Wed Jan 29 15:31:13 2003
+++ wine/objects/font.c  Thu Jan 30 10:27:31 2003
@@ -328,6 +328,11 @@
                   debugstr_w(plf->lfFaceName),
                   plf->lfWeight > 400 ? "Bold" : "",
                   plf->lfItalic ? "Italic" : "", hFont);
+
+         if (plf->lfWidth < 0) {
+             fontPtr->logfont.lfWidth = 0;
+            WARN("Invalid font width has been specified; setting it to
zero.\n");
+         }

         if (plf->lfEscapement != plf->lfOrientation) {
           /* this should really depend on whether GM_ADVANCED is set */
@@ -1610,8 +1615,20 @@
     UINT c;

     if(!(fuFormat & GGO_GLYPH_INDEX)) {
-        p = FONT_mbtowc(hdc, (char*)&uChar, 1, NULL, NULL);
-    c = p[0];
+         char temp[3];
+         if (uChar > 0xFF) {
+              /* multi-byte */
+              temp[1] = uChar & 0xFF;
+              temp[0] = (uChar >> 8) & 0xFF;
+              temp[2] = 0;
+         } else {
+              /* single byte */
+              temp[0] = uChar;
+              temp[1] = 0;
+              temp[2] = 0;
+         }
+         p = FONT_mbtowc(hdc, temp, strlen(temp), NULL, NULL);
+        c = p[0];
     } else
         c = uChar;
     ret = GetGlyphOutlineW(hdc, c, fuFormat, lpgm, cbBuffer, lpBuffer,




[Index of Archives]     [Gimp for Windows]     [Red Hat]     [Samba]     [Yosemite Camping]     [Graphics Cards]     [Wine Home]

  Powered by Linux