git.lucas.co / fontpreview
git clone https://git.lucas.co/fontpreview.git

commit75855f96481f1c90cc5bdaf2a70eb2ba847da8c6
parent98952b2ae6
authorSiddharth Dushantha <siddharth.dushantha@gmail.com>
date2020-03-24 10:53
You can now point fontpreview to a font file and preview it

For example, you can preview a font file you just downloaded:
    fontpreview /path/to/font.ttf

 fontpreview | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/fontpreview b/fontpreview
index 06ac4d3..8d3e89e 100755
--- a/fontpreview
+++ b/fontpreview
@@ -158,6 +158,9 @@ touch "$FONT_PREVIEW" || exit
 TERMWIN_IDFILE="$FONTPREVIEW_DIR/fontpreview.termpid"
 touch "$TERMWIN_IDFILE" || exit
 
+font=$1
+shift
+
 # Parse the arguments
 options=$(getopt -o hi:o: --long position:,size:,version,search-prompt:,font-size:,bg-color:,fg-color:,preview-text:,input:,output:,help -- "$@")
 eval set -- "$options"
@@ -209,6 +212,17 @@ while true; do
     shift
 done
 
+if [ -f "$font" ]; then
+    generate_preview "$font" "$FONT_PREVIEW"
+    # Display the font preview using sxiv
+	# sxiv -g "$SIZE$POSITION" -N "fontpreview" -b "$FONT_PREVIEW" &
+    sxiv -g "$SIZE$POSITION" -N "fontpreview" -b "$FONT_PREVIEW" &
+    # For some strange reason, sxiv just 
+     sleep 0.1
+    exit
+fi
+
+
 if [[ "$input_file" != "" ]] ; then
     if [ -z "$output_file" ] ; then
         output_file="${input_file}.png"