From 1a221c64c0194563d1ec4f9af78fa06ced9c8647 Mon Sep 17 00:00:00 2001 From: borg323 <4010067-borg323@users.noreply.gitlab.com> Date: Mon, 10 Jun 2019 22:02:58 +0300 Subject: [PATCH] use os_check_unicode() --- src/common/frotz.h | 1 + src/common/text.c | 9 ++++++--- src/curses/ux_text.c | 12 ++++++++++++ src/dumb/dumb_output.c | 6 ++++++ 4 files changed, 25 insertions(+), 3 deletions(-) diff --git a/src/common/frotz.h b/src/common/frotz.h index 3abad43..d78d62d 100644 --- a/src/common/frotz.h +++ b/src/common/frotz.h @@ -805,6 +805,7 @@ Zwindow * curwinrec( void); void os_beep (int); int os_char_width (zchar); +int os_check_unicode (int, zword); void os_display_char (zchar); void os_display_string (const zchar *); void os_draw_picture (int, int, int); diff --git a/src/common/text.c b/src/common/text.c index 6768e04..920a6c2 100644 --- a/src/common/text.c +++ b/src/common/text.c @@ -25,6 +25,7 @@ enum string_type { }; extern zword object_name (zword); +extern zword get_window_font (zword); static zchar decoded[10]; static zword encoded[3]; @@ -343,11 +344,13 @@ void z_check_unicode (void) else if (c >= 0xa1 && c <= 0xff) store (3); #else - else if (c >= 0xa1) - /* being optimistic, we can print all unicode characters + else if (c >= 0xa1) { + /* being optimistic, we can print all unicode characters supported * and input the ones with zscii representation */ - store ((unicode_to_zscii (c) != 0) ? 3 : 1); + zword mask = (unicode_to_zscii (c) != 0) ? 3 : 1; + store (mask & os_check_unicode (get_window_font(cwin), c)); + } #endif else store (0); diff --git a/src/curses/ux_text.c b/src/curses/ux_text.c index 4973f7a..3a04ea7 100644 --- a/src/curses/ux_text.c +++ b/src/curses/ux_text.c @@ -277,6 +277,18 @@ void os_display_string (const zchar *s) }/* os_display_string */ +/* + * os_check_unicode + * + * Return with bit 0 set if the Unicode character can be + * displayed, and bit 1 if it can be input. + * + */ +int os_check_unicode(int font, zword c) +{ +/* Assume full input and output. */ + return 3; +} /* * os_char_width diff --git a/src/dumb/dumb_output.c b/src/dumb/dumb_output.c index 09bbdd2..0e4f78f 100644 --- a/src/dumb/dumb_output.c +++ b/src/dumb/dumb_output.c @@ -90,6 +90,12 @@ static char *dumb_changes_row(int r) return screen_changes + r * h_screen_cols; } +int os_check_unicode(int font, zword c) +{ +/* Only UTF-8 output, no input yet. */ + return 1; +} + int os_char_width (zchar z) { if (plain_ascii && z >= ZC_LATIN1_MIN) { -- 2.34.1