From cf4d955df01a821777accc248cfd9eb9bafe5241 Mon Sep 17 00:00:00 2001 From: Bixilon Date: Thu, 15 Jun 2023 14:07:18 +0200 Subject: [PATCH] legacy unicode font type: make chars one pixel smaller --- .../font/types/unicode/legacy/LegacyUnicodeFontTypeTest.kt | 6 +++--- .../font/types/unicode/legacy/LegacyUnicodeFontType.kt | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/integration-test/kotlin/de/bixilon/minosoft/gui/rendering/font/types/unicode/legacy/LegacyUnicodeFontTypeTest.kt b/src/integration-test/kotlin/de/bixilon/minosoft/gui/rendering/font/types/unicode/legacy/LegacyUnicodeFontTypeTest.kt index b2e1feb87..e1892632a 100644 --- a/src/integration-test/kotlin/de/bixilon/minosoft/gui/rendering/font/types/unicode/legacy/LegacyUnicodeFontTypeTest.kt +++ b/src/integration-test/kotlin/de/bixilon/minosoft/gui/rendering/font/types/unicode/legacy/LegacyUnicodeFontTypeTest.kt @@ -47,7 +47,7 @@ class LegacyUnicodeFontTypeTest { } fun firstChar() { - val sizes = byteArrayOf(0x19, 0x12, 0x45) + val sizes = byteArrayOf(0x09, 0x12, 0x45) val chars = load(sizes) val char = chars[0]!! @@ -67,7 +67,7 @@ class LegacyUnicodeFontTypeTest { } fun secondChar() { - val sizes = byteArrayOf(0x00, 0x28) + val sizes = byteArrayOf(0x00, 0x18) val chars = load(sizes) val char = chars[1]!! @@ -78,7 +78,7 @@ class LegacyUnicodeFontTypeTest { fun `19th char`() { val sizes = ByteArray(19) - sizes[18] = 0x9E.toByte() + sizes[18] = 0x8E.toByte() val chars = load(sizes) val char = chars[18]!! diff --git a/src/main/java/de/bixilon/minosoft/gui/rendering/font/types/unicode/legacy/LegacyUnicodeFontType.kt b/src/main/java/de/bixilon/minosoft/gui/rendering/font/types/unicode/legacy/LegacyUnicodeFontType.kt index db49cd104..74e32ecc4 100644 --- a/src/main/java/de/bixilon/minosoft/gui/rendering/font/types/unicode/legacy/LegacyUnicodeFontType.kt +++ b/src/main/java/de/bixilon/minosoft/gui/rendering/font/types/unicode/legacy/LegacyUnicodeFontType.kt @@ -95,7 +95,7 @@ class LegacyUnicodeFontType( val widthByte = sizes.read() if (widthByte < 0) throw IllegalStateException("Unexpected end of sizes stream (pageId=$pageId, x=$x, y=$y)!") - val xStart = maxOf(0, ((widthByte shr 4) and 0x0F) - 1) + val xStart = maxOf(0, ((widthByte shr 4) and 0x0F)) val width = (widthByte and 0x0F) + 1 - xStart