# Fontwhich
Fontwhich is a small CLI tool that uses pango to show
which default fonts are used to render some text.
It should work on any Linux distro with the Cairo and Pango libraries:
it requires the fonts to be available but not a graphical session.
## Usage
`$ fontwhich --version`
```
0.2.1
```
`$ fontwhich --help`
```
fontwhich
Usage: fontwhich [--version] [-f|--font FONT] [-l|--lang LANG] [-b|--utf8]
[-u|--unicode] [TEXT]
Describes the fonts used to render text with pango
Available options:
-h,--help Show this help text
--version Show version
-f,--font FONT Base font [default: Sans]
-l,--lang LANG Language code
-b,--utf8 Output UTF-8 hex codes
-u,--unicode Output Unicode data
```
`$ fontwhich Hello π World δΈη`
```
'Hello ' : Noto Sans
'π' : Noto Color Emoji
' World ' : Noto Sans
'δΈη' : Noto Sans CJK JP
```
`$ fontwhich -f Serif "γγγ«γ‘γ― π δΈη"`
```
'γγγ«γ‘γ― ' : Noto Serif CJK JP
'π' : Noto Color Emoji
' ' : Noto Serif CJK JP
'δΈη' : Noto Serif CJK JP
```
`$ fontwhich -l ja`
```
Primary Sans font for ja is: "Noto Sans CJK JP"
```
`$ fontwhich --utf8 π³`
```
4 bytes;
'π³' [f0 9f 8c b3] : Noto Color Emoji
```
`$ fontwhich --unicode Ξ±Ξ²ΰ₯§ΰ₯¨`
```
10 bytes; 2 pango items
'Ξ±Ξ²' : Noto Sans
Ξ± <U+03B1>: GREEK SMALL LETTER ALPHA [Greek]
Ξ² <U+03B2>: GREEK SMALL LETTER BETA [Greek]
'ΰ₯§ΰ₯¨' : Noto Sans Devanagari
ΰ₯§ <U+0967>: DEVANAGARI DIGIT ONE [Devanagari]
ΰ₯¨ <U+0968>: DEVANAGARI DIGIT TWO [Devanagari]
```
One can use both options together:
`$ fontwhich --utf8 π --unicode`
```
4 bytes;
'π' [f0 9f 8d 8a] : Noto Color Emoji
π <U+1F34A>: TANGERINE [Common]
```
## Building and installation
On Fedora, install system deps with `cabal-rpm builddep`.
C library dependencies:
- Fedora: cairo-devel pango-devel gobject-introspection-devel
- Ubuntu: libcairo2-dev libpango1.0-dev libgirepository1.0-dev
Then:
```
$ cabal install
```
or
```
$ stack install
```
There is a copr repo: <https://copr.fedorainfracloud.org/coprs/petersen/fontwhich/>
## Misc
Code assisted with Gemini 3.1.
The tool is related conceptually to <https://github.com/sudipshil9862/whichfont> (C codebase).
"fontwhich" as in "sandwhich" but with fonts.
## Collaborate
The code is distributed under GPLv3+.
Repository: <https://github.com/juhp/fontwhich>