use os_check_unicode()
authorborg323 <4010067-borg323@users.noreply.gitlab.com>
Mon, 10 Jun 2019 19:02:58 +0000 (22:02 +0300)
committerborg323 <4010067-borg323@users.noreply.gitlab.com>
Mon, 10 Jun 2019 19:02:58 +0000 (22:02 +0300)
src/common/frotz.h
src/common/text.c
src/curses/ux_text.c
src/dumb/dumb_output.c

index 3abad433962bbfe0fee2875c0354bfcfe162abf3..d78d62dc61bcf3fb5ff50cfef64743a69dc2309a 100644 (file)
@@ -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);
index 6768e04eea4e220f5cdb3de03b940092fd520cdb..920a6c2b0966e82cebc80807f8af317298c57b98 100644 (file)
@@ -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);
index 4973f7aa76776f0e37dcaba0ed2349fb1394dc22..3a04ea769d8fe60d717bf5ea040d5ed8a4c7f5b9 100644 (file)
@@ -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
index 09bbdd2041515b16bcaee54f76b1f7e506e1acee..0e4f78fa43930d076a85be310a0983d402510721 100644 (file)
@@ -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) {