Git Product home page Git Product logo

fnt's Introduction

   .d888
  d88P"           888
  888             888
.d88888 88888b. d888888
  888   888 "88b  888
  888   888  888  888
  888   888  888  Y88b.
  888   888  888   "Y888

apt for fonts, the missing font manager for macOS/linux

Packaging status

Why?

If you run Debian stable, you don't get the latest fonts, unless someone backports them actively. So this is useful to just get the latest and greatest fonts from Debian sid. It gets even worse with non Debian based Linux distributions.

If you run macOS, neither fink, brew, nor macports come with a great list of available to install fonts.

Privacy?

Read more about Google Fonts and their FAQ.

Host them yourself.

Font repositories

Debian sid, ~500 fonts available, only those starting with fonts-

Google fonts, ~1600 fonts available, (google- prefixed)

Installation

make install

You can also use your native package manager, see https://repology.org/project/fnt/versions Meanwhile also Debian stable (Bullseye) has an official BPO.

Usage

$ fnt update
Updating...

$ fnt info
Information...
Available Fonts: 2196

$ fnt search agave

$ fnt preview agave
╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴
╴╴╴╴╴▗▄▖╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴
╴╴╴╴╴▟▇▉▏╴▗▆▆▆▖╴╺▆▆▅▖▐▆▖▗▆▍▁▅▇▆▅╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴
╴╴╴╴▗▇▌▇▙╴▜▉▁▇▋╴▃▅▅▇▌╴▜▊▟▉╴▐▇▅▟▉▏╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴
╴╴╴╴▟▛▀▜▉▖▔▀▀▇▋▕▜▙▃▇▍╴▝▇▉▍╴▝▜▙▃▖╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴
╴╴╴╴▔▔╴╴▔▔▕▅▆▛▘╴╴▔▔▔╴╴╴▔▔╴╴╴╴▔▔▔╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴
╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴
╴╴╴╴╴╴▁▁╴╴╴╴╴╴╴╴╴╴╴╴╴╴▁▁▁▁╴╴╴╴╴╴╴╴╴╴╴╴╴▁▁▁▁╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴
╴╴╴╴╴▐▇▉╴╴▕▃▃▃▁╴╴╴╴╴╴▕▇▛▀▀▏╴▂▄▃▁╴╴╴╴╴╴╴▇▛▀▇▌╴▃▃▃▂╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴
╴╴╴╴▕▇▛▇▌╴╴▔▂▇▋╴╴╴╴╴╴▕▇▇▆▅╴▐▇▍▜▉▏╴╴╴╴╴╴▇▉▆▉▘▕▇▍▀▛▏╴╴╴╴╴╴╴╴╴╵╵╵╵╴╴╴╴╴╴╴╴╴╴╴╴╴
╴╴╴╴▐▉▆▇▉╴▇▉▀▇▋╴╴╴╴╴╴▕▇▌╴╴╴▐▇▛▀▀╴╴╴╴╴╴╴▇▋▐▉▖▕▇▍╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╵╴╴╴╴╴╴╴╴╴╴╴╴
╴╴╴╴▀▘╴▕▀▘▝▀▀▀▘╴╴╴╴╴╴▕▀▀▀▀▏╴▀▀▀▘╴╴╴╴╴╴╴▀▘╴▀▘▕▀▘╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╵╴╴╴╴╴╴╴╴╴╴╴╴
╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╶╴╴╴╵╴╴╴╴╴╴╴╴╴╴╴
╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴▁▁╴╴╴╴╴╴╴╴╴╴╴╵╴╴╴╶╴╴╴╴╴╴╴╴╴╴╴
╴╴╴╴▐▇▇▆▖╴▇▊▁╴╴╴╴╴╴╴╴╴▄▆▇▇▏╴╴▁▁╴╴╴╴╴╴╴╴┡▇▇▇▏╴╴▕▀▀╴╴╴╴╴╴╴╴╴╴╶╴╴╴╴╴╵╴╴╴╴╴╴╴╴╴╴
╴╴╴╴▐▉▃▇▛╴▟▉▀▇▌╴╴╴╴╴╴▐▇▘▃▃▖▗▇▛▜▉╴╴╴╴╴╴╴╴╴▐▇▏╴╇▇▇▊╴╴╴╴╴╴╴╴╴╴╷╷╷╷╴╴╶╴╴╴╴╴╴╴╴╴╴
╴╴╴╴▐▉▔▜▇▏▟▊╴▇▊╴╴╴╴╴╴▐▇▎▐▇▍▐▇▄▟▉╴╴╴╴╴╴╴╴╴▐▉▏╴╴╴▇▊╴╴╴╴╴╴╴╴╴╶╴╴╴╴╴╴╴╵╴╴╴╴╴╴╴╴╴
╴╴╴╴▐▉▆▇▀╴▜▉▆▛▘╴╴╴╴╴╴╴▜▇▇▛▘╴╴▔▟▉╴╴╴╴╴╴╴▆▆▛▀╴╴╴▁▇▊╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴
╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴▀▀▀▘╴╴╴╴╴╴╴╴╴╴╴╴▕▜▀▀▔╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴
╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴
╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴
╴╴╴╴▐▇╴▐▇╴▅▇▇▆▖╴╺▇▇▆▖▐▇▇▆▇▖▕▆▇▇▅╴╴╴╴╴╴╴╴╴╴╴╴╴┡▇▆▆▏╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴
╴╴╴╴▐▉╴▐▉╴▟▊╴▇▋╴▄▅▅▇▌▐▋▟▋▟▌▐▇▅▟▉▏╴╴╴╴╴╴▝▛▛▛▏╴▄▅▟▇▎╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴
╴╴╴╴▐▇▄▟▉╴▟▊╴▇▋▕▜▙▄▇▍▐▋▟▋▟▌▝▜▙▄▖╴╴╴╴╴╴╴╴╴╴╴╴▕▇▙▟▉▎╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴
╴╴╴╴╴▔▔▔╴╴▔▔╴▔▔╴╴▔▔▔╴▔▔▔▔▔▔╴╴▔▔▔╴╴╴╴╴╴╴╴╴╴╴╴╴╴▔▔▔╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴
╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴
╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴
▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▛▃▇
▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▛▋▇
▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▛╏▇
▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▆▇
▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▉▛▀▀▉
▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▉▏╴▕▇
▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▆▆▇
▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇
▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇
▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇
▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇
▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇
▇▇▇▇▛▁▖▔▜▛▔╴▇▉▔▗╴▐▉▃▃▔▜▇▛▘╶▇▍╴▃▃▇▉▘▁▟▊▃▃╴▕▛▔▃▏▜▛▔▃▔▜▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇
▇▇▇▇▏▔▔╴▐▆▋╴▇▇▉▀╴▟▇▋▁╴▐▛▏▖╶▇▍▂▔▀▜▘▁▁▀▇▇▛╴▟▉╸▔╴▐▙▁▀╴▟▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇
▇▇▇▇▖▝▘▁▟▇▋╴▇▉▘╶┻▜▉▀▀╴▐▄▃▖╴▟▛▀▘▁▟▖▝▘▁▇▛╴▐▇▌╴▀▏▐▇▛╴▟▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇
▇▇▇▇▇▇▆▇▇▇▇▇▇▇▇▇▇▇▇▆▇▇▇▇▇▇▇▇▇▆▇▇▇▇▆▆▇▇▇▇▇▇▇▇▆▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇

