LeOS-GSI/vendor/LeOS/fonts/patch-font-names.sh

30 lines
887 B
Bash
Raw Permalink Normal View History

2024-10-24 09:22:44 +02:00
#!/usr/bin/env bash
ttx ${@:-*.ttf}
function replace_name() {
cur_name=$1
tgt_name=$2
shift
shift
echo "$cur_name -> $tgt_name"
sed -i "s/\(<FullName value=.\)$cur_name /\1$tgt_name /" "$@"
sed -i "s/\(<FamilyName value=.\)$cur_name/\1$tgt_name/" "$@"
sed -i "s/^ $cur_name$/ $tgt_name/" "$@"
sed -i "s/^ $cur_name \([^UiP].*\)$/ $tgt_name \1/" "$@"
}
replace_name "Roboto" "Roboto Fallback" RobotoFallback-*.ttx
replace_name "Roboto" "Roboto System" RobotoSystem-*.ttx
replace_name "Inter" "Roboto" Roboto-*.ttx
replace_name "Inter" "RobotoStatic" RobotoStatic-*.ttx
replace_name "Inter" "Google Sans" GoogleSans-*.ttx
replace_name "Source Serif 4" "Noto Serif" NotoSerif-*.ttx
replace_name "Fira Code" "Cutive Mono" CutiveMono.ttx
replace_name "Fira Code" "Droid Sans Mono" DroidSansMono.ttx
rm ${@:-*.ttf}
ttx *.ttx
rm *.ttx
rename otf ttf *