kernel32: MultiByteToWideChar: MB_USEGLYPHCHARS fix

Andrew O. Shadoura bugzilla at tut.by
Sun Mar 11 10:59:53 CDT 2007


Hello All!

(Re-submitted. Removed dead code)

This patch implements MB_USEGLYPHCHARS flag in MultiByteToWideChar function.
It works, just tested.

==================== here clipboard begins ====================
diff -u -p ori/dlls/kernel32/locale.c mod/dlls/kernel32/locale.c
--- ori/dlls/kernel32/locale.c        2007-03-11 17:53:35.078078664 +0200
+++ mod/dlls/kernel32/locale.c        2007-03-11 17:56:58.426165056 +0200
@@ -70,6 +70,14 @@ static const WCHAR szNlsKeyName[] = {
     'C','o','n','t','r','o','l','\\','N','l','s','\0'
 };

+/* 0x00..0x1f chars glyph map */
+static const WCHAR glyph_xlat[32] = {
+    0x0000, 0x263A, 0x263B, 0x2665, 0x2666, 0x2663, 0x2662, 0x2219,
+    0x25D8, 0x25CB, 0x25D9, 0x2642, 0x2640, 0x266A, 0x266B, 0x263C,
+    0x25BA, 0x25C4, 0x2195, 0x203C, 0x00B6, 0x00A7, 0x25AC, 0x21A8,
+    0x2191, 0x2193, 0x2192, 0x2190, 0x221F, 0x2194, 0x25B2, 0x25BC
+};
+
 /* Charset to codepage map, sorted by name. */
 static const struct charset_entry
 {
@@ -1763,8 +1771,7 @@ INT WINAPI MultiByteToWideChar( UINT pag
                                 LPWSTR dst, INT dstlen )
 {
     const union cptable *table;
-    int ret;
-    static int once;
+    int i,ret;

     if (!src || (!dst && dstlen))
     {
@@ -1774,12 +1781,6 @@ INT WINAPI MultiByteToWideChar( UINT pag

     if (srclen < 0) srclen = strlen(src) + 1;

-    if (!once && (flags & MB_USEGLYPHCHARS))
-    {
-        once = 1;
-        FIXME("MB_USEGLYPHCHARS not supported\n");
-    }
-
     switch(page)
     {
     case CP_SYMBOL:
@@ -1814,6 +1815,11 @@ INT WINAPI MultiByteToWideChar( UINT pag
         break;
     }

+    if (flags & MB_USEGLYPHCHARS) {
+        for (i=0; i!=dstlen; i++)
+            if (dst[i]<0x20) dst[i]=glyph_xlat[dst[i]];
+    }
+
     if (ret < 0)
     {
         switch(ret)
==================== here clipboard ends ====================

 -- WBR, Andrew O. Shadoura

--- PolySoft Station
 * Origin: Knowledge itself is a power (2:4500/1.25)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: locale.c.diff
Type: application/octet-stream
Size: 1501 bytes
Desc: not available
Url : http://www.winehq.org/pipermail/wine-patches/attachments/20070311/e2822a1a/locale.c.obj


More information about the wine-patches mailing list