$ fnt install agave

$ fnt list
agave-b-autohinted.ttf [699]
agave-r-autohinted.ttf [2443]

Randomly display a preview every ten seconds:

while (clear); do fnt preview $(fnt search | shuf -n1 | sed "s,google-,,;s,fonts-,,"); sleep 10; done

If you want to install all available fonts, you could run something like this:

for a in $(fnt search |grep ^fonts- |sed s,fonts-,,); do fnt install $a; done

You end up with ~2700 font files (~500 fonts), taking up 1.6 GB.

for a in $(fnt search |grep ^google- |sed s,google-,,); do fnt install $a; done

You end up with ~4200 font files (~1600 fonts), taking up 1.4 GB.

ZSH autocompletion

You might want to add something like this to your .zshrc:

# enable autocomplete function
autoload -U compinit
compinit

Thanks

The preview mode works using https://github.com/hpjansson/chafa and https://screenshots.debian.net

Screenshots

Create your own with http://shell.aiei.ch/typography/

Online service

http://sid.ethz.ch/fonts/

Missing a font?

Feel free to create an issue, if the font comes with sources and its license is DFSG compliant, I'm happy to package it for a dollar. Free if I like it.

Want to create or edit fonts?

https://trufont.github.io/

https://fontforge.org/en-US/

https://birdfont.org/

But you know this Comic Sans font?

http://www.comicsanscriminal.com/ kindly, go fuck yourself.

Serve fonts on the web as woff2 and save a lot of traffic

https://github.com/google/woff2

Advertisement

https://bits.debian.org/2021/12/2000-fonts-debian.html

https://news.ycombinator.com/item?id=26063971

https://fostips.com/fnt-a-command-line-font-manager-for-linux-and-mac-os/

https://www.basher.it/package/

https://terminaltrove.com/fnt/

Some interesting links

Helvetica in Motion

https://wakamaifondue.com

https://github.com/fcambus/bdf2sfd (convert bitmap fonts to vector fonts)

https://en.wikipedia.org/wiki/Computer_font

https://github.com/rewtnull/amigafonts (Amiga)

https://www.trueschool.se (More Amiga)

https://github.com/alexmyczko/ree (dump your video card ROM, and extract the bitmap fonts)

Paul Renner and his font Futura

fnt's People

Contributors

alexmyczko avatar andrewshadura avatar borley1211 avatar crpb avatar danielsauve avatar davelab6 avatar ehaupt avatar jo1gi avatar nnbnh avatar unqueued avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

fnt's Issues

Atkinson Hyperlegible Font is missing

Atkinson Hyperlegible Font is missing

source: https://github.com/googlefonts/atkinson-hyperlegible

About Atkinson Hyperlegible

Atkinson Hyperlegible, named after the founder of the Braille Institute, has been developed specifically to increase legibility for readers with low vision, and to improve comprehension.

Having a traditional grotesque sans-serif at its core, it departs from tradition to incorporate unambiguous, distinctive elements—and at times, unexpected forms—always with the goal of increasing character recognition and ultimately improve reading.

wishlist: fnt manager to help sift through fonts

Perhaps I am not the proper target audience for fnt, but for me it is overwhelming. I already have a lot of fonts on my system and there are hundreds available for Debian, so I can easily install more if I know the name of what I want. The problem I have is that there are hundreds of fonts, so I can't simply say apt install font-best-typeface-ever. fnt offers even more fonts but I don't see that it provides any better way of sifting through them.

I know this is perhaps too big a request to wish for, but I would like to see fnt grow the ability to help people sort and select fonts quickly.


If you think this is a good idea, I have some ideas for ways that might work:

Categories would be one way to do it: For example, if I am looking for a traditional, formal font, I don't need to be shown whimsical, fun fonts.

Metapackages of fonts that people use together commonly would be handy. For example, there could be a set for basic word processing, another for designers, and maybe one for command line users.

Searching by Unicode coverage would be helpful (at least for people like me who use unusual glyphs). For example, what fonts support U+FDFD?

Ideally, fnt would show a Quick Comparison of fonts found from such a search. I wrote a tool which does that, but it only works for the fonts installed.

Terminal screenshot showing the unicode character FDFD in different fonts

Sorting by Popularity is a way that many font sites work and would probably be helpful to people, although maybe there should also be a reverse option for folks who want to avoid overly popular fonts. fnt could probably leverage the Debian popcon database for this.

