Debian 7 Wheezy 配置: 中文字体美化

参考的是这篇文章 http://blog.csdn.net/qq280948982/article/details/6782603

首先通过sudo apt-get install 直接安装 ttf-wqy-zenhei. 另外我还安装了 xfonts-wqy.
这两个字体安装完后, 不需要额外设置, Chrome的中文字体方块乱码问题就自动修复了, Iceweasel里面的中文字体也自动更换了.

另外, 如果要加入带版权的字体的话, 要将文件放到 /usr/local/share/fonts 下, 然后运行 sudo fc-cache.

Windows字体的正确安装方法:
1. 将windows/fonts里的字体文件, 放到不同的目录下. 我用了这些目录: Arial, Consola, SimSun, Tahoma, Verdana
2. 这些目录已经下面的字体文件, 必须设置成你当前用户可以访问的. 例如chown -R username:usergroup *, 或者 chmod -R 444 *
3. 运行 sudo fc-cache -f -v 更新字体缓存
4. 运行 fc-list |grep verdana 看一下是否已经正确识别并配置

如果在系统或者eclipse中选择后预览出现方块, 有可能是没有按#2设置权限.

字体的设置:
在Applications中找到Advanced Settings -> Fonts, 设置
Default font: Tahoma 9 (这个将使得所有的窗口文字, 菜单文字变得像Windows那样紧凑)
Window title font Tahoma Bold 9
其他不变, Text scaling factor 保持 1.0

贴近Windows的中文字体设置 Update 2013.05.20

参考的内容是 《Debian lenny字体设置》 http://www.verydemo.com/demo_c370_i964.html
在/etc/fonts/ 下新建文件 local.conf (根据fonts.conf的说明, 不要修改fonts.conf, 而是新建一个local.conf)

里面添加如下内容(有点乱, 复制的话点copy to clipboard就可以了)

<!--?xml version="1.0"?-->

<!-- /etc/fonts/local.conf file to configure local fonts -->

<fontconfig>

<!--
    字体别名设置,主要设置SimSun和NSimSun,设置之后后面的SimSun和
    NSimSun英文替换只用针对英文别名写,中文别名可以不写了。
-->
    <match target="pattern">
        <test name="family">
            <string>宋体</string>
        </test>
        <edit name="family" mode="assign">
            <string>SimSun</string>
        </edit>
    </match>

<!--
    Sans-serif 字体族
-->
    <alias>
        <family>SimSun</family>
        <family>Verdana</family>
        <family>Arial</family>
        <default><family>sans-serif</family></default>
    </alias>
<!--
    Serif 字体族
-->
    <alias>
        <family>SimSun</family>
        <default><family>serif</family></default>
    </alias>
<!--
    Monospace 字体族
    <alias>
        <default><family>monospace</family></default>
    </alias>
-->

<!--
    SimSun字体,英文部分用Tahoma替换,解决粗体英文破粹问题
    “宋体”不用再做设置,前面已用别名解决
-->
    <match target="pattern">
        <test name="family">
            <string>SimSun</string>
        </test>
        <edit name="family" mode="prepend" binding="strong">
            <string>Tahoma</string>
        </edit>
    </match>

<!--
    字体优先设置,越靠前越优先匹配
-->

    <alias>
        <family>sans-serif</family>
<prefer>
            <family>SimSun</family>
            <family>Tahoma</family>
            <family>Verdana</family>
            <family>Arial</family>
        </prefer>
    </alias>
    <alias>
        <family>serif</family>
<prefer>
            <family>SimSun</family>
        </prefer>
    </alias>
    <alias>
        <family>monospace</family>
<prefer>
        </prefer>
    </alias>

<!--
    针对Tahoma,Verdana字体,大号粗体显示太粗,
    这里我替换成Arial,临界值为20px(96 dpi 下15pt)
    15*96/72=20,注意下面的单位是像素pixelsize,可以
    测试后再换成其它值
