7

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?

2

1 Answer 1

6

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.

2
  • 2
    this 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
    Commented Jun 9, 2021 at 15:30
  • 1
    Thanks, 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
    Commented Jun 9, 2021 at 18:12

You must log in to answer this question.

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