Combines differing ranges in each set into a single ascii table

This commit is contained in:
Ryan L McIntyre 2017-04-09 12:48:16 -04:00
parent 77d3c88780
commit a04ecfe080

View file

@ -3,14 +3,18 @@
# Given a decimal number start and end print all unicode codepoint. # Given a decimal number start and end print all unicode codepoint.
# If $3 is specified, it's used as the current column number. # If $3 is specified, it's used as the current column number.
function print-decimal-unicode-range() { function print-decimal-unicode-range() {
local start="$1" #local start="$1"
local end="$2" #local end="$2"
local continuedCount="$3" local originalSequence=("$@")
#echo "1 is $1" #local continuedCount="$3"
echo "1 is:"
echo "${1}"
#echo "2 is $2" #echo "2 is $2"
#echo "3 is $3" #echo "3 is $3"
local counter=0 local counter=0
local count="${continuedCount:-0}" # Paramater substitution: use zero if not set
#local count="${continuedCount:-0}"
#echo "count is $count"
# Use alternating colors to see which symbols extend out of the bounding # Use alternating colors to see which symbols extend out of the bounding
# box. # box.
#local bgColor='\033[48;2;54;11;0m' #local bgColor='\033[48;2;54;11;0m'
@ -36,7 +40,7 @@ function print-decimal-unicode-range() {
local bottomLine="${bgColorBorder}╚══════╩══════╩══════╩══════╩══════╝${reset_color}" local bottomLine="${bgColorBorder}╚══════╩══════╩══════╩══════╩══════╝${reset_color}"
local line="${bgColorBorder}╠══════╬══════╬══════╬══════╬══════╣${reset_color}" local line="${bgColorBorder}╠══════╬══════╬══════╬══════╬══════╣${reset_color}"
local bar="${bgColorBorder}${reset_color}" local bar="${bgColorBorder}${reset_color}"
local originalSequence=($(seq "${start}" "${end}")) #local originalSequence=($(seq "${start}" "${end}"))
local originalSequenceLength=${#originalSequence[@]} local originalSequenceLength=${#originalSequence[@]}
local leftoverSpaces=$((wrapAt - (originalSequenceLength % wrapAt))) local leftoverSpaces=$((wrapAt - (originalSequenceLength % wrapAt)))
@ -131,10 +135,11 @@ function print-decimal-unicode-range() {
} }
function print-unicode-ranges() { function print-unicode-ranges() {
echo -e '' echo ''
#local count=0 #local count=0
local arr=($@) local arr=($@)
local len=$# local len=$#
local combinedRanges=()
#echo "len was $len" #echo "len was $len"
for ((j=0; j<len; j+=2)); do for ((j=0; j<len; j+=2)); do
#for i in "${!arr[@]}" #for i in "${!arr[@]}"
@ -152,13 +157,19 @@ function print-unicode-ranges() {
#echo "end $end" #echo "end $end"
local startDecimal=$((16#$start)) local startDecimal=$((16#$start))
local endDecimal=$((16#$end)) local endDecimal=$((16#$end))
#echo "startDec $startDecimal" echo "startDec $startDecimal"
#echo "endDec $endDecimal" echo "endDec $endDecimal"
combinedRanges+=($(seq "${startDecimal}" "${endDecimal}"))
#echo "end loop - now i is $j" #echo "end loop - now i is $j"
print-decimal-unicode-range "${startDecimal}" "${endDecimal}" "0" #print-decimal-unicode-range "${startDecimal}" "${endDecimal}" "${count}"
#echo "end loop - now i is $j" #echo "end loop - now i is $j"
#count=$(($count + $endDecimal - $startDecimal)) #count=$(($count + $endDecimal - $startDecimal))
done done
echo "arr"
echo "${combinedRanges[@]}"
print-decimal-unicode-range "${combinedRanges[@]}"
} }
function test-fonts() { function test-fonts() {