Having a small Blurb, like one sees on bottles of wine, describing the characteristics and purpose of the font would be helpful. Many OFL font designers have already written such descriptions for their fonts.

Showing a Single line Preview of multiple fonts would be great. Here's an example of one way to show all the fonts available on your system, one per line, in a terminal. (Requires ImageMagick and a sixel capable terminal. For simplicity, the height is hardcoded to 20 pixels, but see my ugrep program for an example of how to detect the size of the character cell):

for f in $(convert -list font | grep Font: | cut -d: -f2- ); do printf "%40s" "$f "; convert -size x20 -font "$f" label:"ABCDEFGHIJKLMNOPQRSTUVWXYZ 0123456789 abcdefghijklmnopqrstuvwxyz" sixel:-; done

Searching by Similar fonts can be helpful. For example, I might want something that has some of the same characteristics as Iosevka and it'd be great if fnt could show me suggestions for alternatives.

Conversely, deduplicating would reduce the overwhelm by not presenting multiple versions of fonts that are too similar any way. For example, when I fnt search obs I am shown two fonts, "google-lobster" and "google-lobster-two", but there is no way in fnt to distinguish them. (By the way, typing fnt preview google-lobster returns "Couldn't retrieve preview". Using fnt preview lobster does show me a preview but it is actually a third font, "fonts-lobster", which may or may not be the same as google-lobster. If they are substantially the same, it would be nice if fewer lobsters were shown by default.)

That is probably more than enough ideas, so I'll just stop here.

~/.fonts/ is deprecated for user fonts; fnt should use the proper XDG directory

the default /etc/fonts/fonts.conf has:

<!-- Font directory list -->

        <dir>/usr/share/fonts</dir>
        <dir>/usr/local/share/fonts</dir>
        <dir prefix="xdg">fonts</dir>
        <!-- the following element will be removed in the future -->
        <dir>~/.fonts</dir>

As you can see, ~/.fonts/ is deprecated now, and it should be whatever XDG environment variables point to (or ~/.local/share/fonts/ by default).

$XDG_CACHE_HOME vs. $TMPDIR

fnt/fnt

Line 9 in 63a55a8

TMPDIR=$HOME/.fnt

https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html

$XDG_CACHE_HOME defines the base directory relative to which user specific non-essential data files should be stored. If $XDG_CACHE_HOME is either not set or empty, a default equal to $HOME/.cache should be used.

The simplest "closer" answer would be: TMPDIR="$HOME/.cache/fnt" (note double quotes so that http://shellcheck.net doesn't yell at you for "what if your $USER has spaces in it?"

Likely more correct would be: CACHEDIR="${XDG_CACHE_HOME:-$HOME/.cache}/fnt"

https://wiki.bash-hackers.org/syntax/pe#use_a_default_value
echo "Your home directory is: ${HOME:-/home/$USER}."

...then either remove the cache dir you control after each execution, or maybe provide some sort of --cache support.

LOVE your code, the $TO_CHECK && $INSTALLER technique is awesome for non-package-manager-based scripts. If you're amenable, I'd probably mess around and submit a patch for some of this or would be happy to discuss, as I love some of the potential that this utility has.

errors and documentation re dependencies

I have been working at installing this because it looks great. :) There was no compatible package available so I downloaded the release v 1.4.1.

First issue is that the suggested make install results in this:

if test ! -d //usr/bin ; then mkdir -p //usr/bin ; fi
install -m 755 fnt //usr/bin/
install: cannot create regular file '//usr/bin/fnt': Permission denied
makefile:11: recipe for target 'install' failed
make: *** [install] Error 1

Which I guessed correctly meant that sudo was required. Perhaps either the error or the instructions could be clarified. So sudo make install whose output was also confusing:

