当前位置:Linux教程 - RedHat - RedHat7.1 GBK解决方案

RedHat7.1 GBK解决方案

redhat7.1 GBK-HowTo:

整理测试者:MagicFeather studio--cjacker and yufei.

致谢:
dl bird :方案的最初提出者.
james su :fonts.dir的完善.
moonlight :部分配置文件.
yufei :miniChinput的修正_MagicChinput.

提要:
本方案适合于linux的初级使用者(像我们这样的).

环境:
基本完成汉化的RedHat 7.1(正确修改/etc/gtk/gtkrc.zh_CN and /etc/gnome/gtkrc.zh_CN等等)
windows me or 2000 的SimSun.ttc字体(simsun.ttf应该也可以,但没有simsun.ttc漂亮).
minichinput或MagicChinput.

方案:

1./usr/X11R6/lib/X11/locale目录下:
创建zh_CN.GBK目录.
cd zh_CN.GBK
创建XLC_LOCALE文件,内容如下:
++++++++++ cut from here++++++++++++++++++++++++++++++++
#
# XLC_FONTSET category
#
XLC_FONTSET
# fs0 class (7 bit ASCII)
fs0 {
charset {
name ISO8859-1:GL
}
font {
primary ISO8859-1:GL
vertical_rotate all
}
}
# fs1 class
fs1 {
charset {
name GBK-0:GLGR
}
font {
primary GBK-0:GLGR
substitute GBK-0:GLGR
}
}
END XLC_FONTSET

#
# XLC_XLOCALE category
#
XLC_XLOCALE

encoding_name zh_CN.GBK
mb_cur_max 2
state_depend_encoding False

wc_encoding_mask x00008000
wc_shift_bits 8

use_stdc_env True
force_convert_to_mb True

# cs0 class
cs0 {
side GL:Default
length 1
wc_encoding x00000000
ct_encoding ISO8859-1:GL
}

# cs1 class
cs1 {
side none
length 2
byte1 x81,xfe
byte2 x40,x7e;x80,xfe

wc_encoding x00008000
ct_encoding GBK-0:GLGR:x1bx25x2fx32x80x88x47x42x4bx2dx30x02

mb_conversion [x8140,xfefe]->x0140
ct_conversion [x0140,x7efe]->x8140
}

END XLC_XLOCALE
++++++++++++++++ end ++++++++++++++++++++++++++++++++++++++++++++++++
修改locale.dir:
加入:zh_CN.GBK/XLC_LOCALE:zh_CN.GBK

2./usr/share/locale目录:
ln -s zh_CN.GB2312 zh_CN.GBK(为使用GB2312的mo)


3./usr/X11R6/lib/module/codeconv目录
将libGBK.a拷贝到这个目录.(libGBK.a可到magicfeather.zouping.com.cn下载,文件很小)


4./usr/share/fonts/default/TrueType/目录
拷贝simsun.ttc到这个目录.创建fonts.dir and fonts.scale.
示范内容:
+++++++++ cut from here ++++++++++++++++++++++++++++++++++++
27
arib____.ttf -macromedia-Arioso-bold-r-normal--0-0-0-0-p-0-ascii-0
arir____.ttf -macromedia-Arioso-medium-r-normal--0-0-0-0-p-0-ascii-0
chvor___.ttf -macromedia-ChevaraOutline-medium-r-normal--0-0-0-0-p-0-ascii-0
chvr____.ttf -macromedia-Chevara-medium-r-normal--0-0-0-0-p-0-ascii-0
cogb____.ttf -macromedia-Conga-bold-r-normal--0-0-0-0-p-0-ascii-0
cogr____.ttf -macromedia-Conga-medium-r-normal--0-0-0-0-p-0-ascii-0
helb____.ttf -macromedia-Helmet-bold-r-normal--0-0-0-0-p-0-ascii-0
helbi___.ttf -macromedia-Helmet-bold-i-normal--0-0-0-0-p-0-ascii-0
helcb___.ttf -macromedia-HelmetCondensed-bold-r-normal--0-0-0-0-p-0-ascii-0
helcbi__.ttf -macromedia-HelmetCondensed-bold-i-normal--0-0-0-0-p-0-ascii-0
helci___.ttf -macromedia-HelmetCondensed-medium-i-normal--0-0-0-0-p-0-ascii-0
helcr___.ttf -macromedia-HelmetCondensed-medium-r-normal--0-0-0-0-p-0-ascii-0
heli____.ttf -macromedia-Helmet-medium-i-normal--0-0-0-0-p-0-ascii-0
helr____.ttf -macromedia-Helmet-medium-r-normal--0-0-0-0-p-0-ascii-0
starbats.ttf -macromedia-StarBats-medium-r-normal--0-0-0-0-p-0-microsoft-symbol
starmath.ttf -macromedia-StarMath-medium-r-normal--0-0-0-0-p-0-microsoft-symbol
timb____.ttf -macromedia-Timmons-bold-r-normal--0-0-0-0-p-0-ascii-0
timbi___.ttf -macromedia-Timmons-bold-i-normal--0-0-0-0-p-0-ascii-0
timi____.ttf -macromedia-Timmons-medium-i-normal--0-0-0-0-p-0-ascii-0
timr____.ttf -macromedia-Timmons-medium-r-normal--0-0-0-0-p-0-ascii-0
simsun.ttc -misc-SimSun-medium-r-normal--0-0-0-0-p-0-ascii-0
simsun.ttc -misc-SimSun-medium-r-normal--0-0-0-0-p-0-fcd8859-15
simsun.ttc -misc-SimSun-medium-r-normal--0-0-0-0-p-0-iso8859-1
simsun.ttc -misc-SimSun-medium-r-normal--0-0-0-0-p-0-iso8859-15
simsun.ttc -misc-SimSun-medium-r-normal--0-0-0-0-p-0-koi8-r
simsun.ttc -misc-SimSun-medium-r-normal--0-0-0-0-p-0-gbk-0
simsun.ttc -misc-SimSun-medium-r-normal--0-0-0-0-p-0-gb2312.1980-0
+++++++++++++ end ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
为提高起动速度,可参考以下(james su文)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
sw=1.0:bw=0.5:simsun.ttf -misc-SimSun-medium-r-normal--0-0-0-0-c-0-ascii-0
sw=1.0:bw=0.5:simsun.ttf -misc-SimSun-medium-r-normal--0-0-0-0-c-0-fcd8859-15
simsun.ttf -misc-SimSun-medium-r-normal--0-0-0-0-c-0-gb2312.1980-0
sw=1.0:bw=0.5:simsun.ttf -misc-SimSun-medium-r-normal--0-0-0-0-c-0-ibm-cp850
sw=1.0:bw=0.5:simsun.ttf -misc-SimSun-medium-r-normal--0-0-0-0-c-0-iso8859-1
sw=1.0:bw=0.5:simsun.ttf -misc-SimSun-medium-r-normal--0-0-0-0-c-0-iso8859-15
sw=1.0:bw=0.5:simsun.ttf -misc-SimSun-medium-r-normal--0-0-0-0-c-0-koi8-r
simsun.ttf -misc-SimSun-medium-r-normal--0-0-0-0-c-0-gbk-0
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

4./usr/lib/Chinput目录:
修改Chinput.ad文件,内容:
chinput.gblocale=zh_CN.GBK
chinput.gbfont=-misc-simsun-medium-r-normal--16-*-*-*-*-*-gbk-0

5./etc/目录:
修改bashrc文件:
增加:
export LANG=zh_CN.GBK
export LC_ALL=zh_CN.GBK
export KDE_LANG=zh_CN.GB2312
export XMODIFIERS=@im=Chinput
修改/etc/sysconfig/i18n文件.改为
LANG=zh_CN.GBK

6./etc/X11/xinit/xinitrc.d/目录:
修改xinput文件.
增加:
magicchinput或chinput.
为使输入法自启动.

7./etc/gtk/gtkrc.zh_CN文件示例:
+++++++++++ cut from here ++++++++++++++++++++++++++++++++++++++++++++
# $(gtkconfigdir)/gtkrc.zh_CN
#
# This file defines the fontsets for Chinese language (zh) using
# the simplified chinese standard GuoBiao as in mainland China (CN)
#
# 1999, Pablo Saratxaga
#

style ""gtk-default-zh-cn"" {
fontset = ""-adobe-helvetica-medium-r-normal--14-*-*-*-*-*-iso8859-1,
-misc-simsun-medium-r-normal--14-*-*-*-*-*-gbk-0,*-r-*""
}
class ""GtkWidget"" style ""gtk-default-zh-cn""

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
8.最后工作:
查看/etc/X11/XF86Config-4文件.确保字体段有/usr/share/fonts/default/TrueType定义.
模块段有Load ""xtt"".

9.退出系统重新login.

10.检测:
测试能否输入这个汉字:
儁(GBK拼音 jun)


BUG:
gnome-terminal中不能进行一些GBK汉字(常用汉字可输入).


其他:
手动配置各个桌面系统或某些应用软件.以达到最好的显示效果.
所需libGBK.a文件(52k)