FreeBSD/Linux的中文字体美化

网上太多此类的文章了,且记下自己用的方法,以备日后参考!

首先当然是要挖出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 local
[root@redhat /usr/share/fonts] # cd local
[root@redhat /usr/share/fonts/local] # cp /tmp/*.ttf ./


刷新字体缓存:

[
root@redhat
/usr/share/fonts/local] # 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/local": 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/local] # ttmkfdir -d ./ -o fonts.dir
[root@redhat /usr/share/fonts/local] # vi fonts.dir


记着把fonts.dir复制一份,并更名为fonts.scale

接下来我们需要修改/etc/fonts/local.conf来调整中英文显示的优先顺序:

[root@redhat /etc/fonts] # vi local.conf


内容如下:


<fontconfig>




<alias>
<family>seriffamily>
<prefer>
<family>Bitstream Vera Seriffamily>
<family>DejaVu Seriffamily>
<family>SimSunfamily>
<family>MingLiufamily>
<family>WenQuanYi Bitmap Songfamily>
prefer>
alias>
<alias>
<family>sans-seriffamily>
<prefer>
<family>Tahomafamily>
<family>Bitstream Vera Sansfamily>
<family>DejaVu Sansfamily>
<family>SimSunfamily>
<family>MingLiufamily>
<family>WenQuanYi Bitmap Songfamily>
prefer>
alias>
<alias>
<family>monospacefamily>
<prefer>
<family>Bitstream Vera Sans Monofamily>
<family>DejaVu Sans Monofamily>
<family>SimSunfamily>
<family>MingLiufamily>
<family>WenQuanYi Bitmap Songfamily>
prefer>
alias>



<alias>
<family>SimSunfamily>
<accept><family>宋体family>accept>
alias>
<alias>
<family>NSimSunfamily>
<accept><family>新宋体family>accept>
alias>
<alias>
<family>SimHeifamily>
<accept><family>黑体family>accept>
alias>
<alias>
<family>Microsoft YaHeifamily>
<accept><family>微软雅黑family>accept>
alias>
<alias>
<family>FangSong_GB2312family>
<accept>
<family>仿宋family>
<family>仿宋_GB2312family>
accept>
alias>
<alias>
<family>KaiTi_GB2312family>
<accept>
<family>楷体family>
<family>楷体_GB2312family>
accept>
alias>
<alias>
<family>YouYuanfamily>
<accept><family>幼圆family>accept>
alias>
<alias>
<family>MingLiUfamily>
<accept><family>細明體family>accept>
alias>
<alias>
<family>PMingLiUfamily>
<accept><family>新細明體family>accept>
alias>



<match target="pattern">
<test name="family"><string>宋体string>test>
<edit name="family" mode="assign"><string>SimSunstring>edit>
match>
<match target="pattern">
<test name="family"><string>新宋体string>test>
<edit name="family" mode="assign"><string>NSimSunstring>edit>
match>
<match target="pattern">
<test name="family"><string>細明體string>test>
<edit name="family" mode="assign"><string>MingLiUstring>edit>
match>
<match target="pattern">
<test name="family"><string>新細明體string>test>
<edit name="family" mode="assign"><string>PMingLiUstring>edit>
match>
<match target="pattern">
<test name="family"><string>黑体string>test>
<edit name="family" mode="assign"><string>SimHeistring>edit>
match>
<match target="pattern">
<test name="family"><string>微软雅黑string>test>
<edit name="family" mode="assign"><string>Microsoft YaHeistring>edit>
match>
<match target="pattern">
<test name="family"><string>仿宋string>test>
<edit name="family" mode="assign"><string>FangSong_GB2312string>edit>
match>
<match target="pattern">
<test name="family"><string>仿宋_GB2312string>test>
<edit name="family" mode="assign"><string>FangSong_GB2312string>edit>
match>
<match target="pattern">
<test name="family"><string>楷体string>test>
<edit name="family" mode="assign"><string>KaiTi_GB2312string>edit>
match>
<match target="pattern">
<test name="family"><string>楷体_GB2312string>test>
<edit name="family" mode="assign"><string>KaiTi_GB2312string>edit>
match>
<match target="pattern">
<test name="family"><string>幼圆string>test>
<edit name="family" mode="assign"><string>YouYuanstring>edit>
match>



