ソースを参照

Change selection logic another time

Automatic selection was to unflexible.

Updated documentation

Updated language files to new logic and documentation.

Updated bdf2u8g.exe
AnHardt 9年前
コミット
96f8d20f2f

+ 38
- 26
Documentation/LCDLanguageFont.md ファイルの表示

@@ -1,15 +1,15 @@
1 1
 # LCD Language Font System
2 2
 
3
-We deal with a variety of differend displays.
4
-And we try to display different languages on them.
3
+We deal with a variety of different displays.
4
+And we try to display a lot of different languages on them.
5 5
 This system is ought to solve some of the related problems.
6 6
 
7 7
 ## The Displays
8
-We have two different technologys for the displays:
8
+We have two different technologies for the displays:
9 9
 
10 10
 * Character based displays
11 11
   Have a fixed set of symbols (charset - font) in their ROM.
12
-  All of them have similar but not identical symbols 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 13
   On the other hand symbols at places higher than 127 have mayor differences.
14 14
   Until now we know of (and support):
15 15
   1.) HD44780 and similar with Kana charset A00 https://www.sparkfun.com/datasheets/LCD/HD44780.pdf Page 17
@@ -22,10 +22,10 @@ We have two different technologys for the displays:
22 22
 
23 23
 * Full graphic displays
24 24
   Where we have the full freedom to display whatever we want, when we can make a program for it.
25
-  Currently we deal with 128x64 Pixel Displays and devide 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 26
   Therefore we need fonts with a bounding box of about 6x10.
27 27
   Until now we used a
28
-  1.) Marlin-font similar to ISO10646-1 but with special Symbols at the end what made 'ö' and 'ü' unaccessible in the size 6x10.
28
+  1.) Marlin-font similar to ISO10646-1 but with special Symbols at the end, what made 'ü' and 'ä' inaccessible, in the size 6x10.
29 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 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
 
@@ -48,17 +48,18 @@ We have two different technologys for the displays:
48 48
   and recently on [Thingiverse](http://www.thingiverse.com/) a new port to
49 49
   * jp    [Japanese](http://www.thingiverse.com/thing:664397)
50 50
   appeared.
51
-  
51
+
52
+## The Problem
52 53
   All of this languages, except the English, normally use extended symbol sets, not contained in US-ASCII.
53
-  Even the English translation uses some Symbols not in US-ASCII. ( '\002' for Thermometer, STR_h3 for '³')
54
-  And worse, in the code itself symbols are used, not taking in account, on what display they are written. [(This is thrue only for Displays with Japanese charset](https://github.com/MarlinFirmware/Marlin/blob/Development/Marlin/ultralcd_implementation_hitachi_HD44780.h#L218) on Western displays you'll see a '~' and on Cyrillic an 'arrow coming from top - pointing to left', what is quite the opposite the programmer wanted.)
55
-  The Germans want to use "ÄaÖöÜüß" the Finnish at least "äö". Other European languages want to see their accents an their letters.
54
+  Even the English translation uses some Symbols not in US-ASCII. ( '\002' for Thermometer, STR_h3 for '³')
55
+  And worse, in the code itself symbols are used, not taking in account, on what display they are written. [(This is thrue only for Displays with Japanese charset](https://github.com/MarlinFirmware/Marlin/blob/Development/Marlin/ultralcd_implementation_hitachi_HD44780.h#L218) on Western displays you'll see a '~' and on Cyrillic an 'arrow coming from top - pointing to left', what is quite the opposite of the programmer wanted.)
56
+  The Germans want to use "ÄäÖöÜüß" the Finnish at least "äö". Other European languages want to see their accents an their letters.
56 57
   For other scripts like Cyrillic, Japanese, Greek, Hebrew, ... you have to find totally different symbol sets.
57 58
 
58 59
   Until now the problems where ignored widely.
59
-  The German translation used utf8 'ä' and 'ü' and did not care about showing garbage on all displays.
60
+  The German translation used utf8 'ä' and 'ö' and did not care about showing garbage on ALL displays.
60 61
   The Russian translators new that their system only works on the Cyrillic character displays and relied on special LCD routines (LiquidCrystalRus.cpp) to handle UTF8 but missed to implement a proper strlen().
61
-  The Japanese translator dealed with to scritps. He introduced a very special font for the full graphic displays and made use of the Japanese version of the character displays. Therefore he ended up with two pretty unreadable language.h files full of '\xxx' definitions.
62
+  The Japanese translator dealed with to scripts. He introduced a very special font for the full graphic displays and made use of the Japanese version of the character displays. Therefore he ended up with two pretty unreadable language.h files full of '\xxx' definitions.
62 63
   Other languages ether tried to avoid wording with their special symbols or ignored the problem at all and used the basic symbols without the accents, dots, ... whatever.
63 64
 
64 65
 ## The (partial) Solution
@@ -74,15 +75,15 @@ We have two different technologys for the displays:
74 75
 ### Actions:
75 76
   a.) Declare the display hardware we use. (Configuration.h)
76 77
   b.) Declare the language ore script we use. (Configuration.h)
77
-  c.) Declare the kind of input we use. Ether direct pointers to the font (\xxx) or UTF8. (language_xx.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)
78 79
   d.) Declare the needed translations. (language_xx.h)
79 80
   e.) Make strlen() work with UTF8. (ultralcd.cpp)
80 81
   f.) Seperate the Marlin Symbols to their own font. (dogm_font_data_Marlin_symbols.h)
81 82
   g.) Make the fontswitch function remember the last used font. (dogm_lcd_implementation.h)
82
-  h.) Make output functions what 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)
83
-  i.) Make three fonts to simulate the HD44780 charsets on dogm-displays. This makes translations easy because we have less charsets we have to deal with. (What is working on the HD44780s will also work on the dogms.)
84
-  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)
85
-  k.) Make mapping functions and tables to convert from UTF8 to the fonts and integrate to the new output functions. (utf_mapper.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)
86 87
   l.) Delete the not needed any more 'LiquidCrystalRus.xxx' files and their calls in 'ultralcd_implementation_hitachi_HD44780.h'.
87 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)
88 89
   n.) Do a bit of preprocessor magic to match displays - fonts and mappers in 'utf_mapper.h'.
@@ -92,13 +93,13 @@ We have two different technologys for the displays:
92 93
   b.) Ether their is declared MAPPER_NON (-> c.) or an other mapper (-> d.)
93 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'
94 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
-      Even on the full graphic displays one of these will be used.
96
+      Even on the full graphic displays one of these will be used when SIMULATE_ROMFONT is defined.
96 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 98
       If you make intensive use, your file will look like 'language_kana.h' and your language file will only work on one of displays. (in this case DISPLAY_CHARSET_HD44780_JAPAN)
98
-      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.
99 100
       MAPPER_NON is the fastest an least memory consuming variant.
