网上太多此类的文章了,且记下自己用的方法,以备日后参考!
首先当然是要挖出Windows中所使用的TrueType字体了,列表如下:
courbd.ttf
courbi.ttf
couri.ttf
cour.ttf
simsun.ttf <-- 宋体,原本为simsun.ttc,请修改扩展名为ttf
tahomabd.ttf
tahoma.ttf
verdanab.ttf
verdanai.ttf
verdana.ttf
将上面这些文件放到这里:
[root@redhat /tmp] # cd /usr/share/fonts
[root@redhat /usr/share/fonts] # mkdir TrueType
[root@redhat /usr/share/fonts] # cd TrueType
[root@redhat /usr/share/fonts/TrueType] # cp /tmp/*.ttf ./
刷新字体缓存:
[root@redhat /usr/share/fonts/TrueType] # fc-cache -fv
fc-cache: "/usr/share/fonts": caching, 0 fonts, 6 dirs
fc-cache: "/usr/share/fonts/bitmap-fonts": caching, 32 fonts, 0 dirs
fc-cache: "/usr/share/fonts/zh_TW": caching, 0 fonts, 1 dirs
fc-cache: "/usr/share/fonts/zh_TW/TrueType": caching, 2 fonts, 0 dirs
fc-cache: "/usr/share/fonts/TrueType": caching, 11 fonts, 0 dirs
fc-cache: "/usr/share/fonts/default": caching, 0 fonts, 2 dirs
fc-cache: "/usr/share/fonts/default/ghostscript": caching, 8 fonts, 0 dirs
fc-cache: "/usr/share/fonts/default/Type1": caching, 35 fonts, 0 dirs
fc-cache: "/usr/share/fonts/zh_CN": caching, 0 fonts, 1 dirs
fc-cache: "/usr/share/fonts/zh_CN/TrueType": caching, 3 fonts, 0 dirs
fc-cache: "/usr/share/fonts/bitstream-vera": caching, 10 fonts, 0 dirs
fc-cache: "/usr/X11R6/lib/X11/fonts/Type1": caching, 29 fonts, 0 dirs
fc-cache: "/usr/X11R6/lib/X11/fonts/OTF": caching, 0 fonts, 0 dirs
fc-cache: "/root/.fonts": skipping, no such directory
fc-cache: succeeded
生成fonts.dir和fonts.scale文件:
[root@redhat /usr/share/fonts/TrueType] # ttmfdir -d ./ -o fonts.dir
[root@redhat /usr/share/fonts/TrueType] # vi fonts.dir
不知道什么原因,生成的fonts.dir文件没有包含SimSun 宋体字形,所以我们需要手动修改一下了,增加下面的内容:
simsun.ttf -misc-SimSun-medium-r-normal--0-0-0-0-p-0-ansi-1251
simsun.ttf -misc-SimSun-medium-r-normal--0-0-0-0-p-0-ascii-0
simsun.ttf -misc-SimSun-medium-r-normal--0-0-0-0-p-0-gb2312.1980-0
simsun.ttf -misc-SimSun-medium-r-normal--0-0-0-0-p-0-gbk-0
记着把fonts.dir复制一份,并更名为fonts.scale
接下来我们需要修改/etc/fonts/fonts.conf来调整中英文显示的优先顺序:
[root@redhat /etc/fonts] # vi fonts.conf
加入我们新放入的字体:
<!--
Serif faces <--第一个需要增加的地方
-->
<alias>
<family>Bitstream Vera Serif</family>
<family>Times</family>
<family>Times New Roman</family>
<family>Nimbus Roman No9 L</family>
<family>Luxi Serif</family>
<family>Kochi Mincho</family>
<family>Tahoma</family>
<family>Verdana</family>
<family>Simsun</family>
<family>AR PL SungtiL GB</family>
<family>AR PL Mingti2L Big5</family>
<family>Baekmuk Batang</family>
<default><family>serif</family></default>
</alias>
<!--
Provide required aliases for standard names <--第二个要修改的地方
-->
<alias>
<family>serif</family>
<prefer>
<family>Nimbus Roman No9 L</family>
<family>Thorndale AMT</family>
<family>Bitstream Vera Serif</family>
<family>Times New Roman</family>
<family>Luxi Serif</family>
<family>Times</family>
<family>KacstQura</family>
<family>Frank Ruehl CLM</family>
<family>Lohit Bengali</family>
<family>Lohit Gujarati</family>
<family>Lohit Hindi</family>
<family>Lohit Punjabi</family>
<family>Lohit Tamil</family>
<family>Kochi Mincho</family>
<family>Tahoma</family> <-- 加在红色标明的字体之前
<family>Verdana</family>
<family>Simsun</family>
<family>ZYSong18030</family>
<family>AR PL SungtiL GB</family>
<family>AR PL Mingti2L Big5</family>
<family>Baekmuk Batang</family>
</prefer>
</alias>
同样的动作,也要套用到<family>sans-serif</family>区块!
最后,就退出到普通帐号,startx开启X-Window环境: