How can I find out which fonts on my system include coverage of a certain character, for example, U+2192?
I've tried looking in Character Map, but I don't see a way to query fonts by character, only characters by font.
How can I find out which fonts on my system include coverage of a certain character, for example, U+2192?
I've tried looking in Character Map, but I don't see a way to query fonts by character, only characters by font.
May be there other tools but hb-shape
gives some results, Example (\u2192
, \u107
, \u106
and \u2191
respectively):
$ 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]
As you notice, available ones results return with their Unicode name Cacute
otherwise NULL
.
I have entered Unicode using Ctrl+Shift+u , or you may want this way for making shell script to loop through fonts:
$ hb-shape .fonts/Roboto-Light.ttf `echo -ne "\u2192"`
[NULL=0+498]
For reference, hb-shape
is a test tool from HarfBuzz Project a Unicode text shaping engine.
echo -ne "\u2192"
[gid0=0+908]
sh-shape
1.4.2 in Ubuntu 17.10, Robot-light.tff 2.000980, 2014, I get similar output [.notdef=0+498]
. If that gid0
is constant for all non-supported characters, then you can use it. Also I recommend to you asking directly in HarfBuzz mailing list. They are active developers.
For installed fonts which have the Unicode character U+2192, you could use fc-list
:
fc-list :charset=2192
Example output:
/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
For formatting the output, there is also a poorly documented -f
format option. See man FcPatternFormat
and the fontconfig documentation page which has a list of some available properties.
For example:
fc-list -f "%{file}\n\t%{family}\n" :charset=2192