2
0
mirror of https://gitlab.com/Nanolx/NanoDroid synced 2024-11-02 03:40:13 +00:00

NanoDroid-Font: System Mode support

This commit is contained in:
Christopher Roy Bratusek 2018-03-18 19:48:45 +01:00
parent 2a7aadc52a
commit 3ba986adab
3 changed files with 62 additions and 24 deletions

View File

@ -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

View File

@ -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
case ${1} in
-s | --set )
if [ -f ${FONTPATH}/NanoDroid/${2}.ttf ]; then
echo "Setting Font ${2}"
for font in ${FONTFILES}; do
ln -sf ${FONTPATH}/NanoDroid/${2}.ttf ${FONTPATH}/${font} || \
error "Failed to apply Font ${2}"
cp /system/fonts/${font} /system/fonts/Original/
done
echo "Reboot to apply Font"
else
error "Font ${2} does not exist"
fi
;;
}
-r | --reset )
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
for font in ${FONTFILES}; do
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
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 )
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

View File

@ -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`