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

首先当然是要挖出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>

<!--//
===============================
Linux Dist: Ubuntu 7.04 Feisty
===============================
fontconfig: 2.4.2-1ubuntu1
freetype: 2.2.1-5ubuntu1.1
libxft: 2.1.12-1
xorg: 7.2-0ubuntu11
==============================
file: ~/.fonts.conf
version: 20070606 final
//
-->

<!--// 对字体簇中的字体进行重新排序 //-->
<alias>
<family>serif</family>
<prefer>
<family>Bitstream Vera Serif</family>
<family>DejaVu Serif</family>
<family>SimSun</family>
<family>MingLiu</family>
<family>WenQuanYi Bitmap Song</family>
</prefer>
</alias>
<alias>
<family>sans-serif</family>
<prefer>
<family>Tahoma</family>
<family>Bitstream Vera Sans</family>
<family>DejaVu Sans</family>
<family>SimSun</family>
<family>MingLiu</family>
<family>WenQuanYi Bitmap Song</family>
</prefer>
</alias>
<alias>
<family>monospace</family>
<prefer>
<family>Bitstream Vera Sans Mono</family>
<family>DejaVu Sans Mono</family>
<family>SimSun</family>
<family>MingLiu</family>
<family>WenQuanYi Bitmap Song</family>
</prefer>
</alias>

<!--// 字体别名的设定-01 //-->
<!--// 这段的设定测试的时候发现并没有起作用,但还是留着,作为01部分。 //-->
<alias>
<family>SimSun</family>
<accept><family>宋体</family></accept>
</alias>
<alias>
<family>NSimSun</family>
<accept><family>新宋体</family></accept>
</alias>
<alias>
<family>SimHei</family>
<accept><family>黑体</family></accept>
</alias>
<alias>
<family>Microsoft YaHei</family>
<accept><family>微软雅黑</family></accept>
</alias>
<alias>
<family>FangSong_GB2312</family>
<accept>
<family>仿宋</family>
<family>仿宋_GB2312</family>
</accept>
</alias>
<alias>
<family>KaiTi_GB2312</family>
<accept>
<family>楷体</family>
<family>楷体_GB2312</family>
</accept>
</alias>
<alias>
<family>YouYuan</family>
<accept><family>幼圆</family></accept>
</alias>
<alias>
<family>MingLiU</family>
<accept><family>細明體</family></accept>
</alias>
<alias>
<family>PMingLiU</family>
<accept><family>新細明體</family></accept>
</alias>

<!--// 字体的别名设定-02 //-->
<!--// 下面这段设定是可以work的,所以放在后面作为02部分。 //-->
<match target="pattern">
<test name="family"><string>宋体</string></test>
<edit name="family" mode="assign"><string>SimSun</string></edit>
</match>
<match target="pattern">
<test name="family"><string>新宋体</string></test>
<edit name="family" mode="assign"><string>NSimSun</string></edit>
</match>
<match target="pattern">
<test name="family"><string>細明體</string></test>
<edit name="family" mode="assign"><string>MingLiU</string></edit>
</match>
<match target="pattern">
<test name="family"><string>新細明體</string></test>
<edit name="family" mode="assign"><string>PMingLiU</string></edit>
</match>
<match target="pattern">
<test name="family"><string>黑体</string></test>
<edit name="family" mode="assign"><string>SimHei</string></edit>
</match>
<match target="pattern">
<test name="family"><string>微软雅黑</string></test>
<edit name="family" mode="assign"><string>Microsoft YaHei</string></edit>
</match>
<match target="pattern">
<test name="family"><string>仿宋</string></test>
<edit name="family" mode="assign"><string>FangSong_GB2312</string></edit>
</match>
<match target="pattern">
<test name="family"><string>仿宋_GB2312</string></test>
<edit name="family" mode="assign"><string>FangSong_GB2312</string></edit>
</match>
<match target="pattern">
<test name="family"><string>楷体</string></test>
<edit name="family" mode="assign"><string>KaiTi_GB2312</string></edit>
</match>
<match target="pattern">
<test name="family"><string>楷体_GB2312</string></test>
<edit name="family" mode="assign"><string>KaiTi_GB2312</string></edit>
</match>
<match target="pattern">
<test name="family"><string>幼圆</string></test>
<edit name="family" mode="assign"><string>YouYuan</string></edit>
</match>

<!--// 所有字体关于AA、Hint、AutoHint的默认全局设定 //-->
<!--// 注意没有指定hintstyle,不希望它作为全局设定 //-->
<match target="font">
<edit name="hinting" mode="assign">
<bool>true</bool>
</edit>
<edit name="autohint" mode="assign">
<bool>true</bool>
</edit>
<edit name="antialias" mode="assign">
<bool>true</bool>
</edit>
</match>

