Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sdushantha/fontpreview
Highly customizable and minimal font previewer written in bash
https://github.com/sdushantha/fontpreview
bash cli commandline font-size fontpreview fonts fontviewer fuzzy-search linux
Last synced: 1 day ago
JSON representation
Highly customizable and minimal font previewer written in bash
- Host: GitHub
- URL: https://github.com/sdushantha/fontpreview
- Owner: sdushantha
- License: mit
- Created: 2020-02-08T12:37:10.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2024-06-29T13:03:07.000Z (7 months ago)
- Last Synced: 2025-01-24T10:04:59.153Z (8 days ago)
- Topics: bash, cli, commandline, font-size, fontpreview, fonts, fontviewer, fuzzy-search, linux
- Language: Shell
- Homepage:
- Size: 6.06 MB
- Stars: 931
- Watchers: 14
- Forks: 40
- Open Issues: 19
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
✨ Very customizable and minimal font previewer written in bash ✨`fontpreview` is a commandline tool that lets you **quickly search** for fonts
that are installed on your machine and preview them. The **fuzzy search** feature
is provided by `fzf` and the preview is generated with `imagemagick` and then
displayed using `nsxiv`. This tool is **highly customizable**, almost all of the
variables in this tool can be changed using the commandline flags or you can
configure them using environment variables.![](extra/demo.gif)
## Dependencies
- `xdotool`
- `fzf`
- `imagemagick`
- `nsxiv`## Installation
### Install using `make`
```bash
# Clone the repo
$ git clone https://github.com/sdushantha/fontpreview# Change your current directory to fontpreview
$ cd fontpreview# Install it
$ sudo make install
```### Install it locally
```bash
# Download the fontpreview source code, save as fontpreview
# and make it executeable
$ curl -L https://git.io/raw_fontpreview > fontpreview && chmod +x fontpreview# Then move fontpreview to somewhere in your $PATH
# Here is an example
$ mv fontpreview ~/scripts/
```## Usage
```
$ fontpreview --help
usage: fontpreview [-h] [--size "px"] [--position "+x+y"] [--search-prompt SEARCH_PROMPT]
[--font-size "FONT_SIZE"] [--bg-color "BG_COLOR"] [--fg-color "FG_COLOR"]
[--preview-text "PREVIEW_TEXT"] [-i font.otf] [-o preview.png] [--version]┌─┐┌─┐┌┐┌┌┬┐┌─┐┬─┐┌─┐┬ ┬┬┌─┐┬ ┬
├┤ │ ││││ │ ├─┘├┬┘├┤ └┐┌┘│├┤ │││
└ └─┘┘└┘ ┴ ┴ ┴└─└─┘ └┘ ┴└─┘└┴┘
Very customizable and minimal font previewer written in bashoptional arguments:
-h, --help show this help message and exit
-i, --input filename of the input font (.otf, .ttf, .woff are supported)
-o, --output filename of the output preview image (input.png if not set)
--size size of the font preview window
--position the position where the font preview window should be displayed
--search-prompt input prompt of fuzzy searcher
--font-size font size
--bg-color background color of the font preview window
--fg-color foreground color of the font preview window
--preview-text preview text that should be displayed in the font preview window
--version show the version of fontpreview you are using
```If you want to generate a preview image for a **single** font file
(.otf, .ttf, and .woff are supported), use the `-i` and `-o` option
to indicate the filename of the input font and the output preview
image.```
$ fontpreview -i font.otf -o preview.png
```This can be used with [überzug](https://github.com/seebye/ueberzug)
to implement font preview within terminal file managers such as
[vifm](https://vifm.info/).![](extra/vifm.png)
A detailed setup instructions can be found [here](https://krasjet.com/scribbles/font-preview.html)
## Configure
You can configure `fontpreview` through environment variables.This can be in your `.bashrc`, `.zshrc`, etc
```bash
# Input prompt of fuzzy searcher
export FONTPREVIEW_SEARCH_PROMPT="❯ "# Size of the font preview window
export FONTPREVIEW_SIZE=532x365# The position where the font preview window should be displayed
export FONTPREVIEW_POSITION="+0+0"# Font size
export FONTPREVIEW_FONT_SIZE=38# Background color of the font preview window
export FONTPREVIEW_BG_COLOR="#ffffff"# Foreground color of the font preview window
export FONTPREVIEW_FG_COLOR="#000000"# Preview text that should be displayed in the font preview window
export FONTPREVIEW_PREVIEW_TEXT="ABCDEFGHIJKLM\nNOPQRSTUVWXYZ\nabcdefghijklm\nnopqrstuvwxyz\n1234567890\n!@$\%(){}[]"
```