1 /* 2 * Copyright © 2018 Christian Persch 3 * 4 * This library is free software: you can redistribute it and/or modify 5 * it under the terms of the GNU Lesser General Public License as published 6 * by the Free Software Foundation, either version 3 of the License, or 7 * (at your option) any later version. 8 * 9 * This library is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * GNU Lesser General Public License for more details. 13 * 14 * You should have received a copy of the GNU Lesser General Public License 15 * along with this library. If not, see <https://www.gnu.org/licenses/>. 16 */ 17 18 #define IR(num) VTE_CHARSET_ISO_2375_IR_##num 19 #define DEC(name) VTE_CHARSET_DEC_##name 20 #define NRCS(name) VTE_CHARSET_##name##_NRCS 21 #define NA VTE_CHARSET_NONE 22 #define RET VTE_CHARSET_RETURN 23 24 /* 94-character graphic character sets: 25 * G0: ESC 2/8 F 26 * G1: ESC 2/9 F 27 * G2: ESC 2/10 F 28 * G3: ESC 2/11 F 29 * C0: - 30 * C1: - 31 */ 32 /* NOTE: 4/8 'H' for IR(11) (SWEDISH_NRCS) conflicts with the 33 * primary choice on ISO_HEBREW_SUPPLEMENTAL. 34 * VT510 always chooses HEBREW; the table below prefers IR #11. 35 * Also note that ARIB STD-B24 defines charsets with 03/01..03/08 36 * which conflict with the DEC and NRCS charsets below; so they 37 * have not been added here. 38 */ 39 static uint8_t const charset_graphic_94[] = { 40 /* 3/0..3/15 */ 41 DEC(SPECIAL_GRAPHIC), NA, NA, NA, NRCS(DUTCH), NRCS(FINNISH), NRCS(NORWEGIAN_DANISH), NRCS(SWEDISH), 42 NA, NRCS(FRENCH_CANADIAN), NA, NA, DEC(UPSS), NRCS(SWISS), DEC(TECHNICAL), NA, 43 /* 4/0..4/15 */ 44 IR(2), IR(4), IR(6), IR(8_1), IR(8_2), IR(9_1), IR(9_2), IR(10), 45 IR(11), IR(13), IR(14), IR(21), IR(16), IR(39), IR(37), IR(38), 46 /* 5/0..5/15 */ 47 IR(53), IR(54), IR(25), IR(55), IR(57), IR(27), IR(47), IR(49), 48 IR(31), IR(15), IR(17), IR(18), IR(19), IR(50), IR(51), IR(59), 49 /* 6/0..6/15 */ 50 IR(60), IR(61), IR(70), IR(71), IR(72_OR_173), IR(68), IR(69), IR(84), 51 IR(85), IR(86), IR(88), IR(89), IR(90), IR(91), IR(92), IR(93), 52 /* 7/0..7/13 */ 53 IR(94), IR(95), IR(96), IR(98), IR(99), IR(102), IR(103), IR(121), 54 IR(122), IR(137), IR(141), IR(146), IR(128), IR(147), 55 }; 56 57 /* 94-character graphic character sets, with second intermediate byte 2/1: 58 * G0: ESC 2/8 2/1 F 59 * G1: ESC 2/9 2/1 F 60 * G2: ESC 2/10 2/1 F 61 * G3: ESC 2/11 2/1 F 62 * C0: - 63 * C1: - 64 */ 65 static uint8_t const charset_graphic_94_with_2_1[] = { 66 /* 4/0..4/6 */ 67 IR(150), IR(151), IR(170), IR(207), IR(230), IR(231), IR(232) 68 }; 69 70 /* 94-character graphic character sets, with second intermediate byte 2/2: 71 * G0: ESC 2/8 2/1 F 72 * G1: ESC 2/9 2/1 F 73 * G2: ESC 2/10 2/1 F 74 * G3: ESC 2/11 2/1 F 75 * C0: - 76 * C1: - 77 */ 78 static uint8_t const charset_graphic_94_with_2_2[] = { 79 /* 3/0..3/15 */ 80 NA, NA, NA, NA, DEC(HEBREW), NA, NA, NA, 81 NA, NA, NA, NA, NA, NA, NRCS(GREEK), DEC(GREEK), 82 }; 83 84 /* 94-character graphic character sets, with second intermediate byte 2/5: 85 * G0: ESC 2/8 2/1 F 86 * G1: ESC 2/9 2/1 F 87 * G2: ESC 2/10 2/1 F 88 * G3: ESC 2/11 2/1 F 89 * C0: - 90 * C1: - 91 */ 92 static uint8_t const charset_graphic_94_with_2_5[] = { 93 /* 3/0..3/15 */ 94 DEC(TURKISH), NA, NRCS(TURKISH), NRCS(SOFT), NA, DEC(SUPPLEMENTAL_GRAPHIC), NRCS(PORTUGUESE), NA, 95 NA, NA, NA, NA, NA, NRCS(HEBREW), NA, NA, 96 }; 97 98 /* 94-character graphic character sets, with second intermediate byte 2/6: 99 * G0: ESC 2/8 2/1 F 100 * G1: ESC 2/9 2/1 F 101 * G2: ESC 2/10 2/1 F 102 * G3: ESC 2/11 2/1 F 103 * C0: - 104 * C1: - 105 */ 106 static uint8_t const charset_graphic_94_with_2_6[] = { 107 /* 3/0..3/15 */ 108 NA, NA, NA, DEC(THAI), DEC(CYRILLIC), NRCS(RUSSIAN), NA, NA, 109 NA, NA, NA, NA, NA, NA, NA, NA, 110 }; 111 112 /* 96-characters graphic character sets: 113 * G0: - 114 * G1: ESC 2/13 F 115 * G2: ESC 2/14 F 116 * G3: ESC 2/15 F 117 * C0: - 118 * C1: - 119 */ 120 static uint8_t const charset_graphic_96[] = { 121 /* 3/0..3/15 */ 122 NA, NA, NA, NA, NA, NA, NA, NA, 123 NA, NA, NA, NA, DEC(UPSS), NA, NA, NA, 124 /* 4/0..4/15 */ 125 IR(111), IR(100), IR(101), IR(109), IR(110), IR(123), IR(126), IR(127), 126 IR(138), IR(139), IR(142), IR(143), IR(144), IR(148), IR(152), IR(153), 127 /* 5/0..5/15 */ 128 IR(154), IR(155), IR(156), IR(164), IR(166), IR(167), IR(157), NA, 129 IR(158), IR(179), IR(180), IR(181), IR(182), IR(197), IR(198), IR(199), 130 /* 6/0..6/15 */ 131 IR(200), IR(201), IR(203), IR(204), IR(205), IR(206), IR(226), IR(208), 132 IR(209), IR(227), IR(234), NA, NA, NA, NA, NA, 133 /* 7/0..7/13 */ 134 NA, NA, NA, NA, NA, NA, NA, NA, 135 NA, NA, NA, NA, NA, IR(129), 136 }; 137 138 /* Multibyte graphic character sets: 139 * G0: ESC 2/4 2/8 F 140 * G1: ESC 2/4 2/9 F 141 * G2: ESC 2/4 2/10 F 142 * G3: ESC 2/4 2/11 F 143 * C0: - 144 * C1: - 145 * 146 * Note that exceptionally, ESC 2/4 4/0, ESC 2/4 4/1 and ESC 2/4 4/2 designate 147 * G0 sets for compatibility with an earlier version of ISO-2022. 148 * Also note that ARIB STD-B24 defines 2-byte charsets with 03/09..03/11 149 * which have not been added here. 150 */ 151 static uint8_t const charset_graphic_94_n[] = { 152 /* 3/0..3/15 */ 153 NA, DEC(KANJI_1978), NA, DEC(KANJI_1983), NA, NA, NA, NA, 154 NA, NA, NA, NA, NA, NA, NA, NA, 155 /* 4/0..4/15 */ 156 IR(42), IR(58), IR(87_OR_168), IR(149), IR(159), IR(165), IR(169), IR(171), 157 IR(172), IR(183), IR(184), IR(185), IR(186), IR(187), IR(202), IR(228), 158 /* 5/0..5/1 */ 159 IR(229), IR(233), 160 }; 161 162 /* Multibyte graphic character sets, with third intermediate byte 2/1: 163 * G0: ESC 2/4 2/8 2/1 F 164 * G1: ESC 2/4 2/9 2/1 F 165 * G2: ESC 2/4 2/10 2/1 F 166 * G3: ESC 2/4 2/11 2/1 F 167 * C0: - 168 * C1: - 169 * 170 * Note that these are not registed in ISO-IR. 171 * 172 * [Source: ecma35lib/ecma35/data/graphdata.py] 173 */ 174 static uint8_t const charset_graphic_94_n_with_2_1[] = { 175 /* 3/0..3/15 */ 176 NA, VTE_CHARSET_EUCTW_G2, VTE_CHARSET_HKCS_EXT, VTE_CHARSET_MS_950_UTC_EXT 177 }; 178 179 /* C0 control character sets: 180 * G0: - 181 * G1: - 182 * G2: - 183 * G3: - 184 * C0: ESC 2/1 F 185 * C1: - 186 */ 187 static uint8_t const charset_control_c0[] = { 188 /* 4/0..4/12 */ 189 IR(1), IR(7), IR(48), IR(26), IR(36), IR(106), IR(74), IR(104), 190 IR(130), IR(132), IR(134), IR(135), IR(140), 191 }; 192 193 /* C1 control character sets: 194 * G0: - 195 * G1: - 196 * G2: - 197 * G3: - 198 * C0: - 199 * C1: ESC 2/2 F 200 */ 201 static uint8_t const charset_control_c1[] = { 202 /* 4/0..4/8 */ 203 IR(56), IR(73), IR(67_OR_124), IR(77), IR(133), IR(40), IR(136), IR(105), 204 IR(107) 205 }; 206 207 #if 0 208 /* Single control functions as two-byte escape sequences 209 * ESC F 210 */ 211 static uint8_t const charset_control_single[] = { 212 /* 6/0..6/15 */ 213 IR(32), IR(33), IR(34), IR(35), IR(189), NA, NA, NA, 214 NA, NA, NA, NA, NA, NA, IR(62), IR(63), 215 /* 7/0..7/14 */ 216 NA, NA, NA, NA, NA, NA, NA, NA, 217 NA, NA, NA, NA, IR(64), IR(65), IR(66) 218 }; 219 #endif 220 221 /* Non-ISO-2022 coding systems, with standard return: 222 * ESC 2/5 F 223 */ 224 static uint8_t const charset_ocs[] = { 225 /* 3/0..3/15 */ 226 NA, NA, NA, NA, NA, NA, NA, NA, 227 DEC(HPPCL), NA, NA, NA, NA, DEC(IBM_PROPRINTER), NA, NA, 228 /* 4/0..4/8 */ 229 RET, IR(108), IR(178), IR(131), IR(145), IR(160), IR(161), IR(196), 230 IR(188) 231 }; 232 233 /* Non-ISO-2022 coding systems, with standard return: 234 * ESC 2/5 SP F 235 */ 236 static uint8_t const charset_ocs_with_2_0[] = { 237 /* 03/00 */ 238 DEC(BARCODE) 239 }; 240 241 /* Non-ISO-2022 coding systems, without standard return: 242 * ESC 2/5 2/15 F 243 */ 244 static uint8_t const charset_ocs_with_2_15[] = { 245 /* 4/0..4/12 */ 246 IR(162), IR(163), IR(125), IR(174), IR(175), IR(176), IR(177), IR(190), 247 IR(191), IR(192), IR(193), IR(194), IR(195) 248 }; 249 250 #undef IR 251 #undef DEC 252 #undef NRCS 253 #undef NA 254 #undef RET 255