<match target="font">
<edit name="hinting" mode="assign">
<bool>truebool>
edit>
<edit name="autohint" mode="assign">
<bool>truebool>
edit>
<edit name="antialias" mode="assign">
<bool>truebool>
edit>
match>



<match target="font">
<test name="lang" compare="contains">
<string>zhstring>
<string>jastring>
<string>kostring>
test>
<edit name="hinting" mode="assign">
<bool>truebool>
edit>
<edit name="autohint" mode="assign">
<bool>falsebool>
edit>
<edit name="antialias" mode="assign">
<bool>truebool>
edit>
match>



<match target="font">
<test name="family" compare="eq">
<string>MingLiUstring>
<string>PMingLiUstring>
test>
<edit name="hintstyle">
<const>hintfullconst>
edit>
match>


<match target="font">
<test name="lang" compare="contains">
<string>zhstring>
<string>jastring>
<string>kostring>
test>

<test name="family" qual="all" compare="not_eq">
<string>Microsoft YaHeistring>
test>
<test name="pixelsize" compare="more_eq">
<int>8int>
test>
<test name="pixelsize" compare="less_eq">
<int>18int>
test>
<edit name="antialias" mode="assign">
<bool>falsebool>
edit>
match>


<match target="font">
<test name="lang" compare="contains">
<string>zhstring>
<string>jastring>
<string>kostring>
test>
<test name="spacing" compare="eq">
<const>dualconst>
test>
<edit name="globaladvance" mode="assign">
<bool>falsebool>
edit>
<edit name="spacing" mode="assign">
<const>proportionalconst>
edit>
match>


<match target="font">
<test name="family" qual="any">
<string>SimSunstring>
<string>NSimSunstring>
<string>MingLiUstring>
<string>PMingLiUstring>
<string>WenQuanYi Bitmap Songstring>
<string>SimHeistring>
<string>Microsoft YaHeistring>
<string>FangSong_GB2312string>
<string>KaiTi_GB2312string>
<string>YouYuanstring>
<string>AR PL ShanHeiSun Unistring>
<string>AR PL ZenKai Unistring>
test>
<test name="pixelsize" compare="more_eq">
<int>8int>
test>
<test name="pixelsize" compare="less_eq">
<int>12int>
test>
<edit name="pixelsize" mode="assign">
<int>12int>
edit>
match>


<match target="pattern" >
<test name="family">
<string>WenQuanYi Bitmap Songstring>
test>
<test name="pixelsize" compare="more_eq">
<int>18int>
test>
<edit name="family" mode="assign">
<string>SimSunstring>
edit>
match>


<match target="font">
<test name="family" compare="contains">
<string>Songstring>
<string>Sunstring>
<string>Kaistring>
<string>Mingstring>
test>
<test name="weight" compare="less_eq">
<int>100int>
test>
<test name="weight" compare="more_eq">
<int>180int>
test>
<edit name="embolden" mode="assign">
<bool>truebool>
edit>
match>


<match target="pattern">
<test name="weight" compare="more">
<const>mediumconst>
test>
<test name="family" compare="eq">
<string>SimSunstring>
<string>NSimSunstring>
<string>MingLiUstring>
<string>PMingLiUstring>
<string>WenQuanYi Bitmap Songstring>
test>
<edit name="family" mode="assign">

<string>Microsoft YaHeistring>
edit>
match>






<match target="font">
<edit name="embeddedbitmap" mode="assign">
<bool>truebool>
edit>
match>

fontconfig>

最后,就退出到普通帐号,startx开启X-Window环境:

你可能感兴趣的:(03.,操作系统)