diff --git a/README.md b/README.md index ec14e35..6470604 100644 --- a/README.md +++ b/README.md @@ -38,12 +38,12 @@ suspend fun awaitPrint(): MyError? { val libraryError: PrintError? = connection.print(configuration) { // (2) // MULTIPLE TEXT ALIGNMENTS PER LINE line("Famous bridges:") - charset(Charset.CP865) // Can encode Ø, but not ů + charset(IBM865) // Can encode Ø, but not ů segmentedLine( LineSegment("Øresundsbroen", TextAlignment.LEFT), LineSegment("7845m", TextAlignment.RIGHT), ) - charset(Charset.CP852) // Can encode ů, but not Ø + charset(IBM852) // Can encode ů, but not Ø segmentedLine( LineSegment("Karlův most", TextAlignment.LEFT), LineSegment("515m", TextAlignment.RIGHT), diff --git a/escpos4k/src/androidMain/kotlin/cz/multiplatform/escpos4k/core/Encoder.android.kt b/escpos4k/src/androidMain/kotlin/cz/multiplatform/escpos4k/core/Encoder.android.kt deleted file mode 100644 index 5e4d255..0000000 --- a/escpos4k/src/androidMain/kotlin/cz/multiplatform/escpos4k/core/Encoder.android.kt +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright 2023 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 - -import java.nio.ByteBuffer -import java.nio.CharBuffer -import java.nio.charset.CodingErrorAction -import java.nio.charset.Charset as JavaCharset - -internal actual fun encode(text: String, charset: Charset): ByteArray = - JavaCharset.forName(charset.ianaName) - .newEncoder() - .onMalformedInput(CodingErrorAction.REPLACE) - .onUnmappableCharacter(CodingErrorAction.REPLACE) - .encode(CharBuffer.wrap(text)) - .toByteArray() - -private fun ByteBuffer.toByteArray(): ByteArray { - val array = ByteArray(remaining()) - get(array) - return array -} diff --git a/escpos4k/src/appleMain/kotlin/cz/multiplatform/escpos4k/core/Encoder.apple.kt b/escpos4k/src/appleMain/kotlin/cz/multiplatform/escpos4k/core/Encoder.apple.kt deleted file mode 100644 index fb3e77b..0000000 --- a/escpos4k/src/appleMain/kotlin/cz/multiplatform/escpos4k/core/Encoder.apple.kt +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright 2023 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 - -import cnames.structs.__CFString -import kotlinx.cinterop.CPointer -import kotlinx.cinterop.ExperimentalForeignApi -import kotlinx.cinterop.addressOf -import kotlinx.cinterop.usePinned -import platform.CoreFoundation.CFRelease -import platform.CoreFoundation.CFStringConvertEncodingToNSStringEncoding -import platform.CoreFoundation.CFStringConvertIANACharSetNameToEncoding -import platform.CoreFoundation.CFStringRef -import platform.CoreFoundation.kCFStringEncodingInvalidId -import platform.Foundation.CFBridgingRetain -import platform.Foundation.NSData -import platform.Foundation.NSString -import platform.Foundation.dataUsingEncoding -import platform.posix.memcpy - -@OptIn(ExperimentalForeignApi::class) -internal actual fun encode(text: String, charset: Charset): ByteArray { - var cfCharsetName: CPointer<__CFString>? = null - try { - // (1) Cast a NSString as CFStringRef for the CF lookup function. - // The BridgingRetain function will transfer the ownership to us, - // making us responsible for freeing the memory. - cfCharsetName = CFBridgingRetain(charset.ianaName as NSString) as CFStringRef? - - // (2) Using the prepared CFStringRef, find the CFStringEncoding. - val cfEncoding = CFStringConvertIANACharSetNameToEncoding(cfCharsetName) - if (cfEncoding == kCFStringEncodingInvalidId) { - throw RuntimeException("invalid encoding: ${charset.ianaName}") - } - - // (3) Using the CF encoding, find the corresponding NSStringEncoding - val nsEncoding = CFStringConvertEncodingToNSStringEncoding(cfEncoding) - - // (4) Encode the Kotlin String using the NS Encoding. The resulting NSData is - // lives in the ARC-enabled runtime and since it does not escape the current - // scope, will be collected when scope ends. - val encodedData: NSData = - (text as NSString).dataUsingEncoding(nsEncoding, allowLossyConversion = true) - ?: throw RuntimeException("encoder failed") - val encodedBytes = encodedData.bytes ?: throw RuntimeException("encoder failed") - - // (5) Create a Kotlin-land ByteArray and copy over the encoded bytes - // from the ObjC-land NSData. - // - // https://github.com/JetBrains/kotlin-native/issues/3172 - return ByteArray(encodedData.length.toInt()).apply { - usePinned { pinnedByteArray -> - memcpy(pinnedByteArray.addressOf(0), encodedBytes, encodedData.length) - } - } - } finally { - // Don't forget to free the unmanaged CF pointer! - CFRelease(cfCharsetName) - } -} diff --git a/escpos4k/src/commonMain/kotlin/cz/multiplatform/escpos4k/core/Command.kt b/escpos4k/src/commonMain/kotlin/cz/multiplatform/escpos4k/core/Command.kt index ed84ac9..070bceb 100644 --- a/escpos4k/src/commonMain/kotlin/cz/multiplatform/escpos4k/core/Command.kt +++ b/escpos4k/src/commonMain/kotlin/cz/multiplatform/escpos4k/core/Command.kt @@ -16,11 +16,14 @@ package cz.multiplatform.escpos4k.core +import cz.multiplatform.escpos4k.core.encoding.charset.Charset +import cz.multiplatform.escpos4k.core.encoding.encode + internal sealed class Command { abstract fun bytes(): ByteArray class Text(private val text: String, charset: Charset) : Command() { - private val encodedBytes: ByteArray by lazy { encode(text, charset) } + private val encodedBytes: ByteArray by lazy { text.encode(charset) } override fun bytes(): ByteArray = encodedBytes.copyOf() diff --git a/escpos4k/src/commonMain/kotlin/cz/multiplatform/escpos4k/core/CommandBuilder.kt b/escpos4k/src/commonMain/kotlin/cz/multiplatform/escpos4k/core/CommandBuilder.kt index 18b5e63..adcfd10 100644 --- a/escpos4k/src/commonMain/kotlin/cz/multiplatform/escpos4k/core/CommandBuilder.kt +++ b/escpos4k/src/commonMain/kotlin/cz/multiplatform/escpos4k/core/CommandBuilder.kt @@ -20,6 +20,7 @@ import arrow.core.Nel import arrow.core.nonEmptyListOf import arrow.core.toNonEmptyListOrNull import cz.multiplatform.escpos4k.core.LineDistributionStrategy.Companion.SpaceEvenly +import cz.multiplatform.escpos4k.core.encoding.charset.Charset /** * The central class for building the content to send to the printer. The class provides a variety @@ -43,9 +44,9 @@ import cz.multiplatform.escpos4k.core.LineDistributionStrategy.Companion.SpaceEv * val builder = CommandBuilder(defaultConfig) { * // Charsets * line("Famous bridges:") - * charset(Charset.CP865) // Can encode Ø, but not ů + * charset(IBM865) // Can encode Ø, but not ů * line("Øresundsbroen: 7845m") - * charset(Charset.CP852) // Can encode ů, but not Ø + * charset(IBM852) // Can encode ů, but not Ø * line("Karlův most: 515m") * * // Text style - temporary style builder @@ -162,10 +163,10 @@ public class CommandBuilder( * printer.print { * line("Famous bridges:") * - * charset(Charset.CP865) // Can encode Ø, but not ů + * charset(IBM865) // Can encode Ø, but not ů * line("Øresundsbroen: 7845m") * - * charset(Charset.CP852) // Can encode ů, but not Ø + * charset(IBM852) // Can encode ů, but not Ø * line("Karlův most: 515m") * } * ``` @@ -192,10 +193,10 @@ public class CommandBuilder( * line("Famous bridges") * * // 865 can encode Ø, but not ů - * charset(Charset.CP865) + * charset(IBM865) * line("Øresundsbroen: 7845m") * - * withCharset(Charset.CP852) { + * withCharset(IBM852) { * // 852 can encode ů, but not Ø * line("Karlův most: 515m") * } diff --git a/escpos4k/src/commonMain/kotlin/cz/multiplatform/escpos4k/core/Encoder.kt b/escpos4k/src/commonMain/kotlin/cz/multiplatform/escpos4k/core/Encoder.kt deleted file mode 100644 index f536975..0000000 --- a/escpos4k/src/commonMain/kotlin/cz/multiplatform/escpos4k/core/Encoder.kt +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Copyright 2023 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 - -internal expect fun encode(text: String, charset: Charset): ByteArray diff --git a/escpos4k/src/commonMain/kotlin/cz/multiplatform/escpos4k/core/encoding/Encoder.kt b/escpos4k/src/commonMain/kotlin/cz/multiplatform/escpos4k/core/encoding/Encoder.kt new file mode 100644 index 0000000..b355d05 --- /dev/null +++ b/escpos4k/src/commonMain/kotlin/cz/multiplatform/escpos4k/core/encoding/Encoder.kt @@ -0,0 +1,63 @@ +/* + * 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 + +import cz.multiplatform.escpos4k.core.encoding.charset.Charset + +private const val replacement = '?' +private const val replacementByte = replacement.code.toByte() + +internal fun String.encode(charset: Charset): ByteArray { + val output = ByteArray(length) + + for ((index, char) in this.withIndex()) { + val byte: Byte = + when { + // 0..31 are control characters, always replaced + char.code < 32 -> { + log("Replacing control character '${char.code}' at index $index with '$replacement'.") + replacementByte + } + + // Printable ASCII up to 127 + char.code < 128 -> { + char.code.toByte() + } + + // Page-specific characters + else -> { + val byte = charset.mapping[char]?.toByte() + if (byte == null) { + log( + "[${charset.ianaName}] Replacing unmappable code unit '${char.code}' at index $index with '$replacement'") + } + byte ?: replacementByte + } + } + + output[index] = byte + } + + return output +} + +private fun log(msg: String) { + val debug = false + if (debug) { + println(msg) + } +} diff --git a/escpos4k/src/commonMain/kotlin/cz/multiplatform/escpos4k/core/Charset.kt b/escpos4k/src/commonMain/kotlin/cz/multiplatform/escpos4k/core/encoding/charset/Charset.kt similarity index 57% rename from escpos4k/src/commonMain/kotlin/cz/multiplatform/escpos4k/core/Charset.kt rename to escpos4k/src/commonMain/kotlin/cz/multiplatform/escpos4k/core/encoding/charset/Charset.kt index d34a26b..64c5556 100644 --- a/escpos4k/src/commonMain/kotlin/cz/multiplatform/escpos4k/core/Charset.kt +++ b/escpos4k/src/commonMain/kotlin/cz/multiplatform/escpos4k/core/encoding/charset/Charset.kt @@ -1,5 +1,5 @@ /* - * Copyright 2023 Ondřej Karmazín + * 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. @@ -14,10 +14,9 @@ * limitations under the License. */ -package cz.multiplatform.escpos4k.core - -public enum class Charset( +package cz.multiplatform.escpos4k.core.encoding.charset +public sealed class Charset( /** * Code page number according to ESC/POS specification. * @@ -30,26 +29,17 @@ public enum class Charset( * * https://www.iana.org/assignments/character-sets/character-sets.xhtml */ - public val ianaName: String, + public val ianaName: String ) { - /** Page 0 [CP437: USA, Standard Europe] */ - CP437(0, "IBM437"), + public companion object { + internal val default = IBM437 + } + + internal abstract val mapping: Map // /** Page 1 [Katakana] */ // Katakana(1, TODO()), - /** Page 2 [CP850: Multilingual] */ - CP850(2, "IBM850"), - - /** Page 3 [CP860: Portuguese] */ - CP860(3, "IBM860"), - - /** Page 4 [CP863: Canadian-French] */ - CP863(4, "IBM863"), - - /** Page 5 [CP865: Nordic] */ - CP865(5, "IBM865"), - // /** Page 6 [Hiragana] */ // Hiragana(6, TODO()), @@ -59,33 +49,15 @@ public enum class Charset( // /** Page 8 [One-pass printing Kanji characters] */ // Kanji_2(8, TODO()), - /** Page 11 [CP851: Greek] */ - CP851(11, "IBM851"), - - /** Page 12 [CP853: Turkish] */ - CP853(12, "IBM853"), + // /** Page 11 [CP851: Greek] */ + // CP851(11, "IBM851"), - // /** Page 13 [CP857: Turkish] */ - // CP857(13, TODO()), + // /** Page 12 [CP853: Turkish] */ + // CP853(12, "IBM853"), // /** Page 14 [CP737: Greek] */ // CP737(14, TODO()), - /** Page 15 [ISO8859-7: Greek] */ - ISO_8859_7(15, "ISO-8859-7"), - - /** Page 16 [Windows-1252] */ - Windows1252(16, "windows-1252"), - - /** Page 17 [CP866: Cyrillic #2] */ - CP866(17, "IBM866"), - - /** Page 18 [CP852: Latin 2] */ - CP852(18, "IBM852"), - - /** Page 19 [CP858: Euro] */ - CP858(19, "IBM00858"), // Note: two leading zeros - // /** Page 20 [Thai Character Code 42] */ // Thai_42(20), // @@ -116,30 +88,6 @@ public enum class Charset( // /** Page 32 [CP720: Arabic] */ // CP720(32), - /** Page 33 [CP775: Baltic Rim] */ - CP775(33, "IBM775"), - - /** Page 34 [CP855: Cyrillic] */ - CP855(34, "IBM855"), - - /** Page 35 [CP861: Icelandic] */ - CP861(35, "IBM861"), - - /** Page 36 [CP862: Hebrew] */ - CP862(36, "IBM862"), - - /** Page 37 [CP864: Arabic] */ - CP864(37, "IBM864"), - - /** Page 38 [CP869: Greek] */ - CP869(38, "IBM869"), - - /** Page 39 [ISO8859-2: Latin 2] */ - ISO8859_2(39, "ISO-8859-2"), - - /** Page 40 [ISO8859-15: Latin 9] */ - ISO8859_15(40, "ISO-8859-15"), - // /** Page 41 [CP1098: Farsi] */ // CP1098(41, TODO()), @@ -152,32 +100,8 @@ public enum class Charset( // /** Page 44 [CP1125: Ukrainian] */ // CP1125(44), - /** Page 45 [Windows-1250] */ - Windows1250(45, "windows-1250"), - - /** Page 46 [Windows-1251] */ - Windows1251(46, "windows-1251"), - - /** Page 47 [Windows-1253] */ - Windows1253(47, "windows-1253"), - - /** Page 48 [Windows-1254] */ - Windows1254(48, "windows-1254"), - - /** Page 49 [Windows-1255] */ - Windows1255(49, "windows-1255"), - - /** Page 50 [Windows-1256] */ - Windows1256(50, "windows-1256"), - - /** Page 51 [Windows-1257] */ - Windows1257(51, "windows-1257"), - - /** Page 52 [Windows-1258] */ - Windows1258(52, "windows-1258"), - - /** Page 53 [KZ-1048: Kazakhstan] */ - KZ1048(52, "KZ-1048"); + // /** Page 53 [KZ-1048: Kazakhstan] */ + // KZ1048(52, "KZ-1048"); // /** Page 66 [Devanagari] */ // Devanagari(66), @@ -211,11 +135,4 @@ public enum class Charset( // // /** Page 82 [Marathi] */ // Marathi(82) - - // TODO - // public fun encode(text: String): ByteArray = encode(text, this) - - public companion object { - internal val default = entries.first() - } } diff --git a/escpos4k/src/commonMain/kotlin/cz/multiplatform/escpos4k/core/encoding/charset/IBM437.kt b/escpos4k/src/commonMain/kotlin/cz/multiplatform/escpos4k/core/encoding/charset/IBM437.kt new file mode 100644 index 0000000..cf9905b --- /dev/null +++ b/escpos4k/src/commonMain/kotlin/cz/multiplatform/escpos4k/core/encoding/charset/IBM437.kt @@ -0,0 +1,151 @@ +/* + * 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 0 [CP437: USA, Standard Europe] */ +public data object IBM437 : Charset(0, "IBM437") { + override val mapping: Map = + mapOf( + '\u00C7' to 0x80, + '\u00FC' to 0x81, + '\u00E9' to 0x82, + '\u00E2' to 0x83, + '\u00E4' to 0x84, + '\u00E0' to 0x85, + '\u00E5' to 0x86, + '\u00E7' to 0x87, + '\u00EA' to 0x88, + '\u00EB' to 0x89, + '\u00E8' to 0x8A, + '\u00EF' to 0x8B, + '\u00EE' to 0x8C, + '\u00EC' to 0x8D, + '\u00C4' to 0x8E, + '\u00C5' to 0x8F, + '\u00C9' to 0x90, + '\u00E6' to 0x91, + '\u00C6' to 0x92, + '\u00F4' to 0x93, + '\u00F6' to 0x94, + '\u00F2' to 0x95, + '\u00FB' to 0x96, + '\u00F9' to 0x97, + '\u00FF' to 0x98, + '\u00D6' to 0x99, + '\u00DC' to 0x9A, + '\u00A2' to 0x9B, + '\u00A3' to 0x9C, + '\u00A5' to 0x9D, + '\u20A7' to 0x9E, + '\u0192' to 0x9F, + '\u00E1' to 0xA0, + '\u00ED' to 0xA1, + '\u00F3' to 0xA2, + '\u00FA' to 0xA3, + '\u00F1' to 0xA4, + '\u00D1' to 0xA5, + '\u00AA' to 0xA6, + '\u00BA' to 0xA7, + '\u00BF' to 0xA8, + '\u2310' to 0xA9, + '\u00AC' to 0xAA, + '\u00BD' to 0xAB, + '\u00BC' to 0xAC, + '\u00A1' to 0xAD, + '\u00AB' to 0xAE, + '\u00BB' to 0xAF, + '\u2591' to 0xB0, + '\u2592' to 0xB1, + '\u2593' to 0xB2, + '\u2502' to 0xB3, + '\u2524' to 0xB4, + '\u2561' to 0xB5, + '\u2562' to 0xB6, + '\u2556' to 0xB7, + '\u2555' to 0xB8, + '\u2563' to 0xB9, + '\u2551' to 0xBA, + '\u2557' to 0xBB, + '\u255D' to 0xBC, + '\u255C' to 0xBD, + '\u255B' to 0xBE, + '\u2510' to 0xBF, + '\u2514' to 0xC0, + '\u2534' to 0xC1, + '\u252C' to 0xC2, + '\u251C' to 0xC3, + '\u2500' to 0xC4, + '\u253C' to 0xC5, + '\u255E' to 0xC6, + '\u255F' to 0xC7, + '\u255A' to 0xC8, + '\u2554' to 0xC9, + '\u2569' to 0xCA, + '\u2566' to 0xCB, + '\u2560' to 0xCC, + '\u2550' to 0xCD, + '\u256C' to 0xCE, + '\u2567' to 0xCF, + '\u2568' to 0xD0, + '\u2564' to 0xD1, + '\u2565' to 0xD2, + '\u2559' to 0xD3, + '\u2558' to 0xD4, + '\u2552' to 0xD5, + '\u2553' to 0xD6, + '\u256B' to 0xD7, + '\u256A' to 0xD8, + '\u2518' to 0xD9, + '\u250C' to 0xDA, + '\u2588' to 0xDB, + '\u2584' to 0xDC, + '\u258C' to 0xDD, + '\u2590' to 0xDE, + '\u2580' to 0xDF, + '\u03B1' to 0xE0, + '\u00DF' to 0xE1, + '\u0393' to 0xE2, + '\u03C0' to 0xE3, + '\u03A3' to 0xE4, + '\u03C3' to 0xE5, + '\u00B5' to 0xE6, + '\u03C4' to 0xE7, + '\u03A6' to 0xE8, + '\u0398' to 0xE9, + '\u03A9' to 0xEA, + '\u03B4' to 0xEB, + '\u221E' to 0xEC, + '\u03C6' to 0xED, + '\u03B5' to 0xEE, + '\u2229' to 0xEF, + '\u2261' to 0xF0, + '\u00B1' to 0xF1, + '\u2265' to 0xF2, + '\u2264' to 0xF3, + '\u2320' to 0xF4, + '\u2321' to 0xF5, + '\u00F7' to 0xF6, + '\u2248' to 0xF7, + '\u00B0' to 0xF8, + '\u2219' to 0xF9, + '\u00B7' to 0xFA, + '\u221A' to 0xFB, + '\u207F' to 0xFC, + '\u00B2' to 0xFD, + '\u25A0' to 0xFE, + '\u00A0' to 0xFF) +} diff --git a/escpos4k/src/commonMain/kotlin/cz/multiplatform/escpos4k/core/encoding/charset/IBM775.kt b/escpos4k/src/commonMain/kotlin/cz/multiplatform/escpos4k/core/encoding/charset/IBM775.kt new file mode 100644 index 0000000..e570214 --- /dev/null +++ b/escpos4k/src/commonMain/kotlin/cz/multiplatform/escpos4k/core/encoding/charset/IBM775.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 33 [CP775: Baltic Rim] */ +public data object IBM775 : Charset(33, "IBM775") { + override val mapping: Map = + mapOf( + '\u0106' to 0x80, + '\u00FC' to 0x81, + '\u00E9' to 0x82, + '\u0101' to 0x83, + '\u00E4' to 0x84, + '\u0123' to 0x85, + '\u00E5' to 0x86, + '\u0107' to 0x87, + '\u0142' to 0x88, + '\u0113' to 0x89, + '\u0156' to 0x8A, + '\u0157' to 0x8B, + '\u012B' to 0x8C, + '\u0179' to 0x8D, + '\u00C4' to 0x8E, + '\u00C5' to 0x8F, + '\u00C9' to 0x90, + '\u00E6' to 0x91, + '\u00C6' to 0x92, + '\u014D' to 0x93, + '\u00F6' to 0x94, + '\u0122' to 0x95, + '\u00A2' to 0x96, + '\u015A' to 0x97, + '\u015B' to 0x98, + '\u00D6' to 0x99, + '\u00DC' to 0x9A, + '\u00F8' to 0x9B, + '\u00A3' to 0x9C, + '\u00D8' to 0x9D, + '\u00D7' to 0x9E, + '\u00A4' to 0x9F, + '\u0100' to 0xA0, + '\u012A' to 0xA1, + '\u00F3' to 0xA2, + '\u017B' to 0xA3, + '\u017C' to 0xA4, + '\u017A' to 0xA5, + '\u201D' to 0xA6, + '\u00A6' to 0xA7, + '\u00A9' to 0xA8, + '\u00AE' to 0xA9, + '\u00AC' to 0xAA, + '\u00BD' to 0xAB, + '\u00BC' to 0xAC, + '\u0141' to 0xAD, + '\u00AB' to 0xAE, + '\u00BB' to 0xAF, + '\u2591' to 0xB0, + '\u2592' to 0xB1, + '\u2593' to 0xB2, + '\u2502' to 0xB3, + '\u2524' to 0xB4, + '\u0104' to 0xB5, + '\u010C' to 0xB6, + '\u0118' to 0xB7, + '\u0116' to 0xB8, + '\u2563' to 0xB9, + '\u2551' to 0xBA, + '\u2557' to 0xBB, + '\u255D' to 0xBC, + '\u012E' to 0xBD, + '\u0160' to 0xBE, + '\u2510' to 0xBF, + '\u2514' to 0xC0, + '\u2534' to 0xC1, + '\u252C' to 0xC2, + '\u251C' to 0xC3, + '\u2500' to 0xC4, + '\u253C' to 0xC5, + '\u0172' to 0xC6, + '\u016A' to 0xC7, + '\u255A' to 0xC8, + '\u2554' to 0xC9, + '\u2569' to 0xCA, + '\u2566' to 0xCB, + '\u2560' to 0xCC, + '\u2550' to 0xCD, + '\u256C' to 0xCE, + '\u017D' to 0xCF, + '\u0105' to 0xD0, + '\u010D' to 0xD1, + '\u0119' to 0xD2, + '\u0117' to 0xD3, + '\u012F' to 0xD4, + '\u0161' to 0xD5, + '\u0173' to 0xD6, + '\u016B' to 0xD7, + '\u017E' to 0xD8, + '\u2518' to 0xD9, + '\u250C' to 0xDA, + '\u2588' to 0xDB, + '\u2584' to 0xDC, + '\u258C' to 0xDD, + '\u2590' to 0xDE, + '\u2580' to 0xDF, + '\u00D3' to 0xE0, + '\u00DF' to 0xE1, + '\u014C' to 0xE2, + '\u0143' to 0xE3, + '\u00F5' to 0xE4, + '\u00D5' to 0xE5, + '\u00B5' to 0xE6, + '\u0144' to 0xE7, + '\u0136' to 0xE8, + '\u0137' to 0xE9, + '\u013B' to 0xEA, + '\u013C' to 0xEB, + '\u0146' to 0xEC, + '\u0112' to 0xED, + '\u0145' to 0xEE, + '\u2019' to 0xEF, + '\u00AD' to 0xF0, + '\u00B1' to 0xF1, + '\u201C' to 0xF2, + '\u00BE' to 0xF3, + '\u00B6' to 0xF4, + '\u00A7' to 0xF5, + '\u00F7' to 0xF6, + '\u201E' to 0xF7, + '\u00B0' to 0xF8, + '\u2219' to 0xF9, + '\u00B7' to 0xFA, + '\u00B9' to 0xFB, + '\u00B3' to 0xFC, + '\u00B2' to 0xFD, + '\u25A0' to 0xFE, + '\u00A0' to 0xFF, + ) +} diff --git a/escpos4k/src/commonMain/kotlin/cz/multiplatform/escpos4k/core/encoding/charset/IBM850.kt b/escpos4k/src/commonMain/kotlin/cz/multiplatform/escpos4k/core/encoding/charset/IBM850.kt new file mode 100644 index 0000000..9f915bf --- /dev/null +++ b/escpos4k/src/commonMain/kotlin/cz/multiplatform/escpos4k/core/encoding/charset/IBM850.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 2 [CP850: Multilingual] */ +public data object IBM850 : Charset(2, "IBM850") { + override val mapping: Map = + mapOf( + '\u00C7' to 0x80, + '\u00FC' to 0x81, + '\u00E9' to 0x82, + '\u00E2' to 0x83, + '\u00E4' to 0x84, + '\u00E0' to 0x85, + '\u00E5' to 0x86, + '\u00E7' to 0x87, + '\u00EA' to 0x88, + '\u00EB' to 0x89, + '\u00E8' to 0x8A, + '\u00EF' to 0x8B, + '\u00EE' to 0x8C, + '\u00EC' to 0x8D, + '\u00C4' to 0x8E, + '\u00C5' to 0x8F, + '\u00C9' to 0x90, + '\u00E6' to 0x91, + '\u00C6' to 0x92, + '\u00F4' to 0x93, + '\u00F6' to 0x94, + '\u00F2' to 0x95, + '\u00FB' to 0x96, + '\u00F9' to 0x97, + '\u00FF' to 0x98, + '\u00D6' to 0x99, + '\u00DC' to 0x9A, + '\u00F8' to 0x9B, + '\u00A3' to 0x9C, + '\u00D8' to 0x9D, + '\u00D7' to 0x9E, + '\u0192' to 0x9F, + '\u00E1' to 0xA0, + '\u00ED' to 0xA1, + '\u00F3' to 0xA2, + '\u00FA' to 0xA3, + '\u00F1' to 0xA4, + '\u00D1' to 0xA5, + '\u00AA' to 0xA6, + '\u00BA' to 0xA7, + '\u00BF' to 0xA8, + '\u00AE' to 0xA9, + '\u00AC' to 0xAA, + '\u00BD' to 0xAB, + '\u00BC' to 0xAC, + '\u00A1' to 0xAD, + '\u00AB' to 0xAE, + '\u00BB' to 0xAF, + '\u2591' to 0xB0, + '\u2592' to 0xB1, + '\u2593' to 0xB2, + '\u2502' to 0xB3, + '\u2524' to 0xB4, + '\u00C1' to 0xB5, + '\u00C2' to 0xB6, + '\u00C0' to 0xB7, + '\u00A9' to 0xB8, + '\u2563' to 0xB9, + '\u2551' to 0xBA, + '\u2557' to 0xBB, + '\u255D' to 0xBC, + '\u00A2' to 0xBD, + '\u00A5' to 0xBE, + '\u2510' to 0xBF, + '\u2514' to 0xC0, + '\u2534' to 0xC1, + '\u252C' to 0xC2, + '\u251C' to 0xC3, + '\u2500' to 0xC4, + '\u253C' to 0xC5, + '\u00E3' to 0xC6, + '\u00C3' to 0xC7, + '\u255A' to 0xC8, + '\u2554' to 0xC9, + '\u2569' to 0xCA, + '\u2566' to 0xCB, + '\u2560' to 0xCC, + '\u2550' to 0xCD, + '\u256C' to 0xCE, + '\u00A4' to 0xCF, + '\u00F0' to 0xD0, + '\u00D0' to 0xD1, + '\u00CA' to 0xD2, + '\u00CB' to 0xD3, + '\u00C8' to 0xD4, + '\u0131' to 0xD5, + '\u00CD' to 0xD6, + '\u00CE' to 0xD7, + '\u00CF' to 0xD8, + '\u2518' to 0xD9, + '\u250C' to 0xDA, + '\u2588' to 0xDB, + '\u2584' to 0xDC, + '\u00A6' to 0xDD, + '\u00CC' to 0xDE, + '\u2580' to 0xDF, + '\u00D3' to 0xE0, + '\u00DF' to 0xE1, + '\u00D4' to 0xE2, + '\u00D2' to 0xE3, + '\u00F5' to 0xE4, + '\u00D5' to 0xE5, + '\u00B5' to 0xE6, + '\u00FE' to 0xE7, + '\u00DE' to 0xE8, + '\u00DA' to 0xE9, + '\u00DB' to 0xEA, + '\u00D9' to 0xEB, + '\u00FD' to 0xEC, + '\u00DD' to 0xED, + '\u00AF' to 0xEE, + '\u00B4' to 0xEF, + '\u00AD' to 0xF0, + '\u00B1' to 0xF1, + '\u2017' to 0xF2, + '\u00BE' to 0xF3, + '\u00B6' to 0xF4, + '\u00A7' to 0xF5, + '\u00F7' to 0xF6, + '\u00B8' to 0xF7, + '\u00B0' to 0xF8, + '\u00A8' to 0xF9, + '\u00B7' to 0xFA, + '\u00B9' to 0xFB, + '\u00B3' to 0xFC, + '\u00B2' to 0xFD, + '\u25A0' to 0xFE, + '\u00A0' to 0xFF, + ) +} diff --git a/escpos4k/src/commonMain/kotlin/cz/multiplatform/escpos4k/core/encoding/charset/IBM852.kt b/escpos4k/src/commonMain/kotlin/cz/multiplatform/escpos4k/core/encoding/charset/IBM852.kt new file mode 100644 index 0000000..40fba48 --- /dev/null +++ b/escpos4k/src/commonMain/kotlin/cz/multiplatform/escpos4k/core/encoding/charset/IBM852.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 18 [CP852: Latin 2] */ +public data object IBM852 : Charset(18, "IBM852") { + override val mapping: Map = + mapOf( + '\u00C7' to 0x80, + '\u00FC' to 0x81, + '\u00E9' to 0x82, + '\u00E2' to 0x83, + '\u00E4' to 0x84, + '\u016F' to 0x85, + '\u0107' to 0x86, + '\u00E7' to 0x87, + '\u0142' to 0x88, + '\u00EB' to 0x89, + '\u0150' to 0x8A, + '\u0151' to 0x8B, + '\u00EE' to 0x8C, + '\u0179' to 0x8D, + '\u00C4' to 0x8E, + '\u0106' to 0x8F, + '\u00C9' to 0x90, + '\u0139' to 0x91, + '\u013A' to 0x92, + '\u00F4' to 0x93, + '\u00F6' to 0x94, + '\u013D' to 0x95, + '\u013E' to 0x96, + '\u015A' to 0x97, + '\u015B' to 0x98, + '\u00D6' to 0x99, + '\u00DC' to 0x9A, + '\u0164' to 0x9B, + '\u0165' to 0x9C, + '\u0141' to 0x9D, + '\u00D7' to 0x9E, + '\u010D' to 0x9F, + '\u00E1' to 0xA0, + '\u00ED' to 0xA1, + '\u00F3' to 0xA2, + '\u00FA' to 0xA3, + '\u0104' to 0xA4, + '\u0105' to 0xA5, + '\u017D' to 0xA6, + '\u017E' to 0xA7, + '\u0118' to 0xA8, + '\u0119' to 0xA9, + '\u00AC' to 0xAA, + '\u017A' to 0xAB, + '\u010C' to 0xAC, + '\u015F' to 0xAD, + '\u00AB' to 0xAE, + '\u00BB' to 0xAF, + '\u2591' to 0xB0, + '\u2592' to 0xB1, + '\u2593' to 0xB2, + '\u2502' to 0xB3, + '\u2524' to 0xB4, + '\u00C1' to 0xB5, + '\u00C2' to 0xB6, + '\u011A' to 0xB7, + '\u015E' to 0xB8, + '\u2563' to 0xB9, + '\u2551' to 0xBA, + '\u2557' to 0xBB, + '\u255D' to 0xBC, + '\u017B' to 0xBD, + '\u017C' to 0xBE, + '\u2510' to 0xBF, + '\u2514' to 0xC0, + '\u2534' to 0xC1, + '\u252C' to 0xC2, + '\u251C' to 0xC3, + '\u2500' to 0xC4, + '\u253C' to 0xC5, + '\u0102' to 0xC6, + '\u0103' to 0xC7, + '\u255A' to 0xC8, + '\u2554' to 0xC9, + '\u2569' to 0xCA, + '\u2566' to 0xCB, + '\u2560' to 0xCC, + '\u2550' to 0xCD, + '\u256C' to 0xCE, + '\u00A4' to 0xCF, + '\u0111' to 0xD0, + '\u0110' to 0xD1, + '\u010E' to 0xD2, + '\u00CB' to 0xD3, + '\u010F' to 0xD4, + '\u0147' to 0xD5, + '\u00CD' to 0xD6, + '\u00CE' to 0xD7, + '\u011B' to 0xD8, + '\u2518' to 0xD9, + '\u250C' to 0xDA, + '\u2588' to 0xDB, + '\u2584' to 0xDC, + '\u0162' to 0xDD, + '\u016E' to 0xDE, + '\u2580' to 0xDF, + '\u00D3' to 0xE0, + '\u00DF' to 0xE1, + '\u00D4' to 0xE2, + '\u0143' to 0xE3, + '\u0144' to 0xE4, + '\u0148' to 0xE5, + '\u0160' to 0xE6, + '\u0161' to 0xE7, + '\u0154' to 0xE8, + '\u00DA' to 0xE9, + '\u0155' to 0xEA, + '\u0170' to 0xEB, + '\u00FD' to 0xEC, + '\u00DD' to 0xED, + '\u0163' to 0xEE, + '\u00B4' to 0xEF, + '\u00AD' to 0xF0, + '\u02DD' to 0xF1, + '\u02DB' to 0xF2, + '\u02C7' to 0xF3, + '\u02D8' to 0xF4, + '\u00A7' to 0xF5, + '\u00F7' to 0xF6, + '\u00B8' to 0xF7, + '\u00B0' to 0xF8, + '\u00A8' to 0xF9, + '\u02D9' to 0xFA, + '\u0171' to 0xFB, + '\u0158' to 0xFC, + '\u0159' to 0xFD, + '\u25A0' to 0xFE, + '\u00A0' to 0xFF, + ) +} diff --git a/escpos4k/src/commonMain/kotlin/cz/multiplatform/escpos4k/core/encoding/charset/IBM855.kt b/escpos4k/src/commonMain/kotlin/cz/multiplatform/escpos4k/core/encoding/charset/IBM855.kt new file mode 100644 index 0000000..d3beef9 --- /dev/null +++ b/escpos4k/src/commonMain/kotlin/cz/multiplatform/escpos4k/core/encoding/charset/IBM855.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 34 [CP855: Cyrillic] */ +public data object IBM855 : Charset(34, "IBM855") { + override val mapping: Map = + mapOf( + '\u0452' to 0x80, + '\u0402' to 0x81, + '\u0453' to 0x82, + '\u0403' to 0x83, + '\u0451' to 0x84, + '\u0401' to 0x85, + '\u0454' to 0x86, + '\u0404' to 0x87, + '\u0455' to 0x88, + '\u0405' to 0x89, + '\u0456' to 0x8A, + '\u0406' to 0x8B, + '\u0457' to 0x8C, + '\u0407' to 0x8D, + '\u0458' to 0x8E, + '\u0408' to 0x8F, + '\u0459' to 0x90, + '\u0409' to 0x91, + '\u045A' to 0x92, + '\u040A' to 0x93, + '\u045B' to 0x94, + '\u040B' to 0x95, + '\u045C' to 0x96, + '\u040C' to 0x97, + '\u045E' to 0x98, + '\u040E' to 0x99, + '\u045F' to 0x9A, + '\u040F' to 0x9B, + '\u044E' to 0x9C, + '\u042E' to 0x9D, + '\u044A' to 0x9E, + '\u042A' to 0x9F, + '\u0430' to 0xA0, + '\u0410' to 0xA1, + '\u0431' to 0xA2, + '\u0411' to 0xA3, + '\u0446' to 0xA4, + '\u0426' to 0xA5, + '\u0434' to 0xA6, + '\u0414' to 0xA7, + '\u0435' to 0xA8, + '\u0415' to 0xA9, + '\u0444' to 0xAA, + '\u0424' to 0xAB, + '\u0433' to 0xAC, + '\u0413' to 0xAD, + '\u00AB' to 0xAE, + '\u00BB' to 0xAF, + '\u2591' to 0xB0, + '\u2592' to 0xB1, + '\u2593' to 0xB2, + '\u2502' to 0xB3, + '\u2524' to 0xB4, + '\u0445' to 0xB5, + '\u0425' to 0xB6, + '\u0438' to 0xB7, + '\u0418' to 0xB8, + '\u2563' to 0xB9, + '\u2551' to 0xBA, + '\u2557' to 0xBB, + '\u255D' to 0xBC, + '\u0439' to 0xBD, + '\u0419' to 0xBE, + '\u2510' to 0xBF, + '\u2514' to 0xC0, + '\u2534' to 0xC1, + '\u252C' to 0xC2, + '\u251C' to 0xC3, + '\u2500' to 0xC4, + '\u253C' to 0xC5, + '\u043A' to 0xC6, + '\u041A' to 0xC7, + '\u255A' to 0xC8, + '\u2554' to 0xC9, + '\u2569' to 0xCA, + '\u2566' to 0xCB, + '\u2560' to 0xCC, + '\u2550' to 0xCD, + '\u256C' to 0xCE, + '\u00A4' to 0xCF, + '\u043B' to 0xD0, + '\u041B' to 0xD1, + '\u043C' to 0xD2, + '\u041C' to 0xD3, + '\u043D' to 0xD4, + '\u041D' to 0xD5, + '\u043E' to 0xD6, + '\u041E' to 0xD7, + '\u043F' to 0xD8, + '\u2518' to 0xD9, + '\u250C' to 0xDA, + '\u2588' to 0xDB, + '\u2584' to 0xDC, + '\u041F' to 0xDD, + '\u044F' to 0xDE, + '\u2580' to 0xDF, + '\u042F' to 0xE0, + '\u0440' to 0xE1, + '\u0420' to 0xE2, + '\u0441' to 0xE3, + '\u0421' to 0xE4, + '\u0442' to 0xE5, + '\u0422' to 0xE6, + '\u0443' to 0xE7, + '\u0423' to 0xE8, + '\u0436' to 0xE9, + '\u0416' to 0xEA, + '\u0432' to 0xEB, + '\u0412' to 0xEC, + '\u044C' to 0xED, + '\u042C' to 0xEE, + '\u2116' to 0xEF, + '\u00AD' to 0xF0, + '\u044B' to 0xF1, + '\u042B' to 0xF2, + '\u0437' to 0xF3, + '\u0417' to 0xF4, + '\u0448' to 0xF5, + '\u0428' to 0xF6, + '\u044D' to 0xF7, + '\u042D' to 0xF8, + '\u0449' to 0xF9, + '\u0429' to 0xFA, + '\u0447' to 0xFB, + '\u0427' to 0xFC, + '\u00A7' to 0xFD, + '\u25A0' to 0xFE, + '\u00A0' to 0xFF, + ) +} diff --git a/escpos4k/src/commonMain/kotlin/cz/multiplatform/escpos4k/core/encoding/charset/IBM857.kt b/escpos4k/src/commonMain/kotlin/cz/multiplatform/escpos4k/core/encoding/charset/IBM857.kt new file mode 100644 index 0000000..9094672 --- /dev/null +++ b/escpos4k/src/commonMain/kotlin/cz/multiplatform/escpos4k/core/encoding/charset/IBM857.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 13 [CP857: Turkish] */ +public data object IBM857 : Charset(13, "IBM857") { + override val mapping: Map = + mapOf( + '\u00C7' to 0x80, + '\u00FC' to 0x81, + '\u00E9' to 0x82, + '\u00E2' to 0x83, + '\u00E4' to 0x84, + '\u00E0' to 0x85, + '\u00E5' to 0x86, + '\u00E7' to 0x87, + '\u00EA' to 0x88, + '\u00EB' to 0x89, + '\u00E8' to 0x8A, + '\u00EF' to 0x8B, + '\u00EE' to 0x8C, + '\u0131' to 0x8D, + '\u00C4' to 0x8E, + '\u00C5' to 0x8F, + '\u00C9' to 0x90, + '\u00E6' to 0x91, + '\u00C6' to 0x92, + '\u00F4' to 0x93, + '\u00F6' to 0x94, + '\u00F2' to 0x95, + '\u00FB' to 0x96, + '\u00F9' to 0x97, + '\u0130' to 0x98, + '\u00D6' to 0x99, + '\u00DC' to 0x9A, + '\u00F8' to 0x9B, + '\u00A3' to 0x9C, + '\u00D8' to 0x9D, + '\u015E' to 0x9E, + '\u015F' to 0x9F, + '\u00E1' to 0xA0, + '\u00ED' to 0xA1, + '\u00F3' to 0xA2, + '\u00FA' to 0xA3, + '\u00F1' to 0xA4, + '\u00D1' to 0xA5, + '\u011E' to 0xA6, + '\u011F' to 0xA7, + '\u00BF' to 0xA8, + '\u00AE' to 0xA9, + '\u00AC' to 0xAA, + '\u00BD' to 0xAB, + '\u00BC' to 0xAC, + '\u00A1' to 0xAD, + '\u00AB' to 0xAE, + '\u00BB' to 0xAF, + '\u2591' to 0xB0, + '\u2592' to 0xB1, + '\u2593' to 0xB2, + '\u2502' to 0xB3, + '\u2524' to 0xB4, + '\u00C1' to 0xB5, + '\u00C2' to 0xB6, + '\u00C0' to 0xB7, + '\u00A9' to 0xB8, + '\u2563' to 0xB9, + '\u2551' to 0xBA, + '\u2557' to 0xBB, + '\u255D' to 0xBC, + '\u00A2' to 0xBD, + '\u00A5' to 0xBE, + '\u2510' to 0xBF, + '\u2514' to 0xC0, + '\u2534' to 0xC1, + '\u252C' to 0xC2, + '\u251C' to 0xC3, + '\u2500' to 0xC4, + '\u253C' to 0xC5, + '\u00E3' to 0xC6, + '\u00C3' to 0xC7, + '\u255A' to 0xC8, + '\u2554' to 0xC9, + '\u2569' to 0xCA, + '\u2566' to 0xCB, + '\u2560' to 0xCC, + '\u2550' to 0xCD, + '\u256C' to 0xCE, + '\u00A4' to 0xCF, + '\u00BA' to 0xD0, + '\u00AA' to 0xD1, + '\u00CA' to 0xD2, + '\u00CB' to 0xD3, + '\u00C8' to 0xD4, + '\uFFFD' to 0xD5, + '\u00CD' to 0xD6, + '\u00CE' to 0xD7, + '\u00CF' to 0xD8, + '\u2518' to 0xD9, + '\u250C' to 0xDA, + '\u2588' to 0xDB, + '\u2584' to 0xDC, + '\u00A6' to 0xDD, + '\u00CC' to 0xDE, + '\u2580' to 0xDF, + '\u00D3' to 0xE0, + '\u00DF' to 0xE1, + '\u00D4' to 0xE2, + '\u00D2' to 0xE3, + '\u00F5' to 0xE4, + '\u00D5' to 0xE5, + '\u00B5' to 0xE6, + '\uFFFD' to 0xE7, + '\u00D7' to 0xE8, + '\u00DA' to 0xE9, + '\u00DB' to 0xEA, + '\u00D9' to 0xEB, + '\u00EC' to 0xEC, + '\u00FF' to 0xED, + '\u00AF' to 0xEE, + '\u00B4' to 0xEF, + '\u00AD' to 0xF0, + '\u00B1' to 0xF1, + '\uFFFD' to 0xF2, + '\u00BE' to 0xF3, + '\u00B6' to 0xF4, + '\u00A7' to 0xF5, + '\u00F7' to 0xF6, + '\u00B8' to 0xF7, + '\u00B0' to 0xF8, + '\u00A8' to 0xF9, + '\u00B7' to 0xFA, + '\u00B9' to 0xFB, + '\u00B3' to 0xFC, + '\u00B2' to 0xFD, + '\u25A0' to 0xFE, + '\u00A0' to 0xFF, + ) +} diff --git a/escpos4k/src/commonMain/kotlin/cz/multiplatform/escpos4k/core/encoding/charset/IBM858.kt b/escpos4k/src/commonMain/kotlin/cz/multiplatform/escpos4k/core/encoding/charset/IBM858.kt new file mode 100644 index 0000000..ba33442 --- /dev/null +++ b/escpos4k/src/commonMain/kotlin/cz/multiplatform/escpos4k/core/encoding/charset/IBM858.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 19 [CP858: Euro] */ +public data object IBM858 : Charset(19, "IBM00858") { // Note: two leading zeros + override val mapping: Map = + mapOf( + '\u00C7' to 0x80, + '\u00FC' to 0x81, + '\u00E9' to 0x82, + '\u00E2' to 0x83, + '\u00E4' to 0x84, + '\u00E0' to 0x85, + '\u00E5' to 0x86, + '\u00E7' to 0x87, + '\u00EA' to 0x88, + '\u00EB' to 0x89, + '\u00E8' to 0x8A, + '\u00EF' to 0x8B, + '\u00EE' to 0x8C, + '\u00EC' to 0x8D, + '\u00C4' to 0x8E, + '\u00C5' to 0x8F, + '\u00C9' to 0x90, + '\u00E6' to 0x91, + '\u00C6' to 0x92, + '\u00F4' to 0x93, + '\u00F6' to 0x94, + '\u00F2' to 0x95, + '\u00FB' to 0x96, + '\u00F9' to 0x97, + '\u00FF' to 0x98, + '\u00D6' to 0x99, + '\u00DC' to 0x9A, + '\u00F8' to 0x9B, + '\u00A3' to 0x9C, + '\u00D8' to 0x9D, + '\u00D7' to 0x9E, + '\u0192' to 0x9F, + '\u00E1' to 0xA0, + '\u00ED' to 0xA1, + '\u00F3' to 0xA2, + '\u00FA' to 0xA3, + '\u00F1' to 0xA4, + '\u00D1' to 0xA5, + '\u00AA' to 0xA6, + '\u00BA' to 0xA7, + '\u00BF' to 0xA8, + '\u00AE' to 0xA9, + '\u00AC' to 0xAA, + '\u00BD' to 0xAB, + '\u00BC' to 0xAC, + '\u00A1' to 0xAD, + '\u00AB' to 0xAE, + '\u00BB' to 0xAF, + '\u2591' to 0xB0, + '\u2592' to 0xB1, + '\u2593' to 0xB2, + '\u2502' to 0xB3, + '\u2524' to 0xB4, + '\u00C1' to 0xB5, + '\u00C2' to 0xB6, + '\u00C0' to 0xB7, + '\u00A9' to 0xB8, + '\u2563' to 0xB9, + '\u2551' to 0xBA, + '\u2557' to 0xBB, + '\u255D' to 0xBC, + '\u00A2' to 0xBD, + '\u00A5' to 0xBE, + '\u2510' to 0xBF, + '\u2514' to 0xC0, + '\u2534' to 0xC1, + '\u252C' to 0xC2, + '\u251C' to 0xC3, + '\u2500' to 0xC4, + '\u253C' to 0xC5, + '\u00E3' to 0xC6, + '\u00C3' to 0xC7, + '\u255A' to 0xC8, + '\u2554' to 0xC9, + '\u2569' to 0xCA, + '\u2566' to 0xCB, + '\u2560' to 0xCC, + '\u2550' to 0xCD, + '\u256C' to 0xCE, + '\u00A4' to 0xCF, + '\u00F0' to 0xD0, + '\u00D0' to 0xD1, + '\u00CA' to 0xD2, + '\u00CB' to 0xD3, + '\u00C8' to 0xD4, + '\u20AC' to 0xD5, + '\u00CD' to 0xD6, + '\u00CE' to 0xD7, + '\u00CF' to 0xD8, + '\u2518' to 0xD9, + '\u250C' to 0xDA, + '\u2588' to 0xDB, + '\u2584' to 0xDC, + '\u00A6' to 0xDD, + '\u00CC' to 0xDE, + '\u2580' to 0xDF, + '\u00D3' to 0xE0, + '\u00DF' to 0xE1, + '\u00D4' to 0xE2, + '\u00D2' to 0xE3, + '\u00F5' to 0xE4, + '\u00D5' to 0xE5, + '\u00B5' to 0xE6, + '\u00FE' to 0xE7, + '\u00DE' to 0xE8, + '\u00DA' to 0xE9, + '\u00DB' to 0xEA, + '\u00D9' to 0xEB, + '\u00FD' to 0xEC, + '\u00DD' to 0xED, + '\u00AF' to 0xEE, + '\u00B4' to 0xEF, + '\u00AD' to 0xF0, + '\u00B1' to 0xF1, + '\u2017' to 0xF2, + '\u00BE' to 0xF3, + '\u00B6' to 0xF4, + '\u00A7' to 0xF5, + '\u00F7' to 0xF6, + '\u00B8' to 0xF7, + '\u00B0' to 0xF8, + '\u00A8' to 0xF9, + '\u00B7' to 0xFA, + '\u00B9' to 0xFB, + '\u00B3' to 0xFC, + '\u00B2' to 0xFD, + '\u25A0' to 0xFE, + '\u00A0' to 0xFF, + ) +} diff --git a/escpos4k/src/commonMain/kotlin/cz/multiplatform/escpos4k/core/encoding/charset/IBM860.kt b/escpos4k/src/commonMain/kotlin/cz/multiplatform/escpos4k/core/encoding/charset/IBM860.kt new file mode 100644 index 0000000..c084ec0 --- /dev/null +++ b/escpos4k/src/commonMain/kotlin/cz/multiplatform/escpos4k/core/encoding/charset/IBM860.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 3 [CP860: Portuguese] */ +public data object IBM860 : Charset(3, "IBM860") { + override val mapping: Map = + mapOf( + '\u00C7' to 0x80, + '\u00FC' to 0x81, + '\u00E9' to 0x82, + '\u00E2' to 0x83, + '\u00E3' to 0x84, + '\u00E0' to 0x85, + '\u00C1' to 0x86, + '\u00E7' to 0x87, + '\u00EA' to 0x88, + '\u00CA' to 0x89, + '\u00E8' to 0x8A, + '\u00CD' to 0x8B, + '\u00D4' to 0x8C, + '\u00EC' to 0x8D, + '\u00C3' to 0x8E, + '\u00C2' to 0x8F, + '\u00C9' to 0x90, + '\u00C0' to 0x91, + '\u00C8' to 0x92, + '\u00F4' to 0x93, + '\u00F5' to 0x94, + '\u00F2' to 0x95, + '\u00DA' to 0x96, + '\u00F9' to 0x97, + '\u00CC' to 0x98, + '\u00D5' to 0x99, + '\u00DC' to 0x9A, + '\u00A2' to 0x9B, + '\u00A3' to 0x9C, + '\u00D9' to 0x9D, + '\u20A7' to 0x9E, + '\u00D3' to 0x9F, + '\u00E1' to 0xA0, + '\u00ED' to 0xA1, + '\u00F3' to 0xA2, + '\u00FA' to 0xA3, + '\u00F1' to 0xA4, + '\u00D1' to 0xA5, + '\u00AA' to 0xA6, + '\u00BA' to 0xA7, + '\u00BF' to 0xA8, + '\u00D2' to 0xA9, + '\u00AC' to 0xAA, + '\u00BD' to 0xAB, + '\u00BC' to 0xAC, + '\u00A1' to 0xAD, + '\u00AB' to 0xAE, + '\u00BB' to 0xAF, + '\u2591' to 0xB0, + '\u2592' to 0xB1, + '\u2593' to 0xB2, + '\u2502' to 0xB3, + '\u2524' to 0xB4, + '\u2561' to 0xB5, + '\u2562' to 0xB6, + '\u2556' to 0xB7, + '\u2555' to 0xB8, + '\u2563' to 0xB9, + '\u2551' to 0xBA, + '\u2557' to 0xBB, + '\u255D' to 0xBC, + '\u255C' to 0xBD, + '\u255B' to 0xBE, + '\u2510' to 0xBF, + '\u2514' to 0xC0, + '\u2534' to 0xC1, + '\u252C' to 0xC2, + '\u251C' to 0xC3, + '\u2500' to 0xC4, + '\u253C' to 0xC5, + '\u255E' to 0xC6, + '\u255F' to 0xC7, + '\u255A' to 0xC8, + '\u2554' to 0xC9, + '\u2569' to 0xCA, + '\u2566' to 0xCB, + '\u2560' to 0xCC, + '\u2550' to 0xCD, + '\u256C' to 0xCE, + '\u2567' to 0xCF, + '\u2568' to 0xD0, + '\u2564' to 0xD1, + '\u2565' to 0xD2, + '\u2559' to 0xD3, + '\u2558' to 0xD4, + '\u2552' to 0xD5, + '\u2553' to 0xD6, + '\u256B' to 0xD7, + '\u256A' to 0xD8, + '\u2518' to 0xD9, + '\u250C' to 0xDA, + '\u2588' to 0xDB, + '\u2584' to 0xDC, + '\u258C' to 0xDD, + '\u2590' to 0xDE, + '\u2580' to 0xDF, + '\u03B1' to 0xE0, + '\u00DF' to 0xE1, + '\u0393' to 0xE2, + '\u03C0' to 0xE3, + '\u03A3' to 0xE4, + '\u03C3' to 0xE5, + '\u00B5' to 0xE6, + '\u03C4' to 0xE7, + '\u03A6' to 0xE8, + '\u0398' to 0xE9, + '\u03A9' to 0xEA, + '\u03B4' to 0xEB, + '\u221E' to 0xEC, + '\u03C6' to 0xED, + '\u03B5' to 0xEE, + '\u2229' to 0xEF, + '\u2261' to 0xF0, + '\u00B1' to 0xF1, + '\u2265' to 0xF2, + '\u2264' to 0xF3, + '\u2320' to 0xF4, + '\u2321' to 0xF5, + '\u00F7' to 0xF6, + '\u2248' to 0xF7, + '\u00B0' to 0xF8, + '\u2219' to 0xF9, + '\u00B7' to 0xFA, + '\u221A' to 0xFB, + '\u207F' to 0xFC, + '\u00B2' to 0xFD, + '\u25A0' to 0xFE, + '\u00A0' to 0xFF, + ) +} diff --git a/escpos4k/src/commonMain/kotlin/cz/multiplatform/escpos4k/core/encoding/charset/IBM861.kt b/escpos4k/src/commonMain/kotlin/cz/multiplatform/escpos4k/core/encoding/charset/IBM861.kt new file mode 100644 index 0000000..958f811 --- /dev/null +++ b/escpos4k/src/commonMain/kotlin/cz/multiplatform/escpos4k/core/encoding/charset/IBM861.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 35 [CP861: Icelandic] */ +public data object IBM861 : Charset(35, "IBM861") { + override val mapping: Map = + mapOf( + '\u00C7' to 0x80, + '\u00FC' to 0x81, + '\u00E9' to 0x82, + '\u00E2' to 0x83, + '\u00E4' to 0x84, + '\u00E0' to 0x85, + '\u00E5' to 0x86, + '\u00E7' to 0x87, + '\u00EA' to 0x88, + '\u00EB' to 0x89, + '\u00E8' to 0x8A, + '\u00D0' to 0x8B, + '\u00F0' to 0x8C, + '\u00DE' to 0x8D, + '\u00C4' to 0x8E, + '\u00C5' to 0x8F, + '\u00C9' to 0x90, + '\u00E6' to 0x91, + '\u00C6' to 0x92, + '\u00F4' to 0x93, + '\u00F6' to 0x94, + '\u00FE' to 0x95, + '\u00FB' to 0x96, + '\u00DD' to 0x97, + '\u00FD' to 0x98, + '\u00D6' to 0x99, + '\u00DC' to 0x9A, + '\u00F8' to 0x9B, + '\u00A3' to 0x9C, + '\u00D8' to 0x9D, + '\u20A7' to 0x9E, + '\u0192' to 0x9F, + '\u00E1' to 0xA0, + '\u00ED' to 0xA1, + '\u00F3' to 0xA2, + '\u00FA' to 0xA3, + '\u00C1' to 0xA4, + '\u00CD' to 0xA5, + '\u00D3' to 0xA6, + '\u00DA' to 0xA7, + '\u00BF' to 0xA8, + '\u2310' to 0xA9, + '\u00AC' to 0xAA, + '\u00BD' to 0xAB, + '\u00BC' to 0xAC, + '\u00A1' to 0xAD, + '\u00AB' to 0xAE, + '\u00BB' to 0xAF, + '\u2591' to 0xB0, + '\u2592' to 0xB1, + '\u2593' to 0xB2, + '\u2502' to 0xB3, + '\u2524' to 0xB4, + '\u2561' to 0xB5, + '\u2562' to 0xB6, + '\u2556' to 0xB7, + '\u2555' to 0xB8, + '\u2563' to 0xB9, + '\u2551' to 0xBA, + '\u2557' to 0xBB, + '\u255D' to 0xBC, + '\u255C' to 0xBD, + '\u255B' to 0xBE, + '\u2510' to 0xBF, + '\u2514' to 0xC0, + '\u2534' to 0xC1, + '\u252C' to 0xC2, + '\u251C' to 0xC3, + '\u2500' to 0xC4, + '\u253C' to 0xC5, + '\u255E' to 0xC6, + '\u255F' to 0xC7, + '\u255A' to 0xC8, + '\u2554' to 0xC9, + '\u2569' to 0xCA, + '\u2566' to 0xCB, + '\u2560' to 0xCC, + '\u2550' to 0xCD, + '\u256C' to 0xCE, + '\u2567' to 0xCF, + '\u2568' to 0xD0, + '\u2564' to 0xD1, + '\u2565' to 0xD2, + '\u2559' to 0xD3, + '\u2558' to 0xD4, + '\u2552' to 0xD5, + '\u2553' to 0xD6, + '\u256B' to 0xD7, + '\u256A' to 0xD8, + '\u2518' to 0xD9, + '\u250C' to 0xDA, + '\u2588' to 0xDB, + '\u2584' to 0xDC, + '\u258C' to 0xDD, + '\u2590' to 0xDE, + '\u2580' to 0xDF, + '\u03B1' to 0xE0, + '\u00DF' to 0xE1, + '\u0393' to 0xE2, + '\u03C0' to 0xE3, + '\u03A3' to 0xE4, + '\u03C3' to 0xE5, + '\u00B5' to 0xE6, + '\u03C4' to 0xE7, + '\u03A6' to 0xE8, + '\u0398' to 0xE9, + '\u03A9' to 0xEA, + '\u03B4' to 0xEB, + '\u221E' to 0xEC, + '\u03C6' to 0xED, + '\u03B5' to 0xEE, + '\u2229' to 0xEF, + '\u2261' to 0xF0, + '\u00B1' to 0xF1, + '\u2265' to 0xF2, + '\u2264' to 0xF3, + '\u2320' to 0xF4, + '\u2321' to 0xF5, + '\u00F7' to 0xF6, + '\u2248' to 0xF7, + '\u00B0' to 0xF8, + '\u2219' to 0xF9, + '\u00B7' to 0xFA, + '\u221A' to 0xFB, + '\u207F' to 0xFC, + '\u00B2' to 0xFD, + '\u25A0' to 0xFE, + '\u00A0' to 0xFF, + ) +} diff --git a/escpos4k/src/commonMain/kotlin/cz/multiplatform/escpos4k/core/encoding/charset/IBM862.kt b/escpos4k/src/commonMain/kotlin/cz/multiplatform/escpos4k/core/encoding/charset/IBM862.kt new file mode 100644 index 0000000..771fe71 --- /dev/null +++ b/escpos4k/src/commonMain/kotlin/cz/multiplatform/escpos4k/core/encoding/charset/IBM862.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 36 [CP862: Hebrew] */ +public data object IBM862 : Charset(36, "IBM862") { + override val mapping: Map = + mapOf( + '\u05D0' to 0x80, + '\u05D1' to 0x81, + '\u05D2' to 0x82, + '\u05D3' to 0x83, + '\u05D4' to 0x84, + '\u05D5' to 0x85, + '\u05D6' to 0x86, + '\u05D7' to 0x87, + '\u05D8' to 0x88, + '\u05D9' to 0x89, + '\u05DA' to 0x8A, + '\u05DB' to 0x8B, + '\u05DC' to 0x8C, + '\u05DD' to 0x8D, + '\u05DE' to 0x8E, + '\u05DF' to 0x8F, + '\u05E0' to 0x90, + '\u05E1' to 0x91, + '\u05E2' to 0x92, + '\u05E3' to 0x93, + '\u05E4' to 0x94, + '\u05E5' to 0x95, + '\u05E6' to 0x96, + '\u05E7' to 0x97, + '\u05E8' to 0x98, + '\u05E9' to 0x99, + '\u05EA' to 0x9A, + '\u00A2' to 0x9B, + '\u00A3' to 0x9C, + '\u00A5' to 0x9D, + '\u20A7' to 0x9E, + '\u0192' to 0x9F, + '\u00E1' to 0xA0, + '\u00ED' to 0xA1, + '\u00F3' to 0xA2, + '\u00FA' to 0xA3, + '\u00F1' to 0xA4, + '\u00D1' to 0xA5, + '\u00AA' to 0xA6, + '\u00BA' to 0xA7, + '\u00BF' to 0xA8, + '\u2310' to 0xA9, + '\u00AC' to 0xAA, + '\u00BD' to 0xAB, + '\u00BC' to 0xAC, + '\u00A1' to 0xAD, + '\u00AB' to 0xAE, + '\u00BB' to 0xAF, + '\u2591' to 0xB0, + '\u2592' to 0xB1, + '\u2593' to 0xB2, + '\u2502' to 0xB3, + '\u2524' to 0xB4, + '\u2561' to 0xB5, + '\u2562' to 0xB6, + '\u2556' to 0xB7, + '\u2555' to 0xB8, + '\u2563' to 0xB9, + '\u2551' to 0xBA, + '\u2557' to 0xBB, + '\u255D' to 0xBC, + '\u255C' to 0xBD, + '\u255B' to 0xBE, + '\u2510' to 0xBF, + '\u2514' to 0xC0, + '\u2534' to 0xC1, + '\u252C' to 0xC2, + '\u251C' to 0xC3, + '\u2500' to 0xC4, + '\u253C' to 0xC5, + '\u255E' to 0xC6, + '\u255F' to 0xC7, + '\u255A' to 0xC8, + '\u2554' to 0xC9, + '\u2569' to 0xCA, + '\u2566' to 0xCB, + '\u2560' to 0xCC, + '\u2550' to 0xCD, + '\u256C' to 0xCE, + '\u2567' to 0xCF, + '\u2568' to 0xD0, + '\u2564' to 0xD1, + '\u2565' to 0xD2, + '\u2559' to 0xD3, + '\u2558' to 0xD4, + '\u2552' to 0xD5, + '\u2553' to 0xD6, + '\u256B' to 0xD7, + '\u256A' to 0xD8, + '\u2518' to 0xD9, + '\u250C' to 0xDA, + '\u2588' to 0xDB, + '\u2584' to 0xDC, + '\u258C' to 0xDD, + '\u2590' to 0xDE, + '\u2580' to 0xDF, + '\u03B1' to 0xE0, + '\u00DF' to 0xE1, + '\u0393' to 0xE2, + '\u03C0' to 0xE3, + '\u03A3' to 0xE4, + '\u03C3' to 0xE5, + '\u00B5' to 0xE6, + '\u03C4' to 0xE7, + '\u03A6' to 0xE8, + '\u0398' to 0xE9, + '\u03A9' to 0xEA, + '\u03B4' to 0xEB, + '\u221E' to 0xEC, + '\u03C6' to 0xED, + '\u03B5' to 0xEE, + '\u2229' to 0xEF, + '\u2261' to 0xF0, + '\u00B1' to 0xF1, + '\u2265' to 0xF2, + '\u2264' to 0xF3, + '\u2320' to 0xF4, + '\u2321' to 0xF5, + '\u00F7' to 0xF6, + '\u2248' to 0xF7, + '\u00B0' to 0xF8, + '\u2219' to 0xF9, + '\u00B7' to 0xFA, + '\u221A' to 0xFB, + '\u207F' to 0xFC, + '\u00B2' to 0xFD, + '\u25A0' to 0xFE, + '\u00A0' to 0xFF, + ) +} diff --git a/escpos4k/src/commonMain/kotlin/cz/multiplatform/escpos4k/core/encoding/charset/IBM863.kt b/escpos4k/src/commonMain/kotlin/cz/multiplatform/escpos4k/core/encoding/charset/IBM863.kt new file mode 100644 index 0000000..f8fbcaa --- /dev/null +++ b/escpos4k/src/commonMain/kotlin/cz/multiplatform/escpos4k/core/encoding/charset/IBM863.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 4 [CP863: Canadian-French] */ +public data object IBM863 : Charset(4, "IBM863") { + override val mapping: Map = + mapOf( + '\u00C7' to 0x80, + '\u00FC' to 0x81, + '\u00E9' to 0x82, + '\u00E2' to 0x83, + '\u00C2' to 0x84, + '\u00E0' to 0x85, + '\u00B6' to 0x86, + '\u00E7' to 0x87, + '\u00EA' to 0x88, + '\u00EB' to 0x89, + '\u00E8' to 0x8A, + '\u00EF' to 0x8B, + '\u00EE' to 0x8C, + '\u2017' to 0x8D, + '\u00C0' to 0x8E, + '\u00A7' to 0x8F, + '\u00C9' to 0x90, + '\u00C8' to 0x91, + '\u00CA' to 0x92, + '\u00F4' to 0x93, + '\u00CB' to 0x94, + '\u00CF' to 0x95, + '\u00FB' to 0x96, + '\u00F9' to 0x97, + '\u00A4' to 0x98, + '\u00D4' to 0x99, + '\u00DC' to 0x9A, + '\u00A2' to 0x9B, + '\u00A3' to 0x9C, + '\u00D9' to 0x9D, + '\u00DB' to 0x9E, + '\u0192' to 0x9F, + '\u00A6' to 0xA0, + '\u00B4' to 0xA1, + '\u00F3' to 0xA2, + '\u00FA' to 0xA3, + '\u00A8' to 0xA4, + '\u00B8' to 0xA5, + '\u00B3' to 0xA6, + '\u00AF' to 0xA7, + '\u00CE' to 0xA8, + '\u2310' to 0xA9, + '\u00AC' to 0xAA, + '\u00BD' to 0xAB, + '\u00BC' to 0xAC, + '\u00BE' to 0xAD, + '\u00AB' to 0xAE, + '\u00BB' to 0xAF, + '\u2591' to 0xB0, + '\u2592' to 0xB1, + '\u2593' to 0xB2, + '\u2502' to 0xB3, + '\u2524' to 0xB4, + '\u2561' to 0xB5, + '\u2562' to 0xB6, + '\u2556' to 0xB7, + '\u2555' to 0xB8, + '\u2563' to 0xB9, + '\u2551' to 0xBA, + '\u2557' to 0xBB, + '\u255D' to 0xBC, + '\u255C' to 0xBD, + '\u255B' to 0xBE, + '\u2510' to 0xBF, + '\u2514' to 0xC0, + '\u2534' to 0xC1, + '\u252C' to 0xC2, + '\u251C' to 0xC3, + '\u2500' to 0xC4, + '\u253C' to 0xC5, + '\u255E' to 0xC6, + '\u255F' to 0xC7, + '\u255A' to 0xC8, + '\u2554' to 0xC9, + '\u2569' to 0xCA, + '\u2566' to 0xCB, + '\u2560' to 0xCC, + '\u2550' to 0xCD, + '\u256C' to 0xCE, + '\u2567' to 0xCF, + '\u2568' to 0xD0, + '\u2564' to 0xD1, + '\u2565' to 0xD2, + '\u2559' to 0xD3, + '\u2558' to 0xD4, + '\u2552' to 0xD5, + '\u2553' to 0xD6, + '\u256B' to 0xD7, + '\u256A' to 0xD8, + '\u2518' to 0xD9, + '\u250C' to 0xDA, + '\u2588' to 0xDB, + '\u2584' to 0xDC, + '\u258C' to 0xDD, + '\u2590' to 0xDE, + '\u2580' to 0xDF, + '\u03B1' to 0xE0, + '\u00DF' to 0xE1, + '\u0393' to 0xE2, + '\u03C0' to 0xE3, + '\u03A3' to 0xE4, + '\u03C3' to 0xE5, + '\u00B5' to 0xE6, + '\u03C4' to 0xE7, + '\u03A6' to 0xE8, + '\u0398' to 0xE9, + '\u03A9' to 0xEA, + '\u03B4' to 0xEB, + '\u221E' to 0xEC, + '\u03C6' to 0xED, + '\u03B5' to 0xEE, + '\u2229' to 0xEF, + '\u2261' to 0xF0, + '\u00B1' to 0xF1, + '\u2265' to 0xF2, + '\u2264' to 0xF3, + '\u2320' to 0xF4, + '\u2321' to 0xF5, + '\u00F7' to 0xF6, + '\u2248' to 0xF7, + '\u00B0' to 0xF8, + '\u2219' to 0xF9, + '\u00B7' to 0xFA, + '\u221A' to 0xFB, + '\u207F' to 0xFC, + '\u00B2' to 0xFD, + '\u25A0' to 0xFE, + '\u00A0' to 0xFF, + ) +} diff --git a/escpos4k/src/commonMain/kotlin/cz/multiplatform/escpos4k/core/encoding/charset/IBM864.kt b/escpos4k/src/commonMain/kotlin/cz/multiplatform/escpos4k/core/encoding/charset/IBM864.kt new file mode 100644 index 0000000..681b982 --- /dev/null +++ b/escpos4k/src/commonMain/kotlin/cz/multiplatform/escpos4k/core/encoding/charset/IBM864.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 37 [CP864: Arabic] */ +public data object IBM864 : Charset(37, "IBM864") { + override val mapping: Map = + mapOf( + '\u00B0' to 0x80, + '\u00B7' to 0x81, + '\u2219' to 0x82, + '\u221A' to 0x83, + '\u2592' to 0x84, + '\u2500' to 0x85, + '\u2502' to 0x86, + '\u253C' to 0x87, + '\u2524' to 0x88, + '\u252C' to 0x89, + '\u251C' to 0x8A, + '\u2534' to 0x8B, + '\u2510' to 0x8C, + '\u250C' to 0x8D, + '\u2514' to 0x8E, + '\u2518' to 0x8F, + '\u03B2' to 0x90, + '\u221E' to 0x91, + '\u03C6' to 0x92, + '\u00B1' to 0x93, + '\u00BD' to 0x94, + '\u00BC' to 0x95, + '\u2248' to 0x96, + '\u00AB' to 0x97, + '\u00BB' to 0x98, + '\uFEF7' to 0x99, + '\uFEF8' to 0x9A, + '\uFFFD' to 0x9B, + '\uFFFD' to 0x9C, + '\uFEFB' to 0x9D, + '\uFEFC' to 0x9E, + '\uFFFD' to 0x9F, + '\u00A0' to 0xA0, + '\u00AD' to 0xA1, + '\uFE82' to 0xA2, + '\u00A3' to 0xA3, + '\u00A4' to 0xA4, + '\uFE84' to 0xA5, + '\uFFFD' to 0xA6, + '\uFFFD' to 0xA7, + '\uFE8E' to 0xA8, + '\uFE8F' to 0xA9, + '\uFE95' to 0xAA, + '\uFE99' to 0xAB, + '\u060C' to 0xAC, + '\uFE9D' to 0xAD, + '\uFEA1' to 0xAE, + '\uFEA5' to 0xAF, + '\u0660' to 0xB0, + '\u0661' to 0xB1, + '\u0662' to 0xB2, + '\u0663' to 0xB3, + '\u0664' to 0xB4, + '\u0665' to 0xB5, + '\u0666' to 0xB6, + '\u0667' to 0xB7, + '\u0668' to 0xB8, + '\u0669' to 0xB9, + '\uFED1' to 0xBA, + '\u061B' to 0xBB, + '\uFEB1' to 0xBC, + '\uFEB5' to 0xBD, + '\uFEB9' to 0xBE, + '\u061F' to 0xBF, + '\u00A2' to 0xC0, + '\uFE80' to 0xC1, + '\uFE81' to 0xC2, + '\uFE83' to 0xC3, + '\uFE85' to 0xC4, + '\uFECA' to 0xC5, + '\uFE8B' to 0xC6, + '\uFE8D' to 0xC7, + '\uFE91' to 0xC8, + '\uFE93' to 0xC9, + '\uFE97' to 0xCA, + '\uFE9B' to 0xCB, + '\uFE9F' to 0xCC, + '\uFEA3' to 0xCD, + '\uFEA7' to 0xCE, + '\uFEA9' to 0xCF, + '\uFEAB' to 0xD0, + '\uFEAD' to 0xD1, + '\uFEAF' to 0xD2, + '\uFEB3' to 0xD3, + '\uFEB7' to 0xD4, + '\uFEBB' to 0xD5, + '\uFEBF' to 0xD6, + '\uFEC1' to 0xD7, + '\uFEC5' to 0xD8, + '\uFECB' to 0xD9, + '\uFECF' to 0xDA, + '\u00A6' to 0xDB, + '\u00AC' to 0xDC, + '\u00F7' to 0xDD, + '\u00D7' to 0xDE, + '\uFEC9' to 0xDF, + '\u0640' to 0xE0, + '\uFED3' to 0xE1, + '\uFED7' to 0xE2, + '\uFEDB' to 0xE3, + '\uFEDF' to 0xE4, + '\uFEE3' to 0xE5, + '\uFEE7' to 0xE6, + '\uFEEB' to 0xE7, + '\uFEED' to 0xE8, + '\uFEEF' to 0xE9, + '\uFEF3' to 0xEA, + '\uFEBD' to 0xEB, + '\uFECC' to 0xEC, + '\uFECE' to 0xED, + '\uFECD' to 0xEE, + '\uFEE1' to 0xEF, + '\uFE7D' to 0xF0, + '\u0651' to 0xF1, + '\uFEE5' to 0xF2, + '\uFEE9' to 0xF3, + '\uFEEC' to 0xF4, + '\uFEF0' to 0xF5, + '\uFEF2' to 0xF6, + '\uFED0' to 0xF7, + '\uFED5' to 0xF8, + '\uFEF5' to 0xF9, + '\uFEF6' to 0xFA, + '\uFEDD' to 0xFB, + '\uFED9' to 0xFC, + '\uFEF1' to 0xFD, + '\u25A0' to 0xFE, + '\uFFFD' to 0xFF, + ) +} diff --git a/escpos4k/src/commonMain/kotlin/cz/multiplatform/escpos4k/core/encoding/charset/IBM865.kt b/escpos4k/src/commonMain/kotlin/cz/multiplatform/escpos4k/core/encoding/charset/IBM865.kt new file mode 100644 index 0000000..d6efbee --- /dev/null +++ b/escpos4k/src/commonMain/kotlin/cz/multiplatform/escpos4k/core/encoding/charset/IBM865.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 5 [CP865: Nordic] */ +public data object IBM865 : Charset(5, "IBM865") { + override val mapping: Map = + mapOf( + '\u00C7' to 0x80, + '\u00FC' to 0x81, + '\u00E9' to 0x82, + '\u00E2' to 0x83, + '\u00E4' to 0x84, + '\u00E0' to 0x85, + '\u00E5' to 0x86, + '\u00E7' to 0x87, + '\u00EA' to 0x88, + '\u00EB' to 0x89, + '\u00E8' to 0x8A, + '\u00EF' to 0x8B, + '\u00EE' to 0x8C, + '\u00EC' to 0x8D, + '\u00C4' to 0x8E, + '\u00C5' to 0x8F, + '\u00C9' to 0x90, + '\u00E6' to 0x91, + '\u00C6' to 0x92, + '\u00F4' to 0x93, + '\u00F6' to 0x94, + '\u00F2' to 0x95, + '\u00FB' to 0x96, + '\u00F9' to 0x97, + '\u00FF' to 0x98, + '\u00D6' to 0x99, + '\u00DC' to 0x9A, + '\u00F8' to 0x9B, + '\u00A3' to 0x9C, + '\u00D8' to 0x9D, + '\u20A7' to 0x9E, + '\u0192' to 0x9F, + '\u00E1' to 0xA0, + '\u00ED' to 0xA1, + '\u00F3' to 0xA2, + '\u00FA' to 0xA3, + '\u00F1' to 0xA4, + '\u00D1' to 0xA5, + '\u00AA' to 0xA6, + '\u00BA' to 0xA7, + '\u00BF' to 0xA8, + '\u2310' to 0xA9, + '\u00AC' to 0xAA, + '\u00BD' to 0xAB, + '\u00BC' to 0xAC, + '\u00A1' to 0xAD, + '\u00AB' to 0xAE, + '\u00A4' to 0xAF, + '\u2591' to 0xB0, + '\u2592' to 0xB1, + '\u2593' to 0xB2, + '\u2502' to 0xB3, + '\u2524' to 0xB4, + '\u2561' to 0xB5, + '\u2562' to 0xB6, + '\u2556' to 0xB7, + '\u2555' to 0xB8, + '\u2563' to 0xB9, + '\u2551' to 0xBA, + '\u2557' to 0xBB, + '\u255D' to 0xBC, + '\u255C' to 0xBD, + '\u255B' to 0xBE, + '\u2510' to 0xBF, + '\u2514' to 0xC0, + '\u2534' to 0xC1, + '\u252C' to 0xC2, + '\u251C' to 0xC3, + '\u2500' to 0xC4, + '\u253C' to 0xC5, + '\u255E' to 0xC6, + '\u255F' to 0xC7, + '\u255A' to 0xC8, + '\u2554' to 0xC9, + '\u2569' to 0xCA, + '\u2566' to 0xCB, + '\u2560' to 0xCC, + '\u2550' to 0xCD, + '\u256C' to 0xCE, + '\u2567' to 0xCF, + '\u2568' to 0xD0, + '\u2564' to 0xD1, + '\u2565' to 0xD2, + '\u2559' to 0xD3, + '\u2558' to 0xD4, + '\u2552' to 0xD5, + '\u2553' to 0xD6, + '\u256B' to 0xD7, + '\u256A' to 0xD8, + '\u2518' to 0xD9, + '\u250C' to 0xDA, + '\u2588' to 0xDB, + '\u2584' to 0xDC, + '\u258C' to 0xDD, + '\u2590' to 0xDE, + '\u2580' to 0xDF, + '\u03B1' to 0xE0, + '\u00DF' to 0xE1, + '\u0393' to 0xE2, + '\u03C0' to 0xE3, + '\u03A3' to 0xE4, + '\u03C3' to 0xE5, + '\u00B5' to 0xE6, + '\u03C4' to 0xE7, + '\u03A6' to 0xE8, + '\u0398' to 0xE9, + '\u03A9' to 0xEA, + '\u03B4' to 0xEB, + '\u221E' to 0xEC, + '\u03C6' to 0xED, + '\u03B5' to 0xEE, + '\u2229' to 0xEF, + '\u2261' to 0xF0, + '\u00B1' to 0xF1, + '\u2265' to 0xF2, + '\u2264' to 0xF3, + '\u2320' to 0xF4, + '\u2321' to 0xF5, + '\u00F7' to 0xF6, + '\u2248' to 0xF7, + '\u00B0' to 0xF8, + '\u2219' to 0xF9, + '\u00B7' to 0xFA, + '\u221A' to 0xFB, + '\u207F' to 0xFC, + '\u00B2' to 0xFD, + '\u25A0' to 0xFE, + '\u00A0' to 0xFF, + ) +} diff --git a/escpos4k/src/commonMain/kotlin/cz/multiplatform/escpos4k/core/encoding/charset/IBM866.kt b/escpos4k/src/commonMain/kotlin/cz/multiplatform/escpos4k/core/encoding/charset/IBM866.kt new file mode 100644 index 0000000..4610c37 --- /dev/null +++ b/escpos4k/src/commonMain/kotlin/cz/multiplatform/escpos4k/core/encoding/charset/IBM866.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 17 [CP866: Cyrillic #2] */ +public data object IBM866 : Charset(17, "IBM866") { + override val mapping: Map = + mapOf( + '\u0410' to 0x80, + '\u0411' to 0x81, + '\u0412' to 0x82, + '\u0413' to 0x83, + '\u0414' to 0x84, + '\u0415' to 0x85, + '\u0416' to 0x86, + '\u0417' to 0x87, + '\u0418' to 0x88, + '\u0419' to 0x89, + '\u041A' to 0x8A, + '\u041B' to 0x8B, + '\u041C' to 0x8C, + '\u041D' to 0x8D, + '\u041E' to 0x8E, + '\u041F' to 0x8F, + '\u0420' to 0x90, + '\u0421' to 0x91, + '\u0422' to 0x92, + '\u0423' to 0x93, + '\u0424' to 0x94, + '\u0425' to 0x95, + '\u0426' to 0x96, + '\u0427' to 0x97, + '\u0428' to 0x98, + '\u0429' to 0x99, + '\u042A' to 0x9A, + '\u042B' to 0x9B, + '\u042C' to 0x9C, + '\u042D' to 0x9D, + '\u042E' to 0x9E, + '\u042F' to 0x9F, + '\u0430' to 0xA0, + '\u0431' to 0xA1, + '\u0432' to 0xA2, + '\u0433' to 0xA3, + '\u0434' to 0xA4, + '\u0435' to 0xA5, + '\u0436' to 0xA6, + '\u0437' to 0xA7, + '\u0438' to 0xA8, + '\u0439' to 0xA9, + '\u043A' to 0xAA, + '\u043B' to 0xAB, + '\u043C' to 0xAC, + '\u043D' to 0xAD, + '\u043E' to 0xAE, + '\u043F' to 0xAF, + '\u2591' to 0xB0, + '\u2592' to 0xB1, + '\u2593' to 0xB2, + '\u2502' to 0xB3, + '\u2524' to 0xB4, + '\u2561' to 0xB5, + '\u2562' to 0xB6, + '\u2556' to 0xB7, + '\u2555' to 0xB8, + '\u2563' to 0xB9, + '\u2551' to 0xBA, + '\u2557' to 0xBB, + '\u255D' to 0xBC, + '\u255C' to 0xBD, + '\u255B' to 0xBE, + '\u2510' to 0xBF, + '\u2514' to 0xC0, + '\u2534' to 0xC1, + '\u252C' to 0xC2, + '\u251C' to 0xC3, + '\u2500' to 0xC4, + '\u253C' to 0xC5, + '\u255E' to 0xC6, + '\u255F' to 0xC7, + '\u255A' to 0xC8, + '\u2554' to 0xC9, + '\u2569' to 0xCA, + '\u2566' to 0xCB, + '\u2560' to 0xCC, + '\u2550' to 0xCD, + '\u256C' to 0xCE, + '\u2567' to 0xCF, + '\u2568' to 0xD0, + '\u2564' to 0xD1, + '\u2565' to 0xD2, + '\u2559' to 0xD3, + '\u2558' to 0xD4, + '\u2552' to 0xD5, + '\u2553' to 0xD6, + '\u256B' to 0xD7, + '\u256A' to 0xD8, + '\u2518' to 0xD9, + '\u250C' to 0xDA, + '\u2588' to 0xDB, + '\u2584' to 0xDC, + '\u258C' to 0xDD, + '\u2590' to 0xDE, + '\u2580' to 0xDF, + '\u0440' to 0xE0, + '\u0441' to 0xE1, + '\u0442' to 0xE2, + '\u0443' to 0xE3, + '\u0444' to 0xE4, + '\u0445' to 0xE5, + '\u0446' to 0xE6, + '\u0447' to 0xE7, + '\u0448' to 0xE8, + '\u0449' to 0xE9, + '\u044A' to 0xEA, + '\u044B' to 0xEB, + '\u044C' to 0xEC, + '\u044D' to 0xED, + '\u044E' to 0xEE, + '\u044F' to 0xEF, + '\u0401' to 0xF0, + '\u0451' to 0xF1, + '\u0404' to 0xF2, + '\u0454' to 0xF3, + '\u0407' to 0xF4, + '\u0457' to 0xF5, + '\u040E' to 0xF6, + '\u045E' to 0xF7, + '\u00B0' to 0xF8, + '\u2219' to 0xF9, + '\u00B7' to 0xFA, + '\u221A' to 0xFB, + '\u2116' to 0xFC, + '\u00A4' to 0xFD, + '\u25A0' to 0xFE, + '\u00A0' to 0xFF, + ) +} diff --git a/escpos4k/src/commonMain/kotlin/cz/multiplatform/escpos4k/core/encoding/charset/IBM869.kt b/escpos4k/src/commonMain/kotlin/cz/multiplatform/escpos4k/core/encoding/charset/IBM869.kt new file mode 100644 index 0000000..11fc010 --- /dev/null +++ b/escpos4k/src/commonMain/kotlin/cz/multiplatform/escpos4k/core/encoding/charset/IBM869.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 38 [CP869: Greek] */ +public data object IBM869 : Charset(38, "IBM869") { + override val mapping: Map = + mapOf( + '\uFFFD' to 0x80, + '\uFFFD' to 0x81, + '\uFFFD' to 0x82, + '\uFFFD' to 0x83, + '\uFFFD' to 0x84, + '\uFFFD' to 0x85, + '\u0386' to 0x86, + '\uFFFD' to 0x87, + '\u00B7' to 0x88, + '\u00AC' to 0x89, + '\u00A6' to 0x8A, + '\u2018' to 0x8B, + '\u2019' to 0x8C, + '\u0388' to 0x8D, + '\u2015' to 0x8E, + '\u0389' to 0x8F, + '\u038A' to 0x90, + '\u03AA' to 0x91, + '\u038C' to 0x92, + '\uFFFD' to 0x93, + '\uFFFD' to 0x94, + '\u038E' to 0x95, + '\u03AB' to 0x96, + '\u00A9' to 0x97, + '\u038F' to 0x98, + '\u00B2' to 0x99, + '\u00B3' to 0x9A, + '\u03AC' to 0x9B, + '\u00A3' to 0x9C, + '\u03AD' to 0x9D, + '\u03AE' to 0x9E, + '\u03AF' to 0x9F, + '\u03CA' to 0xA0, + '\u0390' to 0xA1, + '\u03CC' to 0xA2, + '\u03CD' to 0xA3, + '\u0391' to 0xA4, + '\u0392' to 0xA5, + '\u0393' to 0xA6, + '\u0394' to 0xA7, + '\u0395' to 0xA8, + '\u0396' to 0xA9, + '\u0397' to 0xAA, + '\u00BD' to 0xAB, + '\u0398' to 0xAC, + '\u0399' to 0xAD, + '\u00AB' to 0xAE, + '\u00BB' to 0xAF, + '\u2591' to 0xB0, + '\u2592' to 0xB1, + '\u2593' to 0xB2, + '\u2502' to 0xB3, + '\u2524' to 0xB4, + '\u039A' to 0xB5, + '\u039B' to 0xB6, + '\u039C' to 0xB7, + '\u039D' to 0xB8, + '\u2563' to 0xB9, + '\u2551' to 0xBA, + '\u2557' to 0xBB, + '\u255D' to 0xBC, + '\u039E' to 0xBD, + '\u039F' to 0xBE, + '\u2510' to 0xBF, + '\u2514' to 0xC0, + '\u2534' to 0xC1, + '\u252C' to 0xC2, + '\u251C' to 0xC3, + '\u2500' to 0xC4, + '\u253C' to 0xC5, + '\u03A0' to 0xC6, + '\u03A1' to 0xC7, + '\u255A' to 0xC8, + '\u2554' to 0xC9, + '\u2569' to 0xCA, + '\u2566' to 0xCB, + '\u2560' to 0xCC, + '\u2550' to 0xCD, + '\u256C' to 0xCE, + '\u03A3' to 0xCF, + '\u03A4' to 0xD0, + '\u03A5' to 0xD1, + '\u03A6' to 0xD2, + '\u03A7' to 0xD3, + '\u03A8' to 0xD4, + '\u03A9' to 0xD5, + '\u03B1' to 0xD6, + '\u03B2' to 0xD7, + '\u03B3' to 0xD8, + '\u2518' to 0xD9, + '\u250C' to 0xDA, + '\u2588' to 0xDB, + '\u2584' to 0xDC, + '\u03B4' to 0xDD, + '\u03B5' to 0xDE, + '\u2580' to 0xDF, + '\u03B6' to 0xE0, + '\u03B7' to 0xE1, + '\u03B8' to 0xE2, + '\u03B9' to 0xE3, + '\u03BA' to 0xE4, + '\u03BB' to 0xE5, + '\u03BC' to 0xE6, + '\u03BD' to 0xE7, + '\u03BE' to 0xE8, + '\u03BF' to 0xE9, + '\u03C0' to 0xEA, + '\u03C1' to 0xEB, + '\u03C3' to 0xEC, + '\u03C2' to 0xED, + '\u03C4' to 0xEE, + '\u0384' to 0xEF, + '\u00AD' to 0xF0, + '\u00B1' to 0xF1, + '\u03C5' to 0xF2, + '\u03C6' to 0xF3, + '\u03C7' to 0xF4, + '\u00A7' to 0xF5, + '\u03C8' to 0xF6, + '\u0385' to 0xF7, + '\u00B0' to 0xF8, + '\u00A8' to 0xF9, + '\u03C9' to 0xFA, + '\u03CB' to 0xFB, + '\u03B0' to 0xFC, + '\u03CE' to 0xFD, + '\u25A0' to 0xFE, + '\u00A0' to 0xFF, + ) +} diff --git a/escpos4k/src/commonMain/kotlin/cz/multiplatform/escpos4k/core/encoding/charset/ISO_8859_15.kt b/escpos4k/src/commonMain/kotlin/cz/multiplatform/escpos4k/core/encoding/charset/ISO_8859_15.kt new file mode 100644 index 0000000..9c16d55 --- /dev/null +++ b/escpos4k/src/commonMain/kotlin/cz/multiplatform/escpos4k/core/encoding/charset/ISO_8859_15.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 40 [ISO8859-15: Latin 9] */ +public data object ISO_8859_15 : Charset(40, "ISO-8859-15") { + override val mapping: Map = + mapOf( + '\u0080' to 0x80, + '\u0081' to 0x81, + '\u0082' to 0x82, + '\u0083' to 0x83, + '\u0084' to 0x84, + '\u0085' to 0x85, + '\u0086' to 0x86, + '\u0087' to 0x87, + '\u0088' to 0x88, + '\u0089' to 0x89, + '\u008A' to 0x8A, + '\u008B' to 0x8B, + '\u008C' to 0x8C, + '\u008D' to 0x8D, + '\u008E' to 0x8E, + '\u008F' to 0x8F, + '\u0090' to 0x90, + '\u0091' to 0x91, + '\u0092' to 0x92, + '\u0093' to 0x93, + '\u0094' to 0x94, + '\u0095' to 0x95, + '\u0096' to 0x96, + '\u0097' to 0x97, + '\u0098' to 0x98, + '\u0099' to 0x99, + '\u009A' to 0x9A, + '\u009B' to 0x9B, + '\u009C' to 0x9C, + '\u009D' to 0x9D, + '\u009E' to 0x9E, + '\u009F' to 0x9F, + '\u00A0' to 0xA0, + '\u00A1' to 0xA1, + '\u00A2' to 0xA2, + '\u00A3' to 0xA3, + '\u20AC' to 0xA4, + '\u00A5' to 0xA5, + '\u0160' to 0xA6, + '\u00A7' to 0xA7, + '\u0161' 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, + '\u017D' to 0xB4, + '\u00B5' to 0xB5, + '\u00B6' to 0xB6, + '\u00B7' to 0xB7, + '\u017E' to 0xB8, + '\u00B9' to 0xB9, + '\u00BA' to 0xBA, + '\u00BB' to 0xBB, + '\u0152' to 0xBC, + '\u0153' to 0xBD, + '\u0178' to 0xBE, + '\u00BF' to 0xBF, + '\u00C0' to 0xC0, + '\u00C1' to 0xC1, + '\u00C2' to 0xC2, + '\u00C3' 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, + '\u00CC' to 0xCC, + '\u00CD' to 0xCD, + '\u00CE' to 0xCE, + '\u00CF' to 0xCF, + '\u00D0' to 0xD0, + '\u00D1' to 0xD1, + '\u00D2' to 0xD2, + '\u00D3' to 0xD3, + '\u00D4' to 0xD4, + '\u00D5' to 0xD5, + '\u00D6' to 0xD6, + '\u00D7' to 0xD7, + '\u00D8' to 0xD8, + '\u00D9' to 0xD9, + '\u00DA' to 0xDA, + '\u00DB' to 0xDB, + '\u00DC' to 0xDC, + '\u00DD' to 0xDD, + '\u00DE' to 0xDE, + '\u00DF' to 0xDF, + '\u00E0' to 0xE0, + '\u00E1' to 0xE1, + '\u00E2' to 0xE2, + '\u00E3' 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, + '\u00EC' to 0xEC, + '\u00ED' to 0xED, + '\u00EE' to 0xEE, + '\u00EF' to 0xEF, + '\u00F0' to 0xF0, + '\u00F1' to 0xF1, + '\u00F2' to 0xF2, + '\u00F3' to 0xF3, + '\u00F4' to 0xF4, + '\u00F5' to 0xF5, + '\u00F6' to 0xF6, + '\u00F7' to 0xF7, + '\u00F8' to 0xF8, + '\u00F9' to 0xF9, + '\u00FA' to 0xFA, + '\u00FB' to 0xFB, + '\u00FC' to 0xFC, + '\u00FD' to 0xFD, + '\u00FE' to 0xFE, + '\u00FF' to 0xFF, + ) +} diff --git a/escpos4k/src/commonMain/kotlin/cz/multiplatform/escpos4k/core/encoding/charset/ISO_8859_2.kt b/escpos4k/src/commonMain/kotlin/cz/multiplatform/escpos4k/core/encoding/charset/ISO_8859_2.kt new file mode 100644 index 0000000..3ee6249 --- /dev/null +++ b/escpos4k/src/commonMain/kotlin/cz/multiplatform/escpos4k/core/encoding/charset/ISO_8859_2.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 39 [ISO8859-2: Latin 2] */ +public data object ISO_8859_2 : Charset(39, "ISO-8859-2") { + override val mapping: Map = + mapOf( + '\u0080' to 0x80, + '\u0081' to 0x81, + '\u0082' to 0x82, + '\u0083' to 0x83, + '\u0084' to 0x84, + '\u0085' to 0x85, + '\u0086' to 0x86, + '\u0087' to 0x87, + '\u0088' to 0x88, + '\u0089' to 0x89, + '\u008A' to 0x8A, + '\u008B' to 0x8B, + '\u008C' to 0x8C, + '\u008D' to 0x8D, + '\u008E' to 0x8E, + '\u008F' to 0x8F, + '\u0090' to 0x90, + '\u0091' to 0x91, + '\u0092' to 0x92, + '\u0093' to 0x93, + '\u0094' to 0x94, + '\u0095' to 0x95, + '\u0096' to 0x96, + '\u0097' to 0x97, + '\u0098' to 0x98, + '\u0099' to 0x99, + '\u009A' to 0x9A, + '\u009B' to 0x9B, + '\u009C' to 0x9C, + '\u009D' to 0x9D, + '\u009E' to 0x9E, + '\u009F' to 0x9F, + '\u00A0' to 0xA0, + '\u0104' to 0xA1, + '\u02D8' to 0xA2, + '\u0141' to 0xA3, + '\u00A4' to 0xA4, + '\u013D' to 0xA5, + '\u015A' to 0xA6, + '\u00A7' to 0xA7, + '\u00A8' to 0xA8, + '\u0160' to 0xA9, + '\u015E' to 0xAA, + '\u0164' to 0xAB, + '\u0179' to 0xAC, + '\u00AD' to 0xAD, + '\u017D' to 0xAE, + '\u017B' to 0xAF, + '\u00B0' to 0xB0, + '\u0105' to 0xB1, + '\u02DB' to 0xB2, + '\u0142' to 0xB3, + '\u00B4' to 0xB4, + '\u013E' to 0xB5, + '\u015B' to 0xB6, + '\u02C7' to 0xB7, + '\u00B8' to 0xB8, + '\u0161' to 0xB9, + '\u015F' to 0xBA, + '\u0165' to 0xBB, + '\u017A' to 0xBC, + '\u02DD' to 0xBD, + '\u017E' to 0xBE, + '\u017C' to 0xBF, + '\u0154' to 0xC0, + '\u00C1' to 0xC1, + '\u00C2' to 0xC2, + '\u0102' to 0xC3, + '\u00C4' to 0xC4, + '\u0139' to 0xC5, + '\u0106' to 0xC6, + '\u00C7' to 0xC7, + '\u010C' to 0xC8, + '\u00C9' to 0xC9, + '\u0118' to 0xCA, + '\u00CB' to 0xCB, + '\u011A' to 0xCC, + '\u00CD' to 0xCD, + '\u00CE' to 0xCE, + '\u010E' to 0xCF, + '\u0110' to 0xD0, + '\u0143' to 0xD1, + '\u0147' to 0xD2, + '\u00D3' to 0xD3, + '\u00D4' to 0xD4, + '\u0150' to 0xD5, + '\u00D6' to 0xD6, + '\u00D7' to 0xD7, + '\u0158' to 0xD8, + '\u016E' to 0xD9, + '\u00DA' to 0xDA, + '\u0170' to 0xDB, + '\u00DC' to 0xDC, + '\u00DD' to 0xDD, + '\u0162' to 0xDE, + '\u00DF' to 0xDF, + '\u0155' to 0xE0, + '\u00E1' to 0xE1, + '\u00E2' to 0xE2, + '\u0103' to 0xE3, + '\u00E4' to 0xE4, + '\u013A' to 0xE5, + '\u0107' to 0xE6, + '\u00E7' to 0xE7, + '\u010D' to 0xE8, + '\u00E9' to 0xE9, + '\u0119' to 0xEA, + '\u00EB' to 0xEB, + '\u011B' to 0xEC, + '\u00ED' to 0xED, + '\u00EE' to 0xEE, + '\u010F' to 0xEF, + '\u0111' to 0xF0, + '\u0144' to 0xF1, + '\u0148' to 0xF2, + '\u00F3' to 0xF3, + '\u00F4' to 0xF4, + '\u0151' to 0xF5, + '\u00F6' to 0xF6, + '\u00F7' to 0xF7, + '\u0159' to 0xF8, + '\u016F' to 0xF9, + '\u00FA' to 0xFA, + '\u0171' to 0xFB, + '\u00FC' to 0xFC, + '\u00FD' to 0xFD, + '\u0163' to 0xFE, + '\u02D9' to 0xFF, + ) +} diff --git a/escpos4k/src/commonMain/kotlin/cz/multiplatform/escpos4k/core/encoding/charset/ISO_8859_7.kt b/escpos4k/src/commonMain/kotlin/cz/multiplatform/escpos4k/core/encoding/charset/ISO_8859_7.kt new file mode 100644 index 0000000..6928d48 --- /dev/null +++ b/escpos4k/src/commonMain/kotlin/cz/multiplatform/escpos4k/core/encoding/charset/ISO_8859_7.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 15 [ISO8859-7: Greek] */ +public data object ISO_8859_7 : Charset(15, "ISO-8859-7") { + override val mapping: Map = + mapOf( + '\u0080' to 0x80, + '\u0081' to 0x81, + '\u0082' to 0x82, + '\u0083' to 0x83, + '\u0084' to 0x84, + '\u0085' to 0x85, + '\u0086' to 0x86, + '\u0087' to 0x87, + '\u0088' to 0x88, + '\u0089' to 0x89, + '\u008A' to 0x8A, + '\u008B' to 0x8B, + '\u008C' to 0x8C, + '\u008D' to 0x8D, + '\u008E' to 0x8E, + '\u008F' to 0x8F, + '\u0090' to 0x90, + '\u0091' to 0x91, + '\u0092' to 0x92, + '\u0093' to 0x93, + '\u0094' to 0x94, + '\u0095' to 0x95, + '\u0096' to 0x96, + '\u0097' to 0x97, + '\u0098' to 0x98, + '\u0099' to 0x99, + '\u009A' to 0x9A, + '\u009B' to 0x9B, + '\u009C' to 0x9C, + '\u009D' to 0x9D, + '\u009E' to 0x9E, + '\u009F' to 0x9F, + '\u00A0' to 0xA0, + '\u2018' to 0xA1, + '\u2019' to 0xA2, + '\u00A3' to 0xA3, + '\u20AC' to 0xA4, + '\u20AF' to 0xA5, + '\u00A6' to 0xA6, + '\u00A7' to 0xA7, + '\u00A8' to 0xA8, + '\u00A9' to 0xA9, + '\u037A' to 0xAA, + '\u00AB' to 0xAB, + '\u00AC' to 0xAC, + '\u00AD' to 0xAD, + '\uFFFD' to 0xAE, + '\u2015' to 0xAF, + '\u00B0' to 0xB0, + '\u00B1' to 0xB1, + '\u00B2' to 0xB2, + '\u00B3' to 0xB3, + '\u0384' to 0xB4, + '\u0385' to 0xB5, + '\u0386' to 0xB6, + '\u00B7' to 0xB7, + '\u0388' to 0xB8, + '\u0389' to 0xB9, + '\u038A' to 0xBA, + '\u00BB' to 0xBB, + '\u038C' to 0xBC, + '\u00BD' to 0xBD, + '\u038E' to 0xBE, + '\u038F' to 0xBF, + '\u0390' to 0xC0, + '\u0391' to 0xC1, + '\u0392' to 0xC2, + '\u0393' to 0xC3, + '\u0394' to 0xC4, + '\u0395' to 0xC5, + '\u0396' to 0xC6, + '\u0397' to 0xC7, + '\u0398' to 0xC8, + '\u0399' to 0xC9, + '\u039A' to 0xCA, + '\u039B' to 0xCB, + '\u039C' to 0xCC, + '\u039D' to 0xCD, + '\u039E' to 0xCE, + '\u039F' to 0xCF, + '\u03A0' to 0xD0, + '\u03A1' to 0xD1, + '\uFFFD' to 0xD2, + '\u03A3' to 0xD3, + '\u03A4' to 0xD4, + '\u03A5' to 0xD5, + '\u03A6' to 0xD6, + '\u03A7' to 0xD7, + '\u03A8' to 0xD8, + '\u03A9' to 0xD9, + '\u03AA' to 0xDA, + '\u03AB' to 0xDB, + '\u03AC' to 0xDC, + '\u03AD' to 0xDD, + '\u03AE' to 0xDE, + '\u03AF' to 0xDF, + '\u03B0' to 0xE0, + '\u03B1' to 0xE1, + '\u03B2' to 0xE2, + '\u03B3' to 0xE3, + '\u03B4' to 0xE4, + '\u03B5' to 0xE5, + '\u03B6' to 0xE6, + '\u03B7' to 0xE7, + '\u03B8' to 0xE8, + '\u03B9' to 0xE9, + '\u03BA' to 0xEA, + '\u03BB' to 0xEB, + '\u03BC' to 0xEC, + '\u03BD' to 0xED, + '\u03BE' to 0xEE, + '\u03BF' to 0xEF, + '\u03C0' to 0xF0, + '\u03C1' to 0xF1, + '\u03C2' to 0xF2, + '\u03C3' to 0xF3, + '\u03C4' to 0xF4, + '\u03C5' to 0xF5, + '\u03C6' to 0xF6, + '\u03C7' to 0xF7, + '\u03C8' to 0xF8, + '\u03C9' to 0xF9, + '\u03CA' to 0xFA, + '\u03CB' to 0xFB, + '\u03CC' to 0xFC, + '\u03CD' to 0xFD, + '\u03CE' to 0xFE, + '\uFFFD' to 0xFF, + ) +} diff --git a/escpos4k/src/commonMain/kotlin/cz/multiplatform/escpos4k/core/encoding/charset/Windows1250.kt b/escpos4k/src/commonMain/kotlin/cz/multiplatform/escpos4k/core/encoding/charset/Windows1250.kt new file mode 100644 index 0000000..de15f51 --- /dev/null +++ b/escpos4k/src/commonMain/kotlin/cz/multiplatform/escpos4k/core/encoding/charset/Windows1250.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 45 [Windows-1250] */ +public data object Windows1250 : Charset(45, "windows-1250") { + override val mapping: Map = + mapOf( + '\u20AC' to 0x80, + '\uFFFD' to 0x81, + '\u201A' to 0x82, + '\uFFFD' to 0x83, + '\u201E' to 0x84, + '\u2026' to 0x85, + '\u2020' to 0x86, + '\u2021' to 0x87, + '\uFFFD' to 0x88, + '\u2030' to 0x89, + '\u0160' to 0x8A, + '\u2039' to 0x8B, + '\u015A' to 0x8C, + '\u0164' to 0x8D, + '\u017D' to 0x8E, + '\u0179' 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, + '\uFFFD' to 0x98, + '\u2122' to 0x99, + '\u0161' to 0x9A, + '\u203A' to 0x9B, + '\u015B' to 0x9C, + '\u0165' to 0x9D, + '\u017E' to 0x9E, + '\u017A' to 0x9F, + '\u00A0' to 0xA0, + '\u02C7' to 0xA1, + '\u02D8' to 0xA2, + '\u0141' to 0xA3, + '\u00A4' to 0xA4, + '\u0104' to 0xA5, + '\u00A6' to 0xA6, + '\u00A7' to 0xA7, + '\u00A8' to 0xA8, + '\u00A9' to 0xA9, + '\u015E' to 0xAA, + '\u00AB' to 0xAB, + '\u00AC' to 0xAC, + '\u00AD' to 0xAD, + '\u00AE' to 0xAE, + '\u017B' to 0xAF, + '\u00B0' to 0xB0, + '\u00B1' to 0xB1, + '\u02DB' to 0xB2, + '\u0142' to 0xB3, + '\u00B4' to 0xB4, + '\u00B5' to 0xB5, + '\u00B6' to 0xB6, + '\u00B7' to 0xB7, + '\u00B8' to 0xB8, + '\u0105' to 0xB9, + '\u015F' to 0xBA, + '\u00BB' to 0xBB, + '\u013D' to 0xBC, + '\u02DD' to 0xBD, + '\u013E' to 0xBE, + '\u017C' to 0xBF, + '\u0154' to 0xC0, + '\u00C1' to 0xC1, + '\u00C2' to 0xC2, + '\u0102' to 0xC3, + '\u00C4' to 0xC4, + '\u0139' to 0xC5, + '\u0106' to 0xC6, + '\u00C7' to 0xC7, + '\u010C' to 0xC8, + '\u00C9' to 0xC9, + '\u0118' to 0xCA, + '\u00CB' to 0xCB, + '\u011A' to 0xCC, + '\u00CD' to 0xCD, + '\u00CE' to 0xCE, + '\u010E' to 0xCF, + '\u0110' to 0xD0, + '\u0143' to 0xD1, + '\u0147' to 0xD2, + '\u00D3' to 0xD3, + '\u00D4' to 0xD4, + '\u0150' to 0xD5, + '\u00D6' to 0xD6, + '\u00D7' to 0xD7, + '\u0158' to 0xD8, + '\u016E' to 0xD9, + '\u00DA' to 0xDA, + '\u0170' to 0xDB, + '\u00DC' to 0xDC, + '\u00DD' to 0xDD, + '\u0162' to 0xDE, + '\u00DF' to 0xDF, + '\u0155' to 0xE0, + '\u00E1' to 0xE1, + '\u00E2' to 0xE2, + '\u0103' to 0xE3, + '\u00E4' to 0xE4, + '\u013A' to 0xE5, + '\u0107' to 0xE6, + '\u00E7' to 0xE7, + '\u010D' to 0xE8, + '\u00E9' to 0xE9, + '\u0119' to 0xEA, + '\u00EB' to 0xEB, + '\u011B' to 0xEC, + '\u00ED' to 0xED, + '\u00EE' to 0xEE, + '\u010F' to 0xEF, + '\u0111' to 0xF0, + '\u0144' to 0xF1, + '\u0148' to 0xF2, + '\u00F3' to 0xF3, + '\u00F4' to 0xF4, + '\u0151' to 0xF5, + '\u00F6' to 0xF6, + '\u00F7' to 0xF7, + '\u0159' to 0xF8, + '\u016F' to 0xF9, + '\u00FA' to 0xFA, + '\u0171' to 0xFB, + '\u00FC' to 0xFC, + '\u00FD' to 0xFD, + '\u0163' to 0xFE, + '\u02D9' to 0xFF, + ) +} diff --git a/escpos4k/src/commonMain/kotlin/cz/multiplatform/escpos4k/core/encoding/charset/Windows1251.kt b/escpos4k/src/commonMain/kotlin/cz/multiplatform/escpos4k/core/encoding/charset/Windows1251.kt new file mode 100644 index 0000000..16fec4d --- /dev/null +++ b/escpos4k/src/commonMain/kotlin/cz/multiplatform/escpos4k/core/encoding/charset/Windows1251.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 46 [Windows-1251] */ +public data object Windows1251 : Charset(46, "windows-1251") { + override val mapping: Map = + mapOf( + '\u0402' to 0x80, + '\u0403' to 0x81, + '\u201A' to 0x82, + '\u0453' to 0x83, + '\u201E' to 0x84, + '\u2026' to 0x85, + '\u2020' to 0x86, + '\u2021' to 0x87, + '\u20AC' to 0x88, + '\u2030' to 0x89, + '\u0409' to 0x8A, + '\u2039' to 0x8B, + '\u040A' to 0x8C, + '\u040C' to 0x8D, + '\u040B' to 0x8E, + '\u040F' to 0x8F, + '\u0452' to 0x90, + '\u2018' to 0x91, + '\u2019' to 0x92, + '\u201C' to 0x93, + '\u201D' to 0x94, + '\u2022' to 0x95, + '\u2013' to 0x96, + '\u2014' to 0x97, + '\uFFFD' to 0x98, + '\u2122' to 0x99, + '\u0459' to 0x9A, + '\u203A' to 0x9B, + '\u045A' to 0x9C, + '\u045C' to 0x9D, + '\u045B' to 0x9E, + '\u045F' to 0x9F, + '\u00A0' to 0xA0, + '\u040E' to 0xA1, + '\u045E' to 0xA2, + '\u0408' to 0xA3, + '\u00A4' to 0xA4, + '\u0490' to 0xA5, + '\u00A6' to 0xA6, + '\u00A7' to 0xA7, + '\u0401' to 0xA8, + '\u00A9' to 0xA9, + '\u0404' to 0xAA, + '\u00AB' to 0xAB, + '\u00AC' to 0xAC, + '\u00AD' to 0xAD, + '\u00AE' to 0xAE, + '\u0407' to 0xAF, + '\u00B0' to 0xB0, + '\u00B1' to 0xB1, + '\u0406' to 0xB2, + '\u0456' to 0xB3, + '\u0491' to 0xB4, + '\u00B5' to 0xB5, + '\u00B6' to 0xB6, + '\u00B7' to 0xB7, + '\u0451' to 0xB8, + '\u2116' to 0xB9, + '\u0454' to 0xBA, + '\u00BB' to 0xBB, + '\u0458' to 0xBC, + '\u0405' to 0xBD, + '\u0455' to 0xBE, + '\u0457' to 0xBF, + '\u0410' to 0xC0, + '\u0411' to 0xC1, + '\u0412' to 0xC2, + '\u0413' to 0xC3, + '\u0414' to 0xC4, + '\u0415' to 0xC5, + '\u0416' to 0xC6, + '\u0417' to 0xC7, + '\u0418' to 0xC8, + '\u0419' to 0xC9, + '\u041A' to 0xCA, + '\u041B' to 0xCB, + '\u041C' to 0xCC, + '\u041D' to 0xCD, + '\u041E' to 0xCE, + '\u041F' to 0xCF, + '\u0420' to 0xD0, + '\u0421' to 0xD1, + '\u0422' to 0xD2, + '\u0423' to 0xD3, + '\u0424' to 0xD4, + '\u0425' to 0xD5, + '\u0426' to 0xD6, + '\u0427' to 0xD7, + '\u0428' to 0xD8, + '\u0429' to 0xD9, + '\u042A' to 0xDA, + '\u042B' to 0xDB, + '\u042C' to 0xDC, + '\u042D' to 0xDD, + '\u042E' to 0xDE, + '\u042F' to 0xDF, + '\u0430' to 0xE0, + '\u0431' to 0xE1, + '\u0432' to 0xE2, + '\u0433' to 0xE3, + '\u0434' to 0xE4, + '\u0435' to 0xE5, + '\u0436' to 0xE6, + '\u0437' to 0xE7, + '\u0438' to 0xE8, + '\u0439' to 0xE9, + '\u043A' to 0xEA, + '\u043B' to 0xEB, + '\u043C' to 0xEC, + '\u043D' to 0xED, + '\u043E' to 0xEE, + '\u043F' to 0xEF, + '\u0440' to 0xF0, + '\u0441' to 0xF1, + '\u0442' to 0xF2, + '\u0443' to 0xF3, + '\u0444' to 0xF4, + '\u0445' to 0xF5, + '\u0446' to 0xF6, + '\u0447' to 0xF7, + '\u0448' to 0xF8, + '\u0449' to 0xF9, + '\u044A' to 0xFA, + '\u044B' to 0xFB, + '\u044C' to 0xFC, + '\u044D' to 0xFD, + '\u044E' to 0xFE, + '\u044F' to 0xFF, + ) +} diff --git a/escpos4k/src/commonMain/kotlin/cz/multiplatform/escpos4k/core/encoding/charset/Windows1252.kt b/escpos4k/src/commonMain/kotlin/cz/multiplatform/escpos4k/core/encoding/charset/Windows1252.kt new file mode 100644 index 0000000..f434479 --- /dev/null +++ b/escpos4k/src/commonMain/kotlin/cz/multiplatform/escpos4k/core/encoding/charset/Windows1252.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 16 [Windows-1252] */ +public data object Windows1252 : Charset(16, "windows-1252") { + 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, + '\u0160' to 0x8A, + '\u2039' to 0x8B, + '\u0152' to 0x8C, + '\uFFFD' to 0x8D, + '\u017D' 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, + '\u0161' to 0x9A, + '\u203A' to 0x9B, + '\u0153' to 0x9C, + '\uFFFD' to 0x9D, + '\u017E' 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, + '\u00C3' 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, + '\u00CC' to 0xCC, + '\u00CD' to 0xCD, + '\u00CE' to 0xCE, + '\u00CF' to 0xCF, + '\u00D0' to 0xD0, + '\u00D1' to 0xD1, + '\u00D2' to 0xD2, + '\u00D3' to 0xD3, + '\u00D4' to 0xD4, + '\u00D5' to 0xD5, + '\u00D6' to 0xD6, + '\u00D7' to 0xD7, + '\u00D8' to 0xD8, + '\u00D9' to 0xD9, + '\u00DA' to 0xDA, + '\u00DB' to 0xDB, + '\u00DC' to 0xDC, + '\u00DD' to 0xDD, + '\u00DE' to 0xDE, + '\u00DF' to 0xDF, + '\u00E0' to 0xE0, + '\u00E1' to 0xE1, + '\u00E2' to 0xE2, + '\u00E3' 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, + '\u00EC' to 0xEC, + '\u00ED' to 0xED, + '\u00EE' to 0xEE, + '\u00EF' to 0xEF, + '\u00F0' to 0xF0, + '\u00F1' to 0xF1, + '\u00F2' to 0xF2, + '\u00F3' to 0xF3, + '\u00F4' to 0xF4, + '\u00F5' to 0xF5, + '\u00F6' to 0xF6, + '\u00F7' to 0xF7, + '\u00F8' to 0xF8, + '\u00F9' to 0xF9, + '\u00FA' to 0xFA, + '\u00FB' to 0xFB, + '\u00FC' to 0xFC, + '\u00FD' to 0xFD, + '\u00FE' to 0xFE, + '\u00FF' to 0xFF, + ) +} diff --git a/escpos4k/src/commonMain/kotlin/cz/multiplatform/escpos4k/core/encoding/charset/Windows1253.kt b/escpos4k/src/commonMain/kotlin/cz/multiplatform/escpos4k/core/encoding/charset/Windows1253.kt new file mode 100644 index 0000000..9b149ef --- /dev/null +++ b/escpos4k/src/commonMain/kotlin/cz/multiplatform/escpos4k/core/encoding/charset/Windows1253.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 47 [Windows-1253] */ +public data object Windows1253 : Charset(47, "windows-1253") { + 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, + '\uFFFD' to 0x88, + '\u2030' to 0x89, + '\uFFFD' to 0x8A, + '\u2039' to 0x8B, + '\uFFFD' 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, + '\uFFFD' to 0x98, + '\u2122' to 0x99, + '\uFFFD' to 0x9A, + '\u203A' to 0x9B, + '\uFFFD' to 0x9C, + '\uFFFD' to 0x9D, + '\uFFFD' to 0x9E, + '\uFFFD' to 0x9F, + '\u00A0' to 0xA0, + '\u0385' to 0xA1, + '\u0386' to 0xA2, + '\u00A3' to 0xA3, + '\u00A4' to 0xA4, + '\u00A5' to 0xA5, + '\u00A6' to 0xA6, + '\u00A7' to 0xA7, + '\u00A8' to 0xA8, + '\u00A9' to 0xA9, + '\uFFFD' to 0xAA, + '\u00AB' to 0xAB, + '\u00AC' to 0xAC, + '\u00AD' to 0xAD, + '\u00AE' to 0xAE, + '\u2015' to 0xAF, + '\u00B0' to 0xB0, + '\u00B1' to 0xB1, + '\u00B2' to 0xB2, + '\u00B3' to 0xB3, + '\u0384' to 0xB4, + '\u00B5' to 0xB5, + '\u00B6' to 0xB6, + '\u00B7' to 0xB7, + '\u0388' to 0xB8, + '\u0389' to 0xB9, + '\u038A' to 0xBA, + '\u00BB' to 0xBB, + '\u038C' to 0xBC, + '\u00BD' to 0xBD, + '\u038E' to 0xBE, + '\u038F' to 0xBF, + '\u0390' to 0xC0, + '\u0391' to 0xC1, + '\u0392' to 0xC2, + '\u0393' to 0xC3, + '\u0394' to 0xC4, + '\u0395' to 0xC5, + '\u0396' to 0xC6, + '\u0397' to 0xC7, + '\u0398' to 0xC8, + '\u0399' to 0xC9, + '\u039A' to 0xCA, + '\u039B' to 0xCB, + '\u039C' to 0xCC, + '\u039D' to 0xCD, + '\u039E' to 0xCE, + '\u039F' to 0xCF, + '\u03A0' to 0xD0, + '\u03A1' to 0xD1, + '\uFFFD' to 0xD2, + '\u03A3' to 0xD3, + '\u03A4' to 0xD4, + '\u03A5' to 0xD5, + '\u03A6' to 0xD6, + '\u03A7' to 0xD7, + '\u03A8' to 0xD8, + '\u03A9' to 0xD9, + '\u03AA' to 0xDA, + '\u03AB' to 0xDB, + '\u03AC' to 0xDC, + '\u03AD' to 0xDD, + '\u03AE' to 0xDE, + '\u03AF' to 0xDF, + '\u03B0' to 0xE0, + '\u03B1' to 0xE1, + '\u03B2' to 0xE2, + '\u03B3' to 0xE3, + '\u03B4' to 0xE4, + '\u03B5' to 0xE5, + '\u03B6' to 0xE6, + '\u03B7' to 0xE7, + '\u03B8' to 0xE8, + '\u03B9' to 0xE9, + '\u03BA' to 0xEA, + '\u03BB' to 0xEB, + '\u03BC' to 0xEC, + '\u03BD' to 0xED, + '\u03BE' to 0xEE, + '\u03BF' to 0xEF, + '\u03C0' to 0xF0, + '\u03C1' to 0xF1, + '\u03C2' to 0xF2, + '\u03C3' to 0xF3, + '\u03C4' to 0xF4, + '\u03C5' to 0xF5, + '\u03C6' to 0xF6, + '\u03C7' to 0xF7, + '\u03C8' to 0xF8, + '\u03C9' to 0xF9, + '\u03CA' to 0xFA, + '\u03CB' to 0xFB, + '\u03CC' to 0xFC, + '\u03CD' to 0xFD, + '\u03CE' to 0xFE, + '\uFFFD' to 0xFF, + ) +} diff --git a/escpos4k/src/commonMain/kotlin/cz/multiplatform/escpos4k/core/encoding/charset/Windows1254.kt b/escpos4k/src/commonMain/kotlin/cz/multiplatform/escpos4k/core/encoding/charset/Windows1254.kt new file mode 100644 index 0000000..71477dc --- /dev/null +++ b/escpos4k/src/commonMain/kotlin/cz/multiplatform/escpos4k/core/encoding/charset/Windows1254.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 48 [Windows-1254] */ +public data object Windows1254 : Charset(48, "windows-1254") { + 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, + '\u0160' 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, + '\u0161' 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, + '\u00C3' 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, + '\u00CC' to 0xCC, + '\u00CD' to 0xCD, + '\u00CE' to 0xCE, + '\u00CF' to 0xCF, + '\u011E' to 0xD0, + '\u00D1' to 0xD1, + '\u00D2' to 0xD2, + '\u00D3' to 0xD3, + '\u00D4' to 0xD4, + '\u00D5' to 0xD5, + '\u00D6' to 0xD6, + '\u00D7' to 0xD7, + '\u00D8' to 0xD8, + '\u00D9' to 0xD9, + '\u00DA' to 0xDA, + '\u00DB' to 0xDB, + '\u00DC' to 0xDC, + '\u0130' to 0xDD, + '\u015E' to 0xDE, + '\u00DF' to 0xDF, + '\u00E0' to 0xE0, + '\u00E1' to 0xE1, + '\u00E2' to 0xE2, + '\u00E3' 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, + '\u00EC' to 0xEC, + '\u00ED' to 0xED, + '\u00EE' to 0xEE, + '\u00EF' to 0xEF, + '\u011F' to 0xF0, + '\u00F1' to 0xF1, + '\u00F2' to 0xF2, + '\u00F3' to 0xF3, + '\u00F4' to 0xF4, + '\u00F5' to 0xF5, + '\u00F6' to 0xF6, + '\u00F7' to 0xF7, + '\u00F8' to 0xF8, + '\u00F9' to 0xF9, + '\u00FA' to 0xFA, + '\u00FB' to 0xFB, + '\u00FC' to 0xFC, + '\u0131' to 0xFD, + '\u015F' to 0xFE, + '\u00FF' to 0xFF, + ) +} diff --git a/escpos4k/src/commonMain/kotlin/cz/multiplatform/escpos4k/core/encoding/charset/Windows1255.kt b/escpos4k/src/commonMain/kotlin/cz/multiplatform/escpos4k/core/encoding/charset/Windows1255.kt new file mode 100644 index 0000000..a009ddb --- /dev/null +++ b/escpos4k/src/commonMain/kotlin/cz/multiplatform/escpos4k/core/encoding/charset/Windows1255.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 49 [Windows-1255] */ +public data object Windows1255 : Charset(49, "windows-1255") { + 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, + '\uFFFD' 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, + '\uFFFD' to 0x9C, + '\uFFFD' to 0x9D, + '\uFFFD' to 0x9E, + '\uFFFD' to 0x9F, + '\u00A0' to 0xA0, + '\u00A1' to 0xA1, + '\u00A2' to 0xA2, + '\u00A3' to 0xA3, + '\u20AA' to 0xA4, + '\u00A5' to 0xA5, + '\u00A6' to 0xA6, + '\u00A7' to 0xA7, + '\u00A8' to 0xA8, + '\u00A9' to 0xA9, + '\u00D7' 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, + '\u00F7' to 0xBA, + '\u00BB' to 0xBB, + '\u00BC' to 0xBC, + '\u00BD' to 0xBD, + '\u00BE' to 0xBE, + '\u00BF' to 0xBF, + '\u05B0' to 0xC0, + '\u05B1' to 0xC1, + '\u05B2' to 0xC2, + '\u05B3' to 0xC3, + '\u05B4' to 0xC4, + '\u05B5' to 0xC5, + '\u05B6' to 0xC6, + '\u05B7' to 0xC7, + '\u05B8' to 0xC8, + '\u05B9' to 0xC9, + '\uFFFD' to 0xCA, + '\u05BB' to 0xCB, + '\u05BC' to 0xCC, + '\u05BD' to 0xCD, + '\u05BE' to 0xCE, + '\u05BF' to 0xCF, + '\u05C0' to 0xD0, + '\u05C1' to 0xD1, + '\u05C2' to 0xD2, + '\u05C3' to 0xD3, + '\u05F0' to 0xD4, + '\u05F1' to 0xD5, + '\u05F2' to 0xD6, + '\u05F3' to 0xD7, + '\u05F4' to 0xD8, + '\uFFFD' to 0xD9, + '\uFFFD' to 0xDA, + '\uFFFD' to 0xDB, + '\uFFFD' to 0xDC, + '\uFFFD' to 0xDD, + '\uFFFD' to 0xDE, + '\uFFFD' to 0xDF, + '\u05D0' to 0xE0, + '\u05D1' to 0xE1, + '\u05D2' to 0xE2, + '\u05D3' to 0xE3, + '\u05D4' to 0xE4, + '\u05D5' to 0xE5, + '\u05D6' to 0xE6, + '\u05D7' to 0xE7, + '\u05D8' to 0xE8, + '\u05D9' to 0xE9, + '\u05DA' to 0xEA, + '\u05DB' to 0xEB, + '\u05DC' to 0xEC, + '\u05DD' to 0xED, + '\u05DE' to 0xEE, + '\u05DF' to 0xEF, + '\u05E0' to 0xF0, + '\u05E1' to 0xF1, + '\u05E2' to 0xF2, + '\u05E3' to 0xF3, + '\u05E4' to 0xF4, + '\u05E5' to 0xF5, + '\u05E6' to 0xF6, + '\u05E7' to 0xF7, + '\u05E8' to 0xF8, + '\u05E9' to 0xF9, + '\u05EA' to 0xFA, + '\uFFFD' to 0xFB, + '\uFFFD' to 0xFC, + '\u200E' to 0xFD, + '\u200F' to 0xFE, + '\uFFFD' to 0xFF, + ) +} diff --git a/escpos4k/src/commonMain/kotlin/cz/multiplatform/escpos4k/core/encoding/charset/Windows1256.kt b/escpos4k/src/commonMain/kotlin/cz/multiplatform/escpos4k/core/encoding/charset/Windows1256.kt new file mode 100644 index 0000000..0379f84 --- /dev/null +++ b/escpos4k/src/commonMain/kotlin/cz/multiplatform/escpos4k/core/encoding/charset/Windows1256.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 50 [Windows-1256] */ +public data object Windows1256 : Charset(50, "windows-1256") { + override val mapping: Map = + mapOf( + '\u20AC' to 0x80, + '\u067E' 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, + '\u0679' to 0x8A, + '\u2039' to 0x8B, + '\u0152' to 0x8C, + '\u0686' to 0x8D, + '\u0698' to 0x8E, + '\u0688' to 0x8F, + '\u06AF' to 0x90, + '\u2018' to 0x91, + '\u2019' to 0x92, + '\u201C' to 0x93, + '\u201D' to 0x94, + '\u2022' to 0x95, + '\u2013' to 0x96, + '\u2014' to 0x97, + '\u06A9' to 0x98, + '\u2122' to 0x99, + '\u0691' to 0x9A, + '\u203A' to 0x9B, + '\u0153' to 0x9C, + '\u200C' to 0x9D, + '\u200D' to 0x9E, + '\u06BA' to 0x9F, + '\u00A0' to 0xA0, + '\u060C' 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, + '\u06BE' 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, + '\u061B' to 0xBA, + '\u00BB' to 0xBB, + '\u00BC' to 0xBC, + '\u00BD' to 0xBD, + '\u00BE' to 0xBE, + '\u061F' to 0xBF, + '\u06C1' to 0xC0, + '\u0621' to 0xC1, + '\u0622' to 0xC2, + '\u0623' to 0xC3, + '\u0624' to 0xC4, + '\u0625' to 0xC5, + '\u0626' to 0xC6, + '\u0627' to 0xC7, + '\u0628' to 0xC8, + '\u0629' to 0xC9, + '\u062A' to 0xCA, + '\u062B' to 0xCB, + '\u062C' to 0xCC, + '\u062D' to 0xCD, + '\u062E' to 0xCE, + '\u062F' to 0xCF, + '\u0630' to 0xD0, + '\u0631' to 0xD1, + '\u0632' to 0xD2, + '\u0633' to 0xD3, + '\u0634' to 0xD4, + '\u0635' to 0xD5, + '\u0636' to 0xD6, + '\u00D7' to 0xD7, + '\u0637' to 0xD8, + '\u0638' to 0xD9, + '\u0639' to 0xDA, + '\u063A' to 0xDB, + '\u0640' to 0xDC, + '\u0641' to 0xDD, + '\u0642' to 0xDE, + '\u0643' to 0xDF, + '\u00E0' to 0xE0, + '\u0644' to 0xE1, + '\u00E2' to 0xE2, + '\u0645' to 0xE3, + '\u0646' to 0xE4, + '\u0647' to 0xE5, + '\u0648' to 0xE6, + '\u00E7' to 0xE7, + '\u00E8' to 0xE8, + '\u00E9' to 0xE9, + '\u00EA' to 0xEA, + '\u00EB' to 0xEB, + '\u0649' to 0xEC, + '\u064A' to 0xED, + '\u00EE' to 0xEE, + '\u00EF' to 0xEF, + '\u064B' to 0xF0, + '\u064C' to 0xF1, + '\u064D' to 0xF2, + '\u064E' to 0xF3, + '\u00F4' to 0xF4, + '\u064F' to 0xF5, + '\u0650' to 0xF6, + '\u00F7' to 0xF7, + '\u0651' to 0xF8, + '\u00F9' to 0xF9, + '\u0652' to 0xFA, + '\u00FB' to 0xFB, + '\u00FC' to 0xFC, + '\u200E' to 0xFD, + '\u200F' to 0xFE, + '\u06D2' to 0xFF, + ) +} diff --git a/escpos4k/src/commonMain/kotlin/cz/multiplatform/escpos4k/core/encoding/charset/Windows1257.kt b/escpos4k/src/commonMain/kotlin/cz/multiplatform/escpos4k/core/encoding/charset/Windows1257.kt new file mode 100644 index 0000000..b6e6d7a --- /dev/null +++ b/escpos4k/src/commonMain/kotlin/cz/multiplatform/escpos4k/core/encoding/charset/Windows1257.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 51 [Windows-1257] */ +public data object Windows1257 : Charset(51, "windows-1257") { + override val mapping: Map = + mapOf( + '\u20AC' to 0x80, + '\uFFFD' to 0x81, + '\u201A' to 0x82, + '\uFFFD' to 0x83, + '\u201E' to 0x84, + '\u2026' to 0x85, + '\u2020' to 0x86, + '\u2021' to 0x87, + '\uFFFD' to 0x88, + '\u2030' to 0x89, + '\uFFFD' to 0x8A, + '\u2039' to 0x8B, + '\uFFFD' to 0x8C, + '\u00A8' to 0x8D, + '\u02C7' to 0x8E, + '\u00B8' 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, + '\uFFFD' to 0x98, + '\u2122' to 0x99, + '\uFFFD' to 0x9A, + '\u203A' to 0x9B, + '\uFFFD' to 0x9C, + '\u00AF' to 0x9D, + '\u02DB' to 0x9E, + '\uFFFD' to 0x9F, + '\u00A0' to 0xA0, + '\uFFFD' to 0xA1, + '\u00A2' to 0xA2, + '\u00A3' to 0xA3, + '\u00A4' to 0xA4, + '\uFFFD' to 0xA5, + '\u00A6' to 0xA6, + '\u00A7' to 0xA7, + '\u00D8' to 0xA8, + '\u00A9' to 0xA9, + '\u0156' to 0xAA, + '\u00AB' to 0xAB, + '\u00AC' to 0xAC, + '\u00AD' to 0xAD, + '\u00AE' to 0xAE, + '\u00C6' 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, + '\u00F8' to 0xB8, + '\u00B9' to 0xB9, + '\u0157' to 0xBA, + '\u00BB' to 0xBB, + '\u00BC' to 0xBC, + '\u00BD' to 0xBD, + '\u00BE' to 0xBE, + '\u00E6' to 0xBF, + '\u0104' to 0xC0, + '\u012E' to 0xC1, + '\u0100' to 0xC2, + '\u0106' to 0xC3, + '\u00C4' to 0xC4, + '\u00C5' to 0xC5, + '\u0118' to 0xC6, + '\u0112' to 0xC7, + '\u010C' to 0xC8, + '\u00C9' to 0xC9, + '\u0179' to 0xCA, + '\u0116' to 0xCB, + '\u0122' to 0xCC, + '\u0136' to 0xCD, + '\u012A' to 0xCE, + '\u013B' to 0xCF, + '\u0160' to 0xD0, + '\u0143' to 0xD1, + '\u0145' to 0xD2, + '\u00D3' to 0xD3, + '\u014C' to 0xD4, + '\u00D5' to 0xD5, + '\u00D6' to 0xD6, + '\u00D7' to 0xD7, + '\u0172' to 0xD8, + '\u0141' to 0xD9, + '\u015A' to 0xDA, + '\u016A' to 0xDB, + '\u00DC' to 0xDC, + '\u017B' to 0xDD, + '\u017D' to 0xDE, + '\u00DF' to 0xDF, + '\u0105' to 0xE0, + '\u012F' to 0xE1, + '\u0101' to 0xE2, + '\u0107' to 0xE3, + '\u00E4' to 0xE4, + '\u00E5' to 0xE5, + '\u0119' to 0xE6, + '\u0113' to 0xE7, + '\u010D' to 0xE8, + '\u00E9' to 0xE9, + '\u017A' to 0xEA, + '\u0117' to 0xEB, + '\u0123' to 0xEC, + '\u0137' to 0xED, + '\u012B' to 0xEE, + '\u013C' to 0xEF, + '\u0161' to 0xF0, + '\u0144' to 0xF1, + '\u0146' to 0xF2, + '\u00F3' to 0xF3, + '\u014D' to 0xF4, + '\u00F5' to 0xF5, + '\u00F6' to 0xF6, + '\u00F7' to 0xF7, + '\u0173' to 0xF8, + '\u0142' to 0xF9, + '\u015B' to 0xFA, + '\u016B' to 0xFB, + '\u00FC' to 0xFC, + '\u017C' to 0xFD, + '\u017E' to 0xFE, + '\u02D9' to 0xFF, + ) +} 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, + ) +} diff --git a/escpos4k/src/commonTest/kotlin/cz/multiplatform/escpos4k/core/CommandBuilderTest.kt b/escpos4k/src/commonTest/kotlin/cz/multiplatform/escpos4k/core/CommandBuilderTest.kt index 2b1c341..f25e730 100644 --- a/escpos4k/src/commonTest/kotlin/cz/multiplatform/escpos4k/core/CommandBuilderTest.kt +++ b/escpos4k/src/commonTest/kotlin/cz/multiplatform/escpos4k/core/CommandBuilderTest.kt @@ -1,5 +1,8 @@ package cz.multiplatform.escpos4k.core +import cz.multiplatform.escpos4k.core.encoding.charset.Charset +import cz.multiplatform.escpos4k.core.encoding.charset.IBM850 +import cz.multiplatform.escpos4k.core.encoding.charset.Windows1251 import io.kotest.core.spec.style.FunSpec import io.kotest.matchers.collections.shouldContainExactly @@ -32,14 +35,12 @@ class CommandBuilderTest : FunSpec() { val builder = CommandBuilder(defaultConfig) { charset(Charset.default) - charset(Charset.CP850) - charset(Charset.CP850) - charset(Charset.Windows1251) + charset(IBM850) + charset(IBM850) + charset(Windows1251) } builder.commands shouldContainExactly - initSequence + - Command.SelectCharset(Charset.CP850) + - Command.SelectCharset(Charset.Windows1251) + initSequence + Command.SelectCharset(IBM850) + Command.SelectCharset(Windows1251) } } @@ -48,9 +49,9 @@ class CommandBuilderTest : FunSpec() { val builder = CommandBuilder(defaultConfig) { withCharset(Charset.default) { - withCharset(Charset.CP850) { - withCharset(Charset.CP850) { - withCharset(Charset.Windows1251) { + withCharset(IBM850) { + withCharset(IBM850) { + withCharset(Windows1251) { text("innermost") // } } @@ -60,10 +61,10 @@ class CommandBuilderTest : FunSpec() { builder.commands shouldContainExactly initSequence + - Command.SelectCharset(Charset.CP850) + - Command.SelectCharset(Charset.Windows1251) + - Command.Text("innermost", Charset.Windows1251) + - Command.SelectCharset(Charset.CP850) + + Command.SelectCharset(IBM850) + + Command.SelectCharset(Windows1251) + + Command.Text("innermost", Windows1251) + + Command.SelectCharset(IBM850) + Command.SelectCharset(Charset.default) } } diff --git a/escpos4k/src/jvmMain/kotlin/cz/multiplatform/escpos4k/core/Encoder.jvm.kt b/escpos4k/src/jvmMain/kotlin/cz/multiplatform/escpos4k/core/Encoder.jvm.kt deleted file mode 100644 index 5e4d255..0000000 --- a/escpos4k/src/jvmMain/kotlin/cz/multiplatform/escpos4k/core/Encoder.jvm.kt +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright 2023 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 - -import java.nio.ByteBuffer -import java.nio.CharBuffer -import java.nio.charset.CodingErrorAction -import java.nio.charset.Charset as JavaCharset - -internal actual fun encode(text: String, charset: Charset): ByteArray = - JavaCharset.forName(charset.ianaName) - .newEncoder() - .onMalformedInput(CodingErrorAction.REPLACE) - .onUnmappableCharacter(CodingErrorAction.REPLACE) - .encode(CharBuffer.wrap(text)) - .toByteArray() - -private fun ByteBuffer.toByteArray(): ByteArray { - val array = ByteArray(remaining()) - get(array) - return array -}