diff options
author | Jesse Luehrs <doy@tozt.net> | 2014-04-27 01:41:41 -0400 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2014-04-27 01:41:41 -0400 |
commit | f74888f96379a4e1911002282a623cf40325a8fd (patch) | |
tree | 169ccf8e631ebbd07b2018454edf68db82868fe6 /src | |
parent | 40280ca16718984c2d9dc5786a69be82a8a9f259 (diff) | |
download | runes-f74888f96379a4e1911002282a623cf40325a8fd.tar.gz runes-f74888f96379a4e1911002282a623cf40325a8fd.zip |
normalize cell contents to NFC
some fonts (like the X11 bitmap fonts) include glyphs for things like á,
but can't handle composing a + ´, so try to precompose things as much as
possible
Diffstat (limited to 'src')
-rw-r--r-- | src/screen.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/screen.c b/src/screen.c index 429b057..fa7182b 100644 --- a/src/screen.c +++ b/src/screen.c @@ -105,8 +105,18 @@ void runes_screen_show_string_utf8(RunesTerm *t, char *buf, size_t len) } if (cell) { + char *normal; + memcpy(cell->contents + cell->len, c, next - c); cell->len += next - c; + /* some fonts have combined characters but can't handle + * combining characters, so try to fix that here */ + /* XXX it'd be nice if there was a way to do this that didn't + * require an allocation */ + normal = g_utf8_normalize( + cell->contents, cell->len, G_NORMALIZE_NFC); + memcpy(cell->contents, normal, cell->len); + free(normal); } } else { |