Reputation: 31951
How can I determine which font is used to render a character? Use Firefox on Linux as an example, a page can have the character 🂡
and it renders correctly (Ace of Spades). However, this isn't in my standard fonts, it has chosen some fallback font to render it. This happens in most of the programs on Ubuntu 12.04.
I need a way to find out which font contains a glyph for a given character. Any command-line tool for linux would be helpful or a simple Python library.
Upvotes: 19
Views: 5350
Reputation: 18634
You can use fontconfig:
fc-list ':charset=<hex_code1> <hex_code2>'
For details see https://unix.stackexchange.com/a/393740/14907
For bash script see gist.github.com/akostadinov/202550a1e2fd4ea8cf523d91b437fa09
#!/usr/bin/env bash
# example: ./font_find.sh 🎩︎
# credits: David Baynard, https://unix.stackexchange.com/a/393740/14907
param="$1"
char=${param:0:1}
printf '%x' \'"$char" | xargs -I{} fc-list ":charset={}"
Alternative Python solution here: https://superuser.com/a/1452828/111432
Upvotes: 8
Reputation: 7338
From the Fedora wiki.
Looking up this glyph in the
gucharmap
application, using the same font family, is usually sufficient to learn where it's taken from. Gucharmap will display the origin font when you right-click on a glyph.
sudo apt install gucharmap
Upvotes: 6
Reputation: 2449
See there for an answer (if your GNOME version has not deprecated the feature)
https://fedoraproject.org/wiki/Identifying_fonts
Upvotes: 5