From 9c98cde147a44e9a24631bbec51ef4191ac81d6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Karmaz=C3=ADn?= Date: Wed, 18 Sep 2024 18:41:57 +0200 Subject: [PATCH] Extract Windows1258 to its own file --- .../escpos4k/core/encoding/charset/Charset.kt | 135 ---------------- .../core/encoding/charset/Windows1258.kt | 152 ++++++++++++++++++ 2 files changed, 152 insertions(+), 135 deletions(-) create mode 100644 escpos4k/src/commonMain/kotlin/cz/multiplatform/escpos4k/core/encoding/charset/Windows1258.kt diff --git a/escpos4k/src/commonMain/kotlin/cz/multiplatform/escpos4k/core/encoding/charset/Charset.kt b/escpos4k/src/commonMain/kotlin/cz/multiplatform/escpos4k/core/encoding/charset/Charset.kt index c012fc1..64c5556 100644 --- a/escpos4k/src/commonMain/kotlin/cz/multiplatform/escpos4k/core/encoding/charset/Charset.kt +++ b/escpos4k/src/commonMain/kotlin/cz/multiplatform/escpos4k/core/encoding/charset/Charset.kt @@ -100,141 +100,6 @@ public sealed class Charset( // /** Page 44 [CP1125: Ukrainian] */ // CP1125(44), - /** Page 52 [Windows-1258] */ - public data object Windows1258 : Charset(52, "windows-1258") { - override val mapping: Map = - mapOf( - '\u20AC' to 0x80, - '\uFFFD' to 0x81, - '\u201A' to 0x82, - '\u0192' to 0x83, - '\u201E' to 0x84, - '\u2026' to 0x85, - '\u2020' to 0x86, - '\u2021' to 0x87, - '\u02C6' to 0x88, - '\u2030' to 0x89, - '\uFFFD' to 0x8A, - '\u2039' to 0x8B, - '\u0152' to 0x8C, - '\uFFFD' to 0x8D, - '\uFFFD' to 0x8E, - '\uFFFD' to 0x8F, - '\uFFFD' to 0x90, - '\u2018' to 0x91, - '\u2019' to 0x92, - '\u201C' to 0x93, - '\u201D' to 0x94, - '\u2022' to 0x95, - '\u2013' to 0x96, - '\u2014' to 0x97, - '\u02DC' to 0x98, - '\u2122' to 0x99, - '\uFFFD' to 0x9A, - '\u203A' to 0x9B, - '\u0153' to 0x9C, - '\uFFFD' to 0x9D, - '\uFFFD' to 0x9E, - '\u0178' to 0x9F, - '\u00A0' to 0xA0, - '\u00A1' to 0xA1, - '\u00A2' to 0xA2, - '\u00A3' to 0xA3, - '\u00A4' to 0xA4, - '\u00A5' to 0xA5, - '\u00A6' to 0xA6, - '\u00A7' to 0xA7, - '\u00A8' to 0xA8, - '\u00A9' to 0xA9, - '\u00AA' to 0xAA, - '\u00AB' to 0xAB, - '\u00AC' to 0xAC, - '\u00AD' to 0xAD, - '\u00AE' to 0xAE, - '\u00AF' to 0xAF, - '\u00B0' to 0xB0, - '\u00B1' to 0xB1, - '\u00B2' to 0xB2, - '\u00B3' to 0xB3, - '\u00B4' to 0xB4, - '\u00B5' to 0xB5, - '\u00B6' to 0xB6, - '\u00B7' to 0xB7, - '\u00B8' to 0xB8, - '\u00B9' to 0xB9, - '\u00BA' to 0xBA, - '\u00BB' to 0xBB, - '\u00BC' to 0xBC, - '\u00BD' to 0xBD, - '\u00BE' to 0xBE, - '\u00BF' to 0xBF, - '\u00C0' to 0xC0, - '\u00C1' to 0xC1, - '\u00C2' to 0xC2, - '\u0102' to 0xC3, - '\u00C4' to 0xC4, - '\u00C5' to 0xC5, - '\u00C6' to 0xC6, - '\u00C7' to 0xC7, - '\u00C8' to 0xC8, - '\u00C9' to 0xC9, - '\u00CA' to 0xCA, - '\u00CB' to 0xCB, - '\u0300' to 0xCC, - '\u00CD' to 0xCD, - '\u00CE' to 0xCE, - '\u00CF' to 0xCF, - '\u0110' to 0xD0, - '\u00D1' to 0xD1, - '\u0309' to 0xD2, - '\u00D3' to 0xD3, - '\u00D4' to 0xD4, - '\u01A0' to 0xD5, - '\u00D6' to 0xD6, - '\u00D7' to 0xD7, - '\u00D8' to 0xD8, - '\u00D9' to 0xD9, - '\u00DA' to 0xDA, - '\u00DB' to 0xDB, - '\u00DC' to 0xDC, - '\u01AF' to 0xDD, - '\u0303' to 0xDE, - '\u00DF' to 0xDF, - '\u00E0' to 0xE0, - '\u00E1' to 0xE1, - '\u00E2' to 0xE2, - '\u0103' to 0xE3, - '\u00E4' to 0xE4, - '\u00E5' to 0xE5, - '\u00E6' to 0xE6, - '\u00E7' to 0xE7, - '\u00E8' to 0xE8, - '\u00E9' to 0xE9, - '\u00EA' to 0xEA, - '\u00EB' to 0xEB, - '\u0301' to 0xEC, - '\u00ED' to 0xED, - '\u00EE' to 0xEE, - '\u00EF' to 0xEF, - '\u0111' to 0xF0, - '\u00F1' to 0xF1, - '\u0323' to 0xF2, - '\u00F3' to 0xF3, - '\u00F4' to 0xF4, - '\u01A1' to 0xF5, - '\u00F6' to 0xF6, - '\u00F7' to 0xF7, - '\u00F8' to 0xF8, - '\u00F9' to 0xF9, - '\u00FA' to 0xFA, - '\u00FB' to 0xFB, - '\u00FC' to 0xFC, - '\u01B0' to 0xFD, - '\u20AB' to 0xFE, - '\u00FF' to 0xFF, - ) - } - // /** Page 53 [KZ-1048: Kazakhstan] */ // KZ1048(52, "KZ-1048"); diff --git a/escpos4k/src/commonMain/kotlin/cz/multiplatform/escpos4k/core/encoding/charset/Windows1258.kt b/escpos4k/src/commonMain/kotlin/cz/multiplatform/escpos4k/core/encoding/charset/Windows1258.kt new file mode 100644 index 0000000..9e4dc2b --- /dev/null +++ b/escpos4k/src/commonMain/kotlin/cz/multiplatform/escpos4k/core/encoding/charset/Windows1258.kt @@ -0,0 +1,152 @@ +/* + * Copyright 2024 Ondřej Karmazín + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package cz.multiplatform.escpos4k.core.encoding.charset + +/** Page 52 [Windows-1258] */ +public data object Windows1258 : Charset(52, "windows-1258") { + override val mapping: Map = + mapOf( + '\u20AC' to 0x80, + '\uFFFD' to 0x81, + '\u201A' to 0x82, + '\u0192' to 0x83, + '\u201E' to 0x84, + '\u2026' to 0x85, + '\u2020' to 0x86, + '\u2021' to 0x87, + '\u02C6' to 0x88, + '\u2030' to 0x89, + '\uFFFD' to 0x8A, + '\u2039' to 0x8B, + '\u0152' to 0x8C, + '\uFFFD' to 0x8D, + '\uFFFD' to 0x8E, + '\uFFFD' to 0x8F, + '\uFFFD' to 0x90, + '\u2018' to 0x91, + '\u2019' to 0x92, + '\u201C' to 0x93, + '\u201D' to 0x94, + '\u2022' to 0x95, + '\u2013' to 0x96, + '\u2014' to 0x97, + '\u02DC' to 0x98, + '\u2122' to 0x99, + '\uFFFD' to 0x9A, + '\u203A' to 0x9B, + '\u0153' to 0x9C, + '\uFFFD' to 0x9D, + '\uFFFD' to 0x9E, + '\u0178' to 0x9F, + '\u00A0' to 0xA0, + '\u00A1' to 0xA1, + '\u00A2' to 0xA2, + '\u00A3' to 0xA3, + '\u00A4' to 0xA4, + '\u00A5' to 0xA5, + '\u00A6' to 0xA6, + '\u00A7' to 0xA7, + '\u00A8' to 0xA8, + '\u00A9' to 0xA9, + '\u00AA' to 0xAA, + '\u00AB' to 0xAB, + '\u00AC' to 0xAC, + '\u00AD' to 0xAD, + '\u00AE' to 0xAE, + '\u00AF' to 0xAF, + '\u00B0' to 0xB0, + '\u00B1' to 0xB1, + '\u00B2' to 0xB2, + '\u00B3' to 0xB3, + '\u00B4' to 0xB4, + '\u00B5' to 0xB5, + '\u00B6' to 0xB6, + '\u00B7' to 0xB7, + '\u00B8' to 0xB8, + '\u00B9' to 0xB9, + '\u00BA' to 0xBA, + '\u00BB' to 0xBB, + '\u00BC' to 0xBC, + '\u00BD' to 0xBD, + '\u00BE' to 0xBE, + '\u00BF' to 0xBF, + '\u00C0' to 0xC0, + '\u00C1' to 0xC1, + '\u00C2' to 0xC2, + '\u0102' to 0xC3, + '\u00C4' to 0xC4, + '\u00C5' to 0xC5, + '\u00C6' to 0xC6, + '\u00C7' to 0xC7, + '\u00C8' to 0xC8, + '\u00C9' to 0xC9, + '\u00CA' to 0xCA, + '\u00CB' to 0xCB, + '\u0300' to 0xCC, + '\u00CD' to 0xCD, + '\u00CE' to 0xCE, + '\u00CF' to 0xCF, + '\u0110' to 0xD0, + '\u00D1' to 0xD1, + '\u0309' to 0xD2, + '\u00D3' to 0xD3, + '\u00D4' to 0xD4, + '\u01A0' to 0xD5, + '\u00D6' to 0xD6, + '\u00D7' to 0xD7, + '\u00D8' to 0xD8, + '\u00D9' to 0xD9, + '\u00DA' to 0xDA, + '\u00DB' to 0xDB, + '\u00DC' to 0xDC, + '\u01AF' to 0xDD, + '\u0303' to 0xDE, + '\u00DF' to 0xDF, + '\u00E0' to 0xE0, + '\u00E1' to 0xE1, + '\u00E2' to 0xE2, + '\u0103' to 0xE3, + '\u00E4' to 0xE4, + '\u00E5' to 0xE5, + '\u00E6' to 0xE6, + '\u00E7' to 0xE7, + '\u00E8' to 0xE8, + '\u00E9' to 0xE9, + '\u00EA' to 0xEA, + '\u00EB' to 0xEB, + '\u0301' to 0xEC, + '\u00ED' to 0xED, + '\u00EE' to 0xEE, + '\u00EF' to 0xEF, + '\u0111' to 0xF0, + '\u00F1' to 0xF1, + '\u0323' to 0xF2, + '\u00F3' to 0xF3, + '\u00F4' to 0xF4, + '\u01A1' to 0xF5, + '\u00F6' to 0xF6, + '\u00F7' to 0xF7, + '\u00F8' to 0xF8, + '\u00F9' to 0xF9, + '\u00FA' to 0xFA, + '\u00FB' to 0xFB, + '\u00FC' to 0xFC, + '\u01B0' to 0xFD, + '\u20AB' to 0xFE, + '\u00FF' to 0xFF, + ) +}