|
|
今天闲来无事研究了一下fontconfig的配置。以前也看过fonts.conf这个文件,但是一直没有很留意其中的“人工粗体”一小节。其原文是这样的:
<!--
Synthetic emboldening for fonts that do not have bold face available
-->
<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>200</int>
</test>
<!-- set the embolden flag -->
<edit name="embolden" mode="assign">
<bool>true</bool>
</edit>
</match>
意图很明显,就是对于那些认为需要作为“粗体”展现的pattern,而对应的字体本身不支持粗体时,通过调整"embolden"属性,模拟出粗体(比如可能是在偏移1个像素的地方重绘一次,造成“粗体”的假象)。结构上,前面两个<test>节是用于筛选出条件的,对于满足条件的pattern信息,通过<edit>节设置加粗的属性。如果把前面两个<test>都注释掉,那么结果就是所有的字体都绘被加粗显示。试验的结果也证实了这一点,包括中文在内的所有子体都是粗体了。显然如果能找到粗体与非粗体的临界条件,并在<test>中表现出来,那样就能很好的显示粗体了。我把第二个<test>打开,并把<int>值由200调整为100,结果发现仍然是全部粗体,也就是说没有得到很好的区分,于是试着把100改为150,再打开firefox,去了几个常用的网站,都能交好的显示粗体和正常字体了8-D
最终我的/etc/fonts/local.conf文件(不要改fonts.conf)中加入了如下的一节:
<!--
Synthetic emboldening for fonts that do not have bold face available
-->
<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>150</int>
</test>
<!-- set the embolden flag -->
<edit name="embolden" mode="assign">
<bool>true</bool>
</edit>
</match> |
|