100 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
-  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"
102 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 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 105
       MAPPER_D0D1 correspondents well with the Cyrillic languages. See (http://en.wikipedia.org/wiki/Cyrillic_(Unicode_block))
@@ -106,20 +107,31 @@ We have two different technologys for the displays:
106 107
       The mapper functions will only catch the 'lead in' described in the mappers name. If the input they get does not match they'll put out a '?' or garbage.
107 108
       The last byte in the sequence ether points directly into a matching ISO10646 font or via a mapper_table into one of the HD44780 fonts.
108 109
       The mapper_tables do their best to find a similar symbol in the HD44780_fonts. For example replacing small letters with the matching capital letters. But they may fail to find something matching and will output a '?'. There are combinations of language and display what simply have no corresponding symbols - like Cyrillic on a Japanese display or visa versa - than the compiler will throw an error.
109
-      In short: Chose a Mapper working with the symbols you want to use. Use only symbols matching the mapper. On FULL graphic displays all will be fine, but check for daring replacements or question-marks in the output of character based displays.
110
-      If you get a lot of question-marks on the Hitachi based displays with your new translation, maybe creating a new language file with the format 'language_xx_utf8.h' is the way to go.
110
+      In short: Chose a Mapper working with the symbols you want to use. Use only symbols matching the mapper. On FULL graphic displays all will be fine, but check for daring replacements or question-marks in the output of character based displays by defining SIMULATE_ROMFONT and trying the different variants.
111
+      If you get a lot of question-marks on the Hitachi based displays with your new translation, maybe creating an additional language file with the format 'language_xx_utf8.h' is the way to go.
112
+      MAPPER_NON is the fastest and least memory consuming variant.
111 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.
112 114
       Mappers together with the HD44780_fonts use about additional 128 bytes for the mapping_table.
113
-  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 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.
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.
114 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 117
       Find a matching charset. (http://en.wikipedia.org/wiki/Greek_and_Coptic)
116 118
       Provide a font containing the symbols in the right size. Normal ASCII in the lower 127 places, the upper with your selection.
117 119
       Write a mapper catching, in this case, 0xcd to 0xcf and add it to 'utf_mapper.h'.
118 120
       In case of a ISO10646 font we have a MAPPER_ONE_TO_ONE and don't have to make a table.
119
-  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.
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.
120 122
   h.) If you want to integrate an entirely new variant of a Hitachi based display.
121 123
       Add it in 'Configuration.h'. Define mapper tables in 'utf_mapper.h'. Maybe you need a new mapper function. 
122 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. 
126
+  On the 16x2 displays the strings are cut at the end to fit on the display. So it's a good idea to make them differ early. ('Somverylongoptionname x' -> 'x Somverylongoptionname')
127
+  You'll find all translatable strings in 'language_en.h'. Please don't translate any strings from 'language.h', this may break the serial protocol.
128
+
123 129
 ## User Instructions
124
-   Define your hardware and language in 'Configuration.h'. Done.
125
-   
130
+   Define your hardware and the wanted language in 'Configuration.h'.
131
+   To find out what charset you harware is define language 'test' and compile. In the menu you will see two lines from the upper half of the charset.
132
+   * DISPLAY_CHARSET_HD44780_JAPAN   locks like "�パヒビピフブプヘベペホボ�マミ"
133
+   * DISPLAY_CHARSET_HD44780_WESTERN locks like "�ÑÒÓÔÕÖ×ØÙÚÛÜ�Þß"
134
+   * DISPLAY_CHARSET_HD44780_CYRILIC locks like "РСТУФХЦЧШЩЪЫЬЭЮЯ"
135
+
136
+   If you get an error about missing mappers during compilation - lie about your displays hardware font to see at lest some garbage, or select an other language. English works on all hardware.
137
+

+ 4
- 3
Marlin/Configuration.h ファイルの表示

@@ -567,10 +567,11 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of
567 567
 // Define your display language below. Replace (en) with your language code and uncomment.
568 568
 // en, pl, fr, de, es, ru, it, pt, pt-br, fi, an, nl, ca, eu, kana, kana_utf8, kanji, test
569 569
 // See also language.h
570
-//#define LANGUAGE_INCLUDE GENERATE_LANGUAGE_INCLUDE(en)
570
+#define LANGUAGE_INCLUDE GENERATE_LANGUAGE_INCLUDE(en)
571 571
 
572
-// Chose ONE of the next three charsets. This has to match your hardware. In case of a full graphic display chose that one best fitting to your language.
573
-// to find out what type you have - compile with language_test.h - upload - click to get the menu. You'll see two typical lines from the upper half of the charset.
572
+// Chose ONE of the next three charsets. This has to match your hardware. In case of a full graphic display this information is not important.
573
+// To find out what type you have - compile with (test) - upload - click to get the menu. You'll see two typical lines from the upper half of the charset.
574
+// Se also documentation/LCDLanguageFont.md
574 575
   #define DISPLAY_CHARSET_HD44780_JAPAN        // this is the most common hardware
575 576
   //#define DISPLAY_CHARSET_HD44780_WESTERN
576 577
   //#define DISPLAY_CHARSET_HD44780_CYRILIC

+ 36
- 34
Marlin/dogm_lcd_implementation.h ファイルの表示

@@ -35,10 +35,10 @@
35 35
 #include "ultralcd.h"
36 36
 #include "ultralcd_st7920_u8glib_rrd.h"
37 37
 #include "configuration.h"
38
-#include "utf_mapper.h"
38
+
39 39
 
40 40
 #include <utility/u8g.h>
41
-#include "dogm_font_data_6x9_marlin.h"       // Height of 'A' is only 5 pixel.
41
+#include "dogm_font_data_6x9_marlin.h"       // Height of 'A' is only 6 pixel.
42 42
 #include "dogm_font_data_Marlin_symbols.h"   // The Marlin special symbols
43 43
 
44 44
 #define FONT_STATUSMENU_NAME u8g_font_6x9    // we don't have a small font for Cyrillic, Kana or Kanji
@@ -50,38 +50,38 @@
50 50
   #define USE_BIG_EDIT_FONT
51 51
 #endif
52 52
 
53
-#if defined( MAPPER_C2C3 )
54
-  #include <utility/u8g.h> // System font. This is ISO10646-1
55
-  #define FONT_MENU_NAME u8g_font_6x10
56
-
57
-#elif defined( MAPPER_D0D1 )
58
-  #include "dogm_font_data_ISO10646_5_Cyrillic.h"
59
-  #define FONT_MENU_NAME ISO10646_5_Cyrillic_5x7
60
-
61
-#elif defined( MAPPER_E382E383 )
62
-  #include "dogm_font_data_ISO10646_Kana.h"
63
-  #define FONT_MENU_NAME ISO10646_Kana_5x7
64
-
65
-#elif defined( DISPLAY_CHARSET_KANJI ) && defined( MAPPER_NON )
66
-  #include "dogm_font_data_6x10_marlin_Kanji.h"
67
-  #define FONT_MENU_NAME u8g_font_6x10_marlin
68
-
69
-#elif defined( DISPLAY_CHARSET_HD44780_JAPAN )
70
-  #include "dogm_font_data_HD44780_J.h"
71
-  #define FONT_MENU_NAME HD44780_J_5x7
72
-
73
-#elif defined( DISPLAY_CHARSET_HD44780_WESTERN )
74
-  #include "dogm_font_data_HD44780_W.h"
75
-  #define FONT_MENU_NAME HD44780_W_5x7
76
-
77
-#elif defined( DISPLAY_CHARSET_HD44780_CYRILIC )
78
-  #include "dogm_font_data_HD44780_C.h"
79
-  #define FONT_MENU_NAME HD44780_C_5x7
80
-
81
-#else // #if defined( MAPPER_C2C3 )  // fall-back
82
-  #include <utility/u8g.h> // system font
83
-  #define FONT_MENU_NAME u8g_font_6x10
84
-#endif
53
+#ifndef SIMULATE_ROMFONT
54
+  #if defined( DISPLAY_CHARSET_ISO10646_1 )
55
+    #include <utility/u8g.h> // System font.
56
+    #define FONT_MENU_NAME u8g_font_6x10
57
+  #elif defined( DISPLAY_CHARSET_ISO10646_5 )
58
+    #include "dogm_font_data_ISO10646_5_Cyrillic.h"
59
+    #define FONT_MENU_NAME ISO10646_5_Cyrillic_5x7
60
+  #elif defined( DISPLAY_CHARSET_ISO10646_KANA )
61
+    #include "dogm_font_data_ISO10646_Kana.h"
62
+    #define FONT_MENU_NAME ISO10646_Kana_5x7
63
+  #elif defined( DISPLAY_CHARSET_KANJI )
64
+    #include "dogm_font_data_6x10_marlin_Kanji.h"
65
+    #define FONT_MENU_NAME u8g_font_6x10_marlin
66
+  #else // fall-back
67
+    #include <utility/u8g.h> // system font
68
+    #define FONT_MENU_NAME u8g_font_6x10
69
+  #endif
70
+#else // SIMULATE_ROMFONT
71
+  #if defined( DISPLAY_CHARSET_HD44780_JAPAN )
72
+    #include "dogm_font_data_HD44780_J.h"
73
+    #define FONT_MENU_NAME HD44780_J_5x7
74
+  #elif defined( DISPLAY_CHARSET_HD44780_WESTERN )
75
+    #include "dogm_font_data_HD44780_W.h"
76
+    #define FONT_MENU_NAME HD44780_W_5x7
77
+  #elif defined( DISPLAY_CHARSET_HD44780_CYRILIC )
78
+    #include "dogm_font_data_HD44780_C.h"
79
+    #define FONT_MENU_NAME HD44780_C_5x7
80
+  #else // fall-back
81
+    #include <utility/u8g.h> // system font
82
+    #define FONT_MENU_NAME u8g_font_6x10
83
+  #endif
84
+#endif // SIMULATE_ROMFONT
85 85
 
86 86
 #define FONT_STATUSMENU 1
87 87
 #define FONT_SPECIAL 2
@@ -138,6 +138,8 @@ U8GLIB_NHD_C12864 u8g(DOGLCD_CS, DOGLCD_A0);
138 138
 U8GLIB_DOGM128 u8g(DOGLCD_CS, DOGLCD_A0);  // HW-SPI Com: CS, A0
139 139
 #endif
140 140
 
141
+#include "utf_mapper.h"
142
+
141 143
 char currentfont = 0;
142 144
 
143 145
 static void lcd_setFont(char font_nr) {

+ 6
- 0
Marlin/language.h ファイルの表示

@@ -11,6 +11,7 @@
11 11
 //
12 12
 //   ==> ALWAYS TRY TO COMPILE MARLIN WITH/WITHOUT "ULTIPANEL" / "ULTRALCD" / "SDSUPPORT" #define IN "Configuration.h"
13 13
 //   ==> ALSO TRY ALL AVAILABLE LANGUAGE OPTIONS
14
+// Se also documentation/LCDLanguageFont.md
14 15
 
15 16
 // Languages
16 17
 // en       English
@@ -201,6 +202,11 @@
201 202
 #define MSG_MAXTEMP_BED_OFF                 "Heated bed" MSG_SWITCHED_OFF_MAX
202 203
 
203 204
 // LCD Menu Messages
205
+
206
+#if !(defined( DISPLAY_CHARSET_HD44780_JAPAN ) || defined( DISPLAY_CHARSET_HD44780_WESTERN ) || defined( DISPLAY_CHARSET_HD44780_CYRILIC ))
207
+  #define DISPLAY_CHARSET_HD44780_JAPAN
208
+#endif
209
+
204 210
 #include LANGUAGE_INCLUDE
205 211
 #include "language_en.h"
206 212
 

+ 4
- 1
Marlin/language_an.h ファイルの表示

@@ -2,13 +2,16 @@
2 2
  * Aragonese
3 3
  *
4 4
  * LCD Menu Messages
5
- * Please note these are limited to 17 characters!
5
+ * Se also documentation/LCDLanguageFont.md
6 6
  *
7 7
  */
8 8
 #ifndef LANGUAGE_AN_H
9 9
 #define LANGUAGE_AN_H
10 10
 
11 11
 #define MAPPER_NON
12
+// Define SIMULATE_ROMFONT to see what is seen on the character based display defined in Configuration.h
13
+//#define SIMULATE_ROMFONT
14
+#define DISPLAY_CHARSET_ISO10646_1
12 15
 
13 16
 #define WELCOME_MSG                         MACHINE_NAME " parada."
14 17
 #define MSG_SD_INSERTED                     "Tarcheta colocada"

+ 4
- 1
Marlin/language_ca.h ファイルの表示

@@ -2,7 +2,7 @@
2 2
  * Catalan
3 3
  *
4 4
  * LCD Menu Messages
5
- * Please note these are limited to 17 characters!
5
+ * Se also documentation/LCDLanguageFont.md
6 6
  *
7 7
  */
8 8
 #ifndef LANGUAGE_CA_H
@@ -10,6 +10,9 @@
10 10
 
11 11
 //#define MAPPER_NON 
12 12
 #define MAPPER_C2C3  // because of "ó"
13
+// Define SIMULATE_ROMFONT to see what is seen on the character based display defined in Configuration.h
14
+//#define SIMULATE_ROMFONT
15
+#define DISPLAY_CHARSET_ISO10646_1
13 16
 
14 17
 #define WELCOME_MSG                         MACHINE_NAME " preparada."
15 18
 #define MSG_SD_INSERTED                     "SD detectada."

+ 4
- 1
Marlin/language_de.h ファイルの表示

@@ -2,13 +2,16 @@
2 2
  * German
3 3
  *
4 4
  * LCD Menu Messages
5
- * Please note these are limited to 17 characters!
5
+ * Se also documentation/LCDLanguageFont.md
6 6
  *
7 7
  */
8 8
 #ifndef LANGUAGE_DE_H
9 9
 #define LANGUAGE_DE_H
10 10
 
11 11
 #define MAPPER_C2C3
12
+// Define SIMULATE_ROMFONT to see what is seen on the character based display defined in Configuration.h
13
+//#define SIMULATE_ROMFONT
14
+#define DISPLAY_CHARSET_ISO10646_1
12 15
 
13 16
 #define WELCOME_MSG                         MACHINE_NAME " Bereit."
14 17
 #define MSG_SD_INSERTED                     "SDKarte erkannt."

+ 8
- 2
Marlin/language_en.h ファイルの表示

@@ -2,16 +2,22 @@
2 2
  * English
3 3
  *
4 4
  * LCD Menu Messages
5
- * Please note these are limited to 17 characters!
5
+ * Se also documentation/LCDLanguageFont.md
6 6
  *
7 7
  */
8 8
 #ifndef LANGUAGE_EN_H
9 9
 #define LANGUAGE_EN_H
10 10
 
11
-#if !(defined(MAPPER_NON) || defined(MAPPER_C2C3) || defined(MAPPER_D0D1_MOD) || defined(MAPPER_E382E383))
11
+#if !( defined(MAPPER_NON)|| defined(MAPPER_C2C3)|| defined(MAPPER_D0D1)|| defined(MAPPER_D0D1_MOD)|| defined(MAPPER_E382E383) )
12 12
   #define MAPPER_NON         // For direct asci codes
13 13
 #endif
14 14
 
15
+//#define SIMULATE_ROMFONT //Comment in to see what is seen on the character based displays
16
+#if !( defined(SIMULATE_ROMFONT)|| defined(DISPLAY_CHARSET_ISO10646_1)|| defined(DISPLAY_CHARSET_ISO10646_5)|| defined(DISPLAY_CHARSET_ISO10646_KANA)|| defined(DISPLAY_CHARSET_KANJI) )
17
+  #define DISPLAY_CHARSET_ISO10646_1 // use the better font on full graphic displays.
18
+#endif
19
+
20
+
15 21
 #ifndef WELCOME_MSG
16 22
 #define WELCOME_MSG                         MACHINE_NAME " ready."
17 23
 #endif

+ 4
- 1
Marlin/language_es.h ファイルの表示

@@ -2,13 +2,16 @@
2 2
  * Spanish
3 3
  *
4 4
  * LCD Menu Messages
5
- * Please note these are limited to 17 characters!
5
+ * Se also documentation/LCDLanguageFont.md
6 6
  *
7 7
  */
8 8
 #ifndef LANGUAGE_ES_H
9 9
 #define LANGUAGE_ES_H
10 10
 
11 11
 #define MAPPER_NON
12
+// Define SIMULATE_ROMFONT to see what is seen on the character based display defined in Configuration.h
13
+//#define SIMULATE_ROMFONT
14
+#define DISPLAY_CHARSET_ISO10646_1
12 15
 
13 16
 #define WELCOME_MSG                         MACHINE_NAME " lista."
14 17
 #define MSG_SD_INSERTED                     "Tarjeta colocada"

+ 4
- 1
Marlin/language_eu.h ファイルの表示

@@ -2,13 +2,16 @@
2 2
  * Basque-Euskera
3 3
  *
4 4
  * LCD Menu Messages
5
- * Please note these are limited to 17 characters!
5
+ * Se also documentation/LCDLanguageFont.md
6 6
  *
7 7
  */
8 8
 #ifndef LANGUAGE_EU_H
9 9
 #define LANGUAGE_EU_H
10 10
 
11 11
 #define MAPPER_NON
12
+// Define SIMULATE_ROMFONT to see what is seen on the character based display defined in Configuration.h
13
+//#define SIMULATE_ROMFONT
14
+#define DISPLAY_CHARSET_ISO10646_1
12 15
 
13 16
 #define WELCOME_MSG                         MACHINE_NAME " prest."
14 17
 #define MSG_SD_INSERTED                     "Txartela sartuta"

+ 4
- 1
Marlin/language_fi.h ファイルの表示

@@ -2,13 +2,16 @@
2 2
  * Finnish
3 3
  *
4 4
  * LCD Menu Messages
5
- * Please note these are limited to 17 characters!
5
+ * Se also documentation/LCDLanguageFont.md
6 6
  *
7 7
  */
8 8
 #ifndef LANGUAGE_FI_H
9 9
 #define LANGUAGE_FI_H
10 10
 
11 11
 #define MAPPER_C2C3
12
+// Define SIMULATE_ROMFONT to see what is seen on the character based display defined in Configuration.h
13
+//#define SIMULATE_ROMFONT
14
+#define DISPLAY_CHARSET_ISO10646_1
12 15
 
13 16
 #define WELCOME_MSG                         MACHINE_NAME " valmis."
14 17
 #define MSG_SD_INSERTED                     "Kortti asetettu"

+ 5
- 1
Marlin/language_fr.h ファイルの表示

@@ -2,13 +2,17 @@
2 2
  * French
3 3
  *
4 4
  * LCD Menu Messages
5
- * Please note these are limited to 17 characters!
5
+ * Se also documentation/LCDLanguageFont.md
6 6
  *
7 7
  */
8 8
 #ifndef LANGUAGE_FR_H
9 9
 #define LANGUAGE_FR_H
10 10
 
11 11
 #define MAPPER_NON
12
+// Define SIMULATE_ROMFONT to see what is seen on the character based display defined in Configuration.h
13
+//#define SIMULATE_ROMFONT
14
+#define DISPLAY_CHARSET_ISO10646_1
15
+
12 16
 
13 17
 #define WELCOME_MSG                         MACHINE_NAME " prete."
14 18
 #define MSG_SD_INSERTED                     "Carte inseree"

+ 4
- 1
Marlin/language_it.h ファイルの表示

@@ -2,13 +2,16 @@
2 2
  * Italian
3 3
  *
4 4
  * LCD Menu Messages
5
- * Please note these are limited to 17 characters!
5
+ * Se also documentation/LCDLanguageFont.md
6 6
  *
7 7
  */
8 8
 #ifndef LANGUAGE_IT_H
9 9
 #define LANGUAGE_IT_H
10 10
 
11 11
 #define MAPPER_NON
12
+// Define SIMULATE_ROMFONT to see what is seen on the character based display defined in Configuration.h
13
+//#define SIMULATE_ROMFONT
14
+#define DISPLAY_CHARSET_ISO10646_1
12 15
 
13 16
 #define WELCOME_MSG                         MACHINE_NAME " pronto."
14 17
 #define MSG_SD_INSERTED                     "SD Card inserita"

+ 4
- 1
Marlin/language_kana.h ファイルの表示

@@ -2,7 +2,7 @@
2 2
  * Japanese (Kana)
3 3
  *
4 4
  * LCD Menu Messages
5
- * Please note these are limited to 17 characters!
5
+ * Se also documentation/LCDLanguageFont.md
6 6
  *
7 7
  */
8 8
  
@@ -10,6 +10,9 @@
10 10
 #define LANGUAGE_KANA_H
11 11
 
12 12
 #define MAPPER_NON
13
+// Define SIMULATE_ROMFONT to see what is seen on the character based display defined in Configuration.h
14
+#define SIMULATE_ROMFONT
15
+#define DISPLAY_CHARSET_ISO10646_KANA
13 16
 
14 17
 // 片仮名表示定義
15 18
 #define WELCOME_MSG                         MACHINE_NAME " ready."

+ 4
- 1
Marlin/language_kana_utf8.h ファイルの表示

@@ -2,7 +2,7 @@
2 2
  * Japanese (Kana UTF8 version)
3 3
  *
4 4
  * LCD Menu Messages
5
- * Please note these are limited to 17 characters!
5
+ * Se also documentation/LCDLanguageFont.md
6 6
  *
7 7
  */
8 8
  
@@ -10,6 +10,9 @@
10 10
 #define LANGUAGE_KANA_UTF_H
11 11
 
12 12
 #define MAPPER_E382E383
13
+// Define SIMULATE_ROMFONT to see what is seen on the character based display defined in Configuration.h
14
+//#define SIMULATE_ROMFONT
15
+#define DISPLAY_CHARSET_ISO10646_KANA
13 16
 
14 17
 // This is very crude replacement of the codes used in language_kana.h from somebody who really does not know what he is doing.
15 18
 // Just to show the potential benefit of unicode. 

+ 1
- 1
Marlin/language_kanji.h ファイルの表示

@@ -2,7 +2,7 @@
2 2
  * Japanese (Kanji)
3 3
  *
4 4
  * LCD Menu Messages
5
- * Please note these are limited to 17 characters!
5
+ * Se also documentation/LCDLanguageFont.md
6 6
  *
7 7
  */
8 8
 #include "Configuration.h" 

+ 4
- 1
Marlin/language_nl.h ファイルの表示

@@ -2,13 +2,16 @@
2 2
  * Dutch
3 3
  *
4 4
  * LCD Menu Messages
5
- * Please note these are limited to 17 characters!
5
+ * Se also documentation/LCDLanguageFont.md
6 6
  *
7 7
  */
8 8
 #ifndef LANGUAGE_NL_H
9 9
 #define LANGUAGE_NL_H
10 10
 
11 11
 #define MAPPER_NON
12
+// Define SIMULATE_ROMFONT to see what is seen on the character based display defined in Configuration.h
13
+//#define SIMULATE_ROMFONT
14
+#define DISPLAY_CHARSET_ISO10646_1
12 15
 
13 16
 #define WELCOME_MSG                         MACHINE_NAME " gereed."
14 17
 #define MSG_SD_INSERTED                     "Kaart ingestoken"

+ 4
- 1
Marlin/language_pl.h ファイルの表示

@@ -2,13 +2,16 @@
2 2
  * Polish
3 3
  *
4 4
  * LCD Menu Messages
5
- * Please note these are limited to 17 characters!
5
+ * Se also documentation/LCDLanguageFont.md
6 6
  *
7 7
  */
8 8
 #ifndef LANGUAGE_PL_H
9 9
 #define LANGUAGE_PL_H
10 10
 
11 11
 #define MAPPER_NON
12
+// Define SIMULATE_ROMFONT to see what is seen on the character based display defined in Configuration.h
13
+//#define SIMULATE_ROMFONT
14
+#define DISPLAY_CHARSET_ISO10646_1
12 15
 
13 16
 #define WELCOME_MSG                         MACHINE_NAME " gotowy."
14 17
 #define MSG_SD_INSERTED                     "Karta wlozona"

+ 4
- 1
Marlin/language_pt-br.h ファイルの表示

@@ -2,13 +2,16 @@
2 2
  * Portuguese (Brazil)
3 3
  *
4 4
  * LCD Menu Messages
5
- * Please note these are limited to 17 characters!
5
+ * Se also documentation/LCDLanguageFont.md
6 6
  *
7 7
  */
8 8
 #ifndef LANGUAGE_PT_BR_H
9 9
 #define LANGUAGE_PT_BR_H
10 10
 
11 11
 #define MAPPER_NON
12
+// Define SIMULATE_ROMFONT to see what is seen on the character based display defined in Configuration.h
13
+//#define SIMULATE_ROMFONT
14
+#define DISPLAY_CHARSET_ISO10646_1
12 15
 
13 16
 #define WELCOME_MSG							MACHINE_NAME " pronto."
14 17
 #define MSG_SD_INSERTED                     "Cartao inserido"

+ 4
- 1
Marlin/language_pt.h ファイルの表示

@@ -2,13 +2,16 @@
2 2
  * Portuguese
3 3
  *
4 4
  * LCD Menu Messages
5
- * Please note these are limited to 17 characters!
5
+ * Se also documentation/LCDLanguageFont.md
6 6
  *
7 7
  */
8 8
 #ifndef LANGUAGE_PT_H
9 9
 #define LANGUAGE_PT_H
10 10
 
11 11
 #define MAPPER_NON
12
+// Define SIMULATE_ROMFONT to see what is seen on the character based display defined in Configuration.h
13
+//#define SIMULATE_ROMFONT
14
+#define DISPLAY_CHARSET_ISO10646_1
12 15
 
13 16
 #define WELCOME_MSG                         MACHINE_NAME " pronto."
14 17
 #define MSG_SD_INSERTED                     "Cartao inserido"

+ 5
- 2
Marlin/language_ru.h ファイルの表示

@@ -2,13 +2,16 @@
2 2
  * Russian
3 3
  *
4 4
  * LCD Menu Messages
5
- * Please note these are limited to 17 characters!
5
+ * Se also documentation/LCDLanguageFont.md
6 6
  *
7 7
  */
8 8
 #ifndef LANGUAGE_RU_H
9 9
 #define LANGUAGE_RU_H
10 10
 
11
-#define MAPPER_D0D1        // For Cyrillic
11
+#define MAPPER_D0D1                // For Cyrillic
12
+// Define SIMULATE_ROMFONT to see what is seen on the character based display defined in Configuration.h
13
+//#define SIMULATE_ROMFONT
14
+#define DISPLAY_CHARSET_ISO10646_5
12 15
 
13 16
 #define WELCOME_MSG                         MACHINE_NAME " Готов."
14 17
 #define MSG_SD_INSERTED                     "Карта вставлена"

+ 17
- 9
Marlin/language_test.h ファイルの表示

@@ -2,7 +2,7 @@
2 2
  * TEST
3 3
  *
4 4
  * LCD Menu Messages
5
- * Please note these are limited to 17 characters!
5
+ * Se also documentation/LCDLanguageFont.md
6 6
  *
7 7
  */
8 8
 #ifndef LANGUAGE_TEST_H
@@ -10,12 +10,12 @@
10 10
 
11 11
 // Select ONE of the following Mappers. 
12 12
 // They decide what to do with a symbol in the area of [0x80:0xFF]. They take a symbol of this language file and make them point 
13
-// into an array with 128 cells, where they find the place of the symbol in the font in use.
13
+// into an array with 128 cells, where they'll find the place of the symbol of the font in use.
14 14
 //
15 15
 // a.)For ASCII coded Language_xx.h files like (en) there are no occurrences of symbols above 0x7F so no mapper is needed. 
16
-//   If such a symbol appers it is mapped directly into the font. This is the case for the language files we used until now, with all the STR_XX or
16
+//   If such a symbol appears it is mapped directly into the font. This is the case for the language files we used until now, with all the STR_XX or
17 17
 //   "\xxx" symbols. All Symbols are only one byte long.
18
-// b.) For Unicoded Language_xx.h files (currently ru and de) the non ASCII [0x00-0x7F] symbols are represented by more then one byte.
18
+// b.) For Unicoded Language_xx.h files (currently ru, de and kana_utf8 ) the non ASCII [0x00-0x7F] symbols are represented by more then one byte.
19 19
 //   In the case of two bytes the first is pointing to a 'codepage' and the second to a place in the codepage. These codepages contain 64 symbols.
20 20
 //   So two of them can be mapped. For most of the European languages the necessary symbols are contained in the pages C2 and C3. Cyrillic uses D0 
21 21
 //   and D1.
@@ -25,14 +25,22 @@
25 25
 //   impossible to have a close to direct mapping but will need giant conversion tables and fonts (we don't want to have in a embedded system).
26 26
 // d.) So for Kanji we use a very special and selected subset of symbols and the direct mapping like in a).
27 27
 
28
-#define MAPPER_NON         // For direct asci codes ( until now all languages except ru, de, ... )
28
+#define MAPPER_NON         // For direct asci codes ( until now all languages except ru, de, fi, kana_utf8, ... )
29 29
 //#define MAPPER_C2C3        // For most European languages when language file is in utf8
30 30
 //#define MAPPER_D0D1        // For Cyrillic
31
-////#define MAPPER_D0D1_MOD    // For Cyrillic on HD44780_CYRILIC (will save 32 byte in the mapper but adds some more decisions)
32 31
 //#define MAPPER_E382E383    // For Katakana
33 32
 
33
+// Define SIMULATE_ROMFONT to see what is seen on the character based display defined in Configuration.h
34
+//#define SIMULATE_ROMFONT
34 35
 
35
-// next 4 lines select variants in this file only
36
+// Select the better font for full graphic displays.
37
+//#define DISPLAY_CHARSET_ISO10646_1
38
+//#define DISPLAY_CHARSET_ISO10646_5
39
+//#define DISPLAY_CHARSET_ISO10646_KANA
40
+//#define DISPLAY_CHARSET_KANJI
41
+
42
+
43
+// next 5 lines select variants in this file only
36 44
 #define DISPLAYTEST
37 45
 //#define WEST
38 46
 //#define CYRIL
@@ -96,8 +104,8 @@
96 104
   #define WELCOME_MSG                         "Language TEST"
97 105
 
98 106
   #define MSG_WATCH                           "Display test"
99
-  #define MSG_PREPARE                         STRG_OKTAL_c
100
-  #define MSG_CONTROL                         STRG_OKTAL_d
107
+  #define MSG_PREPARE                         STRG_OKTAL_b
108
+  #define MSG_CONTROL                         STRG_OKTAL_c
101 109
 #endif
102 110
 
103 111
 #ifdef WEST

バイナリ
Marlin/scripts/Fonts/bdf2u8g.exe ファイルの表示


+ 22
- 26
Marlin/utf_mapper.h ファイルの表示

@@ -9,14 +9,18 @@
9 9
   #define HARDWAERE_CHAR_OUT lcd.write
10 10
 #endif
11 11
 
12
-#if !(defined( DISPLAY_CHARSET_HD44780_JAPAN ) || defined( DISPLAY_CHARSET_HD44780_WESTERN ) || defined( DISPLAY_CHARSET_HD44780_CYRILIC ))
13
-  #define DISPLAY_CHARSET_HD44780_JAPAN
14
-#endif
15
-
16
-#ifndef DOGLCD
17
-  #ifdef DISPLAY_CHARSET_KANJI
18
-    #error("Kanji does not work on character based displays!");
19
-  #elif defined( DISPLAY_CHARSET_HD44780_JAPAN )
12
+#ifndef SIMULATE_ROMFONT
13
+  #if defined( DISPLAY_CHARSET_ISO10646_1 ) && defined( DOGLCD )
14
+    #define MAPPER_ONE_TO_ONE
15
+  #elif defined( DISPLAY_CHARSET_ISO10646_5 ) && defined( DOGLCD )
16
+    #define MAPPER_ONE_TO_ONE
17
+  #elif defined( DISPLAY_CHARSET_ISO10646_KANA ) && defined( DOGLCD )
18
+    #define MAPPER_ONE_TO_ONE
19
+  #elif defined( DISPLAY_CHARSET_KANJI ) && defined( DOGLCD )
20
+    #define MAPPER_NON
21
+  #endif
22
+#else // SIMULATE_ROMFONT
23
+  #if defined( DISPLAY_CHARSET_HD44780_JAPAN )
20 24
     #if defined( MAPPER_C2C3 )
21 25
       const PROGMEM uint8_t utf_recode[] =
22 26
            { // 0    1    2    3    4    5    6    7    8    9    a    b    c    d    e    f          This is fair for symbols
@@ -27,11 +31,11 @@
27 31
              0x3f,0x3f,0x3f,0x3f,0xe1,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,  // c38
28 32
   //                              ä
29 33
              0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0xef,0x78,0x3f,0x3f,0x3f,0x3f,0xf5,0x3f,0x3f,0xe2,  // c39 missing characters display as '?'
30
-  //                                        ö     x                       ü              ä
34
+  //                                        ö     x                       ü              ß
31 35
              0x3f,0x3f,0x3f,0x3f,0xe1,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,  // c3a
32 36
   //                              ä
33
-             0x3f,0xee,0x3f,0x3f,0x3f,0x3f,0xef,0xed,0x3f,0x3f,0x3f,0x3f,0xf5,0x3f,0x3f,0x3f   // c3b
34
-  //               n                        ö                             ü
37
+             0x3f,0xee,0x3f,0x3f,0x3f,0x3f,0xef,0xfd,0x3f,0x3f,0x3f,0x3f,0xf5,0x3f,0x3f,0x3f   // c3b
38
+  //               n                        ö    ÷                        ü
35 39
            };
36 40
     #elif defined( MAPPER_E382E383 )
37 41
       const PROGMEM uint8_t utf_recode[] =
@@ -115,14 +119,8 @@
115 119
     #elif defined( MAPPER_E382E383 )
116 120
       #error( "Katakana on a cyrillic display makes no sense. There are no matching symbols." );
117 121
     #endif
118
-  #endif
119
-#else //DOGLCD
120
-  #if defined( DISPLAY_CHARSET_KANJI )
121
-    #define MAPPER_NON
122
-  #else
123
-    #define MAPPER_ONE_TO_ONE
124
-  #endif
125
-#endif //DOGLCD
122
+  #endif // DISPLAY_CHARSET_HD44780_CYRILIC
123
+#endif // SIMULATE_ROMFONT
126 124
 
127 125
 #if defined( MAPPER_NON )
128 126
   char charset_mapper(char c){
@@ -193,20 +191,18 @@
193 191
   uint8_t utf_hi_char; // UTF-8 high part
194 192
   bool seen_d5 = false;
195 193
   char charset_mapper(char c){
196
-    // it is a Russian alphabet translation
197
-    // except 0401 --> 0xa2 = Ё, 0451 --> 0xb5 = ё
198 194
     uint8_t d = c;
199
-    if ( d >= 0x80 ) { // UTF-8 handling
200
-      if ((d >= 0xd0) && (!seen_d5)) {
201
-        utf_hi_char = d - 0xd0;
195
+    if ( d >= 0x80u ) { // UTF-8 handling
196
+      if ((d >= 0xd0u) && (!seen_d5)) {
197
+        utf_hi_char = d - 0xd0u;
202 198
         seen_d5 = true;
203 199
         return 0;
204 200
       } else if (seen_d5) {
205
-          d &= 0x3f;
201
+          d &= 0x3fu;
206 202
         #ifndef MAPPER_ONE_TO_ONE
207 203
           HARDWAERE_CHAR_OUT( (char) pgm_read_byte_near( utf_recode + d + ( utf_hi_char << 6 ) - 0x20)       );
208 204
         #else
209
-          HARDWAERE_CHAR_OUT( (char) (0x80 + ( utf_hi_char << 6 ) + d) ) ;
205
+          HARDWAERE_CHAR_OUT( (char) (0xa0u + ( utf_hi_char << 6 ) + d) ) ;
210 206
         #endif
211 207
       } else {
212 208
         HARDWAERE_CHAR_OUT('?');

読み込み中…
キャンセル
保存