Add UTF-8 mapper for Slovak language

Based on #7862, #7846 by @rmoravcik
This commit is contained in:
Scott Lahteine 2017-10-06 14:51:39 -05:00
parent c81843a414
commit c0382cd8cd
5 changed files with 298 additions and 51 deletions

View File

@ -0,0 +1,151 @@
/*
Fontname: ISO10646_SK
Copyright: A. Hardtung, modified by Roman Moravcik
Capital A Height: 7, '1' Height: 7
Calculated Max Values w= 6 h= 9 x= 2 y= 7 dx= 6 dy= 0 ascent= 8 len= 9
Font Bounding box w= 6 h= 9 x= 0 y=-2
Calculated Min Values x= 0 y=-1 dx= 0 dy= 0
Pure Font ascent = 7 descent=-1
X Font ascent = 7 descent=-1
Max Font ascent = 8 descent=-1
*/
#include <U8glib.h>
const u8g_fntpgm_uint8_t ISO10646_SK[2203] U8G_SECTION(".progmem.ISO10646_SK") = {
0,6,9,0,254,7,1,146,3,33,32,255,255,8,255,7,
255,0,0,0,6,0,0,1,7,7,6,2,0,128,128,128,
128,128,0,128,3,2,2,6,1,5,160,160,5,7,7,6,
0,0,80,80,248,80,248,80,80,5,7,7,6,0,0,32,
120,160,112,40,240,32,5,7,7,6,0,0,192,200,16,32,
64,152,24,5,7,7,6,0,0,96,144,160,64,168,144,104,
2,3,3,6,1,4,192,64,128,3,7,7,6,1,0,32,
64,128,128,128,64,32,3,7,7,6,1,0,128,64,32,32,
32,64,128,5,5,5,6,0,1,32,168,112,168,32,5,5,
5,6,0,1,32,32,248,32,32,2,3,3,6,2,255,192,
64,128,5,1,1,6,0,3,248,2,2,2,6,2,0,192,
192,5,5,5,6,0,1,8,16,32,64,128,5,7,7,6,
0,0,112,136,136,136,136,136,112,3,7,7,6,1,0,64,
192,64,64,64,64,224,5,7,7,6,0,0,112,136,8,112,
128,128,248,5,7,7,6,0,0,248,16,32,16,8,8,240,
5,7,7,6,0,0,16,48,80,144,248,16,16,5,7,7,
6,0,0,248,128,240,8,8,136,112,5,7,7,6,0,0,
112,128,128,240,136,136,112,5,7,7,6,0,0,248,8,16,
32,32,32,32,5,7,7,6,0,0,112,136,136,112,136,136,
112,5,7,7,6,0,0,112,136,136,120,8,8,112,2,5,
5,6,2,0,192,192,0,192,192,2,6,6,6,2,255,192,
192,0,192,64,128,4,7,7,6,0,0,16,32,64,128,64,
32,16,5,3,3,6,0,2,248,0,248,4,7,7,6,1,
0,128,64,32,16,32,64,128,5,7,7,6,0,0,112,136,
8,16,32,0,32,5,7,7,6,0,0,112,136,8,104,168,
168,112,5,7,7,6,0,0,112,136,136,248,136,136,136,5,
7,7,6,0,0,240,136,136,240,136,136,240,5,7,7,6,
0,0,112,136,128,128,128,136,112,5,7,7,6,0,0,240,
136,136,136,136,136,240,5,7,7,6,0,0,248,128,128,240,
128,128,248,5,7,7,6,0,0,248,128,128,240,128,128,128,
5,7,7,6,0,0,112,136,128,184,136,136,112,5,7,7,
6,0,0,136,136,136,248,136,136,136,1,7,7,6,2,0,
128,128,128,128,128,128,128,5,7,7,6,0,0,56,16,16,
16,16,144,96,5,7,7,6,0,0,136,144,160,192,160,144,
136,5,7,7,6,0,0,128,128,128,128,128,128,248,5,7,
7,6,0,0,136,216,168,136,136,136,136,5,7,7,6,0,
0,136,136,200,168,152,136,136,5,7,7,6,0,0,112,136,
136,136,136,136,112,5,7,7,6,0,0,240,136,136,240,128,
128,128,5,7,7,6,0,0,112,136,136,136,168,144,104,5,
7,7,6,0,0,240,136,136,240,160,144,136,5,7,7,6,
0,0,120,128,128,112,8,8,240,5,7,7,6,0,0,248,
32,32,32,32,32,32,5,7,7,6,0,0,136,136,136,136,
136,136,112,5,7,7,6,0,0,136,136,136,136,136,80,32,
5,7,7,6,0,0,136,136,136,136,136,168,80,5,7,7,
6,0,0,136,136,80,32,80,136,136,5,7,7,6,0,0,
136,136,136,80,32,32,32,5,7,7,6,0,0,248,8,16,
32,64,128,248,3,7,7,6,1,0,224,128,128,128,128,128,
224,5,5,5,6,0,1,128,64,32,16,8,3,7,7,6,
1,0,224,32,32,32,32,32,224,5,3,3,6,0,4,32,
80,136,5,1,1,6,0,0,248,2,2,2,6,2,5,128,
64,5,5,5,6,0,0,112,8,120,136,120,5,7,7,6,
0,0,128,128,176,200,136,136,240,5,5,5,6,0,0,112,
128,128,136,112,5,7,7,6,0,0,8,8,104,152,136,136,
120,5,5,5,6,0,0,112,136,248,128,112,5,7,7,6,
0,0,48,72,224,64,64,64,64,5,6,6,6,0,255,112,
136,136,120,8,112,5,7,7,6,0,0,128,128,176,200,136,
136,136,1,7,7,6,2,0,128,0,128,128,128,128,128,3,
8,8,6,1,255,32,0,32,32,32,32,160,64,4,7,7,
6,0,0,128,128,144,160,192,160,144,3,7,7,6,1,0,
192,64,64,64,64,64,224,5,5,5,6,0,0,208,168,168,
168,168,5,5,5,6,0,0,176,200,136,136,136,5,5,5,
6,0,0,112,136,136,136,112,5,6,6,6,0,255,240,136,
136,240,128,128,5,6,6,6,0,255,120,136,136,120,8,8,
5,5,5,6,0,0,176,200,128,128,128,5,5,5,6,0,
0,112,128,112,8,240,4,7,7,6,0,0,64,64,224,64,
64,64,48,5,5,5,6,0,0,136,136,136,152,104,5,5,
5,6,0,0,136,136,136,80,32,5,5,5,6,0,0,136,
136,168,168,80,5,5,5,6,0,0,136,80,32,80,136,5,
6,6,6,0,255,136,136,136,120,8,112,5,5,5,6,0,
0,248,16,32,64,248,3,7,7,6,1,0,32,64,64,128,
64,64,32,1,7,7,6,2,0,128,128,128,128,128,128,128,
3,7,7,6,1,0,128,64,64,32,64,64,128,5,2,2,
6,0,2,104,144,0,0,0,6,0,0,5,8,8,6,0,
0,16,32,112,136,136,248,136,136,5,8,8,6,0,0,80,
0,112,136,136,248,136,136,5,8,8,6,0,0,8,16,248,
128,128,240,128,248,3,8,8,6,1,0,32,64,224,64,64,
64,64,224,5,8,8,6,0,0,16,32,112,136,136,136,136,
112,5,8,8,6,0,0,32,80,112,136,136,136,136,112,5,
8,8,6,0,0,16,32,136,136,136,136,136,112,5,8,8,
6,0,0,16,32,136,136,80,32,32,32,5,8,8,6,0,
0,16,32,0,112,8,120,136,120,5,7,7,6,0,0,80,
0,112,8,120,136,120,5,8,8,6,0,0,16,32,0,112,
136,248,128,112,2,8,8,6,2,0,64,128,0,128,128,128,
128,128,5,8,8,6,0,0,16,32,0,112,136,136,136,112,
5,8,8,6,0,0,32,80,0,112,136,136,136,112,5,8,
8,6,0,0,16,32,0,136,136,136,152,104,5,9,9,6,
0,255,16,32,0,136,136,136,120,8,112,5,8,8,6,0,
0,80,32,112,136,128,128,136,112,5,8,8,6,0,0,80,
32,0,112,128,128,136,112,5,8,8,6,0,0,80,32,240,
136,136,136,136,240,6,8,8,6,0,0,4,20,24,112,144,
144,144,112,5,8,8,6,0,0,16,32,128,128,128,128,128,
248,3,8,8,6,1,0,32,64,0,192,64,64,64,224,5,
8,8,6,0,0,16,144,160,128,128,128,128,248,5,8,8,
6,1,0,8,200,80,64,64,64,64,224,5,8,8,6,0,
0,80,32,136,200,168,152,136,136,5,8,8,6,0,0,80,
32,0,176,200,136,136,136,5,8,8,6,0,0,16,32,240,
136,240,160,144,136,5,8,8,6,0,0,16,32,0,176,200,
128,128,128,5,8,8,6,0,0,80,32,120,128,128,112,8,
240,5,8,8,6,0,0,80,32,0,112,128,112,8,240,5,
8,8,6,0,0,80,32,248,32,32,32,32,32,6,8,8,
6,0,0,4,68,72,224,64,64,64,48,5,8,8,6,0,
0,80,32,248,8,48,64,128,248,5,8,8,6,0,0,80,
32,0,248,16,32,64,248,0,0,0,6,0,0,0,0,0,
6,0,0,0,0,0,6,0,0,0,0,0,6,0,0,0,
0,0,6,0,0,0,0,0,6,0,0,0,0,0,6,0,
0,0,0,0,6,0,0,0,0,0,6,0,0,0,0,0,
6,0,0,0,0,0,6,0,0,0,0,0,6,0,0,0,
0,0,6,0,0,0,0,0,6,0,0,0,0,0,6,0,
0,0,0,0,6,0,0,0,0,0,6,0,0,0,0,0,
6,0,0,0,0,0,6,0,0,0,0,0,6,0,0,0,
0,0,6,0,0,0,0,0,6,0,0,0,0,0,6,0,
0,0,0,0,6,0,0,0,0,0,6,0,0,0,0,0,
6,0,0,0,0,0,6,0,0,0,0,0,6,0,0,0,
0,0,6,0,0,0,0,0,6,0,0,0,0,0,6,0,
0,0,0,0,6,0,0,0,0,0,6,0,0,0,0,0,
6,0,0,0,0,0,6,0,0,0,0,0,6,0,0,0,
0,0,6,0,0,0,0,0,6,0,0,0,0,0,6,0,
0,0,0,0,6,0,0,0,0,0,6,0,0,0,0,0,
6,0,0,0,0,0,6,0,0,0,0,0,6,0,0,0,
0,0,6,0,0,0,0,0,6,0,0,0,0,0,6,0,
0,0,0,0,6,0,0,0,0,0,6,0,0,0,0,0,
6,0,0,0,0,0,6,0,0,0,0,0,6,0,0,0,
0,0,6,0,0,0,0,0,6,0,0,0,0,0,6,0,
0,0,0,0,6,0,0,0,0,0,6,0,0,0,0,0,
6,0,0,0,0,0,6,0,0,0,0,0,6,0,0,0,
0,0,6,0,0,0,0,0,6,0,0,0,0,0,6,0,
0,0,0,0,6,0,0,0,0,0,6,0,0,0,0,0,
6,0,0,0,0,0,6,0,0,0,0,0,6,0,0,0,
0,0,6,0,0,0,0,0,6,0,0,0,0,0,6,0,
0,0,0,0,6,0,0,0,0,0,6,0,0,0,0,0,
6,0,0,0,0,0,6,0,0,0,0,0,6,0,0,0,
0,0,6,0,0,0,0,0,6,0,0,0,0,0,6,0,
0,0,0,0,6,0,0,0,0,0,6,0,0,0,0,0,
6,0,0,0,0,0,6,0,0,0,0,0,6,0,0,0,
0,0,6,0,0,0,0,0,6,0,0,0,0,0,6,0,
0,0,0,0,6,0,0,0,0,0,6,0,0,0,0,0,
6,0,0,0,0,0,6,0,0,0,0,0,6,0,0,0,
0,0,6,0,0,0,0,0,6,0,0};