-->
<!--
    <match target="pattern">
        <test name="family" >
            <string>Tahoma</string>
            <string>Verdana</string>
        </test>
        <test name="weight" compare="more_eq">
            <int>180</int>
        </test>
        <test name="pixelsize" compare="more_eq" >
            <double>20</double>
        </test>
        <edit name="family" mode="prepend" binding="strong">
            <string>Arial</string>
        </edit>
    </match>
-->

<!--
    第二部分
    全局设置和调整,包括AA,HINT等
-->
<!--
    设置DPI,请设置成xdpyinfo | grep dot看到的DPI,也可以不设置。
-->
    <match target="pattern">
        <edit name="dpi" mode="assign">
            <double>96</double>
        </edit>
    </match>

<!--
    子像素渲染设置,据需要而定,我的LCD就没开,设置为NONE,如果看到字体
    颜色有问题(如泛蓝,泛绿色等),请设置成rgb或其它值,具体参考man fonts-conf
-->
    <match target="font">
        <edit name="rgba" mode="assign">
            <const>none</const>
        </edit>
    </match>

<!--
    设置最小字体,所有字体都如此,英文优先是Tahoma 8pt
-->
    <match target="font">
        <test name="pixelsize" compare="more_eq">
            <double>8</double>
        </test>
        <test name="pixelsize" compare="less_eq">
            <double>11</double>
        </test>
        <edit name="pixelsize" mode="assign">
            <double>11</double>
        </edit>
    </match>

<!--
    设置CJK最小字体,主要体现为SimSun ,和上面的综合起来就是
    Tahoma 11px,SimSun 12px
    对应96 dpi 下的就是 8pt , 9pt
    具体临界值自己可以调整
-->
    <match target="font">
        <test name="lang" compare="contains">
            <string>zh</string>
            <string>ja</string>
            <string>ko</string>
        </test>
        <test name="pixelsize" compare="more_eq">
            <double>8</double>
        </test>
        <test name="pixelsize" compare="less_eq">
            <double>12</double>
        </test>
        <edit name="pixelsize" mode="assign">
            <double>12</double>
        </edit>
    </match>

<!--
    支持伪斜体,从fonts.conf中粗过来的。
-->
    <match target="font">
        <!-- check to see if the font is roman -->
        <test name="slant">
            <const>roman</const>
        </test>
        <!-- check to see if the pattern requested non-roman -->
        <test target="pattern" name="slant" compare="not_eq">
            <const>roman</const>
        </test>
        <!-- multiply the matrix to slant the font -->
        <edit name="matrix" mode="assign">
            <times>
                <name>matrix</name>
                <matrix>
                    <double>1</double><double>0.2</double>
                    <double>0</double><double>1</double>
                </matrix>
            </times>
        </edit>
        <!-- pretend the font is oblique now -->
        <edit name="slant" mode="assign">
            <const>oblique</const>
        </edit>
    </match>

<!--
    支持伪粗体,从fonts.conf中粘过来的
-->
    <match target="font">
        <!-- check to see if the font is just regular -->
        <test name="weight" compare="less_eq">
            <int>100</int>
        </test>
        <!-- check to see if the pattern requests bold -->
        <test target="pattern" name="weight" compare="more_eq">
            <int>180</int>
        </test>
        <!-- set the embolden flag -->
        <edit name="embolden" mode="assign">
            <bool>true</bool>
        </edit>
    </match>

<!--
    默认AA设置
    针对自由字体,打开AA,AutoHint,关掉Hinting,样式为hintfull
    MS和CJK字体,下面专门调整
-->
    <match target="font">
        <edit name="antialias" mode="assign">
            <bool>true</bool>
        </edit>
        <edit name="autohint" mode="assign">
            <bool>true</bool>
        </edit>
        <edit name="hinting" mode="assign">
            <bool>false</bool>
        </edit>
        <edit name="hintstyle" mode="assign">
            <const>hintfull</const>
        </edit>
    </match>

<!--
    解决中英文间距过大的问题
