Remap some common but unsupported unicode glyphs to similar existing ones.
authorMatthew Mondor <mmondor@pulsar-zone.net>
Wed, 13 Apr 2022 14:51:33 +0000 (14:51 +0000)
committerMatthew Mondor <mmondor@pulsar-zone.net>
Wed, 13 Apr 2022 14:51:33 +0000 (14:51 +0000)
MATT/TODO.txt
hacks/analogterm.c

index 3f5cea0..ae85221 100644 (file)
@@ -9,6 +9,20 @@ BUILD
 TODO
 ====
 
+- When using French in UTF-8 mode on Ubuntu, some glyphs are missing, like the
+  hyphen ‐ from
+  https://en.wikipedia.org/wiki/General_Punctuation_%28Unicode_block%29
+  Remapped to - for now.
+- Should probably remap utf8 0xc2a0 (UCS-32 A0) to normal space
+  (it's the unbreaking space).
+  Done
+- Wordgrinder uses ▲ ▼ and ▷ from
+  https://en.wikipedia.org/wiki/Geometric_Shapes_%28Unicode_block%29
+  Rightwards one remapped to another graphics symbol for now.
+- Lynx uses ↑ and ↓ from
+  https://en.wikipedia.org/wiki/Arrow_%28symbol%29#Unicode
+  and ▮ from Geometric Shapes
+  These have been remapped to existing graphics chars for now.
 - On a friend's Ubuntu machine, analogterm runs and backspace runs fine in
   general but not in top(1)'s line editor, despite ^H being set for ERASE.
   Moreover, strangely, when switching to the English US keyboard layout (his
index c7b9b7d..9f39ae6 100644 (file)
@@ -455,6 +455,33 @@ at_glyph(analogterm_sim_t *sim, uint32_t c, bool decgfx)
        uint8_t (*glyph)[7] = sim->font_unknown->glyphs[0]; /* Default */
        font_t *font;
 
+       /*
+        * These are common unsupported characters.
+        * XXX May need more generic mapping eventually.
+        */
+       switch (c) {
+       case 0x00A0:    /* Non-breaking space */
+               c = ' ';
+               break;
+       case 0x2010:    /* Hyphen */
+               c = '-';
+               break;
+       case 0x25B7:    /* White right-pointing triangle */
+               c = 0x1FB6C;
+               break;
+       case 0x2191:    /* Up arrow */
+               c = 0x1FBB8;
+               break;
+       case 0x2193:    /* Down arrow */
+               c = 0x1FBB7;
+               break;
+       case 0x25AE:    /* Black vertical rectangle */
+               c = 0x2588;
+               break;
+       default:
+               break;
+       }
+
        /* DEC Special Graphics */
        if (decgfx && c > 94 && c < 127)
                return sim->font_decgfx->glyphs[c - 96];