Skip to content

xlucn/fontpreview-ueberzug

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

53 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

fontpreview-ueberzug is a POSIX shell script to preview all fonts installed on system in fzf with ueberzug. It is inspired by fontpreview project while most of the code are completely rewritten here.

Dependencies

Install

Manual

Simply run the script, or put the script in your $PATH, or with provided makefile.

AUR

For Arch based users, fontpreview-ueberzug-git is available in AUR, thanks to @pabloariasal!

Usage

Usage: fontpreview-ueberzug [-h] [-a TEXT_ALIGN] [-s FONT_SIZE] [-b BG_COLOR] [-f FG_COLOR] [-t PREVIEW_TEXT]

Options:
    -a     alignment of preview text, you can use center, top/bottom/left/right or
           north/south/west/east, or combinations like topleft, default is center
    -s     preview font size, default is 72, note the actual size depends on the preview area
    -b, -f background and foreground color, default is #ffffff and #000000
    -t     preview text, you can add '\n' to split into lines

The arguments are passed directly to 'convert' command, you can check the ImageMagick documentation to find acceptable formats for them.

Tips

  • To merge the preview image into the terminal, set background color the same as that of the terminal emulator, this is not by default.

  • To show ligatures, you can use the following or any other text which contains ligature combination:

FONTPREVIEW_PREVIEW_TEXT="ABCDEFGHIJKLM\nNOPQRSTUVWXYZ\nabcdefghijklm\nnopqrstuvwxyz\n1234567890\n<!-- != == ->\n-| #[ |> <$> ~@" fontpreview-ueberzug

Configure

This script makes use of some of the environment variables as follows, these are the same in fontpreview so you can use the same settings with fontpreview-ueberzug:

  • FONTPREVIEW_FONT_SIZE
  • FONTPREVIEW_BG_COLOR
  • FONTPREVIEW_FG_COLOR
  • FONTPREVIEW_PREVIEW_TEXT
  • FONTPREVIEW_TEXT_ALIGN

Difference from fontpreview

  • Does not need two windows (terminal and sxiv) to display. Use ueberzug to display the preview image in terminal instead.
  • Preview updates as you scroll without having to press enter also going back to the first font in list.