Ubuntu8.04中字体设置的问题(最终版)

来源:互联网 发布:html5shiv.js 下载 编辑:程序博客网 时间:2024/04/30 11:35

Linux /showfly 

今天一整天都在看/etc/fonts/conf.avail下的配置文件,并参考了其它的一些美化方案,终于得到在Ubuntu8.04版中的最终美化方案。一直以来我都喜欢AA显示字体,不喜欢Windows下的点阵,所以所有的美化方案都是基于此的,有同好的朋友可以参考一下。
之前的几种美化方案多少都有不足的地方,要么不能显示Flash字体,要么Openoffice的界面不能显示系统字体,这个方案现在为止都能够很好的解决以上问题。
主要的修改:
1.我发现我的/etc/fonts/conf.d下并没有29-language-selector-zh.conf、69-language-selector-zh-cn.conf、99-language-selector-zh.conf这几个文件,所以首先从/etc/fonts/conf.avail里copy过来。其实Ubuntu8.04把原来的/etc/fonts/language-selector.conf分解成了这几个文件。在conf.d里只剩下这些文件:

shofly@shofly-laptop:/etc/fonts/conf.d$ ls
10-antialias.conf             50-user.conf
10-hinting.conf               51-local.conf
10-hinting-none.conf          52-languageselector.conf
10-no-sub-pixel.conf          53-monospace-lcd-filter.conf
20-fix-globaladvance.conf     60-latin.conf
20-unhint-small-vera.conf     65-fonts-persian.conf
29-language-selector-zh.conf  65-nonlatin.conf
30-cjk-aliases.conf           65-ttf-thai-tlwg.conf
30-defoma.conf                69-language-selector-zh-cn.conf
30-metric-aliases.conf        70-no-bitmaps.conf
30-urw-aliases.conf           80-delicious.conf
40-nonlatin.conf              90-synthetic.conf
45-latin.conf                 99-language-selector-zh.conf
49-sansserif.conf

2.修改了10-hinting.conf,29-language-selector-zh.conf,49-sansserif.conf,69-language-selector-zh-cn.conf,99-language-selector-zh.conf,并增加了10-hinting-none.conf,下面我贴一下这几个文件的内容:
a.10-hinting.conf:将True改为false,意思关闭hinting;
b.10-hinting-none.conf:
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<!--  Use None Hinting -->
  <match target="font">
    <edit name="hintstyle" mode="assign"><const>hintnone</const></edit>
  </match>
</fontconfig>

c.29-language-selector-zh.conf:
<fontconfig>
    <match target="font" >
        <edit name="globaladvance">
            <bool>false</bool>
        </edit>
        <edit name="spacing">
            <int>0</int>
        </edit>
        <edit name="hinting">
            <bool>false</bool>
        </edit>
        <edit name="autohint">
            <bool>false</bool>
        </edit>
        <edit name="antialias" mode="assign">
            <bool>true</bool>
        </edit>
                <edit name="hintstyle" mode="assign">
            <const>hintnone</const>
                </edit>
    </match>
</fontconfig>

d.49-sansserif.conf:
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<!--
  If the font still has no generic name, add sans-serif
 -->
    <match target="pattern">
        <test qual="all" name="family" compare="not_eq">
            <string>sans-serif</string>
        </test>
        <test qual="all" name="family" compare="not_eq">
            <string>serif</string>
        </test>
        <test qual="all" name="family" compare="not_eq">
            <string>monospace</string>
        </test>
        <edit name="family" mode="append_last">
            <string>FZLanTingCuHei</string>
        </edit>
    </match>
</fontconfig>

经过这个设置,Flash中就用FZLanTingCuHei显示了(这个是我自己修改的字体)
e.69-language-selector-zh-cn.conf:
<fontconfig>

    <match target="pattern">
        <test qual="any" name="family">
            <string>serif</string>
        </test>
        <edit name="family" mode="prepend" binding="strong">
                    <string>Neo Tech Std</string>
            <string>FZCuYaSong</string>
        </edit>
    </match>
    <match target="pattern">
        <test qual="any" name="family">
            <string>sans-serif</string>
        </test>
        <edit name="family" mode="prepend" binding="strong">
            <string>Macintosh</string>
            <string>FZLanTingCuHei</string>
        </edit>
    </match>
    <match target="pattern">
        <test qual="any" name="family">
            <string>monospace</string>
        </test>
        <edit name="family" mode="prepend" binding="strong">
            <string>DejaVu Sans Mono</string>
            <string>STHeiti</string>
        </edit>
    </match>

</fontconfig>

看过以前文章的朋友,应该知道这些的作用(不明白的可以回去看一下)
f.99-language-selector-zh.conf
<fontconfig>

    <match target="font" >
                <!-- check to see if the font is just regular -->
                <test name="weight" compare="less_eq">
                        <int>100</int>
        </test>
        <test compare="more_eq" target="pattern" name="weight" >
            <int>180</int>
        </test>
        <edit mode="assign" name="embolden" >
            <bool>true</bool>
        </edit>
    </match>

</fontconfig>

通过这些设置,应该可以显示自己喜欢的字体,又可以在Flash和openoffice中显示自己喜欢的字体。

如果要修改显示字体,可以修改69-language-selector-zh-cn.conf和49-sansserif.conf

这两天查阅了一些资料,现更新如下:
如果不想在/etc/fonts/fonts.conf中添加上一篇文章中的配置,也可以在/etc/fonts/下新建local.conf,把那些复制过来,记得在文件头加上<fontconfig>和文件尾加上</fontconfig>。
加外为了使Flash中显示中文,可以把/etc/fonts/conf.avail/中的49-sansserif.conf删除或改成49-sansserif.conf.bak。

原创粉丝点击