NanoDroid-Font: System Mode support

merge-requests/23/head
Christopher Roy Bratusek 7 years ago
parent 2a7aadc52a
commit 3ba986adab

@ -87,7 +87,6 @@
* NanoDroid-Font
* new script to change the system font (Full package only)
* Magisk Mode only
* controlled by nanodroid_fonts setup variable
* possible fonts:
* FAST

@ -38,29 +38,72 @@ error () {
exit 1
}
[[ $(whoami) != "root" ]] && error "not running as root"
backup_font () {
if [ ! -d /system/fonts/Original ]; then
echo "Backup original Fonts"
mkdir -p /system/fonts/Original
if [[ ${NO_MAGISK} -eq 0 ]]; then
for font in ${FONTFILES}; do
cp /system/fonts/${font} /system/fonts/Original/
done
fi
}
case ${1} in
-s | --set )
reset_font () {
echo "Restoring original Font"
if [ ${NO_MAGISK} -eq 0 ]; then
for font in ${FONTFILES}; do
rm -f ${FONTPATH}/${font}
done
else
for font in ${FONTFILES}; do
cp /system/fonts/Original/${font} /system/fonts/
done
rm -rf /system/fonts/Original
fi
}
set_font () {
echo "Setting Font ${2}"
if [ ${NO_MAGISK} -eq 0 ]; then
if [ -f ${FONTPATH}/NanoDroid/${2}.ttf ]; then
echo "Setting Font ${2}"
for font in ${FONTFILES}; do
ln -sf ${FONTPATH}/NanoDroid/${2}.ttf ${FONTPATH}/${font} || \
ln -sf ${FONTPATH}/NanoDroid/${2}.ttf \
${FONTPATH}/${font} || \
error "Failed to apply Font ${2}"
done
else
error "Font ${2} does not exist"
fi
else
backup_font
if [ -f /system/fonts/NanoDroid/${2}.ttf ]; then
for font in ${FONTFILES}; do
ln -sf /system/fonts/NanoDroid/${2}.ttf \
/system/fonts/${font} || \
error "Failed to apply Font ${2}"
done
echo "Reboot to apply Font"
else
error "Font ${2} does not exist"
fi
fi
echo "Reboot to apply Font"
}
[[ $(whoami) != "root" ]] && error "not running as root"
case ${1} in
-s | --set )
set_font
;;
-r | --reset )
echo "Restoring original Font"
for font in ${FONTFILES}; do
rm -f ${FONTPATH}/${font}
done
reset_font
;;
* )
@ -82,7 +125,3 @@ where [font] can be:
Super Mario Super Mario (World) Game Font"
;;
esac
else
error "*** Resetprop feature is not available in System Mode! ***"
fi

@ -2,7 +2,7 @@
## Purpose
The `nanodroid-font` Script, respectively it's shortcut `nfnt` is used to change the System UI font (reboot required to take effect), this feature exists in Magisk Mode only
The `nanodroid-font` Script, respectively it's shortcut `nfnt` is used to change the System UI font (reboot required to take effect)
The Font is not saved during NanoDroid Updates, thus needs to be re-applied after an update; restoration support during updates is a planned feature
@ -27,7 +27,7 @@ set System UI font to [font], which is one of
* NintendoSwitch NintendoSwitch OS Font
* Splatoon2 Splatoon2 Game Font
* SuperMarioMaker Super Mario Maker Game Font
* Super Mario Super Mario (World) Game Font
* SuperMario Super Mario (World) Game Font
`r`, `--reset`

Loading…
Cancel
Save