How to find which font provides a particular Unicode glyph

fontsunicode

On the Feodora 23 system I upgraded from F22, the U1F32D symbol ? shows up just fine in the terminal, but on the one I installed from scratch, I get the box-with-numbers placeholder. I just checked and I have about 60 font packages on the system where it doesn't work, and over 200 where it does. Without inspecting each one manually, is there a way to identify which font I need to add?

Best Answer

This answer has thankfully been superseded by a new option to the fc-list command, :charset=1F32D as given here and available from version 2.11.91 (late December 2014). Thanks to @scruss for this update.


To keep the whole history of this answer.

If you give the command

fc-list -v

it should list for every font the charset property which is a bitmask of which character codes exist in the font. For example, for a simple font like fc-list -v 'Courier 10 Pitch' it has lines:

charset: 
0000: 00000000 ffffffff ffffffff 7fffffff 00000000 ffffffff ffffffff ffffffff
0001: 00000000 00020000 000c0006 61000003 00040000 00000000 00000000 00000000
...
00fb: 00000006 00000000 00000000 00000000 00000000 00000000 00000000 00000000

Take the hex number in the first column, like the last line 00fb, and shift it left by 8 bits. It is the start of the unicode value. The bitmask 00000006 says a glyph exists for codes 1 and 2 (6 = 2+4 = 1<<1 | 1<<2) which you add to the first column to get 00fb01 and 00fb02. (These glyphs are, for example, latin small ligature fi.)

So in the case of U1F32D you need to grep for 01f3: and look for a bit set at index 2d in the line, i.e. 00000000 00002000 ... (probably!). Note the 0's here just show the position of the 2. The actual values may be any hex digit. (A grep pattern might be 01f3: ........ ....[2367abef]). The preceding file: entry should lead you to the package (use rpm -qf filename).

But I'm sure there must be a better way to search for a glyph.

Related Question