* 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
+2012-06-09 Chong Yidong <cyd@gnu.org>
+
+ * term.c: Support italics in capable terminals (Bug#9652).
+ (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.
+
+ * termchar.h (struct tty_display_info): Add field for italics.
+ Remove unused blink field.
+
+ * xfaces.c (tty_supports_face_attributes_p, realize_tty_face):
+ Handle slant.
+
+ * 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.
+
2012-06-09 Michael Albinus <michael.albinus@gmx.de>
* dbusbind.c (XD_BASIC_DBUS_TYPE): Use dbus_type_is_valid and
unsigned strike_through_color_defaulted_p : 1;
unsigned box_color_defaulted_p : 1;
- /* TTY appearances. Blinking is not yet implemented. Colors are
- found in `lface' with empty color string meaning the default
- color of the TTY. */
+ /* TTY appearances. Colors are found in `lface' with empty color
+ string meaning the default color of the TTY. */
unsigned tty_bold_p : 1;
- unsigned tty_dim_p : 1;
+ unsigned tty_italic_p : 1;
unsigned tty_underline_p : 1;
- unsigned tty_alt_charset_p : 1;
unsigned tty_reverse_p : 1;
- unsigned tty_blinking_p : 1;
/* 1 means that colors of this face may not be freed because they
have been copied bitwise from a base face (see
#define TTY_CAP_UNDERLINE 0x02
#define TTY_CAP_BOLD 0x04
#define TTY_CAP_DIM 0x08
-#define TTY_CAP_BLINK 0x10
-#define TTY_CAP_ALT_CHARSET 0x20
+#define TTY_CAP_ITALIC 0x10
\f
/***********************************************************************
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 */
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);
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);
}
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;
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);
each as vpos and hpos) */
const char *TS_enter_bold_mode; /* "md" -- turn on bold (extra bright mode). */
+ const char *TS_enter_italic_mode; /* "ZH" -- turn on italics mode. */
const char *TS_enter_dim_mode; /* "mh" -- turn on half-bright mode. */
- const char *TS_enter_blink_mode; /* "mb" -- enter blinking mode. */
const char *TS_enter_reverse_mode; /* "mr" -- enter reverse video mode. */
const char *TS_exit_underline_mode; /* "us" -- start underlining. */
const char *TS_enter_underline_mode; /* "ue" -- end underlining. */
tty_supports_face_attributes_p (struct frame *f, Lisp_Object *attrs,
struct face *def_face)
{
- int weight;
+ int weight, slant;
Lisp_Object val, fg, bg;
XColor fg_tty_color, fg_std_color;
XColor bg_tty_color, bg_std_color;
unsigned test_caps = 0;
Lisp_Object *def_attrs = def_face->lface;
-
/* First check some easy-to-check stuff; ttys support none of the
following attributes, so we can just return false if any are requested
(even if `nominal' values are specified, we should still return false,
|| !UNSPECIFIEDP (attrs[LFACE_SWIDTH_INDEX])
|| !UNSPECIFIEDP (attrs[LFACE_OVERLINE_INDEX])
|| !UNSPECIFIEDP (attrs[LFACE_STRIKE_THROUGH_INDEX])
- || !UNSPECIFIEDP (attrs[LFACE_BOX_INDEX])
- || !UNSPECIFIEDP (attrs[LFACE_SLANT_INDEX]))
+ || !UNSPECIFIEDP (attrs[LFACE_BOX_INDEX]))
return 0;
-
/* Test for terminal `capabilities' (non-color character attributes). */
/* font weight (bold/dim) */
return 0; /* same as default */
}
+ /* font slant */
+ val = attrs[LFACE_SLANT_INDEX];
+ if (!UNSPECIFIEDP (val)
+ && (slant = FONT_SLANT_NAME_NUMERIC (val), slant >= 0))
+ {
+ int def_slant = FONT_SLANT_NAME_NUMERIC (def_attrs[LFACE_SLANT_INDEX]);
+ if (slant == 100 || slant == def_slant)
+ return 0; /* same as default */
+ else
+ test_caps |= TTY_CAP_ITALIC;
+ }
+
/* underlining */
val = attrs[LFACE_UNDERLINE_INDEX];
if (!UNSPECIFIEDP (val))
face->font_name = FRAME_MSDOS_P (cache->f) ? "ms-dos" : "tty";
#endif
- /* Map face attributes to TTY appearances. We map slant to
- dimmed text because we want italic text to appear differently
- and because dimmed text is probably used infrequently. */
+ /* Map face attributes to TTY appearances. */
weight = FONT_WEIGHT_NAME_NUMERIC (attrs[LFACE_WEIGHT_INDEX]);
slant = FONT_SLANT_NAME_NUMERIC (attrs[LFACE_SLANT_INDEX]);
if (weight > 100)
face->tty_bold_p = 1;
- if (weight < 100 || slant != 100)
- face->tty_dim_p = 1;
+ if (slant != 100)
+ face->tty_italic_p = 1;
if (!NILP (attrs[LFACE_UNDERLINE_INDEX]))
face->tty_underline_p = 1;
if (!NILP (attrs[LFACE_INVERSE_INDEX]))