Skip to content

Commit

Permalink
Add language of font for test
Browse files Browse the repository at this point in the history
  • Loading branch information
JingMatrix committed Nov 2, 2024
1 parent 22d5af4 commit b91a60f
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions customize.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,33 +18,41 @@ generate_config() {
return 0
fi

# tmpfile="$MODPATH/part_tmp.xml"
ui_print "Pull original $font_config_file"
mkdir -p $MODPATH/$font_dir/etc
# awk '{print >out}; /<familyset>/{out="'$tmpfile'"}' out=$MODPATH/$font_config_file $font_config_file
sed "/^<!-- <\/$config_end_mark> -->/q" $font_config_file >$MODPATH/$font_config_file
sed -i '$ d' $MODPATH/$font_config_file
echo "<!-- </$config_end_mark> -->" >>$MODPATH/$font_config_file

font_family_config=$sep'<family customizationType="new-named-family" name="%{family[0]|downcase}">\n'$sep$sep'<font postScriptName="%{postscriptname}" weight="400" style="normal">%{file}</font>\n'$sep'</family>\n'
font_family_config=$sep'<family'$locale'>\n'$sep$sep'<font postScriptName="%{postscriptname}">%{file}</font>\n'$sep'</family>\n'
alia_config=$sep'<alias name="%{family[1]}" to="%{family[0]|downcase}" />\n'

cd $MODPATH/$font_dir/fonts/
for fontfile in *.*; do
ui_print "Add custom font $fontfile"
fscan -f "$font_family_config" "$fontfile" >>$MODPATH/$font_config_file
fscan -f "%{family}" "$fontfile" | grep ',' >/dev/null
if [ $? -eq 0 ]; then
fscan -f "$alia_config" "$fontfile" >>$MODPATH/$font_config_file
fi
# fscan -f "%{family}" "$fontfile" | grep ',' >/dev/null
# if [ $? -eq 0 ]; then
# fscan -f "$alia_config" "$fontfile" >>$MODPATH/$font_config_file
# fi
done
cd /

# cat $tmpfile >>$MODPATH/$font_config_file
# rm $tmpfile
echo "</$config_end_mark>" >>$MODPATH/$font_config_file
cp $MODPATH/$font_config_file /data/local/tmp
ui_print "New $font_config_file generated"
ui_print ""
}

ui_print "Module directory is $MODPATH"

# locale=' lang="zh-Hans"'
locale=''

font_dir="/system"
font_config_file="$font_dir/etc/fonts.xml"
config_end_mark="familyset"
Expand All @@ -54,6 +62,5 @@ generate_config
font_dir="/system"
font_config_file="$font_dir/etc/font_fallback.xml"
config_end_mark="familyset"
sep="\t"
sep=" "
generate_config

0 comments on commit b91a60f

Please sign in to comment.