|
@@ -2,68 +2,46 @@
|
2
|
2
|
|
3
|
3
|
### Supported hardware
|
4
|
4
|
|
5
|
|
-Marlin supports HD44780 character LCD and 128x64 graphical LCD via U8GLIB.
|
6
|
|
-Because of the limitation of HD44780 hardwares, Marlin can only support three
|
7
|
|
-character sets for that hardware:
|
8
|
|
-Japanese (kana_utf8), Russian/Cyrillic (ru), or Western (Roman characters)
|
9
|
|
-
|
10
|
|
-For the graphical LCD modules, there's far less limitation. Users and language
|
11
|
|
-maintainers can easily change the language translation strings if they save
|
12
|
|
-with UTF-8 encoding. The only extra step is to regenerate the font data from
|
13
|
|
-an existing BDF font file.
|
|
5
|
+Marlin supports HD44780 character LCD and 128x64 graphical LCD via U8GLIB. Because of the limitation of HD44780 hardwares, Marlin can only support three character sets for that hardware: Japanese (kana_utf8), Russian/Cyrillic (ru), or Western (Roman characters)
|
14
|
6
|
|
|
7
|
+For the graphical LCD modules, there's far less limitation. Users and language maintainers can easily change the language translation strings when saved with UTF-8 encoding. The only extra step is to regenerate the font data from an existing BDF font file.
|
15
|
8
|
|
16
|
9
|
### How to support a new language?
|
17
|
10
|
|
18
|
|
-1. prepare the translation source file
|
|
11
|
+1. Prepare the translation source file
|
19
|
12
|
|
20
|
|
-You need to add a language header file language_xx.h,
|
21
|
|
-where xx is the language/country code, for example en is for English.
|
22
|
|
-You may start with a existing language file by copying it to a new location:
|
|
13
|
+You need to add a language header file `language_xx.h`, replacing xx with the language/country code. (e.g., "en" for English). You can start with a existing language file by copying it to a new location:
|
23
|
14
|
|
24
|
15
|
```bash
|
25
|
16
|
cp language_zh_CN.h language_zh_TW.h
|
26
|
17
|
```
|
27
|
18
|
|
28
|
|
-Then you can replace the strings in the macro _UxGT().
|
|
19
|
+Then simply replace the strings inside the `_UxGT()` macros.
|
29
|
20
|
|
30
|
21
|
Make sure the file is saved as UTF-8 encoded.
|
31
|
22
|
|
32
|
|
-
|
33
|
23
|
2. Generate the font data file
|
34
|
24
|
|
35
|
|
-This step is to gather the glyph appearing in the language file from a 9pt bitmap font,
|
36
|
|
-and save the data in a language_data_xx.h file. So the font used for conversion should
|
37
|
|
-contain all the characters in your language file.
|
38
|
|
-
|
39
|
|
-The default bitmap font is WQY's 9pt bitmap font. You may download from
|
|
25
|
+This step gathers the glyphs used in the language file from a 9pt bitmap font and saves the data in a language_data_xx.h file. So the font used for conversion should contain all the characters in your language file.
|
40
|
26
|
|
41
|
|
-http://wenq.org/daily/wqy-bitmapfont-bdf-gb18030-nightly_build.tar.gz
|
|
27
|
+The default bitmap font is WQY's 9pt bitmap font.
|
42
|
28
|
|
43
|
|
-or install in Debian/Ubuntu system:
|
|
29
|
+Download from [here](http://wenq.org/daily/wqy-bitmapfont-bdf-gb18030-nightly_build.tar.gz), or to install in a Debian/Ubuntu system:
|
44
|
30
|
|
45
|
31
|
```
|
46
|
32
|
sudo apt-get install xfonts-wqy
|
47
|
33
|
```
|
48
|
34
|
|
49
|
|
-You need also compile the bdf2u8g which convert the BDF font file to U8glib supported data structures.
|
50
|
|
-Before you compile bdf2u8g, it would better to patch the source file bdf2u8g.c.
|
|
35
|
+You also need to compile the `bdf2u8g` binary to convert BDF font files into U8glib data structures:
|
51
|
36
|
|
52
|
|
-```
|
|
37
|
+```bash
|
53
|
38
|
cd marlin-git/buildroot/share/fonts/
|
54
|
|
-wget https://github.com/olikraus/u8glib/archive/master.zip
|
55
|
|
-unzip master.zip
|
56
|
|
-cd u8glib-master/
|
57
|
|
-patch -p0 < ../u8glib-bdf2u8g.patch
|
58
|
|
-make -C tools/font/bdf2u8g/
|
59
|
|
-cd -
|
60
|
|
-ln -s u8glib-master/tools/font/bdf2u8g/bdf2u8g
|
|
39
|
+./get-bdf2u8g.sh
|
61
|
40
|
```
|
62
|
41
|
|
63
|
|
-The 'genallfont.sh' script will generate the font data for all of the
|
64
|
|
-language translation files.
|
|
42
|
+The `genallfont.sh` script generates font data for all language translation files.
|
65
|
43
|
|
66
|
|
-You may specify the language list you want to process. For example:
|
|
44
|
+You may specify a list of languages to process. For example:
|
67
|
45
|
|
68
|
46
|
```bash
|
69
|
47
|
MARLIN_LANGS="zh_CN zh_TW"
|
|
@@ -78,8 +56,7 @@ MARLIN_LANGS="zh_CN zh_TW" ../buildroot/share/fonts/genallfont.sh
|
78
|
56
|
|
79
|
57
|
3. Change the language settings
|
80
|
58
|
|
81
|
|
-To compile the firmware for your language, you need choose a language
|
82
|
|
-in `Configuration.h`. For Chinese (Taiwan) you would use:
|
|
59
|
+To compile Marlin with your language, choose a language in `Configuration.h`. For Chinese (Taiwan) you would use:
|
83
|
60
|
|
84
|
61
|
```cpp
|
85
|
62
|
#define LCD_LANGUAGE zh_TW
|
|
@@ -87,42 +64,34 @@ in `Configuration.h`. For Chinese (Taiwan) you would use:
|
87
|
64
|
|
88
|
65
|
4. Compile and Upload the firmware
|
89
|
66
|
|
90
|
|
-Open `Marlin.ino` in your IDE and compile the firmware. If it's compiled succeeds, upload it to your Arduino hardware.
|
91
|
|
-
|
|
67
|
+Open `Marlin.ino` in your IDE and compile the firmware. Once the build succeeds, upload it to your board.
|
92
|
68
|
|
93
|
69
|
### Update the language translation
|
94
|
70
|
|
95
|
|
-If you change the language files, you need to run the script `genallfont.sh`
|
96
|
|
-again to update the font data file.
|
97
|
|
-
|
|
71
|
+Whenever language files are changed, you need to run the script `genallfont.sh` again to update the font data file.
|
98
|
72
|
|
99
|
73
|
### Use a cool font
|
100
|
74
|
|
101
|
|
-You may need to use a different font to support your own language, because the
|
102
|
|
-default 9pt font is not complete. (You may also support them by adding the missing
|
103
|
|
-glyphs to the font.)
|
|
75
|
+You may need to use a different font to support your own language, because the default 9pt font is not complete. (You may also support them by adding the missing glyphs to the font.)
|
104
|
76
|
|
105
|
|
-After you've prepared your font, specify the font file path as an argument to
|
106
|
|
-`genallfont.sh`, so that the font used for your language is your new font. For
|
107
|
|
-example, your new font file name is `newfont.bdf`, then run the following command:
|
|
77
|
+After you've prepared your font, specify the font file path as an argument to `genallfont.sh`, so that the font used for your language is your new font. For example, if your font is named `newfont.bdf` run the following command:
|
108
|
78
|
|
109
|
79
|
```bash
|
110
|
80
|
cd Marlin/
|
111
|
81
|
../buildroot/share/fonts/genallfont.sh ./newfont.bdf
|
|
82
|
+```
|
112
|
83
|
|
113
|
|
-# OR if you just want to regenerate the language font data for a specific language:
|
|
84
|
+...or to regenerate the language font data for a specific language:
|
|
85
|
+
|
|
86
|
+```bash
|
114
|
87
|
MARLIN_LANGS="zh_TW" ../buildroot/share/fonts/genallfont.sh ./newfont.bdf
|
115
|
88
|
```
|
116
|
89
|
|
117
|
90
|
### Suggestions for Maintainers
|
118
|
91
|
|
119
|
|
-Even the tool and the language engine can be easily updated,
|
120
|
|
-since it use the common bitmap font files and UTF-8 text,
|
121
|
|
-the maintainer need to confirm that the fonts contains the glyph
|
122
|
|
-in the language files.
|
|
92
|
+The tool and the language engine can be easily updated. Since it uses common bitmap font files and UTF-8 text, the maintainer needs to confirm that the font contains the glyphs in the language files.
|
123
|
93
|
|
124
|
|
-The font file currently used to generate the font data is the file ISO10646-0-3.bdf,
|
125
|
|
-which is combined with the Marlin's ISO10646-1 fonts and WQY 9pt bitmap font.
|
|
94
|
+At this time, the font file `marlin-6x12-3.bdf` is used to generate the font data. It combines all of Marlin's ISO10646-1 fonts and the WQY 9pt bitmap font.
|
126
|
95
|
|
127
|
96
|
### Related resources
|
128
|
97
|
|
|
@@ -135,7 +104,7 @@ which is combined with the Marlin's ISO10646-1 fonts and WQY 9pt bitmap font.
|
135
|
104
|
Documents related to the old version of the language engine:
|
136
|
105
|
|
137
|
106
|
- [Marlin Fonts Documentation](http://www.marlinfw.org/docs/development/fonts.html)
|
138
|
|
-- [Marlin LCD Language](https://github.com/MarlinFirmware/Marlin/wiki/LCD-Language)
|
|
107
|
+- [Marlin LCD Language](http://marlinfw.org/docs/development/lcd_language.html)
|
139
|
108
|
- [U8GLIB](https://github.com/olikraus/u8glib.git)
|
140
|
109
|
- [UTF-8 for U8GLIB](https://github.com/yhfudev/u8glib-fontutf8.git)
|
141
|
110
|
- [Standalone test project for the Marlin UTF-8 language engine](https://github.com/yhfudev/marlin-fontutf8.git)
|