Linux中的中文字体总是显示不正常,究其缘由是Linux系统默认情况下不会安装中文宋体字体。因此浏览中文网站的时候基本上看到的都是些乱码,系统里的中文也全显示为小方块的乱码。将 windows xp 系统里的宋体字体安装到Linux系统中可以彻底解决该问题。 
       
      XP里宋体字体文件的位置和文件名是:C:\WINDOWS\Fonts\simsun.ttc 

      把simsun.ttc文件复制到Linux系统中(我放在/bak/fonts下)。 

      现将我完整的命令以及返回参数粘贴如下: 
     
[root@localhost ~]# cd /usr/share/fonts 
[root@localhost fonts]# mkdir cnfonts 
[root@localhost fonts]# cd cnfonts 
[root@localhost cnfonts]# mkdir simsun 
[root@localhost cnfonts]# cp /bak/fonts/simsun.ttc /usr/share/fonts/cnfonts/simsun 
[root@localhost cnfonts]# cd simsun 
[root@localhost simsun]# ls -l 
total 10284 
-rw-r--r-- 1 root root 10512288 Apr 24 10:35 simsun.ttc 
[root@localhost simsun]# mkfontscale 
[root@localhost simsun]# ls -l 
total 10288 
-rw-r--r-- 1 root root      716 Apr 24 10:38 fonts.scale 
-rw-r--r-- 1 root root 10512288 Apr 24 10:35 simsun.ttc 
[root@localhost simsun]# mkfontdir 
[root@localhost simsun]# ls -l 
total 10292 
-rw-r--r-- 1 root root      716 Apr 24 10:39 fonts.dir 
-rw-r--r-- 1 root root      716 Apr 24 10:38 fonts.scale 
-rw-r--r-- 1 root root 10512288 Apr 24 10:35 simsun.ttc 
[root@localhost simsun]# pwd 
/usr/share/fonts/cnfonts/simsun 
[root@localhost simsun]# chkfontpath --add /usr/share/fonts/cnfonts/simsun/ 
[root@localhost simsun]# service xfs reload 
Reloading xfs:                                             [ OK  ] 
[root@localhost simsun]# 
     
        到此,字体安装完毕,注销Linux系统,使用Xwindow登录,在登陆框将语言选择为“中文(大陆)”,再登陆系统就可以正常显示中文了。 
         
        至于如何将XP系统里的 simsun.ttc 文件复制到 Linux下面,各有各的方法。我是在虚拟机里运行Linux的,所以直接在XP里创建了FTP,在Linux里面登录xp的ftp把windows里的文件复制到 Linux 里面的。 
         
浙工局·宁波
2009.4.24