curses_putmixed() initial attempt

The curses interface was using genl_putmixed() which doesn't
preserve the symbol actually used for a glyph on the display.
This is a first-attempt at implementing curses_putmixed().

On Linux you'll need to distribute the Makefiles again
    sh sys/unix/setup.sh sys/unix/hints/linux.370

On macOS, you'll need to distribute the Makefiles again
    sh sys/unix/setup.sh sys/unix/hints/macOS.370
This commit is contained in:
nhmall
2023-06-06 17:50:08 -04:00
parent a5a11c19c9
commit 4034ec915c
6 changed files with 131 additions and 10 deletions

View File

@@ -542,6 +542,33 @@ mixed_to_utf8(char *buf, size_t bufsz, const char *str, int *retflags)
return buf;
}
/*
* helper routine if a window port wants to extract the unicode
* representation from a glyph representation in the string;
* the returned string is the remainder of the string after
* extracting the \GNNNNNNNN information.
*/
const char *
mixed_to_glyphinfo(const char *str, glyph_info *gip)
{
int dcount, ggv;
if (!str || !gip)
return " ";
*gip = nul_glyphinfo;
if (*str == '\\' && *(str + 1) == 'G') {
if ((dcount = decode_glyph(str + 2, &ggv))) {
map_glyphinfo(0, 0, ggv, 0, gip);
/* 'str' is ready for the next loop iteration and
'*str' should not be copied at the end of this
iteration */
str += (dcount + 2);
}
}
return str;
}
void
dump_all_glyphids(FILE *fp)
{