|
@@ -29,43 +29,60 @@ DN_EXEC=$(dirname $(my_getpath "$0") )
|
29
|
29
|
|
30
|
30
|
EXEC_WXGGEN="${DN_EXEC}/uxggenpages.sh"
|
31
|
31
|
|
|
32
|
+#
|
|
33
|
+# Locate the bdf2u8g command
|
|
34
|
+#
|
32
|
35
|
EXEC_BDF2U8G=`which bdf2u8g`
|
33
|
36
|
[ -x "${EXEC_BDF2U8G}" ] || EXEC_BDF2U8G="${DN_EXEC}/bdf2u8g"
|
34
|
37
|
[ -x "${EXEC_BDF2U8G}" ] || EXEC_BDF2U8G="${PWD}/bdf2u8g"
|
35
|
38
|
[ -x "${EXEC_BDF2U8G}" ] || { EOL=$'\n' ; echo "ERR: Can't find bdf2u8g!${EOL}See uxggenpages.md for bdf2u8g build instructions." >&2 ; exit 1; }
|
36
|
39
|
|
37
|
|
-#FN_FONT="${1:-}"
|
38
|
|
-FN_FONT="${DN_EXEC}/marlin-6x12-3.bdf"
|
39
|
|
-[ "$1" = "" ] || FN_FONT="$1"
|
|
40
|
+#
|
|
41
|
+# Get language arguments
|
|
42
|
+#
|
|
43
|
+LANG_ARG="$@"
|
40
|
44
|
|
41
|
|
-DN_FONT0=`dirname ${FN_FONT}`
|
42
|
|
-DN_FONT="$(my_getpath ${DN_FONT0})"
|
43
|
|
-FN_FONT="$(my_getpath "${DN_FONT}")/"`basename ${FN_FONT}`
|
44
|
|
-[ -z "${FN_FONT}" ] && FN_FONT=${DN_DATA}/../${FN_FONT_BASE}.bdf
|
45
|
|
-[ -f "${FN_FONT}" ] || FN_FONT=${DN_EXEC}/${FN_FONT_BASE}.bdf
|
46
|
|
-[ -f "${FN_FONT}" ] || FN_FONT="$FONTHOME/wenquanyi/${FN_FONT_BASE}.bdf"
|
47
|
|
-[ -f "${FN_FONT}" ] || FN_FONT="$FONTHOME/X11/misc/${FN_FONT_BASE}.bdf"
|
48
|
|
-[ -f "${FN_FONT}" ] || FN_FONT="$FONTHOME/misc/${FN_FONT_BASE}.bdf"
|
49
|
|
-#echo "genallfont.sh: FN_FONT=${FN_FONT}"
|
|
45
|
+#
|
|
46
|
+# Use 6x12 combined font data for Western languages
|
|
47
|
+#
|
|
48
|
+FN_FONT="${DN_EXEC}/marlin-6x12-3.bdf"
|
50
|
49
|
|
51
|
|
-DN_WORK=./tmp1
|
|
50
|
+#
|
|
51
|
+# Change to working directory 'Marlin'
|
|
52
|
+#
|
|
53
|
+OLDWD=`pwd`
|
|
54
|
+[[ $(basename "$OLDWD") != 'Marlin' && -d "Marlin" ]] && cd Marlin
|
|
55
|
+[[ -f "Configuration.h" ]] || { echo -n "cd to the 'Marlin' folder to run " ; basename $0 ; exit 1; }
|
52
|
56
|
|
|
57
|
+#
|
|
58
|
+# Compile the 'genpages' command in-place
|
|
59
|
+#
|
53
|
60
|
(cd ${DN_EXEC}; gcc -o genpages genpages.c getline.c)
|
54
|
61
|
|
|
62
|
+#
|
|
63
|
+# By default loop through all languages
|
|
64
|
+#
|
55
|
65
|
LANGS_DEFAULT="an bg ca cz da de el el-gr en es eu fi fr gl hr it jp-kana ko_KR nl pl pt pt-br ru sk tr uk zh_CN zh_TW test"
|
56
|
66
|
|
57
|
|
-for LANG in ${MARLIN_LANGS:=$LANGS_DEFAULT} ; do
|
|
67
|
+#
|
|
68
|
+# Generate data for language list MARLIN_LANGS or all if not provided
|
|
69
|
+#
|
|
70
|
+for LANG in ${LANG_ARG:=$LANGS_DEFAULT} ; do
|
58
|
71
|
echo "Generating Marlin language data for '${LANG}'" >&2
|
59
|
|
- rm -rf ${DN_WORK}/
|
60
|
|
- mkdir -p ${DN_WORK}
|
|
72
|
+ case "$LANG" in
|
|
73
|
+ zh_* ) FONTFILE="wenquanyi_12pt" ;;
|
|
74
|
+ ko_* ) FONTFILE="${DN_EXEC}/NanumGothic.bdf" ;;
|
|
75
|
+ * ) FONTFILE="${DN_EXEC}/marlin-6x12-3.bdf" ;;
|
|
76
|
+ esac
|
|
77
|
+ DN_WORK=`mktemp -d`
|
61
|
78
|
cp Configuration.h ${DN_WORK}/
|
62
|
79
|
cp src/lcd/language/language_${LANG}.h ${DN_WORK}/
|
63
|
|
- cd ${DN_WORK}/
|
64
|
|
- ${EXEC_WXGGEN} "${FN_FONT}"
|
|
80
|
+ cd "${DN_WORK}"
|
|
81
|
+ ${EXEC_WXGGEN} "${FONTFILE}"
|
65
|
82
|
sed -i fontutf8-data.h -e 's|fonts//|fonts/|g' -e 's|fonts//|fonts/|g' -e 's|[/0-9a-zA-Z_\-]*buildroot/share/fonts|buildroot/share/fonts|' 2>/dev/null
|
66
|
|
- cd ../
|
|
83
|
+ cd - >/dev/null
|
67
|
84
|
mv ${DN_WORK}/fontutf8-data.h src/lcd/dogm/fontdata/langdata_${LANG}.h
|
68
|
|
- rm -rf ${DN_WORK}/
|
|
85
|
+ rm -rf ${DN_WORK}
|
69
|
86
|
done
|
70
|
87
|
|
71
|
88
|
#
|
|
@@ -74,15 +91,16 @@ done
|
74
|
91
|
#
|
75
|
92
|
#if [ "${MARLIN_LANGS}" == "${LANGS_DEFAULT}" ]; then
|
76
|
93
|
if [ 1 = 1 ]; then
|
77
|
|
- rm -rf ${DN_WORK}/
|
78
|
|
- mkdir -p ${DN_WORK}
|
79
|
|
- cd ${DN_WORK}/
|
|
94
|
+ DN_WORK=`mktemp -d`
|
|
95
|
+ cd ${DN_WORK}
|
80
|
96
|
${EXEC_BDF2U8G} -b 1 -e 127 ${FN_FONT} ISO10646_1_5x7 tmp1.h >/dev/null
|
81
|
97
|
${EXEC_BDF2U8G} -b 1 -e 255 ${FN_FONT} ISO10646_1_5x7 tmp2.h >/dev/null
|
82
|
|
- TMP1=$(cat tmp1.h) ; rm tmp1.h
|
83
|
|
- TMP2=$(cat tmp2.h) ; rm tmp2.h
|
|
98
|
+ TMP1=$(cat tmp1.h)
|
|
99
|
+ TMP2=$(cat tmp2.h)
|
|
100
|
+ cd - >/dev/null
|
|
101
|
+ rm -rf ${DN_WORK}
|
84
|
102
|
|
85
|
|
- cat <<EOF >../src/lcd/dogm/fontdata/fontdata_ISO10646_1.h
|
|
103
|
+ cat <<EOF >src/lcd/dogm/fontdata/fontdata_ISO10646_1.h
|
86
|
104
|
/**
|
87
|
105
|
* Marlin 3D Printer Firmware
|
88
|
106
|
* Copyright (C) 2018 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
|
@@ -115,6 +133,8 @@ $TMP2
|
115
|
133
|
#endif
|
116
|
134
|
EOF
|
117
|
135
|
|
118
|
|
- rmdir ../${DN_WORK}
|
119
|
|
- cd - >/dev/null
|
120
|
136
|
fi
|
|
137
|
+
|
|
138
|
+(cd ${DN_EXEC}; rm genpages)
|
|
139
|
+
|
|
140
|
+cd "$OLDWD"
|