android-custom/dist-font/cm-data/99-font.sh.addon

309 lines
13 KiB
Bash
Executable File

__HEADER__
list_files() {
cat <<EOF
fonts/IBMPlexSans-BoldItalic.ttf
fonts/IBMPlexSans-Bold.ttf
fonts/IBMPlexSansCondensed-BoldItalic.ttf
fonts/IBMPlexSansCondensed-Bold.ttf
fonts/IBMPlexSansCondensed-ExtraLightItalic.ttf
fonts/IBMPlexSansCondensed-ExtraLight.ttf
fonts/IBMPlexSansCondensed-Italic.ttf
fonts/IBMPlexSansCondensed-LightItalic.ttf
fonts/IBMPlexSansCondensed-Light.ttf
fonts/IBMPlexSansCondensed-MediumItalic.ttf
fonts/IBMPlexSansCondensed-Medium.ttf
fonts/IBMPlexSansCondensed-Regular.ttf
fonts/IBMPlexSansCondensed-SemiBoldItalic.ttf
fonts/IBMPlexSansCondensed-SemiBold.ttf
fonts/IBMPlexSansCondensed-ThinItalic.ttf
fonts/IBMPlexSansCondensed-Thin.ttf
fonts/IBMPlexSans-ExtraLightItalic.ttf
fonts/IBMPlexSans-ExtraLight.ttf
fonts/IBMPlexSans-Italic.ttf
fonts/IBMPlexSans-LightItalic.ttf
fonts/IBMPlexSans-Light.ttf
fonts/IBMPlexSans-MediumItalic.ttf
fonts/IBMPlexSans-Medium.ttf
fonts/IBMPlexSans-Regular.ttf
fonts/IBMPlexSans-SemiBoldItalic.ttf
fonts/IBMPlexSans-SemiBold.ttf
fonts/IBMPlexSans-ThinItalic.ttf
fonts/IBMPlexSans-Thin.ttf
fonts/IBMPlexSerif-BoldItalic.ttf
fonts/IBMPlexSerif-Bold.ttf
fonts/IBMPlexSerif-Italic.ttf
fonts/IBMPlexSerif-Regular.ttf
EOF
}
case "$1" in
backup)
list_files | while read FILE DUMMY; do
backup_file $S/"$FILE"
done
;;
restore)
list_files | while read FILE REPLACEMENT; do
R=""
[ -n "$REPLACEMENT" ] && R="$S/$REPLACEMENT"
[ -f "$C/$S/$FILE" ] && restore_file $S/"$FILE" "$R"
done
;;
pre-backup)
# Stub
;;
post-backup)
# Stub
;;
pre-restore)
# Stub
;;
post-restore)
# update fonts.xml
cp -p $(get_output_path "$SYS/etc/fonts.xml") $(get_output_path "$SYS/etc/fonts.xml").bak
# Try to patch for android 12
patch -p0 "$SYS/etc/fonts.xml" <<EOT
--- fonts.xml.orig 2022-05-12 10:35:06.965519319 +0200
+++ fonts.xml 2022-05-12 10:44:30.635892195 +0200
@@ -24,92 +24,92 @@
<familyset version="23">
<!-- first font is default -->
<family name="sans-serif">
- <font weight="100" style="normal">Roboto-Regular.ttf
+ <font weight="100" style="normal">IBMPlexSans-Thin.ttf
<axis tag="ital" stylevalue="0" />
<axis tag="wdth" stylevalue="100" />
<axis tag="wght" stylevalue="100" />
</font>
- <font weight="200" style="normal">Roboto-Regular.ttf
+ <font weight="200" style="normal">IBMPlexSans-ExtraLight.ttf
<axis tag="ital" stylevalue="0" />
<axis tag="wdth" stylevalue="100" />
<axis tag="wght" stylevalue="200" />
</font>
- <font weight="300" style="normal">Roboto-Regular.ttf
+ <font weight="300" style="normal">IBMPlexSans-Light.ttf
<axis tag="ital" stylevalue="0" />
<axis tag="wdth" stylevalue="100" />
<axis tag="wght" stylevalue="300" />
</font>
- <font weight="400" style="normal">Roboto-Regular.ttf
+ <font weight="400" style="normal">IBMPlexSans-Regular.ttf
<axis tag="ital" stylevalue="0" />
<axis tag="wdth" stylevalue="100" />
<axis tag="wght" stylevalue="400" />
</font>
- <font weight="500" style="normal">Roboto-Regular.ttf
+ <font weight="500" style="normal">IBMPlexSans-Medium.ttf
<axis tag="ital" stylevalue="0" />
<axis tag="wdth" stylevalue="100" />
<axis tag="wght" stylevalue="500" />
</font>
- <font weight="600" style="normal">Roboto-Regular.ttf
+ <font weight="600" style="normal">IBMPlexSans-SemiBold.ttf
<axis tag="ital" stylevalue="0" />
<axis tag="wdth" stylevalue="100" />
<axis tag="wght" stylevalue="600" />
</font>
- <font weight="700" style="normal">Roboto-Regular.ttf
+ <font weight="700" style="normal">IBMPlexSans-Bold.ttf
<axis tag="ital" stylevalue="0" />
<axis tag="wdth" stylevalue="100" />
<axis tag="wght" stylevalue="700" />
</font>
- <font weight="800" style="normal">Roboto-Regular.ttf
+ <font weight="800" style="normal">IBMPlexSans-Bold.ttf
<axis tag="ital" stylevalue="0" />
<axis tag="wdth" stylevalue="100" />
<axis tag="wght" stylevalue="800" />
</font>
- <font weight="900" style="normal">Roboto-Regular.ttf
+ <font weight="900" style="normal">IBMPlexSans-Bold.ttf
<axis tag="ital" stylevalue="0" />
<axis tag="wdth" stylevalue="100" />
<axis tag="wght" stylevalue="900" />
</font>
- <font weight="100" style="italic">Roboto-Regular.ttf
+ <font weight="100" style="italic">IBMPlexSans-ThinItalic.ttf
<axis tag="ital" stylevalue="1" />
<axis tag="wdth" stylevalue="100" />
<axis tag="wght" stylevalue="100" />
</font>
- <font weight="200" style="italic">Roboto-Regular.ttf
+ <font weight="200" style="italic">IBMPlexSans-ExtraLightItalic.ttf
<axis tag="ital" stylevalue="1" />
<axis tag="wdth" stylevalue="100" />
<axis tag="wght" stylevalue="200" />
</font>
- <font weight="300" style="italic">Roboto-Regular.ttf
+ <font weight="300" style="italic">IBMPlexSans-LightItalic.ttf
<axis tag="ital" stylevalue="1" />
<axis tag="wdth" stylevalue="100" />
<axis tag="wght" stylevalue="300" />
</font>
- <font weight="400" style="italic">Roboto-Regular.ttf
+ <font weight="400" style="italic">IBMPlexSans-Italic.ttf
<axis tag="ital" stylevalue="1" />
<axis tag="wdth" stylevalue="100" />
<axis tag="wght" stylevalue="400" />
</font>
- <font weight="500" style="italic">Roboto-Regular.ttf
+ <font weight="500" style="italic">IBMPlexSans-MediumItalic.ttf
<axis tag="ital" stylevalue="1" />
<axis tag="wdth" stylevalue="100" />
<axis tag="wght" stylevalue="500" />
</font>
- <font weight="600" style="italic">Roboto-Regular.ttf
+ <font weight="600" style="italic">IBMPlexSans-SemiBoldItalic.ttf
<axis tag="ital" stylevalue="1" />
<axis tag="wdth" stylevalue="100" />
<axis tag="wght" stylevalue="600" />
</font>
- <font weight="700" style="italic">Roboto-Regular.ttf
+ <font weight="700" style="italic">IBMPlexSans-BoldItalic.ttf
<axis tag="ital" stylevalue="1" />
<axis tag="wdth" stylevalue="100" />
<axis tag="wght" stylevalue="700" />
</font>
- <font weight="800" style="italic">Roboto-Regular.ttf
+ <font weight="800" style="italic">IBMPlexSans-BoldItalic.ttf
<axis tag="ital" stylevalue="1" />
<axis tag="wdth" stylevalue="100" />
<axis tag="wght" stylevalue="800" />
</font>
- <font weight="900" style="italic">Roboto-Regular.ttf
+ <font weight="900" style="italic">IBMPlexSans-BoldItalic.ttf
<axis tag="ital" stylevalue="1" />
<axis tag="wdth" stylevalue="100" />
<axis tag="wght" stylevalue="900" />
@@ -128,92 +128,92 @@
<alias name="verdana" to="sans-serif" />
<family name="sans-serif-condensed">
- <font weight="100" style="normal">Roboto-Regular.ttf
+ <font weight="100" style="normal">IBMPlexSansCondensed-Thin.ttf
<axis tag="ital" stylevalue="0" />
<axis tag="wdth" stylevalue="75" />
<axis tag="wght" stylevalue="100" />
</font>
- <font weight="200" style="normal">Roboto-Regular.ttf
+ <font weight="200" style="normal">IBMPlexSansCondensed-ExtraLight.ttf
<axis tag="ital" stylevalue="0" />
<axis tag="wdth" stylevalue="75" />
<axis tag="wght" stylevalue="200" />
</font>
- <font weight="300" style="normal">Roboto-Regular.ttf
+ <font weight="300" style="normal">IBMPlexSansCondensed-Light.ttf
<axis tag="ital" stylevalue="0" />
<axis tag="wdth" stylevalue="75" />
<axis tag="wght" stylevalue="300" />
</font>
- <font weight="400" style="normal">Roboto-Regular.ttf
+ <font weight="400" style="normal">IBMPlexSansCondensed-Regular.ttf
<axis tag="ital" stylevalue="0" />
<axis tag="wdth" stylevalue="75" />
<axis tag="wght" stylevalue="400" />
</font>
- <font weight="500" style="normal">Roboto-Regular.ttf
+ <font weight="500" style="normal">IBMPlexSansCondensed-Medium.ttf
<axis tag="ital" stylevalue="0" />
<axis tag="wdth" stylevalue="75" />
<axis tag="wght" stylevalue="500" />
</font>
- <font weight="600" style="normal">Roboto-Regular.ttf
+ <font weight="600" style="normal">IBMPlexSansCondensed-SemiBold.ttf
<axis tag="ital" stylevalue="0" />
<axis tag="wdth" stylevalue="75" />
<axis tag="wght" stylevalue="600" />
</font>
- <font weight="700" style="normal">Roboto-Regular.ttf
+ <font weight="700" style="normal">IBMPlexSansCondensed-Bold.ttf
<axis tag="ital" stylevalue="0" />
<axis tag="wdth" stylevalue="75" />
<axis tag="wght" stylevalue="700" />
</font>
- <font weight="800" style="normal">Roboto-Regular.ttf
+ <font weight="800" style="normal">IBMPlexSansCondensed-Bold.ttf
<axis tag="ital" stylevalue="0" />
<axis tag="wdth" stylevalue="75" />
<axis tag="wght" stylevalue="800" />
</font>
- <font weight="900" style="normal">Roboto-Regular.ttf
+ <font weight="900" style="normal">IBMPlexSansCondensed-Bold.ttf
<axis tag="ital" stylevalue="0" />
<axis tag="wdth" stylevalue="75" />
<axis tag="wght" stylevalue="900" />
</font>
- <font weight="100" style="italic">Roboto-Regular.ttf
+ <font weight="100" style="italic">IBMPlexSansCondensed-ThinItalic.ttf
<axis tag="ital" stylevalue="1" />
<axis tag="wdth" stylevalue="75" />
<axis tag="wght" stylevalue="100" />
</font>
- <font weight="200" style="italic">Roboto-Regular.ttf
+ <font weight="200" style="italic">IBMPlexSansCondensed-ExtraLightItalic.ttf
<axis tag="ital" stylevalue="1" />
<axis tag="wdth" stylevalue="75" />
<axis tag="wght" stylevalue="200" />
</font>
- <font weight="300" style="italic">Roboto-Regular.ttf
+ <font weight="300" style="italic">IBMPlexSansCondensed-LightItalic.ttf
<axis tag="ital" stylevalue="1" />
<axis tag="wdth" stylevalue="75" />
<axis tag="wght" stylevalue="300" />
</font>
- <font weight="400" style="italic">Roboto-Regular.ttf
+ <font weight="400" style="italic">IBMPlexSansCondensed-Italic.ttf
<axis tag="ital" stylevalue="1" />
<axis tag="wdth" stylevalue="75" />
<axis tag="wght" stylevalue="400" />
</font>
- <font weight="500" style="italic">Roboto-Regular.ttf
+ <font weight="500" style="italic">IBMPlexSansCondensed-MediumItalic.ttf
<axis tag="ital" stylevalue="1" />
<axis tag="wdth" stylevalue="75" />
<axis tag="wght" stylevalue="500" />
</font>
- <font weight="600" style="italic">Roboto-Regular.ttf
+ <font weight="600" style="italic">IBMPlexSansCondensed-SemiBoldItalic.ttf
<axis tag="ital" stylevalue="1" />
<axis tag="wdth" stylevalue="75" />
<axis tag="wght" stylevalue="600" />
</font>
- <font weight="700" style="italic">Roboto-Regular.ttf
+ <font weight="700" style="italic">IBMPlexSansCondensed-BoldItalic.ttf
<axis tag="ital" stylevalue="1" />
<axis tag="wdth" stylevalue="75" />
<axis tag="wght" stylevalue="700" />
</font>
- <font weight="800" style="italic">Roboto-Regular.ttf
+ <font weight="800" style="italic">IBMPlexSansCondensed-BoldItalic.ttf
<axis tag="ital" stylevalue="1" />
<axis tag="wdth" stylevalue="75" />
<axis tag="wght" stylevalue="800" />
</font>
- <font weight="900" style="italic">Roboto-Regular.ttf
+ <font weight="900" style="italic">IBMPlexSansCondensed-BoldItalic.ttf
<axis tag="ital" stylevalue="1" />
<axis tag="wdth" stylevalue="75" />
<axis tag="wght" stylevalue="900" />
EOT
# sed for < android 12 and serif
sed -i \
-e "/Roboto-Black-/d" \
-e "s/Roboto-/IBMPlexSans-/" \
-e "s/RobotoCondensed-/IBMPlexSansCondensed-/" \
-e "s/NotoSerif-/IBMPlexSerif-/" \
$(get_output_path "$SYS/etc/fonts.xml")
# Fix ownership/permissions
for i in $(list_files); do
f=$(get_output_path "$SYS/$i")
chown root:root $f
chmod 644 $f
chmod 755 $(dirname $f)
done
;;
esac
# vi: ft=sh