if test ! -d //usr/bin ; then mkdir -p //usr/bin ; fi
install -m 755 fnt //usr/bin/
if test ! -d //usr/share/man/man1 ; then mkdir -p //usr/share/man/man1; fi
install -c -m 644 fnt.1 //usr/share/man/man1/ ; gzip -9 //usr/share/man/man1/fnt.1
if test ! -d //usr/local/share/zsh/site-functions ; then mkdir -p //usr/local/share/zsh/site-functions ; fi
install -m 755 completions/_fnt //usr/local/share/zsh/site-functions/

successful? not? easy to find out by running fnt which alerted that there are unmet dependencies:

chafa not found, please use apt to install it.

So I went to find this package chafa, which was not available via apt. On the developer's page there are instructions on how to add the ppa so I am guessing many people would not find it available by default. But installed it one way or another.

then tried running fnt

otfinfo not found, please use apt to install it.

I was able to find how to install otfinfo only as part of the package lcdf-typetools; not sure if it is available independently. The latter was available via apt while otfinfo itself was not.

I think it is traditional for dependencies to be checked during install rather than afterwards, when the program is run? Not sure if the output of make was something to do with that.

Assuming you do not want to get extremely complicated with figuring out what exactly version of OS each user is running and providing precise instructions, I don't know but maybe something like these would be helpful error messages instead:

Required package chafa not found, please consult https://hpjansson.org/chafa for install instructions.
Required package otfinfo not found, please use apt or your preferred package manager to install the parent package lcdf-typetools or consult https://www.lcdf.org/type/ for further information.

Also when I was poking around in fnt I noticed something about the the error dispayed if brew is not found on Mac.

If I am reading correctly, it looks like the error if brew is not installed would be instructions to use brew to install it. If the case, I would suggest the following instead

Required package brew not found, please consult https://brew.sh/ for further install instructions.

I am not a programmer but I did search the repo to find code about the dependencies. I think the relevant bit is here. Based on that, here is a draft/suggestion of what could reasonably included in the readme or some ancillary location for dependencies.

Dependencies

Mac

Linux

  • curl - should be installed by default
    • available via apt if needed sudo apt install curl
  • chafa - see website for install options
  • otfinfo
    • packaged with with lcdf-typetools which is likely available via sudo apt install lcdf-typetools or your preferred package manager; consult website for install options

FreeBSD

Haiku OS

Windows

  • cmd.exe

OR

  • No outside dependencies

I included explicit instructions for Mac and Linux which are the two systems I am familiar with (Mac more than the 1000 variations of Linux).

  • Windows: Not sure about the cmd.exe as last I knew that was part of the OS so maybe that's just internal for the program and nothing the user would need to think of, therefor does not need mentioned.

I am happy to make a PR for the readme if you are amenable to this. As I mentioned I am not a programmer or anything so if there is a bunch of requirements to setting up a development environment it is unlikely to be worth the time. If it's just textfiles and git I can do it. I'm not capable of making a PR for the error messages because they require coding.

Or you can handle it whatever way works for you, edit, discard etc.

RPM package

It would be nice if there is rpm package of fnt, so it can be installed on fedora.

Provide metadata for fonts

The AppStream specification is providing a metadata standard for fonts, this allow them to be available in Application Software Managers (like GNOME Shell, elementary AppCenter or KDE Discover).
It would be freat if fnt would create such metadata to easily be able to install them.

Comparison with homebrew-cask-fonts

You said the following in your rationale section:

If you run macOS, neither fink, brew, nor macports come with a great list of available to install fonts.

I never used fink and didn't use MacPorts for font management but I certainly do use https://github.com/Homebrew/homebrew-cask-fonts According to GitHub's listing it contains roughly 1700 different fonts all installable by using established HB/HB Cask workflow. I don't know about you but that certainly fits my great list standards 😄
Now for the honest question: Am I missing something here that makes fnt better choice compared to it, or you somehow managed to miss its existence? 🤔

Nevertheless, I very much like the idea and simple and effective cross-platform implementation. 👍

shellcheck

In fnt line 29:
		echo Please report $s to https://github.com/alexmyczko/fnt/issues
                                   ^-- SC2086: Double quote to prevent globbing and word splitting.

