2009年4月15日星期三

fontconfig

fontconfig

这里是一些常用到属性的列表,关于所有的属性请 manpage

# family - String - 就是一般所看到的字型的名称了, 如 Arial
# style - String - 字型的 style, 像是 Regular, Bold, Italic...
# spacing - Int - 字型的宽度, Proportional 是有不同的宽度, monospace 是单一的宽度 (如 terminal 的字型)
# antialias - Bool - 决定该字型是否要被 anti-alias 绘制; 只能用在向量字型上 # hinting - Bool - 决定该字型是否要打开 hinting
# autohint - Bool - 决定是否要用 Freetype 自己的 hint 方法来 hint 字型, 还是用预设的方法来 hint
# rgba - Bool - 决定是否要用 subpixel 的方式来画字, 可以是 none (只用灰阶), rgb, bgr, vrgb, vbgr

match 主要有两种用法,一种是 pattern match, 另一种是 font match. 前者会把所有的字型 match 出来,所以针对它的更改会套用到所有的字型的选择方式上。后者只是它是针对个别字型的属性作修改。

<match target="pattern/font">
...
</match>

中间放的可以是一连串的 test, 然后是一连串的 edit. test 的用法是:
<test qual="any|all|first|not_first" name="属性" compare="eq|not_eq|less|less_eq|more|more_eq|contains|not_contains">
...
</test>
any 指的是说, 只要字型的该属性 list 之中有一项有符合要 test 的值, test 就会成立。all 的话要 list 之中所有的都符合,first 要第一个符合, not_first 要除了第一个以外有符合的。通常只会用到 any, 预设也是 any. name 里面填的就是前面所提的属性, 如 name="family". compare 是比较的条件, eq 是相等, less 是小于, 以此类推。 <test> 所包住的那个值就是要用来比较的值,包括: int, double, string, matrix, bool 等等。一旦 test 的条件都成立, 就会进行到 edit 的阶段,代表编辑符合条件上述 test 条件的属性:

<edit name="属性" mode="assign|assign_replace|prepend|append|prepend_first|append_last">

注意在 fontconfig 中, 属性 (property) 可以是一个 list, 亦即一个属性可有许多的值。 assign 是说把 match 到的值取代掉, assign_replace 是说把该 list 的所有值取代成指定的值, prepend 则是插在 list 中被 match 到的那个值的前头, 以此类推。</edit></test>

参考:
Fontconfig用户手册
http://hi.baidu.com/jmlover/blog/item/5ce6a6864e29cf3f67096e0a.html
Fontconfig配置详解
http://hi.baidu.com/jmlover/blog/item/effef6036bb210ed08fa930a.html

字体设置 (简体中文)
http://wiki.archlinux.org/index.php/%E5%AD%97%E4%BD%93%E8%AE%BE%E7%BD%AE

没有评论:

发表评论