+ if ((AttrOf(attr) & A_ALTCHARSET)
+ && SP_PARM->_acs_map != 0
+ && CharOfD(ch) < ACS_LEN) {
+ my_ch = CHDEREF(ch); /* work around const param */
+#if USE_WIDEC_SUPPORT
+ /*
+ * This is crude & ugly, but works most of the time. It checks if the
+ * acs_chars string specified that we have a mapping for this
+ * character, and uses the wide-character mapping when we expect the
+ * normal one to be broken (by mis-design ;-).
+ */
+ if (SP_PARM->_screen_acs_fix
+ && SP_PARM->_screen_acs_map[CharOf(my_ch)]) {
+ RemAttr(attr, A_ALTCHARSET);
+ my_ch = _nc_wacs[CharOf(my_ch)];
+ }
+#endif
+ /*
+ * If we (still) have alternate character set, it is the normal 8bit
+ * flavor. The _screen_acs_map[] array tells if the character was
+ * really in acs_chars, needed because of the way wide/normal line
+ * drawing flavors are integrated.
+ */
+ if (AttrOf(attr) & A_ALTCHARSET) {
+ int j = CharOfD(ch);
+ chtype temp = UChar(SP_PARM->_acs_map[j]);
+
+ if (!(SP_PARM->_screen_acs_map[j])) {
+ RemAttr(attr, A_ALTCHARSET);
+ if (temp == 0)
+ temp = ' ';
+ }
+ if (temp != 0)
+ SetChar(my_ch, temp, AttrOf(attr));
+ }
+ ch = CHREF(my_ch);
+ }
+ if (tilde_glitch && (CharOfD(ch) == L('~'))) {
+ SetChar(tilde, L('`'), AttrOf(attr));
+ ch = CHREF(tilde);
+ }