Fixed block rendering issues

Fixed issues where graphic blocks had horizontal stripes in them
This commit is contained in:
2026-01-02 00:20:28 +01:00
parent 132dc50de8
commit 66cb788fb0
2 changed files with 44 additions and 17 deletions

View File

@@ -15,10 +15,10 @@ ENGLISH = {
# Swedish/Finnish/Hungarian - Option 010 (2)
SWEDISH_FINNISH = {
0x23: '#', 0x24: '¤', 0x40: 'É',
0x5B: 'Ä', 0x5C: 'Ö', 0x5D: 'Å', 0x5E: 'Ü',
0x5F: '_', 0x60: 'é',
0x7B: 'ä', 0x7C: 'ö', 0x7D: 'å', 0x7E: 'ü'
0x23: '#', 0x24: '\u00A4', 0x40: '\u00C9',
0x5B: '\u00C4', 0x5C: '\u00D6', 0x5D: '\u00C5', 0x5E: '\u00DC',
0x5F: '_', 0x60: '\u00E9',
0x7B: '\u00E4', 0x7C: '\u00F6', 0x7D: '\u00E5', 0x7E: '\u00FC'
}
# German - Option 001 (1)
@@ -58,3 +58,22 @@ def get_char(byte_val, subset_idx):
return mapping[valid_byte]
return chr(valid_byte)
import unicodedata
def get_byte_from_char(char, subset_idx):
if len(char) != 1: return 0
# Normalize input to NFC to match our map keys (if they are NFC, which python literals usually are)
char = unicodedata.normalize('NFC', char)
if subset_idx < 0 or subset_idx >= len(SETS):
subset_idx = 0
mapping = SETS[subset_idx]
for code, mapped_char in mapping.items():
if mapped_char == char:
return code
return ord(char)