Did you mean: 
		echo Please report "$s" to https://github.com/alexmyczko/fnt/issues


In fnt line 35:
    which $a >/dev/null
    ^---^ SC2230: which is non-standard. Use builtin 'command -v' instead.
          ^-- SC2086: Double quote to prevent globbing and word splitting.

Did you mean: 
    which "$a" >/dev/null


In fnt line 36:
    if [ ! $? -eq 0 ]; then
           ^-- SC2181: Check exit code directly with e.g. 'if mycmd;', not indirectly with $?.


In fnt line 37:
        echo $a not found, please use $i to install it.
             ^-- SC2086: Double quote to prevent globbing and word splitting.

Did you mean: 
        echo "$a" not found, please use $i to install it.


In fnt line 42:
if [ ${1}x == x ]; then
     ^--^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean: 
if [ "${1}"x == x ]; then


In fnt line 52:
		if [ ! -d ${TMPDIR} ]; then mkdir -p ${TMPDIR}; fi
                          ^-------^ SC2086: Double quote to prevent globbing and word splitting.
                                                     ^-------^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean: 
		if [ ! -d "${TMPDIR}" ]; then mkdir -p "${TMPDIR}"; fi


In fnt line 53:
	        if [ -f ${TMPDIR}/Packages.xz ]; then rm ${TMPDIR}/Packages.xz; fi
                        ^-------^ SC2086: Double quote to prevent globbing and word splitting.
                                                         ^-------^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean: 
	        if [ -f "${TMPDIR}"/Packages.xz ]; then rm "${TMPDIR}"/Packages.xz; fi


In fnt line 54:
        	curl -s $INDEX -o ${TMPDIR}/Packages.xz
                                  ^-------^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean: 
        	curl -s $INDEX -o "${TMPDIR}"/Packages.xz


In fnt line 61:
		ls -1 $HOME/Library/Fonts/*.?tf $HOME/.fonts/*.?tf 2>/dev/null | while read f; do
                ^-- SC2012: Use find instead of ls to better handle non-alphanumeric filenames.
                      ^---^ SC2086: Double quote to prevent globbing and word splitting.
                                                ^---^ SC2086: Double quote to prevent globbing and word splitting.
                                                                                       ^--^ SC2162: read without -r will mangle backslashes.

Did you mean: 
		ls -1 "$HOME"/Library/Fonts/*.?tf "$HOME"/.fonts/*.?tf 2>/dev/null | while read f; do


In fnt line 62:
			echo "$f [$(otfinfo -u ""$f"" 2>/dev/null|wc -l)]" | sed s,.*/,,
                                                 ^-- SC2027: The surrounding quotes actually unquote this. Remove or escape them.
                                                 ^-- SC2086: Double quote to prevent globbing and word splitting.

