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

摘要:
--字体别名设置主要用于设置SimSun和NSimSun。设置后,SimSun和NSimSun的英文替换仅用于英文别名,中文别名可以省略——SimSun字体,英文部分替换为Tahoma,以解决打破粗体英文的问题,不需要设置“宋体”,并且别名已用于解决--˃SimSun宋体,优先级越高的匹配--˃sans-serifSimSun宋体Arial˂serif˂˂˂宋体和宋体字体,粗体字体太粗。这里我用Arial替换它,临界值是20px15*96/72=20。请注意,下面的单位是像素大小,测试后可以更改为其他值--˃˂!

参考的是这篇文章 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>

免责声明:文章转载自《Debian 7 Wheezy 配置: 中文字体美化》仅用于学习参考。如对内容有疑问,请及时联系本站处理。

上篇js 常用创建a标签实现下载功能sqlserver 2005 64bit express下篇

宿迁高防,2C2G15M,22元/月;香港BGP,2C5G5M,25元/月 雨云优惠码:MjYwNzM=

相关文章

小程序-formdata传参

项目背景,后端接口要求formData传参: 在util.js文件中封装转化函数,代码如下: const formatTime = date =>{ const year =date.getFullYear() const month = date.getMonth() + 1const day =date.getDate() con...

单点登陆 ---密钥

一、需求描述 现在有A系统和B系统,需要在A系统进行单点登陆到B系统。 二、B系统要做事 1、提供一个可以让A系统登陆的网址 http://localhost:8083/Account/SingleSignOn/?u=xxx&token=FB92B341DBDB59D7 其中,u为加密后的用户名,token为B系统与A系统单点登录握手密钥 2、控制...

[ PyQt入门教程 ] Qt Designer工具的使用

Qt Designer是PyQt程序UI界面的实现工具,使用Qt Designer可以拖拽、点击完成GUI界面设计,并且设计完成的.ui程序可以转换成.py文件供python程序调用。本文主要通过用户登录需求描述Qt Designer工具开发界面的使用方法。 本文主要内容1、Qt Designer程序主界面窗口介绍。 2、Qt Designer程序实现界面...

调整 ANTD 组件菜单的字体大小。

调整 ANTD 组件菜单的字体大小:经过多次试验,原有字体太小,只有12px,通过下列CSS 强制加大。 1、分组子菜单(标题) .ant-menu-inline > .ant-menu-submenu > .ant-menu-submenu-title{font-size: 15px !important;} 2、菜单项 .ant-menu-...

【逆向】Yara规则编写安装与使用教程

前言 Yara是一个能够帮助恶意软件研究人员识别和分类恶意软件样本的工具(类似正则表达式)。规则可以通过文本或二进制的模式被创建,并且每个规则均由一组字符串和一个布尔表达式组成。 1 //示例规则 2 rule Test : Trojan 3 { 4 //规则描述 5 meta: 6 author = "Sunset" 7...

单项目实现vendor分离编译,增加编译效率(vue-cli)

1、在build文件夹下添加文件:webpack.dll.config.js const path = require('path') const webpack = require('webpack') const package = require('../package.json') const AssetsPlugin = require('ass...