「Fontconfig」-

认识

官网:https://www.freedesktop.org/wiki/Software/fontconfig/

Fontconfig,软件包,包含用于配置和自定义字体访问的库和支持程序。

组成

https://wiki.archlinux.org/title/Font_configuration

The font paths known to Fontconfig by default are: /usr/share/fonts/, ~/.local/share/fonts (and ~/.fonts/, now deprecated). Fontconfig will scan these directories recursively. For ease of organization and installation, it is recommended to use these font paths when adding fonts.

命令程序 and 配置文件

fonts.conf https://www.freedesktop.org/software/fontconfig/fontconfig-user.html

/usr/share/fonts/, ~/.local/share/fonts (and ~/.fonts/, now deprecated)

fc-cache,用于创建字体信息的缓存,该缓存用于加快应用对字体的处理。

%cachedir%/*-%arch%.cache-%version%,由 fc-cache 命令生成的缓存文件,该文件中包含了字体文件名到字体属性的映射。这些文件在应用程序启动时,当应用需要定位适当的字体时,由 fontconfig 库加载。在 Kali GNU/Linux Rolling 中,这些文件位于
/var/cache/fontconfig 目录中。

fc-cat,用于读取字体信息缓存。

fc-list,列出系统中所有可用的字体。

fc-pattern,用于解析模式(默认为空模式),并显示已解析的结果。

fc-query,其用于查询字体文件,并打印结果模式。其查询那些使用标准 fontconfig 规则的字体文件,并为每个找到的 Family 而打印出字体模式。如果给出 –index,则只查询文件的一个 Family,否则显示多有的 Family。

fc-scan,用于扫描字体文件和目录,并打印生成的模式。

fc-validate,用于验证字体文件。

fc-match – match available fonts

用于匹配可用字体,或者查找满足条件的字体。

-a,显示最匹配字体的排序后列表,不做任何的修剪处理。


-s,显示最匹配字体的排序后列表。


-v,打印每个匹配的字体的更详细的输出,或者是只打印提供的元素。


-f,根据 format 指定的格式进行输出。
pattern,显示匹配 pattern 的字体。默认为空。


element,如果设置了,则显示匹配字体的指定元素。比如:lang、family
-V,显示版本信息。


-h,显示选项摘要。

构建

安装,但通常无需安装(桌面发行版,默认已安装)。

通过仓库安装

# Kali GNU/Linux Rolling
apt-get install fontconfig

通过编译安装

参考 BLFS/Fontconfig-2.12.1: http://www.linuxfromscratch.org/blfs/view/7.10/general/fontconfig.html

查看字体文件信息:fc-query STSong-Regular.ttf

参考

BLFS / Fontconfig-2.12.1 http://www.linuxfromscratch.org/blfs/view/7.10/general/fontconfig.html
BLFS / Fontconfig: http://www.linuxfromscratch.org/blfs/view/stable/general/fontconfig.html
Linux 字体美化实战(Fontconfig 配置): http://www.jinbuguo.com/gui/linux_fontconfig.html
Changing the default fallback subsitution fonts in Linux: http://eosrei.net/articles/2016/02/changing-default-fallback-subsitution-fonts-linux