|
|
|
|
12
|
All of them have a similar but not identical symbol set at the positions 0 to 127 similar to US-ASCII.
|
12
|
All of them have a similar but not identical symbol set at the positions 0 to 127 similar to US-ASCII.
|
13
|
On the other hand symbols at places higher than 127 have mayor differences.
|
13
|
On the other hand symbols at places higher than 127 have mayor differences.
|
14
|
Until now we know of (and support):
|
14
|
Until now we know of (and support):
|
15
|
- 1.) HD44780 and similar with Kana charset A00 https://www.sparkfun.com/datasheets/LCD/HD44780.pdf Page 17
|
|
|
|
|
15
|
+ ** 1.) HD44780 and similar with Kana charset A00 https://www.sparkfun.com/datasheets/LCD/HD44780.pdf Page 17
|
16
|
These are very common, but sadly not very useful when writing in European languages.
|
16
|
These are very common, but sadly not very useful when writing in European languages.
|
17
|
- 2.) HD44780 and similar with Western charset A02 https://www.sparkfun.com/datasheets/LCD/HD44780.pdf Page 18
|
|
|
|
|
17
|
+ ** 2.) HD44780 and similar with Western charset A02 https://www.sparkfun.com/datasheets/LCD/HD44780.pdf Page 18
|
18
|
These are rare, but fairly useful for European languages. Also a limited number of Cyrillic symbols is available.
|
18
|
These are rare, but fairly useful for European languages. Also a limited number of Cyrillic symbols is available.
|
19
|
- 3.) HD44780 and similar with Cyrillic charset http://store.comet.bg/download-file.php?id=466 Page 14
|
|
|
|
|
19
|
+ ** 3.) HD44780 and similar with Cyrillic charset http://store.comet.bg/download-file.php?id=466 Page 14
|
20
|
Some of our Russian friends use them.
|
20
|
Some of our Russian friends use them.
|
21
|
At all of them you can define 8 different symbols by yourself. In Marlin they are used for the Feedrate-, Thermometer-, ... symbols
|
21
|
At all of them you can define 8 different symbols by yourself. In Marlin they are used for the Feedrate-, Thermometer-, ... symbols
|
22
|
|
22
|
|
|
|
|
|
25
|
Currently we deal with 128x64 Pixel Displays and divide this area in about 5 Lines with about 22 columns.
|
25
|
Currently we deal with 128x64 Pixel Displays and divide this area in about 5 Lines with about 22 columns.
|
26
|
Therefore we need fonts with a bounding box of about 6x10.
|
26
|
Therefore we need fonts with a bounding box of about 6x10.
|
27
|
Until now we used a
|
27
|
Until now we used a
|
28
|
- 1.) Marlin-font similar to ISO10646-1 but with special Symbols at the end, what made 'ü' and 'ä' inaccessible, in the size 6x10.
|
|
|
29
|
- 2.) Because these letters are to big for some locations on the info-screen we use a full ISO10646-1 font in the size of 6x9.
|
|
|
30
|
- 3.) When we define USE_BIG_EDIT_FONT we use an additional ISO10646-1 font with 9x18, eating up another 3120 bytes of progmem - but readable without glasses.
|
|
|
|
|
28
|
+ ** 1.) Marlin-font similar to ISO10646-1 but with special Symbols at the end, what made 'ü' and 'ä' inaccessible, in the size 6x10.
|
|
|
29
|
+ ** 2.) Because these letters are to big for some locations on the info-screen we use a full ISO10646-1 font in the size of 6x9.
|
|
|
30
|
+ ** 3.) When we define USE_BIG_EDIT_FONT we use an additional ISO10646-1 font with 9x18, eating up another 3120 bytes of progmem - but readable without glasses.
|
31
|
|
31
|
|
32
|
## The Languages
|
32
|
## The Languages
|
33
|
For the moment Marlin wants to support a lot of languages:
|
33
|
For the moment Marlin wants to support a lot of languages:
|
|
|
|
|
66
|
On a 'perfect' system like Windows or Linux we'd dig out unifont.ttf and some code from the libraries and they'd do what we want. But we are on a embedded system with very limited resources. So we had to find ways so limit the used space (Alone unifont.ttf is about 12MB) and have to make some compromise.
|
66
|
On a 'perfect' system like Windows or Linux we'd dig out unifont.ttf and some code from the libraries and they'd do what we want. But we are on a embedded system with very limited resources. So we had to find ways so limit the used space (Alone unifont.ttf is about 12MB) and have to make some compromise.
|
67
|
|
67
|
|
68
|
### Aims:
|
68
|
### Aims:
|
69
|
- 1.) Make the input for translators as convenient as possible. (Unicode UTF8)
|
|
|
70
|
- 2.) Make the displays show the scripts as good as they can. (fonts, mapping tables)
|
|
|
71
|
- 3.) Don't destroy the existing language files.
|
|
|
72
|
- 3.) Don't loose to much speed
|
|
|
73
|
- 4.) Don't loose to much memory.
|
|
|
|
|
69
|
+ * 1.) Make the input for translators as convenient as possible. (Unicode UTF8)
|
|
|
70
|
+ * 2.) Make the displays show the scripts as good as they can. (fonts, mapping tables)
|
|
|
71
|
+ * 3.) Don't destroy the existing language files.
|
|
|
72
|
+ * 3.) Don't loose to much speed
|
|
|
73
|
+ * 4.) Don't loose to much memory.
|
74
|
|
74
|
|
75
|
### Actions:
|
75
|
### Actions:
|
76
|
- a.) Declare the display hardware we use. (Configuration.h)
|
|
|
77
|
- b.) Declare the language ore script we use. (Configuration.h)
|
|
|
78
|
- c.) Declare the kind of input we use. Ether direct pointers to the font (\xxx) or UTF8 and the font to use on graphic displays. (language_xx.h)
|
|
|
79
|
- d.) Declare the needed translations. (language_xx.h)
|
|
|
80
|
- e.) Make strlen() work with UTF8. (ultralcd.cpp)
|
|
|
81
|
- f.) Seperate the Marlin Symbols to their own font. (dogm_font_data_Marlin_symbols.h)
|
|
|
82
|
- g.) Make the fontswitch function remember the last used font. (dogm_lcd_implementation.h)
|
|
|
83
|
- h.) Make output functions that count the number of written chars and switch the font to Marlin symbols and back when needed. (dogm_lcd_implementation.h) (ultralcd_implementation_hitachi_HD44780.h)
|
|
|
84
|
- i.) Make three fonts to simulate the HD44780 charsets on dogm-displays. With this fonts the translator can check how his translation will look on the character based displays.
|
|
|
85
|
- j.) Make ISO fonts for Cyrillic and Katakana because they do not need a mapping table and are faster to deal with and have a better charset (less compromises) than the HD44780 fonts.
|
|
|
86
|
- k.) Make mapping functions and tables to convert from UTF8 to the fonts and integrate in the new output functions. (utf_mapper.h)
|
|
|
87
|
- l.) Delete the not needed any more 'LiquidCrystalRus.xxx' files and their calls in 'ultralcd_implementation_hitachi_HD44780.h'.
|
|
|
88
|
- m.) Split 'dogm_font_data_Marlin.h' into separate fonts and delete. (+dogm_font_data_6x9_marlin.h , +dogm_font_data_Marlin_symbols.h, -dogm_font_data_Marlin.h)
|
|
|
89
|
- n.) Do a bit of preprocessor magic to match displays - fonts and mappers in 'utf_mapper.h'.
|
|
|
|
|
76
|
+ * a.) Declare the display hardware we use. (Configuration.h)
|
|
|
77
|
+ * b.) Declare the language ore script we use. (Configuration.h)
|
|
|
78
|
+ * c.) Declare the kind of input we use. Ether direct pointers to the font (\xxx) or UTF8 and the font to use on graphic displays. (language_xx.h)
|
|
|
79
|
+ * d.) Declare the needed translations. (language_xx.h)
|
|
|
80
|
+ * e.) Make strlen() work with UTF8. (ultralcd.cpp)
|
|
|
81
|
+ * f.) Seperate the Marlin Symbols to their own font. (dogm_font_data_Marlin_symbols.h)
|
|
|
82
|
+ * g.) Make the fontswitch function remember the last used font. (dogm_lcd_implementation.h)
|
|
|
83
|
+ * h.) Make output functions that count the number of written chars and switch the font to Marlin symbols and back when needed. (dogm_lcd_implementation.h) (ultralcd_implementation_hitachi_HD44780.h)
|
|
|
84
|
+ * i.) Make three fonts to simulate the HD44780 charsets on dogm-displays. With this fonts the translator can check how his translation will look on the character based displays.
|
|
|
85
|
+ * j.) Make ISO fonts for Cyrillic and Katakana because they do not need a mapping table and are faster to deal with and have a better charset (less compromises) than the HD44780 fonts.
|
|
|
86
|
+ * k.) Make mapping functions and tables to convert from UTF8 to the fonts and integrate in the new output functions. (utf_mapper.h)
|
|
|
87
|
+ * l.) Delete the not needed any more 'LiquidCrystalRus.xxx' files and their calls in 'ultralcd_implementation_hitachi_HD44780.h'.
|
|
|
88
|
+ * m.) Split 'dogm_font_data_Marlin.h' into separate fonts and delete. (+dogm_font_data_6x9_marlin.h , +dogm_font_data_Marlin_symbols.h, -dogm_font_data_Marlin.h)
|
|
|
89
|
+ * n.) Do a bit of preprocessor magic to match displays - fonts and mappers in 'utf_mapper.h'.
|
90
|
|
90
|
|
91
|
## Translators handbook
|
91
|
## Translators handbook
|
92
|
- a.) Check is there already is a language_xx.h file for your language (-> b.) or not (-> e.)
|
|
|
93
|
- b.) Ether their is declared MAPPER_NON (-> c.) or an other mapper (-> d.)
|
|
|
94
|
- c.) Symbols outside the normal ASCII-range (32-128) are written as "\xxx" and point directly into the font of the hardware you declared in 'Configuration.h'
|
|
|
|
|
92
|
+ * a.) Check is there already is a language_xx.h file for your language (-> b.) or not (-> e.)
|
|
|
93
|
+ * b.) Ether their is declared MAPPER_NON (-> c.) or an other mapper (-> d.)
|
|
|
94
|
+ * c.) Symbols outside the normal ASCII-range (32-128) are written as "\xxx" and point directly into the font of the hardware you declared in 'Configuration.h'
|
95
|
This is one of the three fonts of the character based Hitachi displays (DISPLAY_CHARSET_HD44780_JAPAN, DISPLAY_CHARSET_HD44780_WEST, DISPLAY_CHARSET_HD44780_CYRILIC).
|
95
|
This is one of the three fonts of the character based Hitachi displays (DISPLAY_CHARSET_HD44780_JAPAN, DISPLAY_CHARSET_HD44780_WEST, DISPLAY_CHARSET_HD44780_CYRILIC).
|
96
|
Even on the full graphic displays one of these will be used when SIMULATE_ROMFONT is defined.
|
96
|
Even on the full graphic displays one of these will be used when SIMULATE_ROMFONT is defined.
|
97
|
If you don't make use of the extended character set your file will look like 'language_en.h' and your language file will work on all the displays.
|
97
|
If you don't make use of the extended character set your file will look like 'language_en.h' and your language file will work on all the displays.
|
|
|
|
|
99
|
Be careful with the characters 0x5c = '\', and 0x7b - 0x7f. "{|}"These are not the same on all variants.
|
99
|
Be careful with the characters 0x5c = '\', and 0x7b - 0x7f. "{|}"These are not the same on all variants.
|
100
|
MAPPER_NON is the fastest an least memory consuming variant.
|
100
|
MAPPER_NON is the fastest an least memory consuming variant.
|
101
|
If you want to make use of more than a view symbols outside standard ASCII or want to improve the portability to more different types of displays use UTF8 input. That means define an other mapper.
|
101
|
If you want to make use of more than a view symbols outside standard ASCII or want to improve the portability to more different types of displays use UTF8 input. That means define an other mapper.
|
102
|
- d.) With a mapper different to MAPPER_NON UTF8 input is used. Instead of "\xe1" (on a display with Japanese font) or STR_ae simply use "ä". When the string is read byte by byte , the "ä" will expand to "\0xc3\0xa4" or "Я" will expand to "0xd0\0xaf" or "ホ" will expand to "\0xe3\0x83\0x9b"
|
|
|
|
|
102
|
+ * d.) With a mapper different to MAPPER_NON UTF8 input is used. Instead of "\xe1" (on a display with Japanese font) or STR_ae simply use "ä". When the string is read byte by byte , the "ä" will expand to "\0xc3\0xa4" or "Я" will expand to "0xd0\0xaf" or "ホ" will expand to "\0xe3\0x83\0x9b"
|
103
|
To limit the used memory we can't use all the possibilities UTF8 gives at the same time. We define a subset matching to the language or script we use.
|
103
|
To limit the used memory we can't use all the possibilities UTF8 gives at the same time. We define a subset matching to the language or script we use.
|
104
|
MAPPER_C2C3 correspondents good with west European languages the possible symbols are listed at (http://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block))
|
104
|
MAPPER_C2C3 correspondents good with west European languages the possible symbols are listed at (http://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block))
|
105
|
MAPPER_D0D1 correspondents well with the Cyrillic languages. See (http://en.wikipedia.org/wiki/Cyrillic_(Unicode_block))
|
105
|
MAPPER_D0D1 correspondents well with the Cyrillic languages. See (http://en.wikipedia.org/wiki/Cyrillic_(Unicode_block))
|
|
|
|
|
112
|
MAPPER_NON is the fastest and least memory consuming variant.
|
112
|
MAPPER_NON is the fastest and least memory consuming variant.
|
113
|
Mappers together with a ISO10646_font are the second best choice regarding speed and memory consumption. Only a few more decisions are mad per character.
|
113
|
Mappers together with a ISO10646_font are the second best choice regarding speed and memory consumption. Only a few more decisions are mad per character.
|
114
|
Mappers together with the HD44780_fonts use about additional 128 bytes for the mapping_table.
|
114
|
Mappers together with the HD44780_fonts use about additional 128 bytes for the mapping_table.
|
115
|
- e.) Creating a new language file is not a big thing. Just make a new file with the format 'language_xx.h' or maybe 'language.xx.utf8.h', define a mapper and a font in there and translate some of the strings defined in language_en.h. You can drop the surrounding #ifndef #endif. You don't have to translate all the stings - the missing one will be added by language_en.h - in English - of cause.
|
|
|
116
|
- f.) If you cant find a matching mapper things will be a bit more complex. With the Hitachi based displays you will not have big chance to make something useful unless you have one with a matching charset. For a full graphic display - lets explain with - let's say Greece.
|
|
|
|
|
115
|
+ * e.) Creating a new language file is not a big thing. Just make a new file with the format 'language_xx.h' or maybe 'language.xx.utf8.h', define a mapper and a font in there and translate some of the strings defined in language_en.h. You can drop the surrounding #ifndef #endif. You don't have to translate all the stings - the missing one will be added by language_en.h - in English - of cause.
|
|
|
116
|
+ * f.) If you cant find a matching mapper things will be a bit more complex. With the Hitachi based displays you will not have big chance to make something useful unless you have one with a matching charset. For a full graphic display - lets explain with - let's say Greece.
|
117
|
Find a matching charset. (http://en.wikipedia.org/wiki/Greek_and_Coptic)
|
117
|
Find a matching charset. (http://en.wikipedia.org/wiki/Greek_and_Coptic)
|
118
|
Provide a font containing the symbols in the right size. Normal ASCII in the lower 127 places, the upper with your selection.
|
118
|
Provide a font containing the symbols in the right size. Normal ASCII in the lower 127 places, the upper with your selection.
|
119
|
Write a mapper catching, in this case, 0xcd to 0xcf and add it to 'utf_mapper.h'.
|
119
|
Write a mapper catching, in this case, 0xcd to 0xcf and add it to 'utf_mapper.h'.
|
120
|
In case of a ISO10646 font we have a MAPPER_ONE_TO_ONE and don't have to make a table.
|
120
|
In case of a ISO10646 font we have a MAPPER_ONE_TO_ONE and don't have to make a table.
|
121
|
- g.) If you discover enough useful symbols in one of the HD44780 fonts you can provide a mapping table. For example HD44780_WEST contains 'alpha', 'beta', 'pi', 'Sigma', 'omega' 'My' - what is not enough to make USEFUL table - I think.
|
|
|
122
|
- h.) If you want to integrate an entirely new variant of a Hitachi based display.
|
|
|
|
|
121
|
+ * g.) If you discover enough useful symbols in one of the HD44780 fonts you can provide a mapping table. For example HD44780_WEST contains 'alpha', 'beta', 'pi', 'Sigma', 'omega' 'My' - what is not enough to make USEFUL table - I think.
|
|
|
122
|
+ * h.) If you want to integrate an entirely new variant of a Hitachi based display.
|
123
|
Add it in 'Configuration.h'. Define mapper tables in 'utf_mapper.h'. Maybe you need a new mapper function.
|
123
|
Add it in 'Configuration.h'. Define mapper tables in 'utf_mapper.h'. Maybe you need a new mapper function.
|
124
|
|
124
|
|
125
|
The length of the strings is limited. '17 chars' was crude rule of thumb. Obviously 17 is to long for the 16x2 displays. A more exact rule would be max_strlen = Displaywidth - 2 - strlen(value to display behind). This is a bit complicated. So try and count is my rule of thumb.
|
125
|
The length of the strings is limited. '17 chars' was crude rule of thumb. Obviously 17 is to long for the 16x2 displays. A more exact rule would be max_strlen = Displaywidth - 2 - strlen(value to display behind). This is a bit complicated. So try and count is my rule of thumb.
|