- if (attr & A_ALTCHARSET) {
- chtype temp = UChar(SP->_acs_map[CharOfD(ch)]);
- if (temp != 0)
- SetChar(my_ch, temp, attr);
- RemAttr(my_ch, A_ALTCHARSET);
+ if (!SP_PARM->_screen_acs_map[c8]) {
+ /*
+ * If we found no mapping for a given alternate-character set item
+ * in the terminal description, attempt to use the ASCII fallback
+ * code which is populated in the _acs_map[] array. If that did
+ * not correspond to a line-drawing, etc., graphics character, the
+ * array entry would be empty.
+ */
+ chtype temp = UChar(SP_PARM->_acs_map[c8]);
+ if (temp) {
+ RemAttr(attr, A_ALTCHARSET);
+ SetChar(my_ch, temp, AttrOf(attr));
+ }
+ }
+
+ /*
+ * 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 (temp != 0) {
+ SetChar(my_ch, temp, AttrOf(attr));
+ } else {
+ my_ch = CHDEREF(ch);
+ RemAttr(attr, A_ALTCHARSET);
+ }