8

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.

1
  • I didn't give it enough time to test, but I hope if it doesn't work or still looking for better than that. Let me know, I may give it another try to search for other options.
    – user.dz
    Feb 19, 2014 at 11:31

2 Answers 2

5

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.

3
  • 1
    The output looks different now (I'm using hb-shape 1.0.1): $ hb-shape ./Roboto-Light.ttf echo -ne "\u2192" [gid0=0+908]
    – Étienne
    May 23, 2018 at 16:15
  • @Étienne, that's quite old, using 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.
    – user.dz
    May 23, 2018 at 23:57
  • 1
    Sorry for being unclear, my comment was not a question. I just wanted to warn other people ghat the output looks different on other versions, but your solurion indeed worked and I upvoted it yesterday.
    – Étienne
    May 24, 2018 at 5:46
4

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .