Recently, I had an .otf
font file, and I wanted to find out which OpenType font feature tags (such as tnum
for fixed-width or tabular numbers, or liga
for ligatures) it supports. These are used, for example, in the font-feature-settings
CSS property. [My actual use case was that I wanted to use font features in my Waybar configuration.]
The supported font features can be listed with the otfinfo
command, like so
otfinfo --features path/to/font/file.otf
For example, for Inter, it shows
$ otfinfo --features /usr/share/fonts/rsms-inter-fonts/Inter-Regular.ttf
aalt Access All Alternates
c2sc Small Capitals From Capitals
calt Contextual Alternates
case Case-Sensitive Forms
ccmp Glyph Composition/Decomposition
cpsp Capital Spacing
cv01 Character Variants 1
cv02 Character Variants 2
cv03 Character Variants 3
cv04 Character Variants 4
cv05 Character Variants 5
cv06 Character Variants 6
cv07 <unknown feature>
cv08 <unknown feature>
cv09 <unknown feature>
cv10 <unknown feature>
cv11 <unknown feature>
cv12 <unknown feature>
cv13 <unknown feature>
dlig Discretionary Ligatures
dnom Denominators
frac Fractions
kern Kerning
mark Mark Positioning
mkmk Mark to Mark Positioning
numr Numerators
ordn Ordinals
pnum Proportional Figures
salt Stylistic Alternates
sinf Scientific Inferiors
smcp Small Capitals
ss01 Stylistic Set 1
ss02 Stylistic Set 2
ss03 Stylistic Set 3
ss04 Stylistic Set 4
ss05 Stylistic Set 5
ss06 Stylistic Set 6
ss07 Stylistic Set 7
ss08 Stylistic Set 8
subs Subscript
sups Superscript
tnum Tabular Figures
zero Slashed Zero
On my system (Fedora 40), the otfinfo
command was already installed. Not sure if it’s there by default or if it came as a dependency of something else.
fc-list <font name>
to find out the font file(s) for a given font. For me, it shows the following for Inter:
$ fc-list Inter
/usr/share/fonts/rsms-inter-fonts/Inter-Light.ttf: Inter,Inter Light:style=Light,Regular
/usr/share/fonts/rsms-inter-fonts/Inter-Thin.ttf: Inter,Inter Thin:style=Thin,Regular
/usr/share/fonts/rsms-inter-fonts/Inter-Black.ttf: Inter,Inter Black:style=Black,Regular
/usr/share/fonts/rsms-inter-fonts/Inter-BoldItalic.ttf: Inter:style=Bold Italic
/usr/share/fonts/rsms-inter-fonts/Inter-ExtraLight.ttf: Inter,Inter ExtraLight:style=ExtraLight,Regular
/usr/share/fonts/rsms-inter-fonts/Inter-ThinItalic.ttf: Inter,Inter Thin:style=Thin Italic,Italic
/usr/share/fonts/rsms-inter-fonts/Inter-ExtraBold.ttf: Inter,Inter ExtraBold:style=ExtraBold,Regular
/usr/share/fonts/rsms-inter-fonts/Inter-Medium.ttf: Inter,Inter Medium:style=Medium,Regular
/usr/share/fonts/rsms-inter-fonts/Inter-ExtraLightItalic.ttf: Inter,Inter ExtraLight:style=ExtraLight Italic,Italic
/usr/share/fonts/rsms-inter-fonts/Inter-BlackItalic.ttf: Inter,Inter Black:style=Black Italic,Italic
/usr/share/fonts/rsms-inter-fonts/Inter-LightItalic.ttf: Inter,Inter Light:style=Light Italic,Italic
/usr/share/fonts/rsms-inter-fonts/Inter-Italic.ttf: Inter:style=Italic
/usr/share/fonts/rsms-inter-fonts/Inter-SemiBoldItalic.ttf: Inter,Inter SemiBold:style=SemiBold Italic,Italic
/usr/share/fonts/rsms-inter-fonts/Inter-Regular.ttf: Inter:style=Regular
/usr/share/fonts/rsms-inter-fonts/Inter-ExtraBoldItalic.ttf: Inter,Inter ExtraBold:style=ExtraBold Italic,Italic
/usr/share/fonts/rsms-inter-fonts/Inter-Bold.ttf: Inter:style=Bold
/usr/share/fonts/rsms-inter-fonts/Inter-MediumItalic.ttf: Inter,Inter Medium:style=Medium Italic,Italic
/usr/share/fonts/rsms-inter-fonts/Inter-SemiBold.ttf: Inter,Inter SemiBold:style=SemiBold,Regular
You can also use the fc-match
command to find out the file for the best matching font for a CSS font-family
style query:
$ fc-match --format "%{file}\n" Inter
/usr/share/fonts/rsms-inter-fonts/Inter-Regular.ttf
$ fc-match --format "%{file}\n" sans-serif
/usr/share/fonts/google-noto-vf/NotoSans[wght].ttf
$ fc-match --format "%{file}\n" monospace
/usr/share/fonts/google-noto-vf/NotoSansMono[wght].ttf
If you leave out the --format
or -f
option, you get some additional info, but not the full file path:
$ fc-match Inter
Inter-Regular.ttf: "Inter" "Regular"
That’s all!
The otfinfo
command was surprisingly hard to find. I tried several search engines for queries like “linux find out opentype font features” or “linux find out font tabular numbers”, but I could only find results like these:
otfinfo
, but I missed it since I assumed it was only about TeX.This struggle compelled me to write this post in the spirit of Simon Willison’s TIL page. I hope you found it useful.
Some further reading: