Emacs21 and faces in the hurd console.
Hi.
Emacs 21 in tty mode maps slanted faces to dimmed text, indipendently
from the terminal support for italic mode.
This patch maps -- if the terminal supports it -- slanted face to
italic fonts. With this patch, then, a properly configured Hurd
console can show italic fonts when in font-lock mode.
I actually tried to made the same work for bold faces, but being the
capability for real bold mode a GNU extension and not being an expert
of terminfo, I don't know the capability code for it. Anybody can
help?
Gianluca
--
It was a type of people I did not know, I found them very strange and
they did not inspire confidence at all. Later I learned that I had been
introduced to electronic engineers.
E. W. Dijkstra
--- src/dispextern.h 2002-11-14 14:15:46.000000000 +0100
+++ /home/glguida/emacs21src-hack/dispextern.h 2005-04-30 16:09:53.000000000 +0200
@@ -1329,6 +1329,7 @@
unsigned tty_alt_charset_p : 1;
unsigned tty_reverse_p : 1;
unsigned tty_blinking_p : 1;
+ unsigned tty_italic_p : 1;
/* 1 means that colors of this face may not be freed because they
have been copied bitwise from a base face (see
--- src/term.c 2005-04-30 19:32:39.000000000 +0200
+++ /home/glguida/emacs21src-hack/term.c 2005-04-30 17:18:55.000000000 +0200
@@ -96,6 +96,7 @@
int char_ins_del_ok; /* Terminal can insert and delete chars */
int scroll_region_ok; /* Terminal supports setting the
scroll window */
+int italic_mode_ok; /* Terminal supports italic mode */
int scroll_region_cost; /* Cost of setting a scroll window,
measured in characters */
int memory_below_frame; /* Terminal remembers lines
@@ -310,6 +311,10 @@
char *TS_enter_bold_mode;
+/* "ZH" -- turn on italics mode. */
+
+char *TS_start_italic_mode;
+
/* "mh" -- turn on half-bright mode. */
char *TS_enter_dim_mode;
@@ -2080,8 +2085,14 @@
OUTPUT1_IF (TS_enter_bold_mode);
}
else if (face->tty_dim_p)
- if (MAY_USE_WITH_COLORS_P (NC_DIM))
- OUTPUT1_IF (TS_enter_dim_mode);
+ {
+ if (MAY_USE_WITH_COLORS_P (NC_DIM))
+ OUTPUT1_IF (TS_enter_dim_mode);
+ }
+ else if (face->tty_italic_p)
+ if (TS_start_italic_mode)
+ OUTPUT1_IF (TS_start_italic_mode);
+
/* Alternate charset and blinking not yet used. */
if (face->tty_alt_charset_p
@@ -2137,6 +2148,7 @@
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
@@ -2345,6 +2357,7 @@
TS_enter_alt_charset_mode = tgetstr ("as", address);
TS_exit_alt_charset_mode = tgetstr ("ae", address);
TS_exit_attribute_mode = tgetstr ("me", address);
+ TS_start_italic_mode = tgetstr ("ZH", address);
MultiUp = tgetstr ("UP", address);
MultiDown = tgetstr ("DO", address);
@@ -2584,6 +2597,8 @@
fast_clear_end_of_line = TS_clr_line != 0;
+ italic_mode_ok = TS_start_italic_mode != 0;
+
init_baud_rate ();
if (read_socket_hook) /* Baudrate is somewhat */
/* meaningless in this case */
--- src/xfaces.c 2005-04-30 19:32:23.000000000 +0200
+++ /home/glguida/emacs21src-hack/xfaces.c 2005-04-30 16:10:17.000000000 +0200
@@ -6577,6 +6577,8 @@
face->background = pixel;
}
+/* Terminal supports italic mode, defined in term.c */
+extern int italic_mode_ok;
/* Realize the fully-specified face with attributes ATTRS in face
cache CACHE for character C. Do it for TTY frame CACHE->f. Value is a
@@ -6602,14 +6604,21 @@
/* 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. */
+ and because dimmed text is probably used infrequently.
+ However, if TTY supports "ZH" (start italic mode) we map slant
+ to it. */
weight = face_numeric_weight (attrs[LFACE_WEIGHT_INDEX]);
slant = face_numeric_slant (attrs[LFACE_SLANT_INDEX]);
if (weight > XLFD_WEIGHT_MEDIUM)
face->tty_bold_p = 1;
if (weight < XLFD_WEIGHT_MEDIUM || slant != XLFD_SLANT_ROMAN)
- face->tty_dim_p = 1;
+ {
+ if (italic_mode_ok)
+ face->tty_italic_p = 1;
+ else
+ face->tty_dim_p = 1;
+ };
if (!NILP (attrs[LFACE_UNDERLINE_INDEX]))
face->tty_underline_p = 1;
if (!NILP (attrs[LFACE_INVERSE_INDEX]))
Reply to: