pax_global_header00006660000000000000000000000064147600010460014510gustar00rootroot0000000000000052 comment=b489cf76a8424a8e260c6788fe6f1a0a411e3145 fnt-1.9/000077500000000000000000000000001476000104600121505ustar00rootroot00000000000000fnt-1.9/.github/000077500000000000000000000000001476000104600135105ustar00rootroot00000000000000fnt-1.9/.github/workflows/000077500000000000000000000000001476000104600155455ustar00rootroot00000000000000fnt-1.9/.github/workflows/main.yml000066400000000000000000000023621476000104600172170ustar00rootroot00000000000000--- name: Update google-fonts index on: push: check_run: schedule: - cron: "30 23 * * *" jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 with: repository: "${{ github.repository }}" ref: 'mirror' - name: Restore id: cache-primes-restore uses: actions/cache/restore@v4 with: key: ${{ runner.os }}-primes path: | fonts-main - name: Install imagemagick and file run: sudo apt-get update -qq && sudo apt-get install -qq imagemagick file - name: generate index and previews run: | ./update.sh git config --global user.email "${{github.repository_owner}}@users.noreply.github.com" git config --global user.name "fnt index" git add OFL.xz APACHE.xz || : git status -s -b -u if git commit -m $(date -Im); then git push fi - name: Save id: cache-primes-save if: always() && steps.cache-primes-restore.outputs.cache-hit != 'true' uses: actions/cache/save@v4 with: key: ${{ steps.cache-primes-restore.outputs.cache-primary-key }} path: | fonts-main fnt-1.9/LICENSE000066400000000000000000000021741476000104600131610ustar00rootroot00000000000000MIT License Copyright (c) 2021-2024 Alex Myczko 2024 Christopher Bock Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. fnt-1.9/Makefile000066400000000000000000000016011476000104600136060ustar00rootroot00000000000000BINDIR=/usr/bin MANDIR=/usr/share/man ZCOMPDIR=/usr/local/share/zsh/site-functions VERSION=1.7 all: @echo make install to install the software @echo make uninstall to remove the software install: if test ! -d $(DESTDIR)/$(BINDIR) ; then mkdir -p $(DESTDIR)/$(BINDIR) ; fi install -m 755 fnt $(DESTDIR)/$(BINDIR)/ if test ! -d $(DESTDIR)/$(MANDIR)/man1 ; then mkdir -p $(DESTDIR)/$(MANDIR)/man1; fi install -c -m 644 fnt.1 $(DESTDIR)/$(MANDIR)/man1/ ; gzip -9 $(DESTDIR)/$(MANDIR)/man1/fnt.1 if test ! -d $(DESTDIR)/$(ZCOMPDIR) ; then mkdir -p $(DESTDIR)/$(ZCOMPDIR) ; fi install -m 755 completions/_fnt $(DESTDIR)/$(ZCOMPDIR)/ uninstall: rm -f $(DESTDIR)/$(BINDIR)/fnt rm -f $(DESTDIR)/$(MANDIR)/man1/fnt.1.gz rm -f $(DESTDIR)/$(ZCOMPDIR)/_fnt clean: @echo nothing to clean release: cd .. ; tar cf fnt-$(VERSION).tar --exclude-vcs fnt ; xz -9f fnt-$(VERSION).tar fnt-1.9/README.md000066400000000000000000000331471476000104600134370ustar00rootroot00000000000000``` .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](https://repology.org/badge/tiny-repos/fnt.svg)](https://repology.org/project/fnt/versions) # Why? If you run [Debian](https://www.debian.org) 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](https://www.next.com), neither [fink](https://www.finkproject.org), [brew](https://brew.sh), nor [macports](https://www.macports.org) come with a great list of available to install fonts. # Privacy? Read more about [Google Fonts](https://uxdesign.cc/a-privacy-concern-about-google-fonts-5aa4418bf87e) and [their FAQ](https://developers.google.com/fonts/faq#what_does_using_the_google_fonts_api_mean_for_the_privacy_of_my_users). Host them [yourself](https://wicki.io/posts/2020-11-goodbye-google-fonts/). # Font repositories [Debian sid](https://packages.debian.org/unstable/fonts/), ~500 fonts available, only those starting with `fonts-` [Google fonts](https://github.com/google/fonts), ~1800 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/ # 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/](https://web.archive.org/web/20230119134258/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://www.youtube.com/watch?v=R1ZBknDPlu4) 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](http://web.archive.org/web/20221003112339/https://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](https://www.maroverlag.de/typo/84-die-kunst-der-typographie-9783875124149.html) fnt-1.9/completions/000077500000000000000000000000001476000104600145045ustar00rootroot00000000000000fnt-1.9/completions/_fnt000066400000000000000000000017711476000104600153630ustar00rootroot00000000000000#compdef fnt _arguments \ "1: :->mode" \ "2: :->fonts" case $state in mode) _values \ $state \ {update,-u}"[update fnt package cache]" \ {list,-l}"[lists installed fonts with glyphcount per font]" \ info"[information about how many fonts can be installed]" \ {help,-h}"[show help]" \ {install,-i}"[install a font]" \ {remove,-r}"[remove a font]" \ {preview,-p}"[preview a font]" \ {search,-s}"[search for font]" ;; fonts) subcmd=${words[2]} case $subcmd in help | update | info | search) ;; install|-i|preview|-p) local -a fonts fonts=($(fnt search 2>/dev/null | sed 's,^google-,,;s,^fonts-,,')) _values \ "fonts" $fonts ;; list|-l|remove|-r) local -a fontindex fontindex=("${(@f)$(fnt list index)}") [[ -z $fontindex ]] && return 0 _values \ "fontindex" $fontindex ;; *) ;; esac ;; esac fnt-1.9/fnt000077500000000000000000000304641476000104600126740ustar00rootroot00000000000000#!/usr/bin/env bash # vim: autoindent noexpandtab # shellcheck disable=SC2237 set -e #set -x # APT but only for fonts # alex@aiei.ch # christopher@bocki.com VERSION=1.9 # Defaults BASE=${XDG_DATA_HOME:-"$HOME/.local/share"} TARGET="$BASE/fonts" FNTDATA="$BASE/fnt" # Fallback if ~/.local/share doesn't exist as if fnt would be the first program # writing to it... HAH! if ! test -d "$BASE"; then BASE="$HOME" TARGET="$BASE/.fonts" FNTDATA="$BASE/.fnt" fi FNTINDEXDIR="$FNTDATA/index" PACKAGES="$FNTDATA/Packages.xz" APACHE="$FNTDATA/APACHE.xz" OFL="$FNTDATA/OFL.xz" MIRROR="https://deb.debian.org/debian" INDEX="$MIRROR/dists/sid/main/binary-all/Packages.xz" GINDEX="https://alexmyczko.github.io/fnt" APACHEINDEX="$GINDEX/APACHE.xz" OFLINDEX="$GINDEX/OFL.xz" if [ ! -d "$FNTDATA" ] || [ ! -d "$FNTINDEXDIR" ]; then mkdir -p "$FNTINDEXDIR" || { echo "Couldn't create cache+index directory: $FNTDATA + /index" ; exit 1 ; } fi if ! command -v uname &>/dev/null; then s="Windows" else s=$(uname -s) fi check_com() { if ! command -v "$1" &> /dev/null; then return 1; fi ; } # Pipelines pipe_download(){ local PIPEFILE PIPEDIR="$(mktemp -d)" PIPEFILE="${1%%*/}" if test -z "$PIPEFILE"; then PIPEFILE=index; fi chmod go-rwx "$PIPEDIR" trap 'rm -rf -- "$PIPEDIR"' EXIT download "$1" "$PIPEDIR/$PIPEFILE" cat "$PIPEDIR/$PIPEFILE" } search() { if [ -r "$PACKAGES" ] && [ -r "$APACHE" ] && [ -r "$OFL" ]; then xzcat "$PACKAGES" | awk '/^Package: fonts-.*'"$1"'.*/ {gsub(/^Package: /,"");print;}' xzcat "$APACHE" "$OFL" | awk '/^Package: .*'"$1"'.*/ {gsub(/^/, "google-", $2); print $2}' else echo "Can't find any Data, please run ${BASH_SOURCE[0]} update and try again." fi } download() { # shellcheck disable=SC2086 local URL LOPTS URL="$1" if test -z "${1##*.deb}"; then if /usr/bin/which /usr/lib/apt/apt-helper>/dev/null then # Test if we could use an local apt-proxy (non-ssl) but no worry we do # md5sum checking on the file anyway. PROXYURL=${URL/https:/http:} if test -n "$(/usr/lib/apt/apt-helper auto-detect-proxy "$PROXYURL" | awk -F\' '{print $2}')"; then URL=$PROXYURL; fi # shellcheck disable=SC2090,SC2086 /usr/lib/apt/apt-helper $LOPTS download-file "$URL" "$2" >/dev/null return fi fi if /usr/bin/which fetch>/dev/null then fetch -q -o "$2" "$URL" elif /usr/bin/which curl>/dev/null then curl -g -L -s -o "$2" "$URL" elif /usr/bin/which wget>/dev/null then wget -q -O "$URL" "$2" else print "ERROR: neither apt-helper, wget, curl nor fetch is installed" >&2 exit 69 fi } deb_handler() { # retrieve font from debian mirror and store infos for removal TMPDIR="$(mktemp -d)" chmod go-rwx "$TMPDIR" trap 'rm -rf -- "$TMPDIR"' EXIT PIT="${TMPDIR}/extract" mkdir -m go-rwx "$PIT" || { echo "Couldn't eat tartar." ; exit 73 ; } NAME="$1" INFOS="$(unxz -c "$PACKAGES" | awk "/^Package: ${NAME}$/,/^$/" | awk '/^(Version|Installed-Size|Filename|Size|MD5sum): /')" VER="$(awk '/^Version: /{print$2}' <<< "$INFOS")" INSTSIZE="$(awk '/^Installed-Size: /{print$2}' <<< "$INFOS")" DOWNSIZE="$(awk '/^Size: /{print$2}' <<< "$INFOS")" FPATH="$(awk '/^Filename: /{print$2}' <<< "$INFOS")" FNAME="$(basename "$FPATH")" MD5SUM="$(awk '/^MD5sum: /{print$2}' <<< "$INFOS") ${FNAME}" echo "Installing $NAME $VER [${DOWNSIZE} ${INSTSIZE}000 ${MIRROR}/${FPATH}]..." cd "$TMPDIR" || { echo "Couldn't cd into $TMPDIR" ; exit 66 ; } test -z "$(download "${MIRROR}/${FPATH}" "${TMPDIR}/$FNAME")" || { echo "Couldn't retrieve file." ; exit 69 ; } echo "$MD5SUM" > "${TMPDIR}/${FNAME}.md5" if $md5 -c "${TMPDIR}/${FNAME}.md5" >/dev/null; then # deb data DATA="$(ar t "$TMPDIR/$FNAME" | grep '^data\.tar')" mkdir -p "${PIT}/data" && cd "${PIT}/data" ar x "${TMPDIR}/$FNAME" "$DATA" tar xf "${PIT}/data/$DATA" find "${PIT}/data" -name "*.?tf" -exec cp {} "$TARGET" \; # deb control CONTROL="$(ar t "$TMPDIR/$FNAME" | grep '^control\.tar')" mkdir -p "${PIT}/control" && cd "${PIT}/control" ar x "${TMPDIR}/$FNAME" "$CONTROL" tar xf "${PIT}/control/${CONTROL}" sed -n 's/^\(.*\) .*\/\(.*tf$\)/\1 \2/p' "${PIT}/control/md5sums" > "$FNTINDEXDIR/$NAME" awk -v pkg="$NAME" '{printf "Package: %s File: %s\n", pkg, $2}' "$FNTINDEXDIR/$NAME" else echo "Can't verify md5sum!" exit 65 fi } fnt_install() { local a o p a='' o='' p='' if [ ! -f "$PACKAGES" ]; then echo "Could not find $PACKAGES" echo "Please run ${BASH_SOURCE[0]} update" # could also just run itself with update... # but apt doesn't do that either :) exit 75 fi if [ ! $# -eq 2 ]; then echo "No fontname supplied." echo "Usage: ${BASH_SOURCE[0]} install agave" exit 64 fi FNTMATCH=$2 if [ ! -d "$TARGET" ]; then mkdir -p "$TARGET" fi # look for first font match p="$(unxz -c "$PACKAGES" | awk '/^Package: (fonts-)?'"$FNTMATCH"'/ {gsub(/^Package: /,"");print;exit;}')" if ! [ -z "$p" ]; then deb_handler "$p" return fi FNTMATCH=${FNTMATCH/google-/} a="$(unxz -c "$APACHE" | awk '/Package: '"$FNTMATCH"'$/,/^$/')" if ! [ -z "$a" ]; then url=$(awk '/^URL:/ {print$2}' <<< "$a") dir="${url##*/}" files="$(awk '/^ .*\.?tf$/ {print $2}' <<< "$a")" md5sums="$(awk '/^ .*\.?tf$/ {gsub(/^ /,""); print}' <<< "$a")" for file in $files; do download "${url}/${file}" "${TARGET}/${file}" echo "Package: $FNTMATCH File: $file" done echo "$md5sums" > "${FNTINDEXDIR}/google-${dir}" return else o="$(unxz -c "$OFL" | awk '/Package: '"$FNTMATCH"'$/,/^$/')" if ! [ -z "$o" ]; then url="$(awk '/^URL:/ {print$2}' <<< "$o")" dir="${url##*/}" files="$(awk '/^ .*\.?tf$/ {print $2}' <<< "$o")" md5sums="$(awk '/^ .*\.?tf$/ {gsub(/^ /,""); print}' <<< "$o")" for file in $files; do download "${url}/${file}" "${TARGET}/${file}" echo "Package: $FNTMATCH File: $file" done echo "$md5sums" > "${FNTINDEXDIR}/google-${dir}" return fi fi } render_preview() { PREVIEW="$1" _app=( chafa="-w 9" timg="" ) for a in "${_app[@]}"; do bin=${a%=*} opt=${a#*=} if check_com "$bin"; then if file --brief --mime-type "$PREVIEW" |grep -q 'image/*'; then # shellcheck disable=SC2086 $bin $opt "$PREVIEW" return 0 fi return 0 else missing=( "${missing[@]}" "$bin" ) fi done echo "Warning: ${missing[*]} not available. Please install one of them." >&2 echo -e "\v\t${PREVIEWURI}\v" return 69 } preview() { PREVIEW="${FNTDATA}/preview.png" PREVIEWURI="https://screenshots.debian.net/screenshot/fonts-$1" if download "$PREVIEWURI" "${PREVIEW}"; then # if we get nothing / "this picture is not available" pic if [ "$($md5 "$PREVIEW" | awk '{print$1}')" = "b5765b390157e36eaf721c8848a4b04d" ]; then PREVIEWURI="$GINDEX/preview/$1/preview.webp" if download "$PREVIEWURI" "$PREVIEW"; then if ! file --brief --mime-type "$PREVIEW" |grep -q 'image/*'; then echo "Couldn't retrieve a preview for ${1}." exit 69 fi fi fi if render_preview "$PREVIEW"; then PRINTED=1 echo "$1: $PREVIEWURI" fi fi if [ "$PRINTED" != "1" ]; then echo "Couldn't display a preview for $1." >&2 return 69 fi } case "$s" in Darwin) #echo macOS md5="md5sum" check="$md5 curl brew otfinfo ar" # otfinfo comes with lcdf-typetools i="brew" TARGET="$HOME/Library/Fonts/" FNTDATA="$HOME/.fnt" ;; Linux|GNU/kFreeBSD|GNU) #echo Linux md5="md5sum" check="$md5 ar awk curl file otfinfo tar unxz xzcat" i="apt" # TARGET="$HOME/.fonts/" if [ 0 -eq "$(id -u)" ]; then TARGET="/usr/local/share/fonts/" fi ;; FreeBSD) #echo FreeBSD md5="md5" check="$md5 curl otfinfo ar" i="pkg" TARGET="$HOME/.fonts" FNTDATA="$HOME/.fnt" ;; OpenBSD) #echo OpenBSD md5="md5" check="$md5 curl otfinfo ar" i="pkg_add" #TARGET="$HOME/.local/share/fonts" ;; Haiku) #echo Haiku OS check="curl ar" i="pkgman" TARGET="$HOME/config/non-packaged/data/fonts" FNTDATA="$HOME/.fnt" ;; Windows) #echo Windows check="cmd.exe" i="ENOPKGMANAGER" TARGET="$USERPROFILE\\Fonts" ;; *) echo "Please report $s to https://github.com/alexmyczko/fnt/issues" exit 1 ;; esac for a in $check; do if ! command -v "$a" &>/dev/null; then echo "$a not found, please use $i to install it." exit 69 fi done cat=$(command -v lolcat || :) PATH="/usr/games:$PATH" if test -z "$cat"; then cat=$(command -v cat); fi case "$1" in help|-h) cat << 'EOF' Syntax: fnt [ update | list [indexfile]| info | help ] fnt [ install | remove | preview | search ] font help|-h this help info information about how many fonts can be installed and are available install|-i install a font list|-l lists installed fonts with glyphcount per font preview|-p preview a font remove|-r remove a font search|-s search for font update|-u updates the font package index of debian sid EOF ;; update|-u) echo -n "Updating... " mkdir -p "${FNTDATA}/index" && rm -rf "$PACKAGES" "$APACHE" "$OFL" PACKAGESTMP=$(mktemp) download "$INDEX" "$PACKAGESTMP" xzcat "$PACKAGESTMP" | awk '/^Package: fonts-/,/^$/' > "${PACKAGES%.xz}"; xz "${PACKAGES%.xz}" ; rm "$PACKAGESTMP" ; echo -n "${PACKAGES##*/}... " download "$APACHEINDEX" "$APACHE"; echo -n "${APACHE##*/}... " download "$OFLINDEX" "$OFL"; echo -n "${OFL##*/}... " echo -n -e "done.\n" ;; info) mkdir -p "$FNTINDEXDIR" INSTALLEDFONTS=$(fnt list index) ALLFONTS=$(${BASH_SOURCE[0]} search) printf 'fnt v:%s infos...\nFNTDATA %s (%s)\nTARGET %s (%s)\n' \ "$VERSION" \ "$FNTDATA" "$(du -hs "$FNTDATA" 2>/dev/null |cut -f1)" \ "$TARGET" "$(du -hs "$TARGET" 2>/dev/null |cut -f1)" printf 'Available Fonts from\tDebian: %i\tGoogle: %i\n' \ "$(grep -c '^fonts-' <<< "$ALLFONTS")" \ "$(grep -c '^google-' <<< "$ALLFONTS")" printf 'Installed Fonts from\tDebian: %i\tGoogle: %i\n' \ "$(grep -c '^fonts-' <<< "$INSTALLEDFONTS")" \ "$(grep -c '^google-' <<< "$INSTALLEDFONTS")" ;; list|-l) if [ $# -eq 1 ]; then find "$TARGET" -iname '*.?tf' 2>/dev/null | sort | while read -r f; do IDX=$(basename "$(grep -rl "$(basename "$f")" "$FNTINDEXDIR")") if test -z "$IDX"; then IDX=NOT-MANAGED-BY-FNT; fi echo "$IDX: $(basename "${f}") [$(otfinfo -u "$f" 2>/dev/null | wc -l | awk '{print $1}')]" unset IDX done fi if [ $# -eq 2 ] && [ "$2" = "index" ] ; then find "$FNTINDEXDIR" -type f | awk -F'/' '{print $NF}' fi if [ $# -eq 2 ] && [ -r "$FNTINDEXDIR/$2" ]; then # shellcheck disable=SC2046 find $(awk -v target="$TARGET" \ '{printf "%s/%s ", target, $2}' "$FNTINDEXDIR/$2") | while read -r font; do echo "$(basename "${font}") [$(otfinfo -u "$font" 2>/dev/null | wc -l)]" done fi ;; preview|-p) if [ $# -ne 2 ]; then echo "No fontname supplied." echo "Usage: ${BASH_SOURCE[0]} preview agave" exit 64 fi mkdir -p "$FNTINDEXDIR" rm -f "${FNTDATA}/preview.png" FNTMATCH="$(sed -E 's/^(fonts|google)-//g' <<< "$2")" preview "$FNTMATCH" ;; install|-i) fnt_install "$@" ;; remove|-r) if [ $# -eq 1 ] ; then echo "Usage: ${BASH_SOURCE[0]} remove fonts-agave agave-b-autohinted.ttf" echo "To get a list of indexes/files: ${BASH_SOURCE[0]} list [index|fonts-agave]" fi if [ $# -eq 2 ] && [ -w "$FNTINDEXDIR/$2" ] ; then if [ -e "$FNTINDEXDIR/$2" ]; then awk '{print$2}' "$FNTINDEXDIR/$2" |while read -r FONTFILE; do ${BASH_SOURCE[0]} remove "$2" "$FONTFILE" done else echo "Couldn't find the font $2" fi rm -fv "${FNTINDEXDIR:?}/$2" fi if [ $# -eq 3 ] && [ -w "$FNTINDEXDIR/$2" ] && [ -w "$TARGET/$3" ] ; then if grep -q "$3" "$FNTINDEXDIR/$2"; then rm -fv "${TARGET:?}/${3:?}" fi fi ;; search|-s) search "$2" ;; purge) if [ $# -eq 1 ] ; then echo "This command will remove $TARGET and $FNTDATA!" echo -e "If you are certain use:\n\t${BASH_SOURCE[0]} purge yes-i-am-sure" echo "You have been warned." fi if [ $# -eq 2 ] && [ "$2" = "yes-i-am-sure" ] ; then rm -Rvf "${TARGET:?}" "${FNTDATA:?}" fi ;; moo) echo "This fnt does not have cow powers." ;; wak) $cat << 'EOF' _()< wak wak (__) EOF ;; quak) $cat << 'EOF' _______ < QUAK? > ------- \ \ oO)-. .-(Oo /__ _\ /_ __\ \ \( | ()~() | )/ / \__|\ | (-___-) | /|__/ ' '--' ==`-'== '--' ' EOF ;; *) $cat << EOF .d888 $VERSION d88P" 888 888 888 .d88888 888888b. d888888 888 888 "88b 888 888 888 888 888 888 888 888 Y88b. 888 888 888 "Y888 EOF ;; esac fnt-1.9/fnt.1000066400000000000000000000015371476000104600130270ustar00rootroot00000000000000.TH man 1 "12 Aug 2023" "1.9" "font downloader and manager" .SH NAME fnt \- download and install fonts .SH SYNOPSIS .TP \fBfnt\fP \fIcommand\fP [\fIargument\fP] .SH DESCRIPTION This tool helps you to download vector fonts from Debian sid, and Google Web Fonts. .SH EXAMPLES .TP .I fnt update update font index. .TP .I fnt info show available/installed font summary. .TP .I fnt search aga search for fonts named aga. .TP .I fnt install agave install the font called agave. .TP .I fnt preview agave show a text-based preview of the font called agave. .TP .I fnt remove agave remove the font files from the package agave. .TP .I fnt list list installed fonts with glyphcount. .SH SEE ALSO birdfont(1), bdf2sfd(1). .SH BUGS Please report to https://github.com/alexmyczko/fnt/issues .SH AUTHOR Alex Myczko .SH INTERNET https://github.com/alexmyczko/fnt