Did you mean: 
			echo "$f [$(otfinfo -u """$f""" 2>/dev/null|wc -l)]" | sed s,.*/,,


In fnt line 68:
		img=$(lynx -dump https://screenshots.debian.net/package/fonts-$2 | grep large.png | sed s,.*http,http,)
                                                                              ^-- SC2086: Double quote to prevent globbing and word splitting.

Did you mean: 
		img=$(lynx -dump https://screenshots.debian.net/package/fonts-"$2" | grep large.png | sed s,.*http,http,)


In fnt line 70:
		curl -s $img -o ${TMPDIR}/preview.png
                        ^--^ SC2086: Double quote to prevent globbing and word splitting.
                                ^-------^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean: 
		curl -s "$img" -o "${TMPDIR}"/preview.png


In fnt line 71:
		chafa --invert -c none --symbols block+border-solid ${TMPDIR}/preview.png
                                                                    ^-------^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean: 
		chafa --invert -c none --symbols block+border-solid "${TMPDIR}"/preview.png


In fnt line 77:
		p=$(cat $HOME/.fnt/Packages.xz |unxz| grep -v "^Architecture:\|^Section:\|^Priority:\|^Replaces:\|^Provides:\|^Brekas:\|^Maintainer:\|^MD5sum:\|^Source:\|^Breaks:\|^Multi-Arch:\|^Description-\|^Tag:\|^SHA256:"|awk '!NF{print line; line=""}{line=line " " $0}' |grep "Package: fonts-"|grep fonts-$2|head -1)
                        ^---^ SC2086: Double quote to prevent globbing and word splitting.
                        ^--------------------^ SC2002: Useless cat. Consider 'cmd < file | ..' or 'cmd file | ..' instead.
                                                                                                                                                                                                                                                                                                                      ^-- SC2086: Double quote to prevent globbing and word splitting.

Did you mean: 
		p=$(cat "$HOME"/.fnt/Packages.xz |unxz| grep -v "^Architecture:\|^Section:\|^Priority:\|^Replaces:\|^Provides:\|^Brekas:\|^Maintainer:\|^MD5sum:\|^Source:\|^Breaks:\|^Multi-Arch:\|^Description-\|^Tag:\|^SHA256:"|awk '!NF{print line; line=""}{line=line " " $0}' |grep "Package: fonts-"|grep fonts-"$2"|head -1)


In fnt line 79:
		name=$(echo $p | awk '{print $2}')
                            ^-- SC2086: Double quote to prevent globbing and word splitting.

Did you mean: 
		name=$(echo "$p" | awk '{print $2}')


In fnt line 80:
		ver=$(echo $p | awk '{print $4}')
                           ^-- SC2086: Double quote to prevent globbing and word splitting.

Did you mean: 
		ver=$(echo "$p" | awk '{print $4}')


In fnt line 81:
		instsize=$(echo $p | awk '{print $6}')
                                ^-- SC2086: Double quote to prevent globbing and word splitting.

Did you mean: 
		instsize=$(echo "$p" | awk '{print $6}')


In fnt line 82:
		downsize=$(echo $p | awk '{print $NF}')
                                ^-- SC2086: Double quote to prevent globbing and word splitting.

Did you mean: 
		downsize=$(echo "$p" | awk '{print $NF}')


In fnt line 83:
		url=$(echo $p | awk '{print $(NF-2)}')
                           ^-- SC2086: Double quote to prevent globbing and word splitting.

Did you mean: 
		url=$(echo "$p" | awk '{print $(NF-2)}')


In fnt line 84:
		f=$(basename $url)
                             ^--^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean: 
		f=$(basename "$url")


In fnt line 86:
		curl -s ${MIRROR}${url} -o ${TMPDIR}/$f
                                 ^----^ SC2086: Double quote to prevent globbing and word splitting.
                                           ^-------^ SC2086: Double quote to prevent globbing and word splitting.
                                                     ^-- SC2086: Double quote to prevent globbing and word splitting.

Did you mean: 
		curl -s ${MIRROR}"${url}" -o "${TMPDIR}"/"$f"


In fnt line 87:
		cd ${TMPDIR}
                ^----------^ SC2164: Use 'cd ... || exit' or 'cd ... || return' in case cd fails.
                   ^-------^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean: 
		cd "${TMPDIR}" || exit


In fnt line 88:
		ar x $f
                     ^-- SC2086: Double quote to prevent globbing and word splitting.

Did you mean: 
		ar x "$f"


In fnt line 90:
		find ${TMPDIR} . -name "*.?tf" -exec cp {} $target \;
                     ^-------^ SC2086: Double quote to prevent globbing and word splitting.
                                                           ^-----^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean: 
		find "${TMPDIR}" . -name "*.?tf" -exec cp {} "$target" \;


In fnt line 91:
		rm $f control.tar* data.tar* debian-binary
                   ^-- SC2086: Double quote to prevent globbing and word splitting.

Did you mean: 
		rm "$f" control.tar* data.tar* debian-binary


In fnt line 92:
		rm -rf ${TMPDIR}/usr
                       ^-----------^ SC2115: Use "${var:?}" to ensure this never expands to /usr .
                       ^-------^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean: 
		rm -rf "${TMPDIR}"/usr


In fnt line 101:
		cat $HOME/.fnt/Packages.xz |unxz |grep ^Package:\ fonts-|awk '{print $2}' | grep "$2"
                    ^---^ SC2086: Double quote to prevent globbing and word splitting.
                    ^--------------------^ SC2002: Useless cat. Consider 'cmd < file | ..' or 'cmd file | ..' instead.

Did you mean: 
		cat "$HOME"/.fnt/Packages.xz |unxz |grep ^Package:\ fonts-|awk '{print $2}' | grep "$2"

For more information:
  https://www.shellcheck.net/wiki/SC2027 -- The surrounding quotes actually u...
  https://www.shellcheck.net/wiki/SC2115 -- Use "${var:?}" to ensure this nev...
  https://www.shellcheck.net/wiki/SC2164 -- Use 'cd ... || exit' or 'cd ... |...

font classification

serif
sans-serif
mono
script
display

find some cli tool/way to figure out how to classify a font(files). help welcome

Upgrade a font

Hi,

From help:

update -u -- updates the font package index of debian sid

Does this mean that when a font is updated it downloads and install the latest version? How would I upgrade a font?

Thanks!

dependency/ install information missing?

I get line 175: unxz: command not found when running fnt search some_font. It still finds what I'm looking for, but it prints this error. Because it found it, I'm assuming, its either not a critical dependency or I'm missing some results or something. I was able to find xz in Homebrew and this clears up the error.

I feel it would be nice to have a mention of the dependency in the REAME.md. Would you like to have such a mention? If so, would you prefer to add it yourself or would you want a Pull request for it?

I will also look to add xz to the Homebrew formula here to get Homebrew to take care of this dependency when installing fnt with brew install fnt on the systems it supports.

typographic/font screensaver mode

in a loop
download random font
select random pop colors
random words, render horizontal/vertical, and
45° and 22.5° rotated random texts
wait n seconds
bestloopever

http://bootes.ethz.ch/fonts/ is down

The webserver hosting prebuilt distro packages is down (80, 443 is not listening), seems only SSH is open. Could you check that? Thank you :)

feature request: enable installing multiple fonts in one install call

Make command like fnt install anonymouspro azeretmono cousine dejavu firacode hack ibmplexmono notosansmono oxygenmono robotomono victormono to install all the fonts specified.


I was confused finding that command from above will install only anonymouspro and silently exit, without any indication that it doesn't install the rest of the fonts.

That feature will bring fnt install on par with typical distro installer behavior, e.g. apt-get install package1 package2 does installs both of packages.

workaround, if somebody lands here

So far I did simple loop in my dotfiles:

# Change to `fnt install` after https://github.com/alexmyczko/fnt/issues/30 is fixed
fonts=(anonymouspro \
        azeretmono \
        cousine \
        dejavu \
        firacode \
        hack \
        ibmplexmono \
        notosansmono \
        oxygenmono \
        robotomono \
        victormono \
)

for font in ${fonts[@]}; do
    fnt install $font
done

Thanks

fnt preview should use sixel for higher resolution images

The font preview is a nifty idea, but the resolution is too low. I don't know much about chafa, but I thought it handled sixels which would allow for a crisp bitmap display in the terminal. Perhaps there is something fnt needs to do to enable it?

Here is an comparison with using sixels, via the ImageMagick convert command, to view a font on the command line in a terminal that handles graphics. (Xterm).

Comparison of fnt preview and ImageMagick font display

convert -list font | grep Font | grep -v Noto
convert -size 800x -font Iosevka label:'ABC xyz' sixel:- ; echo
convert -size 800x -background orange -fill white -font Sudo-Regular label:$'\U2022 ABC xyz \U1F5D1' sixel:- ; echo

But that only works for fonts that are already installed. My hope is that fnt will be able to do the same thing for any font.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.