summaryrefslogtreecommitdiff
path: root/src/term.c
diff options
context:
space:
mode:
authorChong Yidong <cyd@gnu.org>2012-06-10 00:44:44 +0800
committerChong Yidong <cyd@gnu.org>2012-06-10 00:44:44 +0800
commitcd4eb164a9cb5fd4df2290423830471d6086fd1e (patch)
tree2c0cd8990ab457f7818a8284e4567c6a3c51a6fd /src/term.c
parent4f5d2ba15c0dbe248fea1faea9a319435b5fe31a (diff)
Add support for italic text on ttys.
* src/dispextern.h: Replace unused TTY_CAP_BLINK with TTY_CAP_ITALIC. (struct face): Remove unused fields tty_dim_p, tty_blinking_p, and tty_alt_charset_p. Add tty_italic_p. * src/term.c: Support italics in capable terminals. (no_color_bit): Replace unused NC_BLINK with NC_ITALIC. (turn_on_face): Output using TS_enter_italic_mode if available. Don't handle unused blinking and alt-charset cases. (turn_off_face): Handle italic case; discard unused tty_blinking_p and tty_alt_charset_p cases. (tty_capable_p, init_tty): Support italics. * src/termchar.h (struct tty_display_info): Add field for italics. Remove unused blink field. * src/xfaces.c (tty_supports_face_attributes_p, realize_tty_face): Handle slant. Fixes: debbugs:9652
Diffstat (limited to 'src/term.c')
-rw-r--r--src/term.c41
1 files changed, 15 insertions, 26 deletions
diff --git a/src/term.c b/src/term.c
index 3d7a677374..8ce2efc092 100644
--- a/src/term.c
+++ b/src/term.c
@@ -122,12 +122,11 @@ enum no_color_bit
NC_STANDOUT = 1 << 0,
NC_UNDERLINE = 1 << 1,
NC_REVERSE = 1 << 2,
- NC_BLINK = 1 << 3,
+ NC_ITALIC = 1 << 3,
NC_DIM = 1 << 4,
NC_BOLD = 1 << 5,
NC_INVIS = 1 << 6,
- NC_PROTECT = 1 << 7,
- NC_ALT_CHARSET = 1 << 8
+ NC_PROTECT = 1 << 7
};
/* internal state */
@@ -2022,17 +2021,16 @@ turn_on_face (struct frame *f, int face_id)
if (face->tty_bold_p && MAY_USE_WITH_COLORS_P (tty, NC_BOLD))
OUTPUT1_IF (tty, tty->TS_enter_bold_mode);
- if (face->tty_dim_p && MAY_USE_WITH_COLORS_P (tty, NC_DIM))
- OUTPUT1_IF (tty, tty->TS_enter_dim_mode);
-
- /* Alternate charset and blinking not yet used. */
- if (face->tty_alt_charset_p
- && MAY_USE_WITH_COLORS_P (tty, NC_ALT_CHARSET))
- OUTPUT1_IF (tty, tty->TS_enter_alt_charset_mode);
-
- if (face->tty_blinking_p
- && MAY_USE_WITH_COLORS_P (tty, NC_BLINK))
- OUTPUT1_IF (tty, tty->TS_enter_blink_mode);
+ if (face->tty_italic_p && MAY_USE_WITH_COLORS_P (tty, NC_ITALIC))
+ {
+ if (tty->TS_enter_italic_mode)
+ OUTPUT1 (tty, tty->TS_enter_italic_mode);
+ else
+ /* Italics mode is unavailable on many terminals. In that
+ case, map slant to dimmed text; we want italic text to
+ appear different and dimming is not otherwise used. */
+ OUTPUT1 (tty, tty->TS_enter_dim_mode);
+ }
if (face->tty_underline_p && MAY_USE_WITH_COLORS_P (tty, NC_UNDERLINE))
OUTPUT1_IF (tty, tty->TS_enter_underline_mode);
@@ -2077,27 +2075,19 @@ turn_off_face (struct frame *f, int face_id)
half-bright, reverse-video, standout, underline. It may or
may not turn off alt-char-mode. */
if (face->tty_bold_p
- || face->tty_dim_p
+ || face->tty_italic_p
|| face->tty_reverse_p
- || face->tty_alt_charset_p
- || face->tty_blinking_p
|| face->tty_underline_p)
{
OUTPUT1_IF (tty, tty->TS_exit_attribute_mode);
if (strcmp (tty->TS_exit_attribute_mode, tty->TS_end_standout_mode) == 0)
tty->standout_mode = 0;
}
-
- if (face->tty_alt_charset_p)
- OUTPUT_IF (tty, tty->TS_exit_alt_charset_mode);
}
else
{
/* If we don't have "me" we can only have those appearances
that have exit sequences defined. */
- if (face->tty_alt_charset_p)
- OUTPUT_IF (tty, tty->TS_exit_alt_charset_mode);
-
if (face->tty_underline_p)
OUTPUT_IF (tty, tty->TS_exit_underline_mode);
}
@@ -2128,8 +2118,7 @@ tty_capable_p (struct tty_display_info *tty, unsigned int caps,
TTY_CAPABLE_P_TRY (tty, TTY_CAP_UNDERLINE, tty->TS_enter_underline_mode, NC_UNDERLINE);
TTY_CAPABLE_P_TRY (tty, TTY_CAP_BOLD, tty->TS_enter_bold_mode, NC_BOLD);
TTY_CAPABLE_P_TRY (tty, TTY_CAP_DIM, tty->TS_enter_dim_mode, NC_DIM);
- TTY_CAPABLE_P_TRY (tty, TTY_CAP_BLINK, tty->TS_enter_blink_mode, NC_BLINK);
- TTY_CAPABLE_P_TRY (tty, TTY_CAP_ALT_CHARSET, tty->TS_enter_alt_charset_mode, NC_ALT_CHARSET);
+ TTY_CAPABLE_P_TRY (tty, TTY_CAP_ITALIC, tty->TS_enter_italic_mode, NC_ITALIC);
/* We can do it! */
return 1;
@@ -3222,8 +3211,8 @@ use the Bourne shell command `TERM=... export TERM' (C-shell:\n\
tty->TS_enter_underline_mode = tgetstr ("us", address);
tty->TS_exit_underline_mode = tgetstr ("ue", address);
tty->TS_enter_bold_mode = tgetstr ("md", address);
+ tty->TS_enter_italic_mode = tgetstr ("ZH", address);
tty->TS_enter_dim_mode = tgetstr ("mh", address);
- tty->TS_enter_blink_mode = tgetstr ("mb", address);
tty->TS_enter_reverse_mode = tgetstr ("mr", address);
tty->TS_enter_alt_charset_mode = tgetstr ("as", address);
tty->TS_exit_alt_charset_mode = tgetstr ("ae", address);