diff --git a/src/main/java/de/bixilon/minosoft/gui/rendering/font/types/unicode/unihex/UnihexFontType.kt b/src/main/java/de/bixilon/minosoft/gui/rendering/font/types/unicode/unihex/UnihexFontType.kt index ec3b9916c..e2b88a005 100644 --- a/src/main/java/de/bixilon/minosoft/gui/rendering/font/types/unicode/unihex/UnihexFontType.kt +++ b/src/main/java/de/bixilon/minosoft/gui/rendering/font/types/unicode/unihex/UnihexFontType.kt @@ -1,6 +1,6 @@ /* * Minosoft - * Copyright (C) 2020-2025 Moritz Zwerger + * Copyright (C) 2020-2026 Moritz Zwerger * * This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. * @@ -126,9 +126,10 @@ class UnihexFontType( while (this.available() > 0) { val codePoint = readHexInt() if (codePoint == -1) continue - val data = this.readUnihexData(buffer) - chars[codePoint] = data - totalWidth += data.size / (UnifontRasterizer.HEIGHT / Byte.SIZE_BITS) + val data = readUnihexData(buffer) + if (chars.putIfAbsent(codePoint, data) == null) { + totalWidth += data.size / (UnifontRasterizer.HEIGHT / Byte.SIZE_BITS) + } } return totalWidth