支持特定字符的已安装字体列表

ænd*_*rük 7 fonts unicode

如何找出系统上的哪些字体包含某个字符的覆盖范围,例如 U+2192?

我试过查看字符映射表,但我没有看到按字符查询字体的方法,只能按字体查询字符。

use*_*.dz 5

可能还有其他的工具,而是hb-shape给出了一定的成效,例(\u2192\u107\u106\u2191分别对应)。

$ hb-shape .fonts/Roboto-Light.ttf "?"
[NULL=0+498]

$ hb-shape .fonts/Roboto-Light.ttf "?"
[cacute=0+1054]

$ hb-shape .fonts/Roboto-Light.ttf "?"
[Cacute=0+1313]

$ hb-shape .fonts/Roboto-Light.ttf "?"
[NULL=0+498]
Run Code Online (Sandbox Code Playgroud)

如您所见,可用结果返回其 Unicode 名称,Cacute否则返回NULL

我一直在使用Unicode的进入Ctrl+ Shift+ u,或者你可能想通过这种方式,通过字体制作shell脚本循环:

$ hb-shape .fonts/Roboto-Light.ttf `echo -ne "\u2192"`
[NULL=0+498]
Run Code Online (Sandbox Code Playgroud)

作为参考,hb-shape是来自HarfBuzz Project一个 Unicode 文本整形引擎的测试工具。


miv*_*ivk 4

对于已安装的具有 Unicode 字符 U+2192 的字体,您可以使用fc-list

fc-list :charset=2192
Run Code Online (Sandbox Code Playgroud)

输出示例:

/usr/local/share/fonts/consolas/consolab.ttf: Consolas:style=Bold
/usr/local/share/fonts/consolas/consolai.ttf: Consolas:style=Italic
/usr/local/share/fonts/consolas/consola.ttf: Consolas:style=Regular
/usr/local/share/fonts/consolas/consolaz.ttf: Consolas:style=Bold Italic
/usr/share/fonts/opentype/cantarell/Cantarell-Bold.otf: Cantarell:style=Bold
/usr/share/fonts/opentype/cantarell/Cantarell-ExtraBold.otf: Cantarell,Cantarell Extra Bold:style=Extra Bold,Regular
...
/usr/share/texmf/fonts/opentype/public/lm/lmsansquot8-oblique.otf: Latin Modern Sans Quotation,LM Sans Quot 8:style=8 Oblique,Bold Italic
/usr/share/texmf/fonts/opentype/public/lm/lmsansquot8-regular.otf: Latin Modern Sans Quotation,LM Sans Quot 8:style=8 Regular,Regular
/usr/share/texmf/fonts/opentype/public/lm-math/latinmodern-math.otf: Latin Modern Math:style=Regular
Run Code Online (Sandbox Code Playgroud)

对于格式化输出,还有一个记录不完善的-f格式选项。请参阅man FcPatternFormatfontconfig文档页面,其中列出了一些可用属性

例如:

fc-list -f "%{file}\n\t%{family}\n" :charset=2192
Run Code Online (Sandbox Code Playgroud)