Last active
January 2, 2020 22:50
-
-
Save willeccles/315ada913bc6d26626cfe1b204dd1d52 to your computer and use it in GitHub Desktop.
Take screenshots of all fonts in a linux console.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash -e | |
if ! command -v fbgrab &>/dev/null; then | |
echo "Please install fbgrab before running this." | |
exit 1 | |
fi | |
fontpath="${FONTPATH:-/usr/share/consolefonts}" | |
cd "$fontpath" | |
outputpath="${1:-/shared/fontpics}" | |
shopt -s extglob | |
if [ -f "$outputpath" ]; then | |
echo "$outputpath already exists and is not a directory!" | |
exit 1 | |
fi | |
if [ ! -d "$outputpath" ]; then | |
mkdir "$outputpath" | |
fi | |
for font in *.psf*; do | |
fontnoext="${font//.psf*/}" | |
fontname="${fontnoext/%?(+([0-9])?(x+([0-9])))}" | |
fontsize="${fontnoext/#"$fontname"}" | |
if setfont $font; then | |
clear | |
printf "$fontname: $fontsize\n\n" | |
showconsolefont | |
fbgrab "$outputpath/$fontnoext.png" | |
fi | |
done | |
clear | |
echo "Screenshots saved to $outputpath." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment