ESC/P: it's actually ESC/P 2, fill international character sets

This commit is contained in:
Lili Kurek
2025-08-27 07:59:02 +00:00
committed by GitHub
parent e42ce145b1
commit 162697a412

View File

@@ -4,7 +4,7 @@
* using the ISA,EISA,VLB,MCA and PCI system buses, roughly
* spanning the era between 1981 and 1995.
*
* Implementation of the Generic ESC/P Dot-Matrix printer.
* Implementation of the Generic ESC/P 2 Dot-Matrix printer.
*
*
*
@@ -283,10 +283,9 @@ static const uint16_t codepages[15] = {
/* "patches" to the codepage for the international charsets
* these bytes patch the following 12 positions of the char table, in order:
* 0x23 0x24 0x40 0x5b 0x5c 0x5d 0x5e 0x60 0x7b 0x7c 0x7d 0x7e
* TODO: Implement the missing international charsets
*/
static const uint16_t intCharSets[15][12] = {
{0x0023, 0x0024, 0x0040, 0x005b, 0x005c, 0x005d, /* 0 USA */
{ 0x0023, 0x0024, 0x0040, 0x005b, 0x005c, 0x005d, /* 0 USA */
0x005e, 0x0060, 0x007b, 0x007c, 0x007d, 0x007e},
{ 0x0023, 0x0024, 0x00e0, 0x00ba, 0x00e7, 0x00a7, /* 1 France */
@@ -298,7 +297,7 @@ static const uint16_t intCharSets[15][12] = {
{ 0x00a3, 0x0024, 0x0040, 0x005b, 0x005c, 0x005d, /* 3 UK */
0x005e, 0x0060, 0x007b, 0x007c, 0x007d, 0x007e},
{ 0x0023, 0x0024, 0x0040, 0x00c6, 0x00d8, 0x00c5, /* 4 Denmark (1) */
{ 0x0023, 0x0024, 0x0040, 0x00c6, 0x00d8, 0x00c5, /* 4 Denmark I */
0x005e, 0x0060, 0x00e6, 0x00f8, 0x00e5, 0x007e},
{ 0x0023, 0x00a4, 0x00c9, 0x00c4, 0x00d6, 0x00c5, /* 5 Sweden */
@@ -307,28 +306,28 @@ static const uint16_t intCharSets[15][12] = {
{ 0x0023, 0x0024, 0x0040, 0x00ba, 0x005c, 0x00e9, /* 6 Italy */
0x005e, 0x00f9, 0x00e0, 0x00f2, 0x00e8, 0x00ec},
{ 0x0023, 0x0024, 0x0040, 0x005b, 0x005c, 0x005d, /* 7 Spain 1 */
0x005e, 0x0060, 0x007b, 0x007c, 0x007d, 0x007e}, /* TODO */
{ 0x20a7, 0x0024, 0x0040, 0x00a1, 0x00d1, 0x00bf, /* 7 Spain I */
0x005e, 0x0060, 0x00a8, 0x00f1, 0x007d, 0x007e},
{ 0x0023, 0x0024, 0x0040, 0x005b, 0x005c, 0x005d, /* 8 Japan (English) */
0x005e, 0x0060, 0x007b, 0x007c, 0x007d, 0x007e}, /* TODO */
{ 0x0023, 0x0024, 0x0040, 0x005b, 0x00a5, 0x005d, /* 8 Japan (Eng) */
0x005e, 0x0060, 0x007b, 0x007c, 0x007d, 0x007e},
{ 0x0023, 0x0024, 0x0040, 0x005b, 0x005c, 0x005d, /* 9 Norway */
0x005e, 0x0060, 0x007b, 0x007c, 0x007d, 0x007e}, /* TODO */
{ 0x0023, 0x00a4, 0x00c9, 0x00c6, 0x00d8, 0x00c5, /* 9 Norway */
0x00dc, 0x00e9, 0x00e6, 0x00f8, 0x00e5, 0x00fc},
{ 0x0023, 0x0024, 0x0040, 0x005b, 0x005c, 0x005d, /* 10 Denmark (2) */
0x005e, 0x0060, 0x007b, 0x007c, 0x007d, 0x007e}, /* TODO */
{ 0x0023, 0x0024, 0x00c9, 0x00c6, 0x00d8, 0x00c5, /* 10 Denmark II */
0x00dc, 0x00e9, 0x00e6, 0x00f8, 0x00e5, 0x00fc},
{ 0x0023, 0x0024, 0x0040, 0x005b, 0x005c, 0x005d, /* 11 Spain (2) */
0x005e, 0x0060, 0x007b, 0x007c, 0x007d, 0x007e}, /* TODO */
{ 0x0023, 0x0024, 0x00e1, 0x00a1, 0x00d1, 0x00bf, /* 11 Spain II */
0x00e9, 0x0060, 0x00ed, 0x00f1, 0x00f3, 0x00fa},
{ 0x0023, 0x0024, 0x0040, 0x005b, 0x005c, 0x005d, /* 12 Latin America */
0x005e, 0x0060, 0x007b, 0x007c, 0x007d, 0x007e}, /* TODO */
{ 0x0023, 0x0024, 0x00e1, 0x00a1, 0x00d1, 0x00bf, /* 12 Lat America */
0x00e9, 0x00fc, 0x00ed, 0x00f1, 0x00f3, 0x00fa},
{ 0x0023, 0x0024, 0x0040, 0x005b, 0x005c, 0x005d, /* 13 Korea */
0x005e, 0x0060, 0x007b, 0x007c, 0x007d, 0x007e}, /* TODO */
{ 0x0023, 0x0024, 0x0040, 0x005b, 0x20a9, 0x005d, /* 13 Korea */
0x005e, 0x0060, 0x007b, 0x007c, 0x007d, 0x007e},
{ 0x0023, 0x0024, 0x00a7, 0x00c4, 0x0027, 0x0022, /* 14 Legal */
{ 0x0023, 0x0024, 0x00a7, 0x00ba, 0x2019, 0x201d, /* 64 Legal */
0x00b6, 0x0060, 0x00a9, 0x00ae, 0x2020, 0x2122}
};
@@ -1099,8 +1098,8 @@ process_char(escp_t *dev, uint8_t ch)
break;
case 0x52: /* select an intl character set (ESC R) */
if (dev->esc_parms[0] <= 13 || dev->esc_parms[0] == '@') {
if (dev->esc_parms[0] == '@')
if (dev->esc_parms[0] <= 13 || dev->esc_parms[0] == 64) {
if (dev->esc_parms[0] == 64)
dev->esc_parms[0] = 14;
dev->curr_cpmap[0x23] = intCharSets[dev->esc_parms[0]][0];
@@ -2124,7 +2123,7 @@ static const device_config_t lpt_prt_escp_config[] = {
// clang-format on
const device_t prt_escp_device = {
.name = "Generic ESC/P Dot-Matrix Printer",
.name = "Generic ESC/P 2 Dot-Matrix Printer",
.internal_name = "dot_matrix",
.flags = DEVICE_LPT,
.local = 0,
@@ -2142,7 +2141,7 @@ const device_t prt_escp_device = {
};
const lpt_device_t lpt_prt_escp_device = {
.name = "Generic ESC/P Dot-Matrix Printer",
.name = "Generic ESC/P 2 Dot-Matrix Printer",
.internal_name = "dot_matrix",
.init = escp_init,
.close = escp_close,