diff --git a/Firmware/Fonts/FontGen.py b/Firmware/Fonts/FontGen.py
deleted file mode 100644
index 1e8dbe660..000000000
--- a/Firmware/Fonts/FontGen.py
+++ /dev/null
@@ -1,112 +0,0 @@
-#!/usr/bin/env python3
-
-import argparse
-from traceback import print_exc
-import xml.etree.ElementTree as ET
-import os
-import sys
-
-class CustomCharacter:
- def __init__(self, utf, default, alternate = None):
- self.utf = utf
- self.default = default
- self.alternate = alternate
-
-fontTable = [
-# custom characters:
- CustomCharacter('๐ท', 0x80, 'H'),
- CustomCharacter('ยฐ', 0x81, '\\xdf'),
- CustomCharacter('๐ก', 0x82, 'h'),
- CustomCharacter('โฌ', 0x83, '^'),
- CustomCharacter('๐', 0x84, '\\xf3'),
- CustomCharacter('๐', 0x85, '\\xdb'),
- CustomCharacter('ยป', 0x86, '>'),
- CustomCharacter('๐', 0x87, '\\xe5'),
- CustomCharacter('โฌ', 0x88, '\\x7e'),
- CustomCharacter('โ', 0x89, '\\x7e'),
- CustomCharacter('ฤ', 0x8a, 'a'),
- CustomCharacter('รข', 0x8b, 'a'),
- CustomCharacter('รฎ', 0x8c, 'i'),
- CustomCharacter('ศ', 0x8d, 's'),
- CustomCharacter('ศ', 0x8e, 't'),
- CustomCharacter('ร', 0x8f, 'I'),
- CustomCharacter('ศ', 0x90, 'S'),
- CustomCharacter('ศ', 0x91, 'T'),
-
-# from the default character set:
- CustomCharacter('รค', 0xe1),
- CustomCharacter('ยต', 0xe4),
- CustomCharacter('รถ', 0xef),
- CustomCharacter('รผ', 0xf5),
-]
-
-def generateLineInTable(index, chars):
- pixels = chars[index]["PIXELS"].split(',')
-
- # Generate the rows binary data
- rows = []
- for i in range(8):
- rows.append(0)
- for j in range(5):
- rows[i] |= (1 << (5 - j - 1)) if pixels[j * 8 + i] == "0" else 0
-
- # compress the rows data
- colByte = 0
- compressedRows = []
- for i in range(4):
- rowByte = ((rows[i * 2 + 1] >> 1) & 0xF) | (((rows[i * 2 + 0] >> 1) & 0xF) << 4)
- colByte |= (1 << i * 2 + 0) if (rows[i * 2 + 0] & 0x1) else 0
- colByte |= (1 << i * 2 + 1) if (rows[i * 2 + 1] & 0x1) else 0
- compressedRows.append(rowByte)
-
- line = f"{{0x{colByte:02X}, {{"
- for r in compressedRows:
- line += f"0x{r:02X}, "
- line += f"}}, '{fontTable[index].alternate}'}}, // '{fontTable[index].utf}', \\x{fontTable[index].default:02X}"
- return line
-
-def generateFont():
- tree = ET.parse(os.path.join(sys.path[0], "Prusa.lcd"))
- root = tree.getroot()
-
- CharList = [Char.attrib for Char in root.iter("CHAR")]
-
- f = open(os.path.join(sys.path[0], "FontTable.h"), "w", encoding='utf8')
- for x in range(len(fontTable)):
- if fontTable[x].default >= 0xE0:
- continue
- f.write(generateLineInTable(x, CharList) + '\n')
- f.close()
-
-def utfToLCD(infile, outfile):
- return
-
-def lcdToUTF(infile, outfile):
- return
-
-def main():
- parser = argparse.ArgumentParser(description = "Layer between the unicode and the LCD")
- parser.add_argument("action", type = str, nargs = '?', default = "generateFont",
- help = "What the script should do: (generateFont|utfToLCD|lcdToUTF)")
- parser.add_argument('infile', nargs = '?', type = argparse.FileType('r'), default = sys.stdin)
- parser.add_argument('outfile', nargs = '?', type = argparse.FileType('w'), default = sys.stdout)
- args = parser.parse_args()
- try:
- if args.action == "generateFont":
- generateFont()
- elif args.action == "utfToLCD":
- utfToLCD(args.infile, args.outfile)
- elif args.action == "lcdToUTF":
- lcdToUTF(args.infile, args.outfile)
- else:
- print("invalid action")
- return 1
- # parse_txt(args.lang, args.no_warning, args.warn_empty)
- return 0
- except Exception as exc:
- print_exc()
- parser.error("%s" % exc)
- return 1
-
-if __name__ == "__main__":
- exit(main())
diff --git a/Firmware/Fonts/FontTable.h b/Firmware/Fonts/FontTable.h
deleted file mode 100644
index 385ae4f0c..000000000
--- a/Firmware/Fonts/FontTable.h
+++ /dev/null
@@ -1,18 +0,0 @@
-{0x3E, {0x0F, 0xA8, 0xAF, 0x00, }, 'H'}, // '๐ท', \x80
-{0x00, {0x69, 0x96, 0x00, 0x00, }, '\xdf'}, // 'ยฐ', \x81
-{0x60, {0x25, 0x55, 0x58, 0x87, }, 'h'}, // '๐ก', \x82
-{0x04, {0x27, 0xF2, 0xE0, 0x00, }, '^'}, // 'โฌ', \x83
-{0x34, {0x03, 0xCC, 0x19, 0x60, }, '\xf3'}, // '๐', \x84
-{0x3C, {0x0E, 0xF8, 0x8F, 0x00, }, '\xdb'}, // '๐', \x85
-{0x08, {0x02, 0x94, 0x92, 0x00, }, '>'}, // 'ยป', \x86
-{0x1C, {0x07, 0x9A, 0x87, 0x00, }, '\xe5'}, // '๐', \x87
-{0x24, {0x00, 0x85, 0x28, 0x52, }, '\x7e'}, // 'โฌ', \x88
-{0x06, {0x00, 0x1B, 0xE4, 0x00, }, '\x7e'}, // 'โ', \x89
-{0xF1, {0x87, 0x07, 0x07, 0x87, }, 'a'}, // 'ฤ', \x8A
-{0xF0, {0x25, 0x07, 0x07, 0x87, }, 'a'}, // 'รข', \x8B
-{0x00, {0x25, 0x06, 0x22, 0x27, }, 'i'}, // 'รฎ', \x8C
-{0x10, {0x07, 0x87, 0x0F, 0x24, }, 's'}, // 'ศ', \x8D
-{0x10, {0x4E, 0x44, 0x43, 0x24, }, 't'}, // 'ศ', \x8E
-{0x00, {0x25, 0x07, 0x22, 0x27, }, 'I'}, // 'ร', \x8F
-{0x12, {0x78, 0x63, 0x87, 0x24, }, 'S'}, // 'ศ', \x90
-{0x01, {0xF2, 0x22, 0x20, 0x24, }, 'T'}, // 'ศ', \x91
diff --git a/Firmware/Fonts/Prusa.lcd b/Firmware/Fonts/Prusa.lcd
deleted file mode 100644
index dab031c80..000000000
--- a/Firmware/Fonts/Prusa.lcd
+++ /dev/null
@@ -1,104 +0,0 @@
-
-
- Prusa
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/Firmware/lcd.cpp b/Firmware/lcd.cpp
index 320c69979..36fb16da1 100644
--- a/Firmware/lcd.cpp
+++ b/Firmware/lcd.cpp
@@ -858,7 +858,7 @@ void lcd_buttons_update(void)
// Custom character data
const CustomCharacter Font[] PROGMEM = {
-#include "Fonts/FontTable.h"
+#include "../lang/lib/FontTable.h"
};
// #define DEBUG_CUSTOM_CHARACTERS
diff --git a/lang/lib/FontGen.py b/lang/lib/FontGen.py
new file mode 100644
index 000000000..59941ff99
--- /dev/null
+++ b/lang/lib/FontGen.py
@@ -0,0 +1,82 @@
+#!/usr/bin/env python3
+
+import xml.etree.ElementTree as ET
+import os
+import sys
+
+class CustomCharacter:
+ def __init__(self, utf, charListIndex, alternate = None):
+ self.utf = utf
+ self.charListIndex = charListIndex
+ self.alternate = alternate
+
+FONT_TABLE = [
+ CustomCharacter('๐ท', 0, 'H'),
+ CustomCharacter('ยฐ', 1, '\\xdf'),
+ CustomCharacter('๐ก', 2, 'h'),
+ CustomCharacter('โฌ', 3, '^'),
+ CustomCharacter('๐', 4, '\\xf3'),
+ CustomCharacter('๐', 5, '\\xdb'),
+ CustomCharacter('ยป', 6, '>'),
+ CustomCharacter('๐', 7, '\\xe5'),
+ CustomCharacter('โฌ', 8, '\\x7e'),
+ CustomCharacter('โ', 9, '\\x7e'),
+]
+
+BUILTIN_CHARS = {
+ '\x7e': 'โ',
+ '\x7f': 'โ',
+ '\xe1': 'รค',
+ '\xe4': 'ยต', #on keyboard AltGr+m it is \xC2\xB5
+ '\xef': 'รถ',
+ '\xf5': 'รผ',
+ '\xff': 'โ',
+}
+
+# Mapping from LCD source encoding to unicode characters
+CUSTOM_CHARS = {}
+for index in range(len(FONT_TABLE)):
+ CUSTOM_CHARS.update({chr(index + 0x80): FONT_TABLE[index].utf})
+CUSTOM_CHARS.update(BUILTIN_CHARS)
+
+def generateLineInTable(index, chars):
+ pixels = chars[FONT_TABLE[index].charListIndex]["PIXELS"].split(',')
+
+ # Generate the rows binary data
+ rows = []
+ for i in range(8):
+ rows.append(0)
+ for j in range(5):
+ rows[i] |= (1 << (5 - j - 1)) if pixels[j * 8 + i] == "0" else 0
+
+ # compress the rows data
+ colByte = 0
+ compressedRows = []
+ for i in range(4):
+ rowByte = ((rows[i * 2 + 1] >> 1) & 0xF) | (((rows[i * 2 + 0] >> 1) & 0xF) << 4)
+ colByte |= (1 << i * 2 + 0) if (rows[i * 2 + 0] & 0x1) else 0
+ colByte |= (1 << i * 2 + 1) if (rows[i * 2 + 1] & 0x1) else 0
+ compressedRows.append(rowByte)
+
+ line = f"{{0x{colByte:02X}, {{"
+ for r in compressedRows:
+ line += f"0x{r:02X}, "
+ line += f"}}, '{FONT_TABLE[index].alternate}'}}, // index=0x{index + 0x80:02X}, utf8='{FONT_TABLE[index].utf}'"
+ return line
+
+def generateFont():
+ tree = ET.parse(os.path.join(sys.path[0], "Prusa.lcd"))
+ root = tree.getroot()
+
+ CharList = [Char.attrib for Char in root.iter("CHAR")]
+
+ f = open(os.path.join(sys.path[0], "FontTable.h"), "w", encoding='utf8')
+ for index in range(len(FONT_TABLE)):
+ f.write(generateLineInTable(index, CharList) + '\n')
+ f.close()
+
+def main():
+ generateFont()
+
+if __name__ == "__main__":
+ exit(main())
diff --git a/lang/lib/FontTable.h b/lang/lib/FontTable.h
new file mode 100644
index 000000000..261387673
--- /dev/null
+++ b/lang/lib/FontTable.h
@@ -0,0 +1,10 @@
+{0x3E, {0x0F, 0xA8, 0xAF, 0x00, }, 'H'}, // index=0x80, utf8='๐ท'
+{0x00, {0x69, 0x96, 0x00, 0x00, }, '\xdf'}, // index=0x81, utf8='ยฐ'
+{0x60, {0x25, 0x55, 0x58, 0x87, }, 'h'}, // index=0x82, utf8='๐ก'
+{0x04, {0x27, 0xF2, 0xE0, 0x00, }, '^'}, // index=0x83, utf8='โฌ'
+{0x34, {0x03, 0xCC, 0x19, 0x60, }, '\xf3'}, // index=0x84, utf8='๐'
+{0x3C, {0x0E, 0xF8, 0x8F, 0x00, }, '\xdb'}, // index=0x85, utf8='๐'
+{0x08, {0x02, 0x94, 0x92, 0x00, }, '>'}, // index=0x86, utf8='ยป'
+{0x1C, {0x07, 0x9A, 0x87, 0x00, }, '\xe5'}, // index=0x87, utf8='๐'
+{0x24, {0x00, 0x85, 0x28, 0x52, }, '\x7e'}, // index=0x88, utf8='โฌ'
+{0x06, {0x00, 0x1B, 0xE4, 0x00, }, '\x7e'}, // index=0x89, utf8='โ'
diff --git a/Firmware/Fonts/Font_CZ.lcd b/lang/lib/Font_CZ.lcd
similarity index 99%
rename from Firmware/Fonts/Font_CZ.lcd
rename to lang/lib/Font_CZ.lcd
index 22751d30b..57a8180c1 100644
--- a/Firmware/Fonts/Font_CZ.lcd
+++ b/lang/lib/Font_CZ.lcd
@@ -1,40 +1,40 @@
-
-
- CZ
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+ CZ
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Firmware/Fonts/Font_DE.lcd b/lang/lib/Font_DE.lcd
similarity index 99%
rename from Firmware/Fonts/Font_DE.lcd
rename to lang/lib/Font_DE.lcd
index 453232ac4..1cba2f56c 100644
--- a/Firmware/Fonts/Font_DE.lcd
+++ b/lang/lib/Font_DE.lcd
@@ -1,40 +1,40 @@
-
-
- DE
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+ DE
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Firmware/Fonts/Font_ES.lcd b/lang/lib/Font_ES.lcd
similarity index 99%
rename from Firmware/Fonts/Font_ES.lcd
rename to lang/lib/Font_ES.lcd
index fc132ab2a..6080aa97b 100644
--- a/Firmware/Fonts/Font_ES.lcd
+++ b/lang/lib/Font_ES.lcd
@@ -1,40 +1,40 @@
-
-
- ES
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+ ES
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Firmware/Fonts/Font_FR.lcd b/lang/lib/Font_FR.lcd
similarity index 99%
rename from Firmware/Fonts/Font_FR.lcd
rename to lang/lib/Font_FR.lcd
index fd07b6f23..adf25243a 100644
--- a/Firmware/Fonts/Font_FR.lcd
+++ b/lang/lib/Font_FR.lcd
@@ -1,40 +1,40 @@
-
-
- FR
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+ FR
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Firmware/Fonts/Font_IT.lcd b/lang/lib/Font_IT.lcd
similarity index 99%
rename from Firmware/Fonts/Font_IT.lcd
rename to lang/lib/Font_IT.lcd
index 60815e2ad..da8e26742 100644
--- a/Firmware/Fonts/Font_IT.lcd
+++ b/lang/lib/Font_IT.lcd
@@ -1,40 +1,40 @@
-
-
- IT
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+ IT
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Firmware/Fonts/Font_PL.lcd b/lang/lib/Font_PL.lcd
similarity index 99%
rename from Firmware/Fonts/Font_PL.lcd
rename to lang/lib/Font_PL.lcd
index 95fdfb59c..f96f2ef26 100644
--- a/Firmware/Fonts/Font_PL.lcd
+++ b/lang/lib/Font_PL.lcd
@@ -1,40 +1,40 @@
-
-
- PL
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+ PL
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Firmware/Fonts/Font_RO.lcd b/lang/lib/Font_RO.lcd
similarity index 99%
rename from Firmware/Fonts/Font_RO.lcd
rename to lang/lib/Font_RO.lcd
index eb5e5dcbd..b55669236 100644
--- a/Firmware/Fonts/Font_RO.lcd
+++ b/lang/lib/Font_RO.lcd
@@ -1,40 +1,40 @@
-
-
- RO
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+ RO
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/lang/lib/Prusa.lcd b/lang/lib/Prusa.lcd
new file mode 100644
index 000000000..11ac81e45
--- /dev/null
+++ b/lang/lib/Prusa.lcd
@@ -0,0 +1,264 @@
+
+
+ Prusa
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/lang/lib/charset.py b/lang/lib/charset.py
index 5efeaf647..4cb668556 100644
--- a/lang/lib/charset.py
+++ b/lang/lib/charset.py
@@ -1,26 +1,4 @@
-# Mapping from LCD source encoding to unicode characters
-CUSTOM_CHARS = {
- # Dynamic characters
- '\x80': '๐ท',
- '\x81': 'ยฐ',
- '\x82': '๐ก',
- '\x83': 'โฌ',
- '\x84': '๐',
- '\x85': '๐',
- '\x86': 'ยป',
- '\x87': '๐',
- '\x88': 'โฌ',
- '\x89': 'โ',
-
- # HD44780 A00 font:
- '\x7e': 'โ',
- '\x7f': 'โ',
- '\xe1': 'รค',
- '\xe4': 'ยต', #on keyboard AltGr+m it is \xC2\xB5
- '\xef': 'รถ',
- '\xf5': 'รผ',
- '\xff': 'โ',
-}
+from .FontGen import CUSTOM_CHARS
# Charaters to be remapped prior to source-encoding transformation
# This transformation is applied to the translation prior to being converted to the final encoding,