-->
    <match target="font">
        <test name="lang" compare="contains">
            <string>zh</string>
            <string>ja</string>
            <string>ko</string>
        </test>
        <edit name="spacing" mode="assign">
            <const>proportional</const>
        </edit>
        <edit name="globaladvance" mode="assign">
            <bool>false</bool>
        </edit>
    </match>

<!--
    CJK字体AA设置,小于20px(96dpi 上是15pt)时不开AA
-->
    <match target="font">
        <test name="lang" compare="contains">
            <string>zh</string>
            <string>ja</string>
            <string>ko</string>
        </test>
        <test name="pixelsize" compare="more_eq">
            <double>8</double>
        </test>
        <test name="pixelsize" compare="less_eq">
            <double>20</double>
        </test>
        <edit name="antialias" mode="assign">
            <bool>false</bool>
        </edit>
        <edit name="autohint" mode="assign">
            <bool>false</bool>
        </edit>
        <edit name="hinting" mode="assign">
            <bool>false</bool>
        </edit>
    </match>

<!--
    CJK字体AA设置,大于20px(96dpi 上是15pt)时开AA,AutoHint,Hinting
    采用hintfull,
    在我机器上autohint和hinting都开效果比较好,可以自己调整,一般两者只开一个,
    具体视情况而定
-->
    <match target="font">
        <test name="lang" compare="contains">
            <string>zh</string>
            <string>ja</string>
            <string>ko</string>
        </test>
        <test name="pixelsize" compare="more_eq">
            <double>20</double>
        </test>
        <edit name="antialias" mode="assign">
            <bool>true</bool>
        </edit>
        <edit name="autohint" mode="assign">
            <bool>true</bool>
        </edit>
        <edit name="hinting" mode="assign">
            <bool>true</bool>
        </edit>
    </match>

<!--
    如果是斜体CJK字体,打开AA,不喜欢可以把这一段删除掉或全部改成false
-->
    <match target="font">
        <test name="lang" compare="contains">
            <string>zh</string>
            <string>ja</string>
            <string>ko</string>
        </test>
        <test name="slant" compare="not_eq">
            <const>roman</const>
        </test>
        <edit name="antialias" mode="assign">
            <bool>true</bool>
        </edit>
        <edit name="autohint" mode="assign">
            <bool>true</bool>
        </edit>
        <edit name="hinting" mode="assign">
            <bool>true</bool>
        </edit>
    </match>

<!--
    微软字体设置
-->
<!--
    默认,打开AA和hint,不喜欢,可以全部改成false
-->
    <match target="font">
        <test name="foundry">
            <string>monotype</string>
            <string>microsoft</string>
        </test>
        <edit name="antialias" mode="assign">
            <bool>false</bool>
        </edit>
        <edit name="autohint" mode="assign">
            <bool>false</bool>
        </edit>
        <edit name="hinting" mode="assign">
            <bool>true</bool>
        </edit>
        <edit name="hintstyle" mode="assign">
            <const>hintfull</const>
        </edit>
    </match>

<!--
    如果是Courier New,打开AA,AutoHint,Hinting,不喜欢可以全部改成false
-->
    <match target="font">
        <test name="family">
            <string>Courier</string>
            <string>Courier New</string>
        </test>
        <edit name="antialias" mode="assign">
            <bool>false</bool>
        </edit>
        <edit name="autohint" mode="assign">
            <bool>false</bool>
        </edit>
        <edit name="hinting" mode="assign">
            <bool>true</bool>
        </edit>
        <edit name="hintstyle" mode="assign">Courier New
            <const>hintfull</const>
        </edit>
    </match>

<!--
    Courier New 字体大小设置
    这里设置最小为14.7px(96 dpi 上是11pt),可以依情况而定
-->
    <match target="font">
        <test name="family">
            <string>Courier New</string>
        </test>
        <test name="pixelsize" compare="less_eq">
            <double>12</double>
        </test>
        <edit name="pixelsize" mode="assign">
            <double>12</double>
        </edit>
    </match>
</fontconfig>

 

posted on 2013-05-15 04:16  Milton  阅读(551)  评论(0编辑  收藏  举报

导航