加入收藏 | 设为首页 | 会员中心 | 我要投稿 常州站长网 (https://www.0519zz.com/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 服务器 > 搭建环境 > Linux > 正文

Linux桌面系统字体配置详解(二)

发布时间:2016-09-07 18:53:49 所属栏目:Linux 来源:站长网
导读:字体配置实战 下面,将以Fedora 20为例,自己动手将它配置为正确的显示效果。目前,在Linux系统上配置字体的工具是Fontconfig。 为什么是Fontconfig 感谢这个时

以上代码通过将文泉驿点阵宋体添加到AR PL UMing的前面来实现替换掉AR PL UMing自己的点阵,通过将文泉驿点阵正黑添加到文泉驿正黑和文泉驿等宽正黑的前面来显示点阵正黑。文泉驿的点阵只包含12px到16px的范围,对该范围大小的文泉驿正黑关闭抗锯齿。把控制台字体调到monospace-12,可以看到控制台中的中文使用点阵,如下图:

Linux桌面系统字体配置详解(二)

写到这里,我不得不提到另外一个问题,就是<edit...binding="?">...</edit>中binding究竟应该设置为什么的问题。binding属性有几种选择,分别是binding="strong"、binding="weak"和binding="same"。如果该属性设置不合理,则会出现这样的问题:明明使用fc-pattern查看的时候是文泉驿点阵宋体排在AR PL UMing前面,是DejaVu Sans Mono排在文泉驿等宽正黑前面,但是使用fc-match匹配的时候,偏偏首选的是AR PL UMing和文泉驿等宽正黑。为什么会这样呢?这是因为Fontconfig选择字体的时候不仅仅只看字体名的排列顺序,还要综合考虑一种字体能覆盖的字符集和字体大小范围,所以,在前面的例子中,虽然文泉驿点阵宋体排在AR PL UMing前面,但是它覆盖的字体大小范围只有12px到16px,DejaVu Sans Mono虽然排在文泉驿等宽正黑前面,但是其覆盖的字符集不包含中日韩文,所以Fontconfig就会首选排在后面的字体。为了解决这个问题,就必须把binding属性设置为strong,这样,不管什么情况都首选排在前面的字体,只有遇到该字体不能胜任的字符时才选择后面的字体。在我的配置文件中,我都是一路strong到底。

第七步:对没有包含斜体和粗体的字体自动合成斜体和粗体

代码如下:

 1<?xml version="1.0"?> 2<!DOCTYPE fontconfig SYSTEM "fonts.dtd"> 3<fontconfig> 4 <!-- 5  Artificial oblique for fonts without an italic or oblique version
 6 --> 7 8<match target="font"> 9 <!--  check to see if the font is roman  -->10<test name="slant">11<const>roman</const>12</test>13 <!--  check to see if the pattern requested non-roman  -->14<test target="pattern" name="slant" compare="not_eq">15<const>roman</const>16</test>17 <!--  multiply the matrix to slant the font  -->18<edit name="matrix" mode="assign">19<times>20<name>matrix</name>21<matrix><double>1</double><double>0.2</double>22<double>0</double><double>1</double>23</matrix>24</times>25</edit>26 <!--  pretend the font is oblique now  -->27<edit name="slant" mode="assign">28<const>oblique</const>29</edit>30 <!--  and disable embedded bitmaps for artificial oblique  -->31<edit name="embeddedbitmap" mode="assign">32<bool>false</bool>33</edit>34</match>3536 <!--37  Synthetic emboldening for fonts that do not have bold face available
38 -->3940<match target="font">41 <!--  check to see if the font is just regular  -->42<test name="weight" compare="less_eq">43<const>medium</const>44</test>45 <!--  check to see if the pattern requests bold  -->46<test target="pattern" name="weight" compare="more">47<const>medium</const>48</test>49 <!--50           set the embolden flag
51           needed for applications using cairo, e.g. gucharmap, gedit, ...
52 -->53<edit name="embolden" mode="assign">54<bool>true</bool>55</edit>56 <!--57          set weight to bold
58          needed for applications using Xft directly, e.g. Firefox, ...
59 -->60<edit name="weight" mode="assign">61<const>bold</const>62</edit>63</match>64</fontconfig>

~/fonts.conf.d/07-synthetic.conf

(编辑:常州站长网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

热点阅读