From 8bf8021f945429e3d2026ffabe943c7afac0fc15 Mon Sep 17 00:00:00 2001 From: Huw D M Davies Date: Tue, 23 Oct 2001 19:54:27 +0000 Subject: [PATCH] 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. --- graphics/x11drv/codepage.c | 33 +++++++++++++++++++++++++++++++++ graphics/x11drv/xfont.c | 4 ++-- include/x11font.h | 1 + objects/text.c | 4 ++-- 4 files changed, 38 insertions(+), 4 deletions(-) diff --git a/graphics/x11drv/codepage.c b/graphics/x11drv/codepage.c index 092c7ca2f5c..c4d9480cbb6 100644 --- a/graphics/x11drv/codepage.c +++ b/graphics/x11drv/codepage.c @@ -364,6 +364,30 @@ static XChar2b* X11DRV_unicode_to_char2b_cp950( fontObject* pfo, 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 @@ const X11DRV_CP X11DRV_cptable[X11DRV_CPTABLE_COUNT] = 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, + } }; diff --git a/graphics/x11drv/xfont.c b/graphics/x11drv/xfont.c index b9382d5e884..ac9ab65e0b0 100644 --- a/graphics/x11drv/xfont.c +++ b/graphics/x11drv/xfont.c @@ -141,8 +141,8 @@ static const SuffixCharset sufch_microsoft[] = { { "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[] = { diff --git a/include/x11font.h b/include/x11font.h index 3147aa7510e..cde280e4b34 100644 --- a/include/x11font.h +++ b/include/x11font.h @@ -80,6 +80,7 @@ enum X11DRV_CPTABLE X11DRV_CPTABLE_CP936, X11DRV_CPTABLE_CP949, X11DRV_CPTABLE_CP950, + X11DRV_CPTABLE_SYMBOL, X11DRV_CPTABLE_COUNT }; diff --git a/objects/text.c b/objects/text.c index 42195e0fe15..d28ec0fe221 100644 --- a/objects/text.c +++ b/objects/text.c @@ -43,8 +43,8 @@ LPWSTR FONT_mbtowc(HDC hdc, LPCSTR str, INT count, INT *plenW, UINT *pCP) 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();