LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 2817|回复: 5

谁能解释等宽字体中,中文字体宽度的问题?

[复制链接]
发表于 2005-6-30 10:14:00 | 显示全部楼层 |阅读模式
https://www.redhat.com/archives/ ... -June/msg05996.html

Tony Nelson        
<tonynelson@georgeanelson.com> 致 fedora-list
         更多选项          9:46 (20分钟前)
I know nothing about Chinese, but some of you do.  I'm writing a Gedit
plugin using Unicode.  My plugin wraps text for block comments in programs,
and it assumes a fixed-width font, such as Monospace.  Reading about
Unicode, I see that in a "fixed-width" font that some characters are
double-wide, and I'm wondering if I need to handle that in Gedit.

I installed ttfonts-zh_CN in an attempt to see what happens with Chinese
characters in Gedit, but I'm not sure what I learned.  I think that AR PL
Kait6iM GB is monospaced, but 7 random (double-width) chinese characters
take up 13 western characters, not 14.  They also do so in other fonts I
tried (most seemed to substitute AR PL SungtiL GB for the Chinese
characters).

Is this double-width thing real, or am I confused?

Does Gedit do it, say, if a real Chinese language installation is done?

Does it make any sense to try to handle Chinese characters?  Do
word-wrapping and Chinse go together in, say, C programming source code
comments?

If they do go together, uhh, what constitutes word breaks?  Those odd
Unicode spaces?  Any double-wide character boundary?  (Not followed by
punctuation?)
____________________________________________________________________
TonyN.:'                       <mailto:tonynelson@georgeanelson.com>
     '                              <http://www.georgeanelson.com/>
发表于 2005-6-30 17:13:03 | 显示全部楼层
所谓的等宽字体,应该是指同一种script下,所有字符的宽度都相等。至于中文这个script中,汉字的宽度是否是en这个script里英文宽度的两倍,取决于制作字体时的考虑,以及pango的字体替换算法。因为在很多情况下,pango会试图使用同一种字体来显示所有的字符,所以你经常会看到gtk2的应用把英文字符也用中文字体来显示。

如果单就解决这个问题而言,你可以告诉这个软件的作者,在进行算法设计的时候,就把中日韩字符以及标点符号算成两个字符宽就行了。说中文的开发者可以自行设定正确的字体。他如果想要测试的话,可以安装文泉驿的点阵字体,这个字体应该是标准的双倍宽度
回复 支持 反对

使用道具 举报

 楼主| 发表于 2005-6-30 18:44:30 | 显示全部楼层
script 是什么意思?以前只在 qterm 的配置里看到过
回复 支持 反对

使用道具 举报

发表于 2005-7-1 00:02:15 | 显示全部楼层
script是字体这个范畴内的一个术语,大概跟字符集的意思差不多,也可以理解为Unicode范围。总之不是脚本的意思了
回复 支持 反对

使用道具 举报

 楼主| 发表于 2005-7-4 09:28:56 | 显示全部楼层
是不是可以理解为在 Unicode 同一码位的字符,在不同语言中有不同的外观表示,因此这样指定?
那么应用程序在请求字体的时候,可以指定 script 吗? 可以指定语言吗? 可以指定字符集吗? 同时指定两项会不会冲突?
回复 支持 反对

使用道具 举报

发表于 2005-7-5 05:41:04 | 显示全部楼层
Unicode同一码位的glyph不同,是通过字体的不同来区分的。同一个字体里,一个Unicode当然只能对应一个glyph。不过TTF或OTF都提供了一个叫做feature的东西,它可以将一个字符用另外一个字符替代。这需要字体解释引擎将相应的feature映射到locale中,不过目前没有一个字体解释引擎可以支持这个feature。

应用程序在请求字体的时候,是不可以指定script的,至少在Qt和Pango中是这样的,X就更不用说了。Pango收到的应该只是Unicode代码而已。
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表