fc-match 命令详解

| 选择喜欢的代码风格  

A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

fc-match 命令安装:


-bash/zsh: fc-list command not found

#Debian
apt-get install fontconfig

#Ubuntu
apt-get install fontconfig

#Alpine
apk add fontconfig

#Arch Linux
pacman -S fontconfig

#Kali Linux
apt-get install fontconfig

#CentOS
yum install fontconfig

#Fedora
dnf install fontconfig

#OS X
brew install fontconfig

#Raspbian
apt-get install fontconfig

#Docker
docker run cmd.cat/fc-match fc-match

fc-match 命令补充说明:


Fontconfig 是用于配置和自定义字体访问的库。

fc-match 使用正常的 fontconfig 匹配规则匹配模式(默认为空模式),以找到可用的最佳字体。如果给出 --sort,则显示最佳匹配字体的排序列表。该 --all 选项的作用类似于 --sort

Fontconfig 可以:

  • 自动安装时发现新字体,从而消除了常见的配置问题。
  • 执行字体名称替换,以便在缺少字体时可以选择适当的替代字体。
  • 确定完全覆盖一组语言所需的一组字体。
  • 由于使用基于 XML 的配置文件而构建了 GUI 配置工具(尽管具有自动发现功能,但我们认为这一需求已降至最低)。
  • 即使已安装了数千种字体,也可以在减少内存使用的同时,高效,快速地在已安装的字体集中找到所需的字体。
  • X Render ExtensionFreeType 配合使用,可在显示器上实现高质量,抗锯齿和亚像素渲染的文本。

Fontconfig 不会:

  • 自己渲染字体(留给 FreeType 或其他渲染机制)
  • 以任何方式依赖于 X Window 系统,因此仅打印机应用程序不具有此类依赖关系

fc-match 命令语法:


fc-match [ -asvVh ] [ --all ] [ --sort ] [ --verbose ] [ -f format | --format format ] [ --version ] [ --help ]
         [ pattern  [ element ... ]  ]

fc-match 命令选项:


-a --all
      Displays sorted list of best matching fonts, but do not do any pruning on the list.

-s --sort
      Displays sorted list of best matching fonts.

-v
      Print verbose output of the whole font pattern for each match, or elements if any is provided.

-f --format format
      Format output according to the format specifier format.

-V --version
      Show version of the program and exit.

-h --help
      Show summary of options.

pattern
      Displays fonts matching pattern (uses empty pattern by default).

element
      If set, the element property is displayed for matching fonts.

fc-match 命令实例:


fc-match 返回最佳匹配字体的排序列表:

$ fc-match -s 'DejaVu Serif'


DejaVuSans.ttf: "DejaVu Sans" "Book"
DejaVuSans-Bold.ttf: "DejaVu Sans" "Bold"
DejaVuSans-Oblique.ttf: "DejaVu Sans" "Oblique"
DejaVuSans-BoldOblique.ttf: "DejaVu Sans" "Bold Oblique"

fc-match 返回默认匹配的字体列表:

$ fc-match

DejaVuSans.ttf: "DejaVu Sans" "Book"

fc-match 命令扩展阅读:




fc-match 命令评论

共收录到 491Linux 命令