Skip to content

A lightning-fast, terminal-based font previewer with Sixel graphics support, designed for designers and developers who work with fonts in Linux/Unix environments.

License

Notifications You must be signed in to change notification settings

felipefacundes/fontpreview

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Font Preview ✨

License: GPLv3 Version Shell

A lightning-fast, terminal-based font previewer with Sixel graphics support, designed for designers and developers who work with fonts in Linux/Unix environments.

This script is part of the shell_utils framework, one of the largest collections of scripts and utilities aimed at simplifying and enhancing user experience in the terminal. Demo Animation

Features 🌟

  • 🖼️ Interactive previews with real-time rendering
  • 🎨 Fully customizable colors, sizes, and sample text
  • 📋 Automatic clipboard integration (supports X11, Wayland, Termux)
  • 🔍 Fuzzy search through all available system fonts
  • 🖌️ Image export capability for documentation
  • 📱 Termux/Android compatible
  • 🎚️ Environment variable configuration
  • 🌈 Sixel graphics support for modern terminals

Installation 📦

Prerequisites

# Debian/Ubuntu
sudo apt install imagemagick fzf

# Arch Linux
sudo pacman -S imagemagick fzf

# Fedora
sudo dnf install ImageMagick fzf

# macOS (via Homebrew)
brew install imagemagick fzf

Install Script

wget https://raw.githubusercontent.com/felipefacundes/fontpreview/main/fontpreview -O ~/.local/bin/fontpreview
chmod +x ~/.local/bin/fontpreview

Usage 🚀

Basic Interactive Mode

fontpreview

Custom Preview Settings

fontpreview --margin-height 90 --size "1200x800" --font-size 36 --bg-color "#290a04" --fg-color "#f5e0c9"

Export to Image

fontpreview -i "FiraCode.otf" -o "fira_preview.png"

Show Help

fontpreview --help

Configuration ⚙️

Customize defaults through environment variables (add to your .bashrc/.zshrc):

export FONT_SIZE=36
export SIZE="1200x800"
export BG_COLOR="#290a04"
export FG_COLOR="#f5e0c9"
export PREVIEW_TEXT="Custom Preview Text\n1234567890\nABCDEFGHIJKLMNOPQRSTUVWXYZ"
export FZF_MARGIN_R=70  # Right margin percentage
export FZF_MARGIN_H=90  # Height percentage

Keybindings ⌨️

While in interactive mode:

  • / - Navigate font list
  • Enter - Select font (copies to clipboard)
  • Esc/Ctrl+C - Exit

Supported Terminals 🖥️

For best experience, use a Sixel-compatible terminal:

Troubleshooting 🔧

Problem: Preview not displaying
Solution: Ensure your terminal supports Sixel graphics or install feh as fallback:

sudo pacman -S feh  # ArchLinux
sudo apt install feh  # Debian/Ubuntu

Problem: Missing fonts
Solution: Specify exact path with -i flag
Install: To install additional fonts, use the --install flag and provide the font file exact path with -i

Contributing 🤝

Pull requests are welcome! For major changes, please open an issue first to discuss proposed changes.

License 📜

This project is licensed under the GPLv3 License - see the LICENSE file for details.


Crafted with ❤️ by [Felipe Facundes]

About

A lightning-fast, terminal-based font previewer with Sixel graphics support, designed for designers and developers who work with fonts in Linux/Unix environments.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages