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

Re: Debian for ARM710的中文化問題



ha shao wrote:

>
> > 你肯定 ARM 上 sizeof(XChart2b) == 4 ? 如果肯定,那上面這種hack完全
> > 錯了。XmbDrawString... 都不對了。XDrawString16 沒問題,
> > (_Xconst XChar2b *)ch_str 這種cast 就肯定亂套了。相應的Xmb 函數全完了。
> >
>
> In omText.c, you can find that the cast is from (char *) to (_Xconst XChar2b *).
> Which is totally wrong with XChar2b != char * 2.
> In your example, simply replace i < length /sizeof(XChar2b) with
> i < (length>>1) will do the job. I think the DrawStringWidthFontSet should
> changed to your example, Of course if we sure sizeof(XChar2b) could be 4.
>
> --
> Best regard
> hashao
>

    事實上一切錯誤都在于sizeof(XChar2b) == 2這個假設不成立。目前的狀況是:
1、glibc 2.1.3 locale/iconv工作正常。
2、X locale除了和sizeof(XChar2b) == 2這個假設相關之外,其它正常。
3、XDrawString16基本正常,可以畫漢字(問題在後面)。
所以如果是:
char *ch_str = "zh1 zh2 zh3 zh4";
...
XDrawString16 (display, window, gc, x, y, (_Xconst XChar2b *)ch_str, length + 1);
看到的是
zh1 zh2 zh3 zh4 00
如果是:
XChar2b *ch_str = struct copy "zh1 zh2 zh3 zh4";
...
XDrawString16 (display, window, gc, x, y, (_Xconst XChar2b *)ch_str, length + 1);
看到的是
zh1 00 zh2 00
XmbDrawString/XwcDrawString在漢字部分就是這樣顯示。如果想保持代碼的效率,只有在
gcc for ARM一端解決。因為有些ARM CPU要求尋址按字(word)對齊,所以只要把gcc for ARM
的缺省編碼按字對齊而不是按雙字(dword)就行了。

XDrawString16的問題:
1、第一次畫漢字時會在第一個漢字前多畫一個漢字(規律還沒有找到)。程序自己刷新窗口
就正常了。
2、最後一個漢字畫不出來,除非length = length + 1。刷新窗口也沒有用。
問題的原因還在查找,我猜想可能和sizeof(XChar2b) == 4相關。

-- 
| This message was re-posted from debian-chinese-gb@lists.debian.org
| and converted from gb2312 to big5 by an automatic gateway.



Reply to: