Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Find the font used to render a character, or containing the glyph?

Tags:

linux

fonts

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.

like image 448
edA-qa mort-ora-y Avatar asked Mar 26 '14 09:03

edA-qa mort-ora-y


People also ask

How do you find the font that has the glyph you need?

1. In the Character Viewer, click a Category, and scroll to find the glyph you want, then follow the procedure I outlined above. Examine each of the glyphs displayed in the Font Variation section, and pick the font that includes the glyph display you like.

How do I access font glyphs in word?

Go to Insert > Symbol. Pick a symbol, or choose More Symbols. Scroll up or down to find the symbol you want to insert. Different font sets often have different symbols in them and the most commonly used symbols are in the Segoe UI Symbol font set.

Do Google fonts have glyphs?

Material Symbols are our newest icons, consolidating over 2,500 glyphs in a single font file with a wide range of design variants. Symbols are available in three styles and four adjustable variable font axes (fill, weight, grade, and optical size).


3 Answers

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.

enter image description here

sudo apt install gucharmap

like image 115
Maarten Avatar answered Oct 22 '22 06:10

Maarten


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

like image 38
akostadinov Avatar answered Oct 22 '22 05:10

akostadinov


See there for an answer (if your GNOME version has not deprecated the feature)

https://fedoraproject.org/wiki/Identifying_fonts

like image 28
nim Avatar answered Oct 22 '22 06:10

nim