2018-07-09 16:20:40 +02:00
|
|
|
#!/usr/bin/env bash
|
2023-11-21 12:23:08 +02:00
|
|
|
# Nerd Fonts Version: 3.1.0
|
2023-06-01 07:37:35 +02:00
|
|
|
# Script Version: 1.1.1
|
2016-11-24 03:57:46 +02:00
|
|
|
|
2023-04-11 14:37:03 +02:00
|
|
|
# Run this script in your local bash:
|
|
|
|
# curl https://raw.githubusercontent.com/ryanoasis/nerd-fonts/master/bin/scripts/test-fonts.sh | bash
|
2023-05-31 21:41:19 +02:00
|
|
|
# Is possible to change the number of columns passing a number as the first parameter (default=16):
|
|
|
|
# ./test-fonts.sh 8
|
2023-04-11 14:37:03 +02:00
|
|
|
|
2017-04-09 18:57:33 +02:00
|
|
|
# Given an array of decimal numbers print all unicode codepoint.
|
2016-11-24 03:57:46 +02:00
|
|
|
function print-decimal-unicode-range() {
|
2017-04-09 18:48:16 +02:00
|
|
|
local originalSequence=("$@")
|
2017-04-09 15:57:47 +02:00
|
|
|
local counter=0
|
|
|
|
# Use alternating colors to see which symbols extend out of the bounding
|
|
|
|
# box.
|
|
|
|
local bgColorBorder='\033[48;5;8m'
|
|
|
|
local bgColorCode='\033[48;5;246m'
|
|
|
|
local alternateBgColorCode='\033[48;5;240m'
|
|
|
|
local bgColorChar='\033[48;5;66m'
|
|
|
|
local alternateBgColorChar='\033[48;5;60m'
|
|
|
|
local underline='\033[4m'
|
|
|
|
local currentColorCode="${bgColorCode}"
|
|
|
|
local currentColorChar="${bgColorChar}"
|
|
|
|
local reset_color='\033[0m'
|
|
|
|
local allChars=""
|
|
|
|
local allCodes=""
|
2023-05-31 04:36:31 +02:00
|
|
|
local wrapAt=16
|
2023-05-31 07:45:53 +02:00
|
|
|
[[ "$wrappingValue" =~ ^[0-9]+$ ]] && [ "$wrappingValue" -gt 2 ] && wrapAt="$wrappingValue"
|
2023-05-31 04:34:09 +02:00
|
|
|
local topLineStart="${bgColorBorder}╔═══"
|
|
|
|
local topLineMiddle="═══╦═══"
|
|
|
|
local topLineEnd="═══╗${reset_color}"
|
|
|
|
local bottomLineStart="${bgColorBorder}╚═══"
|
|
|
|
local bottomLineMiddle="═══╩═══"
|
|
|
|
local bottomLineEnd="═══╝${reset_color}"
|
|
|
|
local lineStart="${bgColorBorder}╠═══"
|
|
|
|
local lineMiddle="═══╬═══"
|
|
|
|
local lineEnd="═══╣${reset_color}"
|
2017-04-09 15:57:47 +02:00
|
|
|
local bar="${bgColorBorder}║${reset_color}"
|
|
|
|
local originalSequenceLength=${#originalSequence[@]}
|
|
|
|
local leftoverSpaces=$((wrapAt - (originalSequenceLength % wrapAt)))
|
|
|
|
|
|
|
|
# add fillers to array to maintain table:
|
2023-05-31 07:48:38 +02:00
|
|
|
if [ "$leftoverSpaces" -lt "$wrapAt" ]; then
|
2023-05-31 19:37:06 +02:00
|
|
|
for ((c = 1; c <= leftoverSpaces; c++)); do
|
2017-04-09 15:57:47 +02:00
|
|
|
originalSequence+=(0)
|
2016-11-24 03:57:46 +02:00
|
|
|
done
|
2017-04-09 15:57:47 +02:00
|
|
|
fi
|
|
|
|
|
|
|
|
local sequenceLength=${#originalSequence[@]}
|
|
|
|
|
2023-05-31 04:34:09 +02:00
|
|
|
printf "%b" "$topLineStart"
|
|
|
|
for ((c = 2; c <= wrapAt; c++)); do
|
|
|
|
printf "%b" "$topLineMiddle"
|
|
|
|
done
|
|
|
|
printf "%b\\n" "$topLineEnd"
|
2017-04-09 18:57:33 +02:00
|
|
|
|
2017-04-09 15:57:47 +02:00
|
|
|
for decimalCode in "${originalSequence[@]}"; do
|
2018-01-13 05:20:52 +02:00
|
|
|
local hexCode
|
|
|
|
hexCode=$(printf '%x' "${decimalCode}")
|
2017-04-09 15:57:47 +02:00
|
|
|
local code="${hexCode}"
|
2023-06-01 07:37:35 +02:00
|
|
|
local char="\\U${hexCode}"
|
2017-04-09 15:57:47 +02:00
|
|
|
|
|
|
|
# fill in placeholder cells properly formatted:
|
2023-06-01 07:37:35 +02:00
|
|
|
if [ "${char}" = "\\U0" ]; then
|
2017-04-09 15:57:47 +02:00
|
|
|
char=" "
|
2023-06-01 07:37:35 +02:00
|
|
|
code=""
|
2017-04-09 15:57:47 +02:00
|
|
|
fi
|
|
|
|
|
2023-06-01 07:37:35 +02:00
|
|
|
filler=""
|
|
|
|
for ((c = ${#code}; c < 5; c++)); do
|
|
|
|
filler=" ${filler}"
|
|
|
|
done
|
|
|
|
|
|
|
|
allCodes+="${currentColorCode}${filler}${underline}${code}${reset_color}${currentColorCode} ${reset_color}$bar"
|
2017-04-09 15:57:47 +02:00
|
|
|
allChars+="${currentColorChar} ${char} ${reset_color}$bar"
|
|
|
|
counter=$((counter + 1))
|
|
|
|
count=$(( (count + 1) % wrapAt))
|
2017-04-09 18:57:33 +02:00
|
|
|
|
2017-04-09 15:57:47 +02:00
|
|
|
if [[ $count -eq 0 ]]; then
|
2017-04-09 18:57:33 +02:00
|
|
|
|
2017-04-09 15:57:47 +02:00
|
|
|
if [[ "${currentColorCode}" = "${alternateBgColorCode}" ]]; then
|
|
|
|
currentColorCode="${bgColorCode}"
|
|
|
|
currentColorChar="${bgColorChar}"
|
|
|
|
else
|
|
|
|
currentColorCode="${alternateBgColorCode}"
|
|
|
|
currentColorChar="${alternateBgColorChar}"
|
|
|
|
fi
|
|
|
|
|
|
|
|
printf "%b%b%b" "$bar" "$allCodes" "$reset_color"
|
2018-01-13 05:20:52 +02:00
|
|
|
printf "\\n"
|
2017-04-09 15:57:47 +02:00
|
|
|
printf "%b%b%b" "$bar" "$allChars" "$reset_color"
|
2018-01-13 05:20:52 +02:00
|
|
|
printf "\\n"
|
2017-04-09 15:57:47 +02:00
|
|
|
|
|
|
|
if [ "$counter" != "$sequenceLength" ]; then
|
2023-05-31 04:34:09 +02:00
|
|
|
printf "%b" "$lineStart"
|
|
|
|
for ((c = 2; c <= wrapAt; c++)); do
|
|
|
|
printf "%b" "$lineMiddle"
|
|
|
|
done
|
|
|
|
printf "%b\\n" "$lineEnd"
|
2017-04-09 15:57:47 +02:00
|
|
|
fi
|
|
|
|
|
|
|
|
allCodes=""
|
|
|
|
allChars=""
|
|
|
|
fi
|
|
|
|
|
|
|
|
done
|
2017-04-09 18:52:31 +02:00
|
|
|
|
2023-05-31 04:34:09 +02:00
|
|
|
printf "%b" "$bottomLineStart"
|
|
|
|
for ((c = 2; c <= wrapAt; c++)); do
|
|
|
|
printf "%b" "$bottomLineMiddle"
|
|
|
|
done
|
|
|
|
printf "%b\\n" "$bottomLineEnd"
|
|
|
|
|
2017-04-09 18:57:33 +02:00
|
|
|
|
2016-11-24 03:57:46 +02:00
|
|
|
}
|
2016-12-14 04:11:16 +02:00
|
|
|
|
2016-11-24 03:57:46 +02:00
|
|
|
function print-unicode-ranges() {
|
2017-04-09 18:48:16 +02:00
|
|
|
echo ''
|
2017-04-09 18:57:33 +02:00
|
|
|
|
2019-08-11 16:30:38 +02:00
|
|
|
local arr=("$@")
|
2017-04-09 15:57:47 +02:00
|
|
|
local len=$#
|
2017-04-09 18:48:16 +02:00
|
|
|
local combinedRanges=()
|
2017-04-09 18:57:33 +02:00
|
|
|
|
2017-04-09 15:57:47 +02:00
|
|
|
for ((j=0; j<len; j+=2)); do
|
|
|
|
local start="${arr[$j]}"
|
|
|
|
local end="${arr[(($j+1))]}"
|
|
|
|
local startDecimal=$((16#$start))
|
|
|
|
local endDecimal=$((16#$end))
|
2017-04-09 18:57:33 +02:00
|
|
|
|
2023-06-01 07:54:21 +02:00
|
|
|
# shellcheck disable=SC2207 # We DO WANT the output to be split
|
|
|
|
combinedRanges+=($(seq "$startDecimal" "$endDecimal"))
|
2017-04-09 18:57:33 +02:00
|
|
|
|
2017-04-09 15:57:47 +02:00
|
|
|
done
|
2017-04-09 18:48:16 +02:00
|
|
|
|
|
|
|
print-decimal-unicode-range "${combinedRanges[@]}"
|
|
|
|
|
2016-11-24 03:57:46 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
function test-fonts() {
|
2017-04-09 15:57:47 +02:00
|
|
|
echo "Nerd Fonts - Pomicons"
|
|
|
|
print-unicode-ranges e000 e00d
|
|
|
|
echo; echo
|
2017-04-08 23:34:59 +02:00
|
|
|
|
2017-04-09 15:57:47 +02:00
|
|
|
echo "Nerd Fonts - Powerline"
|
|
|
|
print-unicode-ranges e0a0 e0a2 e0b0 e0b3
|
|
|
|
echo; echo
|
2016-11-24 03:57:46 +02:00
|
|
|
|
2017-04-09 15:57:47 +02:00
|
|
|
echo "Nerd Fonts - Powerline Extra"
|
|
|
|
print-unicode-ranges e0a3 e0a3 e0b4 e0c8 e0cc e0d2 e0d4 e0d4
|
|
|
|
echo; echo
|
2016-11-24 03:57:46 +02:00
|
|
|
|
2017-04-09 15:57:47 +02:00
|
|
|
echo "Nerd Fonts - Symbols original"
|
|
|
|
print-unicode-ranges e5fa e62b
|
|
|
|
echo; echo
|
2016-11-24 03:57:46 +02:00
|
|
|
|
2017-04-09 15:57:47 +02:00
|
|
|
echo "Nerd Fonts - Devicons"
|
|
|
|
print-unicode-ranges e700 e7c5
|
|
|
|
echo; echo
|
2016-11-24 03:57:46 +02:00
|
|
|
|
2017-04-09 15:57:47 +02:00
|
|
|
echo "Nerd Fonts - Font awesome"
|
|
|
|
print-unicode-ranges f000 f2e0
|
|
|
|
echo; echo
|
2016-11-24 03:57:46 +02:00
|
|
|
|
2017-04-09 15:57:47 +02:00
|
|
|
echo "Nerd Fonts - Font awesome extension"
|
|
|
|
print-unicode-ranges e200 e2a9
|
|
|
|
echo; echo
|
2016-11-24 03:57:46 +02:00
|
|
|
|
2017-04-09 15:57:47 +02:00
|
|
|
echo "Nerd Fonts - Octicons"
|
|
|
|
print-unicode-ranges f400 f4a8 2665 2665 26A1 26A1 f27c f27c
|
|
|
|
echo; echo
|
2016-11-24 03:57:46 +02:00
|
|
|
|
2022-09-13 07:06:41 +02:00
|
|
|
echo "Nerd Fonts - Font Logos"
|
2023-05-31 18:57:37 +02:00
|
|
|
print-unicode-ranges f300 f32f
|
2017-04-09 15:57:47 +02:00
|
|
|
echo; echo
|
2016-11-24 03:57:46 +02:00
|
|
|
|
2017-04-09 15:57:47 +02:00
|
|
|
echo "Nerd Fonts - Font Power Symbols"
|
|
|
|
print-unicode-ranges 23fb 23fe 2b58 2b58
|
|
|
|
echo; echo
|
2016-11-24 03:57:46 +02:00
|
|
|
|
2023-06-01 08:01:02 +02:00
|
|
|
echo "Nerd Fonts - Material Design Icons (first few)"
|
|
|
|
print-unicode-ranges f0001 f0010
|
2018-02-13 04:32:31 +02:00
|
|
|
echo; echo
|
|
|
|
|
2019-08-01 23:08:03 +02:00
|
|
|
echo "Nerd Fonts - Weather Icons"
|
|
|
|
print-unicode-ranges e300 e3eb
|
|
|
|
echo; echo
|
2016-11-24 03:57:46 +02:00
|
|
|
}
|
|
|
|
|
2023-05-31 07:45:53 +02:00
|
|
|
wrappingValue="$1"
|
|
|
|
|
2016-11-24 03:57:46 +02:00
|
|
|
test-fonts
|