diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 20 | ||||
| -rw-r--r-- | src/dispextern.h | 12 | ||||
| -rw-r--r-- | src/term.c | 41 | ||||
| -rw-r--r-- | src/termchar.h | 2 | ||||
| -rw-r--r-- | src/xfaces.c | 27 |
5 files changed, 57 insertions, 45 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 563faaae68b..fb8b2a7b956 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,23 @@ | |||
| 1 | 2012-06-09 Chong Yidong <cyd@gnu.org> | ||
| 2 | |||
| 3 | * term.c: Support italics in capable terminals (Bug#9652). | ||
| 4 | (no_color_bit): Replace unused NC_BLINK with NC_ITALIC. | ||
| 5 | (turn_on_face): Output using TS_enter_italic_mode if available. | ||
| 6 | Don't handle unused blinking and alt-charset cases. | ||
| 7 | (turn_off_face): Handle italic case; discard unused tty_blinking_p | ||
| 8 | and tty_alt_charset_p cases. | ||
| 9 | (tty_capable_p, init_tty): Support italics. | ||
| 10 | |||
| 11 | * termchar.h (struct tty_display_info): Add field for italics. | ||
| 12 | Remove unused blink field. | ||
| 13 | |||
| 14 | * xfaces.c (tty_supports_face_attributes_p, realize_tty_face): | ||
| 15 | Handle slant. | ||
| 16 | |||
| 17 | * dispextern.h: Replace unused TTY_CAP_BLINK with TTY_CAP_ITALIC. | ||
| 18 | (struct face): Remove unused fields tty_dim_p, tty_blinking_p, and | ||
| 19 | tty_alt_charset_p. Add tty_italic_p. | ||
| 20 | |||
| 1 | 2012-06-09 Michael Albinus <michael.albinus@gmx.de> | 21 | 2012-06-09 Michael Albinus <michael.albinus@gmx.de> |
| 2 | 22 | ||
| 3 | * dbusbind.c (XD_BASIC_DBUS_TYPE): Use dbus_type_is_valid and | 23 | * dbusbind.c (XD_BASIC_DBUS_TYPE): Use dbus_type_is_valid and |
diff --git a/src/dispextern.h b/src/dispextern.h index 979ade70bfc..b877bf9965a 100644 --- a/src/dispextern.h +++ b/src/dispextern.h | |||
| @@ -1609,15 +1609,12 @@ struct face | |||
| 1609 | unsigned strike_through_color_defaulted_p : 1; | 1609 | unsigned strike_through_color_defaulted_p : 1; |
| 1610 | unsigned box_color_defaulted_p : 1; | 1610 | unsigned box_color_defaulted_p : 1; |
| 1611 | 1611 | ||
| 1612 | /* TTY appearances. Blinking is not yet implemented. Colors are | 1612 | /* TTY appearances. Colors are found in `lface' with empty color |
| 1613 | found in `lface' with empty color string meaning the default | 1613 | string meaning the default color of the TTY. */ |
| 1614 | color of the TTY. */ | ||
| 1615 | unsigned tty_bold_p : 1; | 1614 | unsigned tty_bold_p : 1; |
| 1616 | unsigned tty_dim_p : 1; | 1615 | unsigned tty_italic_p : 1; |
| 1617 | unsigned tty_underline_p : 1; | 1616 | unsigned tty_underline_p : 1; |
| 1618 | unsigned tty_alt_charset_p : 1; | ||
| 1619 | unsigned tty_reverse_p : 1; | 1617 | unsigned tty_reverse_p : 1; |
| 1620 | unsigned tty_blinking_p : 1; | ||
| 1621 | 1618 | ||
| 1622 | /* 1 means that colors of this face may not be freed because they | 1619 | /* 1 means that colors of this face may not be freed because they |
| 1623 | have been copied bitwise from a base face (see | 1620 | have been copied bitwise from a base face (see |
| @@ -2979,8 +2976,7 @@ enum tool_bar_item_image | |||
| 2979 | #define TTY_CAP_UNDERLINE 0x02 | 2976 | #define TTY_CAP_UNDERLINE 0x02 |
| 2980 | #define TTY_CAP_BOLD 0x04 | 2977 | #define TTY_CAP_BOLD 0x04 |
| 2981 | #define TTY_CAP_DIM 0x08 | 2978 | #define TTY_CAP_DIM 0x08 |
| 2982 | #define TTY_CAP_BLINK 0x10 | 2979 | #define TTY_CAP_ITALIC 0x10 |
| 2983 | #define TTY_CAP_ALT_CHARSET 0x20 | ||
| 2984 | 2980 | ||
| 2985 | 2981 | ||
| 2986 | /*********************************************************************** | 2982 | /*********************************************************************** |
diff --git a/src/term.c b/src/term.c index 3d7a677374c..8ce2efc0929 100644 --- a/src/term.c +++ b/src/term.c | |||
| @@ -122,12 +122,11 @@ enum no_color_bit | |||
| 122 | NC_STANDOUT = 1 << 0, | 122 | NC_STANDOUT = 1 << 0, |
| 123 | NC_UNDERLINE = 1 << 1, | 123 | NC_UNDERLINE = 1 << 1, |
| 124 | NC_REVERSE = 1 << 2, | 124 | NC_REVERSE = 1 << 2, |
| 125 | NC_BLINK = 1 << 3, | 125 | NC_ITALIC = 1 << 3, |
| 126 | NC_DIM = 1 << 4, | 126 | NC_DIM = 1 << 4, |
| 127 | NC_BOLD = 1 << 5, | 127 | NC_BOLD = 1 << 5, |
| 128 | NC_INVIS = 1 << 6, | 128 | NC_INVIS = 1 << 6, |
| 129 | NC_PROTECT = 1 << 7, | 129 | NC_PROTECT = 1 << 7 |
| 130 | NC_ALT_CHARSET = 1 << 8 | ||
| 131 | }; | 130 | }; |
| 132 | 131 | ||
| 133 | /* internal state */ | 132 | /* internal state */ |
| @@ -2022,17 +2021,16 @@ turn_on_face (struct frame *f, int face_id) | |||
| 2022 | if (face->tty_bold_p && MAY_USE_WITH_COLORS_P (tty, NC_BOLD)) | 2021 | if (face->tty_bold_p && MAY_USE_WITH_COLORS_P (tty, NC_BOLD)) |
| 2023 | OUTPUT1_IF (tty, tty->TS_enter_bold_mode); | 2022 | OUTPUT1_IF (tty, tty->TS_enter_bold_mode); |
| 2024 | 2023 | ||
| 2025 | if (face->tty_dim_p && MAY_USE_WITH_COLORS_P (tty, NC_DIM)) | 2024 | if (face->tty_italic_p && MAY_USE_WITH_COLORS_P (tty, NC_ITALIC)) |
| 2026 | OUTPUT1_IF (tty, tty->TS_enter_dim_mode); | 2025 | { |
| 2027 | 2026 | if (tty->TS_enter_italic_mode) | |
| 2028 | /* Alternate charset and blinking not yet used. */ | 2027 | OUTPUT1 (tty, tty->TS_enter_italic_mode); |
| 2029 | if (face->tty_alt_charset_p | 2028 | else |
| 2030 | && MAY_USE_WITH_COLORS_P (tty, NC_ALT_CHARSET)) | 2029 | /* Italics mode is unavailable on many terminals. In that |
| 2031 | OUTPUT1_IF (tty, tty->TS_enter_alt_charset_mode); | 2030 | case, map slant to dimmed text; we want italic text to |
| 2032 | 2031 | appear different and dimming is not otherwise used. */ | |
| 2033 | if (face->tty_blinking_p | 2032 | OUTPUT1 (tty, tty->TS_enter_dim_mode); |
| 2034 | && MAY_USE_WITH_COLORS_P (tty, NC_BLINK)) | 2033 | } |
| 2035 | OUTPUT1_IF (tty, tty->TS_enter_blink_mode); | ||
| 2036 | 2034 | ||
| 2037 | if (face->tty_underline_p && MAY_USE_WITH_COLORS_P (tty, NC_UNDERLINE)) | 2035 | if (face->tty_underline_p && MAY_USE_WITH_COLORS_P (tty, NC_UNDERLINE)) |
| 2038 | OUTPUT1_IF (tty, tty->TS_enter_underline_mode); | 2036 | OUTPUT1_IF (tty, tty->TS_enter_underline_mode); |
| @@ -2077,27 +2075,19 @@ turn_off_face (struct frame *f, int face_id) | |||
| 2077 | half-bright, reverse-video, standout, underline. It may or | 2075 | half-bright, reverse-video, standout, underline. It may or |
| 2078 | may not turn off alt-char-mode. */ | 2076 | may not turn off alt-char-mode. */ |
| 2079 | if (face->tty_bold_p | 2077 | if (face->tty_bold_p |
| 2080 | || face->tty_dim_p | 2078 | || face->tty_italic_p |
| 2081 | || face->tty_reverse_p | 2079 | || face->tty_reverse_p |
| 2082 | || face->tty_alt_charset_p | ||
| 2083 | || face->tty_blinking_p | ||
| 2084 | || face->tty_underline_p) | 2080 | || face->tty_underline_p) |
| 2085 | { | 2081 | { |
| 2086 | OUTPUT1_IF (tty, tty->TS_exit_attribute_mode); | 2082 | OUTPUT1_IF (tty, tty->TS_exit_attribute_mode); |
| 2087 | if (strcmp (tty->TS_exit_attribute_mode, tty->TS_end_standout_mode) == 0) | 2083 | if (strcmp (tty->TS_exit_attribute_mode, tty->TS_end_standout_mode) == 0) |
| 2088 | tty->standout_mode = 0; | 2084 | tty->standout_mode = 0; |
| 2089 | } | 2085 | } |
| 2090 | |||
| 2091 | if (face->tty_alt_charset_p) | ||
| 2092 | OUTPUT_IF (tty, tty->TS_exit_alt_charset_mode); | ||
| 2093 | } | 2086 | } |
| 2094 | else | 2087 | else |
| 2095 | { | 2088 | { |
| 2096 | /* If we don't have "me" we can only have those appearances | 2089 | /* If we don't have "me" we can only have those appearances |
| 2097 | that have exit sequences defined. */ | 2090 | that have exit sequences defined. */ |
| 2098 | if (face->tty_alt_charset_p) | ||
| 2099 | OUTPUT_IF (tty, tty->TS_exit_alt_charset_mode); | ||
| 2100 | |||
| 2101 | if (face->tty_underline_p) | 2091 | if (face->tty_underline_p) |
| 2102 | OUTPUT_IF (tty, tty->TS_exit_underline_mode); | 2092 | OUTPUT_IF (tty, tty->TS_exit_underline_mode); |
| 2103 | } | 2093 | } |
| @@ -2128,8 +2118,7 @@ tty_capable_p (struct tty_display_info *tty, unsigned int caps, | |||
| 2128 | TTY_CAPABLE_P_TRY (tty, TTY_CAP_UNDERLINE, tty->TS_enter_underline_mode, NC_UNDERLINE); | 2118 | TTY_CAPABLE_P_TRY (tty, TTY_CAP_UNDERLINE, tty->TS_enter_underline_mode, NC_UNDERLINE); |
| 2129 | TTY_CAPABLE_P_TRY (tty, TTY_CAP_BOLD, tty->TS_enter_bold_mode, NC_BOLD); | 2119 | TTY_CAPABLE_P_TRY (tty, TTY_CAP_BOLD, tty->TS_enter_bold_mode, NC_BOLD); |
| 2130 | TTY_CAPABLE_P_TRY (tty, TTY_CAP_DIM, tty->TS_enter_dim_mode, NC_DIM); | 2120 | TTY_CAPABLE_P_TRY (tty, TTY_CAP_DIM, tty->TS_enter_dim_mode, NC_DIM); |
| 2131 | TTY_CAPABLE_P_TRY (tty, TTY_CAP_BLINK, tty->TS_enter_blink_mode, NC_BLINK); | 2121 | TTY_CAPABLE_P_TRY (tty, TTY_CAP_ITALIC, tty->TS_enter_italic_mode, NC_ITALIC); |
| 2132 | TTY_CAPABLE_P_TRY (tty, TTY_CAP_ALT_CHARSET, tty->TS_enter_alt_charset_mode, NC_ALT_CHARSET); | ||
| 2133 | 2122 | ||
| 2134 | /* We can do it! */ | 2123 | /* We can do it! */ |
| 2135 | return 1; | 2124 | return 1; |
| @@ -3222,8 +3211,8 @@ use the Bourne shell command `TERM=... export TERM' (C-shell:\n\ | |||
| 3222 | tty->TS_enter_underline_mode = tgetstr ("us", address); | 3211 | tty->TS_enter_underline_mode = tgetstr ("us", address); |
| 3223 | tty->TS_exit_underline_mode = tgetstr ("ue", address); | 3212 | tty->TS_exit_underline_mode = tgetstr ("ue", address); |
| 3224 | tty->TS_enter_bold_mode = tgetstr ("md", address); | 3213 | tty->TS_enter_bold_mode = tgetstr ("md", address); |
| 3214 | tty->TS_enter_italic_mode = tgetstr ("ZH", address); | ||
| 3225 | tty->TS_enter_dim_mode = tgetstr ("mh", address); | 3215 | tty->TS_enter_dim_mode = tgetstr ("mh", address); |
| 3226 | tty->TS_enter_blink_mode = tgetstr ("mb", address); | ||
| 3227 | tty->TS_enter_reverse_mode = tgetstr ("mr", address); | 3216 | tty->TS_enter_reverse_mode = tgetstr ("mr", address); |
| 3228 | tty->TS_enter_alt_charset_mode = tgetstr ("as", address); | 3217 | tty->TS_enter_alt_charset_mode = tgetstr ("as", address); |
| 3229 | tty->TS_exit_alt_charset_mode = tgetstr ("ae", address); | 3218 | tty->TS_exit_alt_charset_mode = tgetstr ("ae", address); |
diff --git a/src/termchar.h b/src/termchar.h index d50ee805e03..102fe45350e 100644 --- a/src/termchar.h +++ b/src/termchar.h | |||
| @@ -124,8 +124,8 @@ struct tty_display_info | |||
| 124 | each as vpos and hpos) */ | 124 | each as vpos and hpos) */ |
| 125 | 125 | ||
| 126 | const char *TS_enter_bold_mode; /* "md" -- turn on bold (extra bright mode). */ | 126 | const char *TS_enter_bold_mode; /* "md" -- turn on bold (extra bright mode). */ |
| 127 | const char *TS_enter_italic_mode; /* "ZH" -- turn on italics mode. */ | ||
| 127 | const char *TS_enter_dim_mode; /* "mh" -- turn on half-bright mode. */ | 128 | const char *TS_enter_dim_mode; /* "mh" -- turn on half-bright mode. */ |
| 128 | const char *TS_enter_blink_mode; /* "mb" -- enter blinking mode. */ | ||
| 129 | const char *TS_enter_reverse_mode; /* "mr" -- enter reverse video mode. */ | 129 | const char *TS_enter_reverse_mode; /* "mr" -- enter reverse video mode. */ |
| 130 | const char *TS_exit_underline_mode; /* "us" -- start underlining. */ | 130 | const char *TS_exit_underline_mode; /* "us" -- start underlining. */ |
| 131 | const char *TS_enter_underline_mode; /* "ue" -- end underlining. */ | 131 | const char *TS_enter_underline_mode; /* "ue" -- end underlining. */ |
diff --git a/src/xfaces.c b/src/xfaces.c index 10d1c93fef8..772d2646291 100644 --- a/src/xfaces.c +++ b/src/xfaces.c | |||
| @@ -4884,14 +4884,13 @@ static int | |||
| 4884 | tty_supports_face_attributes_p (struct frame *f, Lisp_Object *attrs, | 4884 | tty_supports_face_attributes_p (struct frame *f, Lisp_Object *attrs, |
| 4885 | struct face *def_face) | 4885 | struct face *def_face) |
| 4886 | { | 4886 | { |
| 4887 | int weight; | 4887 | int weight, slant; |
| 4888 | Lisp_Object val, fg, bg; | 4888 | Lisp_Object val, fg, bg; |
| 4889 | XColor fg_tty_color, fg_std_color; | 4889 | XColor fg_tty_color, fg_std_color; |
| 4890 | XColor bg_tty_color, bg_std_color; | 4890 | XColor bg_tty_color, bg_std_color; |
| 4891 | unsigned test_caps = 0; | 4891 | unsigned test_caps = 0; |
| 4892 | Lisp_Object *def_attrs = def_face->lface; | 4892 | Lisp_Object *def_attrs = def_face->lface; |
| 4893 | 4893 | ||
| 4894 | |||
| 4895 | /* First check some easy-to-check stuff; ttys support none of the | 4894 | /* First check some easy-to-check stuff; ttys support none of the |
| 4896 | following attributes, so we can just return false if any are requested | 4895 | following attributes, so we can just return false if any are requested |
| 4897 | (even if `nominal' values are specified, we should still return false, | 4896 | (even if `nominal' values are specified, we should still return false, |
| @@ -4907,11 +4906,9 @@ tty_supports_face_attributes_p (struct frame *f, Lisp_Object *attrs, | |||
| 4907 | || !UNSPECIFIEDP (attrs[LFACE_SWIDTH_INDEX]) | 4906 | || !UNSPECIFIEDP (attrs[LFACE_SWIDTH_INDEX]) |
| 4908 | || !UNSPECIFIEDP (attrs[LFACE_OVERLINE_INDEX]) | 4907 | || !UNSPECIFIEDP (attrs[LFACE_OVERLINE_INDEX]) |
| 4909 | || !UNSPECIFIEDP (attrs[LFACE_STRIKE_THROUGH_INDEX]) | 4908 | || !UNSPECIFIEDP (attrs[LFACE_STRIKE_THROUGH_INDEX]) |
| 4910 | || !UNSPECIFIEDP (attrs[LFACE_BOX_INDEX]) | 4909 | || !UNSPECIFIEDP (attrs[LFACE_BOX_INDEX])) |
| 4911 | || !UNSPECIFIEDP (attrs[LFACE_SLANT_INDEX])) | ||
| 4912 | return 0; | 4910 | return 0; |
| 4913 | 4911 | ||
| 4914 | |||
| 4915 | /* Test for terminal `capabilities' (non-color character attributes). */ | 4912 | /* Test for terminal `capabilities' (non-color character attributes). */ |
| 4916 | 4913 | ||
| 4917 | /* font weight (bold/dim) */ | 4914 | /* font weight (bold/dim) */ |
| @@ -4937,6 +4934,18 @@ tty_supports_face_attributes_p (struct frame *f, Lisp_Object *attrs, | |||
| 4937 | return 0; /* same as default */ | 4934 | return 0; /* same as default */ |
| 4938 | } | 4935 | } |
| 4939 | 4936 | ||
| 4937 | /* font slant */ | ||
| 4938 | val = attrs[LFACE_SLANT_INDEX]; | ||
| 4939 | if (!UNSPECIFIEDP (val) | ||
| 4940 | && (slant = FONT_SLANT_NAME_NUMERIC (val), slant >= 0)) | ||
| 4941 | { | ||
| 4942 | int def_slant = FONT_SLANT_NAME_NUMERIC (def_attrs[LFACE_SLANT_INDEX]); | ||
| 4943 | if (slant == 100 || slant == def_slant) | ||
| 4944 | return 0; /* same as default */ | ||
| 4945 | else | ||
| 4946 | test_caps |= TTY_CAP_ITALIC; | ||
| 4947 | } | ||
| 4948 | |||
| 4940 | /* underlining */ | 4949 | /* underlining */ |
| 4941 | val = attrs[LFACE_UNDERLINE_INDEX]; | 4950 | val = attrs[LFACE_UNDERLINE_INDEX]; |
| 4942 | if (!UNSPECIFIEDP (val)) | 4951 | if (!UNSPECIFIEDP (val)) |
| @@ -5857,15 +5866,13 @@ realize_tty_face (struct face_cache *cache, Lisp_Object *attrs) | |||
| 5857 | face->font_name = FRAME_MSDOS_P (cache->f) ? "ms-dos" : "tty"; | 5866 | face->font_name = FRAME_MSDOS_P (cache->f) ? "ms-dos" : "tty"; |
| 5858 | #endif | 5867 | #endif |
| 5859 | 5868 | ||
| 5860 | /* Map face attributes to TTY appearances. We map slant to | 5869 | /* Map face attributes to TTY appearances. */ |
| 5861 | dimmed text because we want italic text to appear differently | ||
| 5862 | and because dimmed text is probably used infrequently. */ | ||
| 5863 | weight = FONT_WEIGHT_NAME_NUMERIC (attrs[LFACE_WEIGHT_INDEX]); | 5870 | weight = FONT_WEIGHT_NAME_NUMERIC (attrs[LFACE_WEIGHT_INDEX]); |
| 5864 | slant = FONT_SLANT_NAME_NUMERIC (attrs[LFACE_SLANT_INDEX]); | 5871 | slant = FONT_SLANT_NAME_NUMERIC (attrs[LFACE_SLANT_INDEX]); |
| 5865 | if (weight > 100) | 5872 | if (weight > 100) |
| 5866 | face->tty_bold_p = 1; | 5873 | face->tty_bold_p = 1; |
| 5867 | if (weight < 100 || slant != 100) | 5874 | if (slant != 100) |
| 5868 | face->tty_dim_p = 1; | 5875 | face->tty_italic_p = 1; |
| 5869 | if (!NILP (attrs[LFACE_UNDERLINE_INDEX])) | 5876 | if (!NILP (attrs[LFACE_UNDERLINE_INDEX])) |
| 5870 | face->tty_underline_p = 1; | 5877 | face->tty_underline_p = 1; |
| 5871 | if (!NILP (attrs[LFACE_INVERSE_INDEX])) | 5878 | if (!NILP (attrs[LFACE_INVERSE_INDEX])) |