mirror of
https://github.com/ryanoasis/nerd-fonts.git
synced 2024-12-19 20:12:52 +02:00
test-powerline: Allow for 2 cell wide glyphs
[why] When testing 'Nerd Font' fonts (i.e. symbols may be 2 cells wide), the output does not take that into account and does not insert the needed blanks. [how] Because the actual width can not be easily determined add a parameter (just add anything as parameter) to switch some glyphs to two cell mode. These glyphs are in a list, i.e. hardcoded. If the widths in non-Mono fonts is ever changed this script needs to be adapted. Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
This commit is contained in:
parent
23502d630e
commit
c899778ad4
@ -1,6 +1,9 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
# Nerd Fonts Version: 2.3.3
|
# Nerd Fonts Version: 2.3.3
|
||||||
# Script Version: 1.1.0
|
# Script Version: 1.2.0
|
||||||
|
|
||||||
|
# Give any parameter to allow some glyphs to be 2 'cells' wide.
|
||||||
|
# This might or might not be how they are currently handled while patching
|
||||||
|
|
||||||
text1='Testing'
|
text1='Testing'
|
||||||
text2='Nerd Fonts'
|
text2='Nerd Fonts'
|
||||||
@ -9,6 +12,7 @@ leftSymbolsCodes=('E0B0' 'E0B4' 'E0B8' 'E0BC' 'E0C0' 'E0C4' 'E0C6' 'E0C8' 'E0CC'
|
|||||||
leftSymbols=('' '' '' '' '' '' '' '' '' '' '' '' '' '')
|
leftSymbols=('' '' '' '' '' '' '' '' '' '' '' '' '' '')
|
||||||
rightSymbolsCodes=('E0B2' 'E0B6' 'E0BA' 'E0BE' 'E0C2' 'E0C5' 'E0C7' 'E0CA' 'E0CC' 'E0CE' 'E0CF' 'E0CF' 'E0D1' 'E0D4')
|
rightSymbolsCodes=('E0B2' 'E0B6' 'E0BA' 'E0BE' 'E0C2' 'E0C5' 'E0C7' 'E0CA' 'E0CC' 'E0CE' 'E0CF' 'E0CF' 'E0D1' 'E0D4')
|
||||||
rightSymbols=('' '' '' '' '' '' '' '' '' '' '' '' '' '')
|
rightSymbols=('' '' '' '' '' '' '' '' '' '' '' '' '' '')
|
||||||
|
isWide=(0 0 0 0 1 1 1 1 1 1 1 1 1 0)
|
||||||
|
|
||||||
# shellcheck disable=SC2034
|
# shellcheck disable=SC2034
|
||||||
# don't check unused vars we might want to use them later on
|
# don't check unused vars we might want to use them later on
|
||||||
@ -35,17 +39,26 @@ colorBgDefault='\033[49m'
|
|||||||
echo -e "$colorReset Nerd Fonts :: Testing Powerline Symbol size and alignment"
|
echo -e "$colorReset Nerd Fonts :: Testing Powerline Symbol size and alignment"
|
||||||
|
|
||||||
for i in "${!leftSymbolsCodes[@]}"; do
|
for i in "${!leftSymbolsCodes[@]}"; do
|
||||||
|
pad=' '
|
||||||
|
pad2=' '
|
||||||
symbol=${leftSymbols[$i]}
|
symbol=${leftSymbols[$i]}
|
||||||
symbol2=${rightSymbols[$i]}
|
symbol2=${rightSymbols[$i]}
|
||||||
code="${leftSymbolsCodes[$i]}"
|
code="${leftSymbolsCodes[$i]}"
|
||||||
code2="${rightSymbolsCodes[$i]}"
|
code2="${rightSymbolsCodes[$i]}"
|
||||||
|
|
||||||
|
if [ ${isWide[$i]} -ge 1 -a $# -ge 1 ]; then
|
||||||
|
symbol="${symbol} "
|
||||||
|
symbol2="${symbol2} "
|
||||||
|
pad=
|
||||||
|
pad2=
|
||||||
|
fi
|
||||||
if [ "$code" = "$code2" ]; then
|
if [ "$code" = "$code2" ]; then
|
||||||
symbol2=${rightSymbols[0]}
|
symbol2=${rightSymbols[0]}
|
||||||
code2='None'
|
code2='None'
|
||||||
|
pad2=' '
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo -e "$colorBg1$colorFg1$text1 $code $colorFg2$colorBg2$symbol $text2 $colorFg1$colorBgDefault$symbol -- $colorFg1$colorBgDefault$symbol2$colorFg2$colorBg2 $text2 $symbol2$colorBg1$colorFg1 $code2 $colorReset$colorBgWhite\\n$colorReset"
|
echo -e "$colorBg1$colorFg1$text1 $code $colorFg2$colorBg2$symbol$pad $text2 $pad$colorFg1$colorBgDefault$symbol -- $colorFg1$colorBgDefault$symbol2$colorFg2$colorBg2$pad2 $text2 $pad2$symbol2$colorBg1$colorFg1 $code2 $colorReset$colorBgWhite\\n$colorReset"
|
||||||
|
|
||||||
done
|
done
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user