Chinaunix首页 | 论坛 | 博客
  • 博客访问: 101874716
  • 博文数量: 19283
  • 博客积分: 9968
  • 博客等级: 上将
  • 技术积分: 196062
  • 用 户 组: 普通用户
  • 注册时间: 2007-02-07 14:28
文章分类

全部博文(19283)

文章存档

2011年(1)

2009年(125)

2008年(19094)

2007年(63)

分类: LINUX

2008-05-21 08:55:30

作者: basiozwq  出自:
因为在安装linux(redhat enterprise linux 5.0)的过程中忘记了选择支持中文,所以机器在安装完之后从Mozzila访问中文网站全是乱码,在“查看”菜单中即使选择GBK的编码字符集或其他中文字符集也无效,另外在shell中的中文也为乱码。

重装机器,个人觉得比较烦,不想那样做。于是我选择了对其进行汉化,就在网上找了半天些资料,(现在可以显示中文了,但还有些乱码,有时间尽量去解决,这里先分享!-见笑!)另外,大家可别在真正的服务器上做这个实验,要做也可以,出问题了别找我!

第一步:

修改文件/etc/sysconfig/i18n。将里面的en:US.UTF8修改成zh_CN.GB18030,修改后的内容如下:

LANG="zh_CN.GB18030"

LANGUAGE="zh_CN.GB18030:zh_CN.GB2312:zh_CN"

SUPPORTED="zh_CN.GB18030:zh_CN:zh"

SYSFONT="lat0-sun16"

SYSFONTACM="8859-15"

第二步:

安装中文字库。字库文件一般是独立于系统的,所以我选择了将windows下的字库文件安装到linux中去,大家可以到网上找找看,我最终选择的是windows中的字库文件位于C:\WINDOWS\Fonts下,选择其中的三个文件(simsun.ttc,tahoma.ttf ,tahomabd.ttf)。

首先,逐个创建文件夹,直到拥有/usr/share/fonts/default/TrueType。然后,想办法将这三个字库文件直接复制到linux分区的/usr/share/fonts/default/TrueType。

其次我们要配置显卡文件/etc/X11/XF86Config——我装的这个系统没有这个文件,可以从其他地方获取一个,我是从redhat linux 9.0中copy的!X中可以支持TrueType字体(一种可缩放的矢量字体,这些字体需要字体渲染引擎来读取。字体渲染引擎有很多种,我们现在就是要配置指定用xtt这个字体渲染引擎去/usr/share/fonts/default/TrueType目录读取上面的三个字体文件的信息(如大小,分辩率,编码等)。修改其中的Section "Module"处,加入Load “xtt”让其用使用xtt这个引擎,并注释掉与其冲突的#Load "freetype"与 #Load "type1"。

另外,在Section "Files"处加入FontPath “/usr/share/fonts/default/TrueType”一句让xtt引擎去这个目录去找字库文件。修改后的部分文件如下:

Section "Files"

# RgbPath is the location of the RGB database. Note, this is the name of the

# file minus the extension (like ".txt" or ".db"). There is normally

# no need to change the default.

# Multiple FontPath entries are allowed (they are concatenated together)

# By default, Red Hat 6.0 and later now use a font server independent of

# the X server to render fonts.

RgbPath "/usr/X11R6/lib/X11/rgb"

FontPath "unix/:7100"

FontPath “/usr/share/fonts/default/TrueType”

EndSection

Section "Module"

Load "dbe"

Load "extmod"

Load "fbdevhw"

Load "glx"

Load "record"

#Load "freetype"

#Load "type1"

Load "dri"

Load “xtt”

EndSection

最后,建立配置文件fonts.dir与fonts.scale。方法很简单,在/usr/share/fonts/default/TrueType运行命令ttmkfdir > fonts.dir即可生成一个有内容的fonts.scale的文件与一个空的fonts.dir。然后在fonts.scale中加入一行(别忘了修改第一行的那个数字):

ds=y:ai=0.3:SimSun.ttf –misc-SimSun-bold-i-normal –-0-0-0-0-p-0-gbk-0

接着,将fonts.scale复制一份到fonts.dir即可。(运行命令cp fonts.scale fonts.dir)

最后,将/usr/x11R6/lib/X11/fonts/encodings/encoding.dir(这个文件也是从别出cp过来的)复制到/usr/share/fonts/default/TrueType中。

重启机器,OK。
阅读(876) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~