mirror of
https://github.com/ryanoasis/nerd-fonts.git
synced 2024-12-31 21:22:38 +02:00
Fixes Combinations printf and variation total count and misc readability
This commit is contained in:
parent
0e36da6dc2
commit
179356f81e
@ -3,9 +3,9 @@
|
||||
|
||||
# Check for Fontforge
|
||||
type fontforge >/dev/null 2>&1 || {
|
||||
echo >&2 "FontForge must be installed before running this script."
|
||||
echo >&2 "Please see installation instructions at"
|
||||
echo >&2 "http://designwithfontforge.com/en-US/Installing_Fontforge.html"
|
||||
echo >&2 "# FontForge must be installed before running this script."
|
||||
echo >&2 "# Please see installation instructions at"
|
||||
echo >&2 "# http://designwithfontforge.com/en-US/Installing_Fontforge.html"
|
||||
exit 1
|
||||
}
|
||||
|
||||
@ -24,7 +24,7 @@ last_parent_dir=""
|
||||
if [ $# -eq 1 ]
|
||||
then
|
||||
like_pattern=$1
|
||||
echo "Parameter given, limiting search and patch to pattern '$like_pattern' given"
|
||||
echo "# Parameter given, limiting search and patch to pattern '$like_pattern' given"
|
||||
fi
|
||||
|
||||
# correct way to output find results into an array (when files have space chars, etc)
|
||||
@ -35,14 +35,14 @@ source_fonts=()
|
||||
done < <(find "$source_fonts_dir" -name "$like_pattern*.[o,t]tf" -type f -print0)
|
||||
|
||||
# print total number of source fonts found
|
||||
echo "Total source fonts found: ${#source_fonts[*]}"
|
||||
echo "# Total source fonts found: ${#source_fonts[*]}"
|
||||
|
||||
|
||||
function patch_font {
|
||||
local f=$1; shift
|
||||
# take everything before the last slash (/) to start building the full path
|
||||
local patched_font_dir="${f%/*}/"
|
||||
printf "\n---------------\n\n"
|
||||
#printf "\n---------------\n\n"
|
||||
local patched_font_dir="${patched_font_dir/unpatched-sample-fonts/patched-fonts}"
|
||||
#echo "patched font dir is $patched_font_dir"
|
||||
local patched_font_dir+=$organizing_sub_dir
|
||||
@ -53,7 +53,7 @@ function patch_font {
|
||||
config_parent_dir=$( cd "$( dirname "$f" )" && cd ".." && pwd)
|
||||
config_dir=$( cd "$( dirname "$f" )" && pwd)
|
||||
|
||||
echo "config parent dir is $config_parent_dir"
|
||||
#echo "config parent dir is $config_parent_dir"
|
||||
|
||||
# source the font config file if exists:
|
||||
if [ -f "$config_dir/config.cfg" ]
|
||||
@ -70,12 +70,13 @@ function patch_font {
|
||||
combinations=$(printf "./font-patcher ${f##*/} %s\n" {' --use-single-width-glyphs',}{' --windows',}{' --fontawesome',}{' --octicons',}{' --fontlinux',}{' --pomicons',}{' --powerlineextra',}{' --fontawesomeextension',}{' --powersymbols',})
|
||||
else
|
||||
powerline="--powerline"
|
||||
combinations=$("./font-patcher ${f##*/} %s\n" {' --powerline',}{' --use-single-width-glyphs',}{' --windows',}{' --fontawesome',}{' --octicons',}{' --fontlinux',}{' --pomicons',}{' --powerlineextra',}{' --fontawesomeextension',}{' --powersymbols',})
|
||||
combinations=$(printf "./font-patcher ${f##*/} %s\n" {' --powerline',}{' --use-single-width-glyphs',}{' --windows',}{' --fontawesome',}{' --octicons',}{' --fontlinux',}{' --pomicons',}{' --powerlineextra',}{' --fontawesomeextension',}{' --powersymbols',})
|
||||
fi
|
||||
|
||||
fontforge -quiet -script ./font-patcher "$f" -q -s $powerline --complete --outputdir $patched_font_dir"complete/" 2>/dev/null
|
||||
fontforge -quiet -script ./font-patcher "$f" -q -w $powerline --complete --outputdir $patched_font_dir"complete/" 2>/dev/null
|
||||
fontforge -quiet -script ./font-patcher "$f" -q -s -w $powerline --complete --outputdir $patched_font_dir"complete/" 2>/dev/null
|
||||
fontforge -quiet -script ./font-patcher "$f" -q -s $powerline --complete --outputdir $patched_font_dir"complete/" 2>/dev/null &
|
||||
fontforge -quiet -script ./font-patcher "$f" -q -w $powerline --complete --outputdir $patched_font_dir"complete/" 2>/dev/null &
|
||||
fontforge -quiet -script ./font-patcher "$f" -q -s -w $powerline --complete --outputdir $patched_font_dir"complete/" 2>/dev/null &
|
||||
#wait
|
||||
|
||||
complete_variation_count=$((complete_variation_count+3))
|
||||
combination_count=$(printf "$combinations" | wc -l)
|
||||
@ -85,7 +86,7 @@ function patch_font {
|
||||
# if first time with this font then re-build parent dir readme, else skip:
|
||||
if [[ $config_parent_dir != $last_parent_dir ]];
|
||||
then
|
||||
echo "Re-generate parent directory readme"
|
||||
#echo "Re-generate parent directory readme"
|
||||
generate_readme "$patched_font_dir/.."
|
||||
fi
|
||||
|
||||
@ -93,7 +94,7 @@ function patch_font {
|
||||
|
||||
last_parent_dir=$config_parent_dir
|
||||
|
||||
total_variation_count=$((combination_count))
|
||||
total_variation_count=$((total_variation_count+combination_count))
|
||||
total_count=$((complete_variation_count+combination_count))
|
||||
|
||||
}
|
||||
@ -119,12 +120,12 @@ function generate_readme {
|
||||
# $f stores current value
|
||||
for f in "${source_fonts[@]}"
|
||||
do
|
||||
patch_font "$f" &
|
||||
patch_font "$f"
|
||||
|
||||
# un-comment to test this script (patch 1 font)
|
||||
#break
|
||||
# wait for this set of bg commands to finish: dont do too many at once!
|
||||
wait
|
||||
#wait
|
||||
done
|
||||
# wait for all bg commands to finish
|
||||
wait
|
||||
@ -138,9 +139,9 @@ dt3=$(echo "$dt2-3600*$dh" | bc)
|
||||
dm=$(echo "$dt3/60" | bc)
|
||||
ds=$(echo "$dt3-60*$dm" | bc)
|
||||
|
||||
printf "Total runtime: %d:%02d:%02d:%02d\n" $dd $dh $dm $ds
|
||||
printf "# Total runtime: %d:%02d:%02d:%02d\n" $dd $dh $dm $ds
|
||||
|
||||
echo "All unpatched fonts re-patched to their respective sub-directories in $patched_fonts_dir"
|
||||
echo "The total number of 'variation' patched fonts created was $total_variation_count"
|
||||
echo "The total number of 'complete' patched fonts created was $complete_variation_count"
|
||||
echo "The total number of patched fonts created was $total_count"
|
||||
printf "# All fonts patched to sub-directories in '$patched_fonts_dir'\n"
|
||||
printf "# The total number of 'variation' patched fonts created was $total_variation_count\n"
|
||||
printf "# The total number of 'complete' patched fonts created was $complete_variation_count\n"
|
||||
printf "# The total number of patched fonts created was $total_count\n"
|
||||
|
Loading…
Reference in New Issue
Block a user