Fix symbol font handling

Huw D M Davies h.davies1 at physics.ox.ac.uk
Tue Oct 23 08:55:16 CDT 2001


	Huw D M Davies <hdavies at codeweavers.com>
	ExtTextOutW with symbol fonts works with chars in the ranges
	0x0000 -- 0x00ff and 0xf000 -- 0xf0ff and not, for example, with
	chars in the Unicode Greek range.
-------------- next part --------------
Index: graphics/x11drv/codepage.c
===================================================================
RCS file: /home/wine/wine/graphics/x11drv/codepage.c,v
retrieving revision 1.11
diff -u -r1.11 codepage.c
--- graphics/x11drv/codepage.c	2001/07/25 00:43:35	1.11
+++ graphics/x11drv/codepage.c	2001/10/23 12:31:15
@@ -364,6 +364,30 @@
     return str2b;
 }
 
+static XChar2b* X11DRV_unicode_to_char2b_symbol( fontObject* pfo,
+						 LPCWSTR lpwstr, UINT count )
+{
+    XChar2b *str2b;
+    UINT i;
+    char ch = pfo->fs->default_char;
+
+    if (!(str2b = HeapAlloc( GetProcessHeap(), 0, count * sizeof(XChar2b) )))
+	return NULL;
+
+    for (i = 0; i < count; i++)
+    {
+	str2b[i].byte1 = 0;
+	if(lpwstr[i] >= 0xf000 && lpwstr[i] < 0xf100)
+	    str2b[i].byte2 = lpwstr[i] - 0xf000;
+	else if(lpwstr[i] < 0x100)
+	    str2b[i].byte2 = lpwstr[i];
+	else
+	    str2b[i].byte2 = ch;
+    }
+
+    return str2b;
+}
+
 
 static void X11DRV_DrawString_normal( fontObject* pfo, Display* pdisp,
                                       Drawable d, GC gc, int x, int y,
@@ -700,4 +724,13 @@
 	X11DRV_TextExtents_dbcs_2fonts,
         X11DRV_GetTextMetricsA_cp932,
     },
+    { /* SYMBOL */
+	X11DRV_enum_subfont_charset_normal,
+	X11DRV_unicode_to_char2b_symbol,
+	X11DRV_DrawString_normal,
+	X11DRV_TextWidth_normal,
+	X11DRV_DrawText_normal,
+	X11DRV_TextExtents_normal,
+	X11DRV_GetTextMetricsA_normal,
+    }
 };
Index: graphics/x11drv/xfont.c
===================================================================
RCS file: /home/wine/wine/graphics/x11drv/xfont.c,v
retrieving revision 1.86
diff -u -r1.86 xfont.c
--- graphics/x11drv/xfont.c	2001/10/08 20:40:10	1.86
+++ graphics/x11drv/xfont.c	2001/10/23 12:31:16
@@ -141,8 +141,8 @@
     { "cp1255", HEBREW_CHARSET, 1255, X11DRV_CPTABLE_SBCS },
     { "cp1256", ARABIC_CHARSET, 1256, X11DRV_CPTABLE_SBCS },
     { "cp1257", BALTIC_CHARSET, 1257, X11DRV_CPTABLE_SBCS },
-    { "fontspecific", SYMBOL_CHARSET, CP_SYMBOL, X11DRV_CPTABLE_SBCS },
-    { "symbol", SYMBOL_CHARSET, CP_SYMBOL, X11DRV_CPTABLE_SBCS },
+    { "fontspecific", SYMBOL_CHARSET, CP_SYMBOL, X11DRV_CPTABLE_SYMBOL },
+    { "symbol", SYMBOL_CHARSET, CP_SYMBOL, X11DRV_CPTABLE_SYMBOL },
     {   NULL,   ANSI_CHARSET, 1252, X11DRV_CPTABLE_SBCS }};
 
 static const SuffixCharset sufch_tcvn[] = {
Index: include/x11font.h
===================================================================
RCS file: /home/wine/wine/include/x11font.h,v
retrieving revision 1.15
diff -u -r1.15 x11font.h
--- include/x11font.h	2000/08/20 19:04:04	1.15
+++ include/x11font.h	2001/10/23 12:31:16
@@ -80,6 +80,7 @@
     X11DRV_CPTABLE_CP936,
     X11DRV_CPTABLE_CP949,
     X11DRV_CPTABLE_CP950,
+    X11DRV_CPTABLE_SYMBOL,
     X11DRV_CPTABLE_COUNT
 };
 
Index: objects/text.c
===================================================================
RCS file: /home/wine/wine/objects/text.c,v
retrieving revision 1.40
diff -u -r1.40 text.c
--- objects/text.c	2001/10/10 20:25:04	1.40
+++ objects/text.c	2001/10/23 12:31:16
@@ -43,8 +43,8 @@
         cp = csi.ciACP;
     else {
         switch(charset) {
-	case SYMBOL_CHARSET:
-	    cp = CP_SYMBOL;
+	case SYMBOL_CHARSET: /* We don't want any translation here */
+	    cp = GetACP();
 	    break;
 	case OEM_CHARSET:
 	    cp = GetOEMCP();


More information about the wine-patches mailing list