四、Fontconfig配置文件的结构
在2.4.2以后的版本中,Fonfconfig的配置文件采用了模块化的结构。配置文件由以下文件组成
/usr/local/etc/fonts/fonts.conf
/usr/local/etc/fonts/conf.avail/*.conf
/usr/local/etc/fonts/conf.d/*.conf
/usr/local/etc/fonts/conf.d/ 目录下的文件大多数是 conf.avail/ 目录下的连接,大致是如下这些:
20-fix-globaladvance.conf
20-lohit-gujarati.conf
20-unhint-small-vera.conf
30-amt-aliases.conf
30-urw-aliases.conf
40-generic.conf
49-sansserif.conf
50-user.conf
51-local.conf
60-latin.conf
65-fonts-persian.conf
65-nonlatin.conf
69-unifont.conf
80-delicious.conf
90-synthetic.conf
前面的数字用来控制执行的先后顺序,从名称上就可以看出,每个.conf文件都有针对性的字体特性进行处理。
而实现这种模块化,所借助的就是 /usr/local/etc/fonts/fonts.conf 文件。
<!--
Load local system customization file
-->
<include ignore_missing="yes">conf.d</include>
分析/usr/local/etc/fonts/conf.d 目录下的文件,并通过打开Fontconfig的调试功能,可知这些配置文件的执行顺序:
Loading config file /usr/local/etc/fonts/fonts.conf
Scanning config dir /usr/local/etc/fonts/conf.d
Loading config file /usr/local/etc/fonts/conf.d/20-fix-globaladvance.conf
Loading config file /usr/local/etc/fonts/conf.d/20-lohit-gujarati.conf
Loading config file /usr/local/etc/fonts/conf.d/20-unhint-small-vera.conf
Loading config file /usr/local/etc/fonts/conf.d/30-amt-aliases.conf
Loading config file /usr/local/etc/fonts/conf.d/30-urw-aliases.conf
Loading config file /usr/local/etc/fonts/conf.d/40-generic.conf
Loading config file /usr/local/etc/fonts/conf.d/49-sansserif.conf
Loading config file /usr/local/etc/fonts/conf.d/50-user.conf
Loading config file /home/dbhrscom/.fonts.conf
Loading config file /usr/local/etc/fonts/conf.d/51-local.conf
Loading config file /usr/local/etc/fonts/conf.d/60-latin.conf
Loading config file /usr/local/etc/fonts/conf.d/65-fonts-persian.conf
Loading config file /usr/local/etc/fonts/conf.d/65-nonlatin.conf
Loading config file /usr/local/etc/fonts/conf.d/69-unifont.conf
Loading config file /usr/local/etc/fonts/conf.d/80-delicious.conf
Loading config file /usr/local/etc/fonts/conf.d/90-synthetic.conf
五、Fontconfig所提供的调试功能
Fontconfig提供了调制功能,用来诊断字体配置运行时的信息,使用调制功能非常简单,在KDE环境下用模拟终端定义 FC_DEBUG 这个环境变量的值即可:
例如:csh环境下
setenv FC_DEBUG 1
在模拟终端中启动相应的程序,就可以查看设定的调试信息。可以按照下面Fontconfig用户手册介绍的说明设定具体显示的调试信息。
MATCH 1 Brief information about font matching 字体匹配信息
MATCHV 2 Extensive font matching information
EDIT 4 Monitor match/test/edit execution 显示match/test/edit信息
FONTSET 8 Track loading of font information at startup
CACHE 16 Watch cache files being written
CACHEV 32 Extensive cache file writing information
PARSE 64 (no longer in use)
SCAN 128 Watch font files being scanned to build caches
SCANV 256 Verbose font file scanning information
MEMORY 512 Monitor fontconfig memory usage
CONFIG 1024 Monitor which config files are loaded 显示配置文件装载信息
LANGSET 2048 Dump char sets used to construct lang values
OBJTYPES 4096 Display message when value typechecks fail |