On the Fedora 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?
- Unfortunately none of the answers in Gallery of installed fonts support this. It would be a useful addition.Gilles 'SO- stop being evil'– Gilles 'SO- stop being evil'2015-11-03 21:57:35 +00:00Commented Nov 3, 2015 at 21:57
- see this answer for a python script from Gilles, or this onemeuh– meuh2016-03-08 10:31:57 +00:00Commented Mar 8, 2016 at 10:31
1 Answer
Current Solution
Use, fc-list :charset=<hexcode>. Let's say you want the 🌠hotdog emoji.
$ printf '\U1F32D\n' 🌠$ fc-list :charset=1F32D /usr/share/fonts/usr/share/fonts/noto/NotoColorEmoji.ttf: Noto Color Emoji:style=Regular See also: https://unix.stackexchange.com/a/393740/
Pre-2015 Solution.
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.
- 3this answer gives fc-list ':charset=<hex_code1> <hex_code2>'. Sure enough
fc-list ':charset=1F32D'on my system returns Noto Color Emoji, Segoe UI Emoji and Segoe UI Symbol.scruss– scruss2021-06-09 15:30:48 +00:00Commented Jun 9, 2021 at 15:30 - 1Thanks, this is a great solution that wasn't available in the distribution I had installed at the time. I've updated the answer, but left the info for any historical value it might have.meuh– meuh2021-06-09 18:12:02 +00:00Commented Jun 9, 2021 at 18:12