中文补丁wine官方讨论及修正

Wine、Cedega、CrossOver 等配置
回复
bigben446
帖子: 108
注册时间: 2007-09-12 14:45
送出感谢: 8 次
接收感谢: 1 次

中文补丁wine官方讨论及修正

#1

帖子 bigben446 » 2008-08-26 4:33

Bug#: 11861 regedit does not correctly display unicode value data
http://bugs.winehq.org/show_bug.cgi?id=11861

修正:gdi32: Fix GetGlyphIndices to select properly the invalid char glyph for TrueType fonts .
http://www.winehq.org/pipermail/wine-cv ... 41978.html


主要是那两个链接
第一个链接Lei Zhang在2008-03-05向官方提交了中文字体显示为框框的bug
第二个链接Alexandre Julliard在2008-04-02给出了解决方案

按理说,新版的wine就没有问题
但是不知道为什么wine1.1.3还是有问题

用置顶贴的gdi32.dll.so.tar.gz替换了事
sudo mv /usr/lib/wine/gdi32.dll.so /usr/lib/wine/gdi32.dll.so.backup
sudo cp gdi32.dll.so /usr/lib/wine
viewtopic.php?t=132463



Mikołaj Zalewski : gdi32: Fix GetGlyphIndices to select properly the invalid char glyph for TrueType fonts .
Alexandre Julliard julliard at winehq.org
Wed Apr 2 06:55:38 CDT 2008

* Previous message: James Hawkins : shell32: Handle a few cases in FO_COPY that arise from not double-NULL terminating the input .
* Next message: Nikolay Sivov : gdi32: PlgBlt implementation.
* Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

Module: wine
Branch: master
Commit: 4094ff025675a14e7572d975d4fd1bf7c11dc2e7
URL: http://source.winehq.org/git/wine.git/? ... f7c11dc2e7

Author: Mikołaj Zalewski <mikolaj at zalewski.pl>
Date: Sun Mar 30 21:43:15 2008 +0200

gdi32: Fix GetGlyphIndices to select properly the invalid char glyph for TrueType fonts.

---

dlls/gdi32/freetype.c | 21 ++++++++++++++-------
dlls/gdi32/tests/font.c | 32 +++++++++++++++++++++++---------
2 files changed, 37 insertions(+), 16 deletions(-)