<!--// CJK字体关于AA、Hint、AutoHint的设定 //-->
<!--// 注意没有指定hintstyle,不希望它作为全局设定 //-->
<match target="font">
<test name="lang" compare="contains">
<string>zh</string>
<string>ja</string>
<string>ko</string>
</test>
<edit name="hinting" mode="assign">
<bool>true</bool>
</edit>
<edit name="autohint" mode="assign">
<bool>false</bool>
</edit>
<edit name="antialias" mode="assign">
<bool>true</bool>
</edit>
</match>

<!--// CJK字体中hinting需要火力全开的字体 //-->
<!--// MingLiU/PMingLiU一定要全力hint,否则字会错乱 //-->
<match target="font">
<test name="family" compare="eq">
<string>MingLiU</string>
<string>PMingLiU</string>
</test>
<edit name="hintstyle">
<const>hintfull</const>
</edit>
</match>

<!--// 对CJK字体中8~18号的字体不做AA处理 //-->
<match target="font">
<test name="lang" compare="contains">
<string>zh</string>
<string>ja</string>
<string>ko</string>
</test>
<!--// 微软雅黑字体需要启用AA,故排除在外 //-->
<test name="family" qual="all" compare="not_eq">
<string>Microsoft YaHei</string>
</test>
<test name="pixelsize" compare="more_eq">
<int>8</int>
</test>
<test name="pixelsize" compare="less_eq">
<int>18</int>
</test>
<edit name="antialias" mode="assign">
<bool>false</bool>
</edit>
</match>

<!--// 禁止英文字体和CJK字体等宽 //-->
<match target="font">
<test name="lang" compare="contains">
<string>zh</string>
<string>ja</string>
<string>ko</string>
</test>
<test name="spacing" compare="eq">
<const>dual</const>
</test>
<edit name="globaladvance" mode="assign">
<bool>false</bool>
</edit>
<edit name="spacing" mode="assign">
<const>proportional</const>
</edit>
</match>

<!--// 设定中文字体的最小字号 //-->
<match target="font">
<test name="family" qual="any">
<string>SimSun</string>
<string>NSimSun</string>
<string>MingLiU</string>
<string>PMingLiU</string>
<string>WenQuanYi Bitmap Song</string>
<string>SimHei</string>
<string>Microsoft YaHei</string>
<string>FangSong_GB2312</string>
<string>KaiTi_GB2312</string>
<string>YouYuan</string>
<string>AR PL ShanHeiSun Uni</string>
<string>AR PL ZenKai Uni</string>
</test>
<test name="pixelsize" compare="more_eq">
<int>8</int>
</test>
<test name="pixelsize" compare="less_eq">
<int>12</int>
</test>
<edit name="pixelsize" mode="assign">
<int>12</int>
</edit>
</match>

<!--// 当文泉驿点阵字体的字号超过18时需要替换成宋体 //-->
<match target="pattern" >
<test name="family">
<string>WenQuanYi Bitmap Song</string>
</test>
<test name="pixelsize" compare="more_eq">
<int>18</int>
</test>
<edit name="family" mode="assign">
<string>SimSun</string>
</edit>
</match>

<!--// 设定中文粗体 //-->
<match target="font">
<test name="family" compare="contains">
<string>Song</string>
<string>Sun</string>
<string>Kai</string>
<string>Ming</string>
</test>
<test name="weight" compare="less_eq">
<int>100</int>
</test>
<test name="weight" compare="more_eq">
<int>180</int>
</test>
<edit name="embolden" mode="assign">
<bool>true</bool>
</edit>
</match>

<!--// 对中文字体的粗体进行替换 //-->
<match target="pattern">
<test name="weight" compare="more">
<const>medium</const>
</test>
<test name="family" compare="eq">
<string>SimSun</string>
<string>NSimSun</string>
<string>MingLiU</string>
<string>PMingLiU</string>
<string>WenQuanYi Bitmap Song</string>
</test>
<edit name="family" mode="assign">
<!--// 我喜欢微软雅黑作为粗体 //-->
<string>Microsoft YaHei</string>
</edit>
</match>

<!--// 优化中文字体中的英文显示-01 //-->
<!--// 只是为了针对Web显示的美观,却带来了另外一个问题:在程序的字体选取中无法
取到中文字体,因为最后都会被替换成Tahoma,这对于OOo来说简直就是灾难。 //
-->
<!--//
<match target="pattern">
<test name="family" compare="eq">
<string>SimSun</string>
<string>NSimSun</string>
</test>
<edit name="family" mode="prepend" binding="strong">
<string>Tahoma</string>
</edit>
</match>
//
-->

<!--// 优先使用内嵌的点阵字 //-->
<match target="font">
<edit name="embeddedbitmap" mode="assign">
<bool>true</bool>
</edit>
</match>

</fontconfig>

最后,就退出到普通帐号,startx开启X-Window环境:
GitHub 加速计划 / li / linux-dash
10.39 K
1.2 K
下载
A beautiful web dashboard for Linux
最近提交(Master分支:2 个月前 )
186a802e added ecosystem file for PM2 4 年前
5def40a3 Add host customization support for the NodeJS version 4 年前
Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