View File

@ -34,12 +34,8 @@
#ifndef LANGUAGE_SK_UTF_H #ifndef LANGUAGE_SK_UTF_H
#define LANGUAGE_SK_UTF_H #define LANGUAGE_SK_UTF_H
#define MAPPER_NON #define MAPPER_C3C4C5_SK
#define DISPLAY_CHARSET_ISO10646_1 #define DISPLAY_CHARSET_ISO10646_SK
// TBD
//#define MAPPER_C3C4C5_SK
//#define DISPLAY_CHARSET_ISO10646_SK
#define WELCOME_MSG MACHINE_NAME _UxGT(" pripravená.") #define WELCOME_MSG MACHINE_NAME _UxGT(" pripravená.")
#define MSG_BACK _UxGT("Naspať") #define MSG_BACK _UxGT("Naspať")

View File

@ -38,6 +38,10 @@
#include "../inc/MarlinConfig.h" #include "../inc/MarlinConfig.h"
/**
* Implementation of the LCD display routines for a DOGM128 graphic display.
* These are common LCD 128x64 pixel graphic displays.
*/
#include "ultralcd.h" #include "ultralcd.h"
#if ENABLED(U8GLIB_ST7565_64128N) #if ENABLED(U8GLIB_ST7565_64128N)
@ -104,6 +108,9 @@
#elif ENABLED(DISPLAY_CHARSET_ISO10646_CZ) #elif ENABLED(DISPLAY_CHARSET_ISO10646_CZ)
#include "dogm/dogm_font_data_ISO10646_CZ.h" #include "dogm/dogm_font_data_ISO10646_CZ.h"
#define FONT_MENU_NAME ISO10646_CZ #define FONT_MENU_NAME ISO10646_CZ
#elif ENABLED(DISPLAY_CHARSET_ISO10646_SK)
#include "dogm/dogm_font_data_ISO10646_SK.h"
#define FONT_MENU_NAME ISO10646_SK
#else // fall-back #else // fall-back
#include "dogm/dogm_font_data_ISO10646_1.h" #include "dogm/dogm_font_data_ISO10646_1.h"
#define FONT_MENU_NAME ISO10646_1_5x7 #define FONT_MENU_NAME ISO10646_1_5x7

View File

@ -26,9 +26,9 @@
#include "../inc/MarlinConfig.h" #include "../inc/MarlinConfig.h"
#if ENABLED(DOGLCD) #if ENABLED(DOGLCD)
#define HARDWARE_CHAR_OUT u8g.print #define HARDWARE_CHAR_OUT(C) u8g.print((char)(C))
#else #else
#define HARDWARE_CHAR_OUT lcd.write #define HARDWARE_CHAR_OUT(C) lcd.write((char)(C))
#endif #endif
#if DISABLED(SIMULATE_ROMFONT) && ENABLED(DOGLCD) #if DISABLED(SIMULATE_ROMFONT) && ENABLED(DOGLCD)
@ -161,9 +161,9 @@
else if (seen_c2) { else if (seen_c2) {
d &= 0x3Fu; d &= 0x3Fu;
#ifndef MAPPER_ONE_TO_ONE #ifndef MAPPER_ONE_TO_ONE
HARDWARE_CHAR_OUT((char)pgm_read_byte_near(utf_recode + d + (utf_hi_char << 6) - 0x20)); HARDWARE_CHAR_OUT(pgm_read_byte_near(utf_recode + d + (utf_hi_char << 6) - 0x20));
#else #else
HARDWARE_CHAR_OUT((char)(0x80u + (utf_hi_char << 6) + d)) ; HARDWARE_CHAR_OUT(0x80u + (utf_hi_char << 6) + d);
#endif #endif
} }
else { else {
@ -171,7 +171,7 @@
} }
} }
else { else {
HARDWARE_CHAR_OUT((char) c ); HARDWARE_CHAR_OUT(c);
} }
seen_c2 = false; seen_c2 = false;
return 1; return 1;
@ -203,7 +203,7 @@
case 0xB1u: d = 0xFDu; break; case 0xB1u: d = 0xFDu; break;
default: d = '?'; default: d = '?';
} }
HARDWARE_CHAR_OUT((char)d) ; HARDWARE_CHAR_OUT(d);
} }
else if (seen_c5) { else if (seen_c5) {
switch(d) { switch(d) {
@ -211,14 +211,14 @@
case 0x9Fu: d = 0xFEu; break; case 0x9Fu: d = 0xFEu; break;
default: d = '?'; default: d = '?';
} }
HARDWARE_CHAR_OUT((char)d) ; HARDWARE_CHAR_OUT(d);
} }
else if (seen_c2) { else if (seen_c2) {
d &= 0x3Fu; d &= 0x3Fu;
#ifndef MAPPER_ONE_TO_ONE #ifndef MAPPER_ONE_TO_ONE
HARDWARE_CHAR_OUT((char)pgm_read_byte_near(utf_recode + d + (utf_hi_char << 6) - 0x20)); HARDWARE_CHAR_OUT(pgm_read_byte_near(utf_recode + d + (utf_hi_char << 6) - 0x20));
#else #else
HARDWARE_CHAR_OUT((char)(0x80u + (utf_hi_char << 6) + d)) ; HARDWARE_CHAR_OUT(0x80u + (utf_hi_char << 6) + d);
#endif #endif
} }
else { else {
@ -226,7 +226,7 @@
} }
} }
else { else {
HARDWARE_CHAR_OUT((char) c ); HARDWARE_CHAR_OUT(c);
} }
seen_c2 = seen_c4 = seen_c5 = false; seen_c2 = seen_c4 = seen_c5 = false;
return 1; return 1;
@ -247,9 +247,9 @@
else if (seen_ce) { else if (seen_ce) {
d &= 0x3F; d &= 0x3F;
#ifndef MAPPER_ONE_TO_ONE #ifndef MAPPER_ONE_TO_ONE
HARDWARE_CHAR_OUT((char)pgm_read_byte_near(utf_recode + d + (utf_hi_char << 6) - 0x20)); HARDWARE_CHAR_OUT(pgm_read_byte_near(utf_recode + d + (utf_hi_char << 6) - 0x20));
#else #else
HARDWARE_CHAR_OUT((char)(0x80 + (utf_hi_char << 6) + d)) ; HARDWARE_CHAR_OUT(0x80 + (utf_hi_char << 6) + d);
#endif #endif
} }
else { else {
@ -257,7 +257,7 @@
} }
} }
else { else {
HARDWARE_CHAR_OUT((char)c); HARDWARE_CHAR_OUT(c);
} }
seen_ce = false; seen_ce = false;
return 1; return 1;
@ -278,9 +278,9 @@
else if (seen_ce) { else if (seen_ce) {
d &= 0x3F; d &= 0x3F;
#ifndef MAPPER_ONE_TO_ONE #ifndef MAPPER_ONE_TO_ONE
HARDWARE_CHAR_OUT((char)pgm_read_byte_near(utf_recode + d + (utf_hi_char << 6) - 0x20)); HARDWARE_CHAR_OUT(pgm_read_byte_near(utf_recode + d + (utf_hi_char << 6) - 0x20));
#else #else
HARDWARE_CHAR_OUT((char)(0x80 + (utf_hi_char << 6) + d)) ; HARDWARE_CHAR_OUT(0x80 + (utf_hi_char << 6) + d);
#endif #endif
} }
else { else {
@ -288,7 +288,7 @@
} }
} }
else { else {
HARDWARE_CHAR_OUT((char) c ); HARDWARE_CHAR_OUT(c);
} }
seen_ce = false; seen_ce = false;
return 1; return 1;
@ -311,13 +311,13 @@
else if (seen_d5) { else if (seen_d5) {
d &= 0x3F; d &= 0x3F;
if (!utf_hi_char && d == 1) { if (!utf_hi_char && d == 1) {
HARDWARE_CHAR_OUT((char) 0xA2); // Ё HARDWARE_CHAR_OUT(0xA2); // Ё
} }
else if (utf_hi_char == 1 && d == 0x11) { else if (utf_hi_char == 1 && d == 0x11) {
HARDWARE_CHAR_OUT((char)0xB5); // ё HARDWARE_CHAR_OUT(0xB5); // ё
} }
else { else {
HARDWARE_CHAR_OUT((char)pgm_read_byte_near(utf_recode + d + (utf_hi_char << 6) - 0x10)); HARDWARE_CHAR_OUT(pgm_read_byte_near(utf_recode + d + (utf_hi_char << 6) - 0x10));
} }
} }
else { else {
@ -325,7 +325,7 @@
} }
} }
else { else {
HARDWARE_CHAR_OUT((char) c ); HARDWARE_CHAR_OUT(c);
} }
seen_d5 = false; seen_d5 = false;
return 1; return 1;
@ -346,9 +346,9 @@
else if (seen_d5) { else if (seen_d5) {
d &= 0x3Fu; d &= 0x3Fu;
#ifndef MAPPER_ONE_TO_ONE #ifndef MAPPER_ONE_TO_ONE
HARDWARE_CHAR_OUT((char)pgm_read_byte_near(utf_recode + d + (utf_hi_char << 6) - 0x20)); HARDWARE_CHAR_OUT(pgm_read_byte_near(utf_recode + d + (utf_hi_char << 6) - 0x20));
#else #else
HARDWARE_CHAR_OUT((char)(0xA0u + (utf_hi_char << 6) + d)) ; HARDWARE_CHAR_OUT(0xA0u + (utf_hi_char << 6) + d);
#endif #endif
} }
else { else {
@ -356,7 +356,7 @@
} }
} }
else { else {
HARDWARE_CHAR_OUT((char) c ); HARDWARE_CHAR_OUT(c);
} }
seen_d5 = false; seen_d5 = false;
return 1; return 1;
@ -382,18 +382,17 @@
else if (seen_e3 && seen_82_83) { else if (seen_e3 && seen_82_83) {
d &= 0x3F; d &= 0x3F;
#ifndef MAPPER_ONE_TO_ONE #ifndef MAPPER_ONE_TO_ONE
HARDWARE_CHAR_OUT((char)pgm_read_byte_near(utf_recode + d + (utf_hi_char << 6) - 0x20)); HARDWARE_CHAR_OUT(pgm_read_byte_near(utf_recode + d + (utf_hi_char << 6) - 0x20));
#else #else
HARDWARE_CHAR_OUT((char)(0x80 + (utf_hi_char << 6) + d)) ; HARDWARE_CHAR_OUT(0x80 + (utf_hi_char << 6) + d);
#endif #endif
} }
else { else
HARDWARE_CHAR_OUT((char) '?' ); HARDWARE_CHAR_OUT('?');
}
}
else {
HARDWARE_CHAR_OUT((char) c );
} }
else
HARDWARE_CHAR_OUT(c);
seen_e3 = false; seen_e3 = false;
seen_82_83 = false; seen_82_83 = false;
return 1; return 1;
@ -437,7 +436,7 @@
case 0x98u ... 0x99u: d -= 20; break; //Ę i ę case 0x98u ... 0x99u: d -= 20; break; //Ę i ę
default: d = '?'; default: d = '?';
} }
HARDWARE_CHAR_OUT((char)d) ; HARDWARE_CHAR_OUT(d);
} }
else if (seen_c5) { else if (seen_c5) {
switch(d) { switch(d) {
@ -446,7 +445,7 @@
case 0xB9u ... 0xBCu: d -= 0x2Bu; break; //Ź - ż case 0xB9u ... 0xBCu: d -= 0x2Bu; break; //Ź - ż
default: d = '?'; default: d = '?';
} }
HARDWARE_CHAR_OUT((char)d) ; HARDWARE_CHAR_OUT(d);
} }
else if (seen_c3) { else if (seen_c3) {
switch(d) { switch(d) {
@ -454,13 +453,13 @@
case 0xB3u: d = 0x8Bu; break; //ó case 0xB3u: d = 0x8Bu; break; //ó
d = '?'; d = '?';
} }
HARDWARE_CHAR_OUT((char)d) ; HARDWARE_CHAR_OUT(d);
} }
} }
else { else
HARDWARE_CHAR_OUT((char) c ); HARDWARE_CHAR_OUT(c);
}
seen_c3 = seen_c4 = seen_c5 = false; seen_c3 = seen_c4 = seen_c5 = false;
return 1; return 1;
} }
@ -515,7 +514,7 @@
case 0x9Au ... 0x9Bu: d -= 10; break; // Ěě case 0x9Au ... 0x9Bu: d -= 10; break; // Ěě
default: d = '?'; default: d = '?';
} }
HARDWARE_CHAR_OUT((char)d) ; HARDWARE_CHAR_OUT(d);
} }
else if (seen_c5) { else if (seen_c5) {
switch(d) { switch(d) {
@ -527,7 +526,7 @@
case 0xBDu ... 0xBEu: d -= 0x21u; break; // Žž case 0xBDu ... 0xBEu: d -= 0x21u; break; // Žž
default: d = '?'; default: d = '?';
} }
HARDWARE_CHAR_OUT((char)d) ; HARDWARE_CHAR_OUT(d);
} }
else if (seen_c3) { else if (seen_c3) {
switch(d) { switch(d) {
@ -545,21 +544,115 @@
case 0xBDu: d = 0x8Bu; break; // ý case 0xBDu: d = 0x8Bu; break; // ý
default: d = '?'; default: d = '?';
} }
HARDWARE_CHAR_OUT((char)d) ; HARDWARE_CHAR_OUT(d);
} }
} }
else { else
HARDWARE_CHAR_OUT((char) c ); HARDWARE_CHAR_OUT(c);
}
seen_c3 = seen_c4 = seen_c5 = false; seen_c3 = seen_c4 = seen_c5 = false;
return 1; return 1;
} }
#elif ENABLED(MAPPER_C3C4C5_SK) #elif ENABLED(MAPPER_C3C4C5_SK)
// TBD /**
#error "No mapping for Slovak at this time. Use MAPPER_NON." * Á C3 81 = 80
* Ä C3 84 = 81
* É C3 89 = 82
* Í C3 8D = 83
* Ó C3 93 = 84
* Ô C3 94 = 85
* Ú C3 9A = 86
* Ý C3 9D = 87
* á C3 A1 = 88
* ä C3 A4 = 89
* é C3 A9 = 8A
* í C3 AD = 8B
* ó C3 B3 = 8C
* ô C3 B4 = 8D
* ú C3 BA = 8E
* ý C3 BD = 8F
* Č C4 8C = 90
* č C4 8D = 91
* Ď C4 8E = 92
* ď C4 8F = 93
* Ĺ C4 B9 = 94
* ĺ C4 BA = 95
* Ľ C4 BD = 96
* ľ C4 BE = 97
* Ň C5 87 = 98
* ň C5 88 = 99
* Ŕ C5 94 = 9A
* ŕ C5 95 = 9B
* Š C5 A0 = 9C
* š C5 A1 = 9D
* Ť C5 A4 = 9E
* ť C5 A5 = 9F
* Ž C5 BD = A0
* ž C5 BE = A1
*/
char charset_mapper(const char c) {
static bool seen_c3 = false,
seen_c4 = false,
seen_c5 = false;
uint8_t d = c;
if (d >= 0x80u) { // UTF-8 handling
if (d == 0xC4u) { seen_c4 = true; return 0; }
else if (d == 0xC5u) { seen_c5 = true; return 0; }
else if (d == 0xC3u) { seen_c3 = true; return 0; }
else if (seen_c4) {
switch(d) {
case 0x8Cu ... 0x8Fu: d += 0x04u; break; // ČčĎď
case 0xB9u ... 0xBAu: d -= 0x25u; break; // Ĺĺ
case 0xBDu ... 0xBEu: d -= 0x27u; break; // Ľľ
default: d = '?';
}
HARDWARE_CHAR_OUT(d);
}
else if (seen_c5) {
switch(d) {
case 0x87u ... 0x88u: d += 0x11u; break; // Ňň
case 0x94u ... 0x95u: d += 0x06u; break; // Ŕŕ
case 0xA0u ... 0xA1u: d -= 0x04u; break; // Šš
case 0xA4u ... 0xA5u: d -= 0x06u; break; // Ťť
case 0xBDu ... 0xBEu: d -= 0x1Du; break; // Žž
default: d = '?';
}
HARDWARE_CHAR_OUT(d);
}
else if (seen_c3) {
switch(d) {
case 0x81u: d = 0x80u; break; // Á
case 0x84u: d = 0x81u; break; // Ä
case 0x89u: d = 0x82u; break; // É
case 0x8Du: d = 0x83u; break; // Í
case 0x93u: d = 0x84u; break; // Ó
case 0x94u: d = 0x85u; break; // Ô
case 0x9Au: d = 0x86u; break; // Ú
case 0x9Du: d = 0x87u; break; // Ý
case 0xA1u: d = 0x88u; break; // á
case 0xA4u: d = 0x89u; break; // ä
case 0xA9u: d = 0x8Au; break; // é
case 0xADu: d = 0x8Bu; break; // í
case 0xB3u: d = 0x8Cu; break; // ó
case 0xB4u: d = 0x8Du; break; // ô
case 0xBAu: d = 0x8Eu; break; // ú
case 0xBDu: d = 0x8Fu; break; // ý
default: d = '?';
}
HARDWARE_CHAR_OUT(d);
}
}
else
HARDWARE_CHAR_OUT(c);
seen_c3 = seen_c4 = seen_c5 = false;
return 1;
}
#else #else

Binary file not shown.