diff --git a/dlls/gdi32/freetype.c b/dlls/gdi32/freetype.c
index 04db3ae..6356c1f 100644
--- a/dlls/gdi32/freetype.c
+++ b/dlls/gdi32/freetype.c
@@ -4068,26 +4068,33 @@ static FT_UInt get_glyph_index(const GdiFont *font, UINT glyph)
/*************************************************************
* WineEngGetGlyphIndices
*
- * FIXME: add support for GGI_MARK_NONEXISTING_GLYPHS
*/
DWORD WineEngGetGlyphIndices(GdiFont *font, LPCWSTR lpstr, INT count,
LPWORD pgi, DWORD flags)
{
int i;
- WCHAR default_char = 0;
- TEXTMETRICW textm;
+ int default_char = -1;

- if (flags & GGI_MARK_NONEXISTING_GLYPHS) default_char = 0x001f; /* Indicate non existence */
+ if (flags & GGI_MARK_NONEXISTING_GLYPHS) default_char = 0xffff; /* XP would use 0x1f for bitmap fonts */

for(i = 0; i < count; i++)
{
pgi = get_glyph_index(font, lpstr);
if (pgi == 0)
{
- if (!default_char)
+ if (default_char == -1)
{
- WineEngGetTextMetrics(font, &textm);
- default_char = textm.tmDefaultChar;
+ if (FT_IS_SFNT(font->ft_face))
+ {
+ TT_OS2 *pOS2 = pFT_Get_Sfnt_Table(font->ft_face, ft_sfnt_os2);
+ default_char = (pOS2->usDefaultChar ? get_glyph_index(font, pOS2->usDefaultChar) : 0);
+ }
+ else
+ {
+ TEXTMETRICW textm;
+ WineEngGetTextMetrics(font, &textm);
+ default_char = textm.tmDefaultChar;
+ }
}
pgi = default_char;
}
diff --git a/dlls/gdi32/tests/font.c b/dlls/gdi32/tests/font.c
index ce34ab2..d85ab12 100644
--- a/dlls/gdi32/tests/font.c
+++ b/dlls/gdi32/tests/font.c
@@ -583,35 +583,49 @@ static void test_GetGlyphIndices(void)
WCHAR testtext[] = {'T','e','s','t',0xffff,0};
WORD glyphs[(sizeof(testtext)/2)-1];
TEXTMETRIC textm;
+ HFONT hOldFont;

if (!pGetGlyphIndicesW) {
skip("GetGlyphIndices not available on platform\n");
return;
}

- if(!is_font_installed("Symbol"))
+ hdc = GetDC(0);
+
+ ok(GetTextMetrics(hdc, &textm), "GetTextMetric failed\n");
+ flags |= GGI_MARK_NONEXISTING_GLYPHS;
+ charcount = pGetGlyphIndicesW(hdc, testtext, (sizeof(testtext)/2)-1, glyphs, flags);
+ ok(charcount == 5, "GetGlyphIndices count of glyphs should = 5 not %d\n", charcount);
+ ok((glyphs[4] == 0x001f || glyphs[4] == 0xffff /* Vista */), "GetGlyphIndices should have returned a nonexistent char not %04x\n", glyphs[4]);
+ flags = 0;
+ charcount = pGetGlyphIndicesW(hdc, testtext, (sizeof(testtext)/2)-1, glyphs, flags);
+ ok(charcount == 5, "GetGlyphIndices count of glyphs should = 5 not %d\n", charcount);
+ ok(glyphs[4] == textm.tmDefaultChar, "GetGlyphIndices should have returned a %04x not %04x\n",
+ textm.tmDefaultChar, glyphs[4]);
+
+ if(!is_font_installed("Tahoma"))
{
- skip("Symbol is not installed so skipping this test\n");
+ skip("Tahoma is not installed so skipping this test\n");
return;
}
-
memset(&lf, 0, sizeof(lf));
- strcpy(lf.lfFaceName, "Symbol");
+ strcpy(lf.lfFaceName, "Tahoma");
lf.lfHeight = 20;

hfont = CreateFontIndirectA(&lf);
- hdc = GetDC(0);
-
+ hOldFont = SelectObject(hdc, hfont);
ok(GetTextMetrics(hdc, &textm), "GetTextMetric failed\n");
flags |= GGI_MARK_NONEXISTING_GLYPHS;
charcount = pGetGlyphIndicesW(hdc, testtext, (sizeof(testtext)/2)-1, glyphs, flags);
ok(charcount == 5, "GetGlyphIndices count of glyphs should = 5 not %d\n", charcount);
- ok((glyphs[4] == 0x001f || glyphs[4] == UNICODE_NOCHAR /* Vista */), "GetGlyphIndices should have returned a nonexistent char not %04x\n", glyphs[4]);
+ ok(glyphs[4] == 0xffff, "GetGlyphIndices should have returned 0xffff char not %04x\n", glyphs[4]);
flags = 0;
+ testtext[0] = textm.tmDefaultChar;
charcount = pGetGlyphIndicesW(hdc, testtext, (sizeof(testtext)/2)-1, glyphs, flags);
ok(charcount == 5, "GetGlyphIndices count of glyphs should = 5 not %d\n", charcount);
- ok(glyphs[4] == textm.tmDefaultChar, "GetGlyphIndices should have returned a %04x not %04x\n",
- textm.tmDefaultChar, glyphs[4]);
+ todo_wine ok(glyphs[0] == 0, "GetGlyphIndices for tmDefaultChar should be 0 not %04x\n", glyphs[0]);
+ ok(glyphs[4] == 0, "GetGlyphIndices should have returned 0 not %04x\n", glyphs[4]);
+ DeleteObject(SelectObject(hdc, hOldFont));
}

static void test_GetKerningPairs(void)
上次由 bigben446 在 2008-08-26 14:08,总共编辑 1 次。
头像
jialeadmin
帖子: 724
注册时间: 2008-06-17 23:17
来自: 灾区
送出感谢: 0
接收感谢: 0
联系:

#2

帖子 jialeadmin » 2008-08-26 4:35

看不懂!
◆WINDOWS系统已彻底删除
◆正在安装UBUNTU 9.04
◆系统正在复制文件,请稍等...
┌────────────┐
│ ■■■■■■■□□□ 70% │
└────────────┘
头像
hongmy525
帖子: 236
注册时间: 2007-01-26 22:06
来自: 南宁 杭州
送出感谢: 0
接收感谢: 0
联系:

#3

帖子 hongmy525 » 2008-08-26 8:38

好东西,非常感谢~
bigben446
帖子: 108
注册时间: 2007-09-12 14:45
送出感谢: 8 次
接收感谢: 1 次

#4

帖子 bigben446 » 2008-08-26 14:07

主要是那两个链接
第一个链接Lei Zhang在2008-03-05向官方提交了中文字体显示为框框的bug
第二个链接Alexandre Julliard在2008-04-02给出了解决方案

按理说,新版的wine就没有问题
但是不知道为什么wine1.1.3还是有问题

用置顶贴的gdi32.dll.so.tar.gz替换了事
sudo mv /usr/lib/wine/gdi32.dll.so /usr/lib/wine/gdi32.dll.so.backup
sudo cp gdi32.dll.so /usr/lib/wine
viewtopic.php?t=132463

jialeadmin 写了:看不懂!
yoyu007
帖子: 195
注册时间: 2007-09-02 10:08
送出感谢: 0
接收感谢: 0

#5

帖子 yoyu007 » 2008-08-26 20:30

那段代码官方没有加进去
igotcha
帖子: 190
注册时间: 2007-02-27 0:43
送出感谢: 0
接收感谢: 0

#6

帖子 igotcha » 2008-08-28 17:04

说实话,那个补丁打了有部分程序会出问题,估计官方也是考虑到稳定性的~
头像
BigSnake.NET
帖子: 12522
注册时间: 2006-07-02 11:16
来自: 廣州
送出感谢: 0
接收感谢: 7 次
联系:

#7

帖子 BigSnake.NET » 2008-08-28 17:07

人家可以不接受的嘛
正常现象
^_^ ~~~
要理解递归,首先要理解递归。

地球人都知道,理论上,理论跟实际是没有差别的,但实际上,理论跟实际的差别是相当大滴。
头像
bones7456
论坛版主
帖子: 8495
注册时间: 2006-04-12 20:05
来自: 杭州
送出感谢: 0
接收感谢: 8 次
联系:

#8

帖子 bones7456 » 2008-08-28 17:42

难道是ee提的bug?
关注我的blog: ε==3
回复

回到 “Wine及其分支”