Mon Aug 25 21:08:20 2003 Michael Jennings (mej)

Patch from David Lloyd <dmlloyd@tds.net>.  Removed the NO_BRIGHTCOLOR
and NO_BOLDOVERSTRIKE defines.  If you want to do NO_BRIGHTCOLOR, set
colors 8-16 the same as 0-7. :P  For bold overstrike, it's now an
option (--overstrike-bold).  There are also options to deactivate the
"bold" and "blink" attributes' setting of high-intensity colors, and
to allow non-default foreground colors to be bolded.


SVN revision: 7377
This commit is contained in:
Michael Jennings 2003-08-26 01:45:11 +00:00
parent 243e65e5a2
commit 2918d31c09
10 changed files with 120 additions and 64 deletions

View File

@ -5102,3 +5102,12 @@ in here. :)
Hopefully I didn't break anything....
----------------------------------------------------------------------
Mon Aug 25 21:08:20 2003 Michael Jennings (mej)
Patch from David Lloyd <dmlloyd@tds.net>. Removed the NO_BRIGHTCOLOR
and NO_BOLDOVERSTRIKE defines. If you want to do NO_BRIGHTCOLOR, set
colors 8-16 the same as 0-7. :P For bold overstrike, it's now an
option (--overstrike-bold). There are also options to deactivate the
"bold" and "blink" attributes' setting of high-intensity colors, and
to allow non-default foreground colors to be bolded.
----------------------------------------------------------------------

View File

@ -509,6 +509,28 @@ If true, Eterm will automatically detect the nearest corner, and
font-change resizes will cause the Eterm window to gravitate toward
that corner.
.TP
.BR \-\-overstrike-bold
If true (default), Eterm will simulate a bold font by printing each
character twice, offsetting the second pass by one pixel. This makes
the characters seem thicker without the need for a special font. You
may wish to disable this if you use a specific color for bold.
.TP
.BR \-\-bold-brightens-foreground
If true (default), Eterm will use the "bold" ANSI color attribute to
brighten the foreground color by using the high-intensity colors (8
through 15) rather than the low-intensity colors (0 through 7). Note
that having a specific color selected for bold will override this.
.TP
.BR \-\-blink-brightens-background
If true (default), Eterm will use the "blink" ANSI color attribute to
brighten the background color by using the high-intensity colors (8
through 15) rather than the low-intensity colors (0 through 7).
.TP
.BR \-\-colors-suppress-bold
If true (default), any colored text (that is, any text not rendered
using the default foreground color) will not be given any other
special treatment for bolding (e.g., bold font or bold overstrike).
.TP
.BI \-\-big-font-key " keysym"
Specify a keysym to increase the font size. Default is Shift and the +
key on the keypad. Ctrl-> or Meta-> may also work (if you #define one
@ -1682,6 +1704,36 @@ If true, Eterm will automatically detect the nearest corner, and
font-change resizes will cause the Eterm window to gravitate toward
that corner.
.RE
.BI overstrike_bold " boolean"
.RS 5
If true (default), Eterm will simulate a bold font by printing each
character twice, offsetting the second pass by one pixel. This makes
the characters seem thicker without the need for a special font. You
may wish to disable this if you use a specific color for bold.
.RE
.BI bold_brightens_foreground " boolean"
.RS 5
If true (default), Eterm will use the "bold" ANSI color attribute to
brighten the foreground color by using the high-intensity colors (8
through 15) rather than the low-intensity colors (0 through 7). Note
that having a specific color selected for bold will override this.
.RE
.BI blink_brightens_background " boolean"
.RS 5
If true (default), Eterm will use the "blink" ANSI color attribute to
brighten the background color by using the high-intensity colors (8
through 15) rather than the low-intensity colors (0 through 7).
.RE
.BI colors_suppress_bold " boolean"
.RS 5
If true (default), any colored text (that is, any text not rendered
using the default foreground color) will not be given any other
special treatment for bolding (e.g., bold font or bold overstrike).
.RE
.RE
.TP

View File

@ -100,10 +100,6 @@
config files and pixmaps */
#define PATH_ENV "ETERMPATH"
/* Disable simulation of bold font using an "overstrike" technique. This technique
has been known to cause pixel droppings. See also FORCE_CLEAR_CHARS. */
/* #define NO_BOLDOVERSTRIKE */
/* Disable the secondary screen ("\E[?47h" / "\E[?47l") */
/* #define NO_SECONDARY_SCREEN */
@ -112,7 +108,7 @@
/* This will force clearing of characters before writing new ones on top of
* them. This is experimental - added in order to try and fix pixel dropping
* problems some people have had. See also NO_BOLDOVERSTRIKE. */
* problems some people have had. */
/*# define FORCE_CLEAR_CHARS*/
/* The command through which to pipe print-screen requests */

View File

@ -97,7 +97,8 @@ static char *rs_greek_keyboard = NULL;
#endif
unsigned long eterm_options = (ETERM_OPTIONS_SCROLLBAR | ETERM_OPTIONS_SELECT_TRAILING_SPACES);
unsigned long vt_options = (VT_OPTIONS_SECONDARY_SCREEN);
unsigned long vt_options = (VT_OPTIONS_SECONDARY_SCREEN | VT_OPTIONS_OVERSTRIKE_BOLD | VT_OPTIONS_BOLD_BRIGHTENS_FOREGROUND |
VT_OPTIONS_BLINK_BRIGHTENS_BACKGROUND | VT_OPTIONS_COLORS_SUPPRESS_BOLD);
unsigned long image_options = 0;
char *theme_dir = NULL, *user_dir = NULL;
char **rs_exec_args = NULL; /* Args to exec (-e or --exec) */
@ -195,7 +196,6 @@ spifopt_t option_list[] = {
SPIFOPT_STR_LONG("color5", "color 5", rs_color[minColor + 5]),
SPIFOPT_STR_LONG("color6", "color 6", rs_color[minColor + 6]),
SPIFOPT_STR_LONG("color7", "color 7", rs_color[minColor + 7]),
#ifndef NO_BRIGHTCOLOR
SPIFOPT_STR_LONG("color8", "color 8", rs_color[minBright]),
SPIFOPT_STR_LONG("color9", "color 9", rs_color[minBright + 1]),
SPIFOPT_STR_LONG("color10", "color 10", rs_color[minBright + 2]),
@ -204,7 +204,6 @@ spifopt_t option_list[] = {
SPIFOPT_STR_LONG("color13", "color 13", rs_color[minBright + 5]),
SPIFOPT_STR_LONG("color14", "color 14", rs_color[minBright + 6]),
SPIFOPT_STR_LONG("color15", "color 15", rs_color[minBright + 7]),
#endif /* NO_BRIGHTCOLOR */
#ifndef NO_BOLDUNDERLINE
SPIFOPT_STR_LONG("colorBD", "bold color", rs_color[colorBD]),
SPIFOPT_STR_LONG("colorUL", "underline color", rs_color[colorUL]),
@ -288,6 +287,10 @@ spifopt_t option_list[] = {
SPIFOPT_BOOL_LONG("scrollbar-floating", "display the scrollbar with no trough", eterm_options, ETERM_OPTIONS_SCROLLBAR_FLOATING),
SPIFOPT_BOOL_LONG("scrollbar-popup", "popup the scrollbar only when focused", eterm_options, ETERM_OPTIONS_SCROLLBAR_POPUP),
SPIFOPT_BOOL('x', "borderless", "force Eterm to have no borders", eterm_options, ETERM_OPTIONS_BORDERLESS),
SPIFOPT_BOOL_LONG("overstrike-bold", "simulate bold by overstriking characters", vt_options, VT_OPTIONS_OVERSTRIKE_BOLD),
SPIFOPT_BOOL_LONG("bold-brightens-foreground", "\"bold\" attribute brightens foreground color", vt_options, VT_OPTIONS_BOLD_BRIGHTENS_FOREGROUND),
SPIFOPT_BOOL_LONG("blink-brightens-background", "\"blink\" attribute brightens background color", vt_options, VT_OPTIONS_BLINK_BRIGHTENS_BACKGROUND),
SPIFOPT_BOOL_LONG("colors-suppress-bold", "do not make ANSI colors 0-16 bold", vt_options, VT_OPTIONS_COLORS_SUPPRESS_BOLD),
#ifndef NO_MAPALERT
# ifdef MAPALERT_OPTION
SPIFOPT_BOOL('m', "map-alert", "uniconify on beep", vt_options, VT_OPTIONS_MAP_ALERT),
@ -510,21 +513,11 @@ version(void)
#else
printf(" -NO_CURSORCOLOR");
#endif
#ifdef NO_BRIGHTCOLOR
printf(" +NO_BRIGHTCOLOR");
#else
printf(" -NO_BRIGHTCOLOR");
#endif
#ifdef NO_BOLDUNDERLINE
printf(" +NO_BOLDUNDERLINE");
#else
printf(" -NO_BOLDUNDERLINE");
#endif
#ifdef NO_BOLDOVERSTRIKE
printf(" +NO_BOLDOVERSTRIKE");
#else
printf(" -NO_BOLDOVERSTRIKE");
#endif
#ifdef NO_BOLDFONT
printf(" +NO_BOLDFONT");
#else
@ -1239,6 +1232,35 @@ parse_toggles(char *buff, void *state)
} else {
BITFIELD_CLEAR(eterm_options, ETERM_OPTIONS_RESIZE_GRAVITY);
}
} else if (!BEG_STRCASECMP(buff, "overstrike_bold ")) {
if (bool_val) {
BITFIELD_SET(vt_options, VT_OPTIONS_OVERSTRIKE_BOLD);
} else {
BITFIELD_CLEAR(vt_options, VT_OPTIONS_OVERSTRIKE_BOLD);
}
} else if (!BEG_STRCASECMP(buff, "bold_brightens_foreground ")) {
if (bool_val) {
BITFIELD_SET(vt_options, VT_OPTIONS_BOLD_BRIGHTENS_FOREGROUND);
} else {
BITFIELD_CLEAR(vt_options, VT_OPTIONS_BOLD_BRIGHTENS_FOREGROUND);
}
} else if (!BEG_STRCASECMP(buff, "blink_brightens_background ")) {
if (bool_val) {
BITFIELD_SET(vt_options, VT_OPTIONS_BLINK_BRIGHTENS_BACKGROUND);
} else {
BITFIELD_CLEAR(vt_options, VT_OPTIONS_BLINK_BRIGHTENS_BACKGROUND);
}
} else if (!BEG_STRCASECMP(buff, "colors_suppress_bold ")) {
if (bool_val) {
BITFIELD_SET(vt_options, VT_OPTIONS_COLORS_SUPPRESS_BOLD);
} else {
BITFIELD_CLEAR(vt_options, VT_OPTIONS_COLORS_SUPPRESS_BOLD);
}
} else {
print_error("Parse error in file %s, line %lu: Attribute \"%s\" is not valid within context toggles\n", file_peek_path(),
file_peek_line(), buff);
@ -2483,9 +2505,7 @@ init_defaults(void)
#ifdef PIXMAP_SUPPORT
rs_path = NULL;
#endif
#ifndef NO_BRIGHTCOLOR
colorfgbg = DEFAULT_RSTYLE;
#endif
/* Font stuff. */
MEMSET(rs_font, 0, sizeof(char *) * NFONTS);

View File

@ -38,6 +38,10 @@
# define VT_OPTIONS_REPORT_AS_KEYSYMS (1LU << 7)
# define VT_OPTIONS_PROPORTIONAL (1LU << 8)
# define VT_OPTIONS_SECONDARY_SCREEN (1LU << 9)
# define VT_OPTIONS_OVERSTRIKE_BOLD (1LU << 10)
# define VT_OPTIONS_BOLD_BRIGHTENS_FOREGROUND (1LU << 11)
# define VT_OPTIONS_BLINK_BRIGHTENS_BACKGROUND (1LU << 12)
# define VT_OPTIONS_COLORS_SUPPRESS_BOLD (1LU << 13)
# define ETERM_OPTIONS_LOGIN_SHELL (1LU << 0)
# define ETERM_OPTIONS_ICONIC (1LU << 1)

View File

@ -485,11 +485,20 @@ scr_color(unsigned int color, unsigned int Intensity)
break;
}
} else {
#ifndef NO_BRIGHTCOLOR
if ((rstyle & Intensity) && color >= minColor && color <= maxColor) {
color += (minBright - minColor);
switch (Intensity) {
case RS_Bold:
if (BITFIELD_IS_SET(vt_options, VT_OPTIONS_BOLD_BRIGHTENS_FOREGROUND)) {
color += (minBright - minColor);
}
break;
case RS_Blink:
if (BITFIELD_IS_SET(vt_options, VT_OPTIONS_BLINK_BRIGHTENS_BACKGROUND)) {
color += (minBright - minColor);
}
break;
}
}
#endif
}
}
switch (Intensity) {
@ -520,7 +529,6 @@ scr_rendition(int set, int style)
if (rvideo)
rstyle &= ~RS_RVid;
break;
#ifndef NO_BRIGHTCOLOR
case RS_Bold:
color = GET_FGCOLOR(rstyle);
scr_color((color == fgColor ? GET_FGCOLOR(colorfgbg) : color), RS_Bold);
@ -529,7 +537,6 @@ scr_rendition(int set, int style)
color = GET_BGCOLOR(rstyle);
scr_color((color == bgColor ? GET_BGCOLOR(colorfgbg) : color), RS_Blink);
break;
#endif
}
} else {
/* B: Unset style */
@ -543,7 +550,6 @@ scr_rendition(int set, int style)
if (rvideo)
rstyle |= RS_RVid;
break;
#ifndef NO_BRIGHTCOLOR
case RS_Bold:
color = GET_FGCOLOR(rstyle);
if (color >= minBright && color <= maxBright) {
@ -560,7 +566,6 @@ scr_rendition(int set, int style)
scr_color(restoreBG, RS_Blink);
}
break;
#endif
}
}
}
@ -1942,12 +1947,10 @@ scr_refresh(int type)
}
DRAW_STRING(draw_string, xpixel, ypixel, buffer, 1);
UPDATE_BOX(xpixel, ypixel - ascent, xpixel + Width2Pixel(1), ypixel + Height2Pixel(1));
#ifndef NO_BOLDOVERSTRIKE
if (MONO_BOLD(rend)) {
if (BITFIELD_IS_SET(vt_options, VT_OPTIONS_OVERSTRIKE_BOLD) && MONO_BOLD(rend)) {
DRAW_STRING(draw_string, xpixel + 1, ypixel, buffer, 1);
UPDATE_BOX(xpixel + 1, ypixel - ascent, xpixel + 1 + Width2Pixel(1), ypixel + Height2Pixel(1));
}
#endif
} else {
#ifdef PIXMAP_SUPPORT
if (background_is_pixmap() && (back == bgColor)) {
@ -2042,12 +2045,10 @@ scr_refresh(int type)
}
/* do the convoluted bold overstrike */
#ifndef NO_BOLDOVERSTRIKE
if (MONO_BOLD(rend)) {
if (BITFIELD_IS_SET(vt_options, VT_OPTIONS_OVERSTRIKE_BOLD) && MONO_BOLD(rend)) {
DRAW_STRING(draw_string, xpixel + 1, ypixel, buffer, wlen);
UPDATE_BOX(xpixel + 1, ypixel - ascent, xpixel + 1 + Width2Pixel(wlen), ypixel + Height2Pixel(1));
}
#endif
if (rend & RS_Uline) {
if (descent > 1) {
@ -3340,21 +3341,17 @@ debug_colors(void)
fprintf(stderr, "): ");
color = GET_FGCOLOR(rstyle);
#ifndef NO_BRIGHTCOLOR
if (color >= minBright && color <= maxBright) {
color -= (minBright - minColor);
fprintf(stderr, "bright ");
}
#endif
fprintf(stderr, "%s on ", name[color]);
color = GET_BGCOLOR(rstyle);
#ifndef NO_BRIGHTCOLOR
if (color >= minBright && color <= maxBright) {
color -= (minBright - minColor);
fprintf(stderr, "bright ");
}
#endif
fprintf(stderr, "%s\n", name[color]);
}

View File

@ -60,11 +60,10 @@
#define ERASE_ROWS(row, num) do {XFillRectangle(Xdisplay, draw_buffer, TermWin.gc, Col2Pixel(0), Row2Pixel(row), TERM_WINDOW_GET_WIDTH(), Height2Pixel(num)); \
if (buffer_pixmap) {XClearArea(Xdisplay, TermWin.vt, Col2Pixel(0), Row2Pixel(row), TERM_WINDOW_GET_WIDTH(), Height2Pixel(num), 0);}} while (0)
#define DRAW_STRING(Func, x, y, str, len) Func(Xdisplay, draw_buffer, TermWin.gc, x, y, str, len)
#ifndef NO_BRIGHTCOLOR
# define MONO_BOLD(x) (((x) & RS_Bold) && fore == fgColor)
#else
# define MONO_BOLD(x) ((x) & (RS_Bold|RS_Blink))
#endif
/* Make bold if bold flag is set and either we're drawing the foreground color or we're not suppressing bold.
In other words, the foreground color can always be bolded, but other colors can't if bold is suppressed. */
#define MONO_BOLD(x) (((x) & RS_Bold) && (!BITFIELD_IS_SET(vt_options, VT_OPTIONS_COLORS_SUPPRESS_BOLD) || fore == fgColor))
/* Screen refresh methods */
#define NO_REFRESH 0 /* Window not visible at all! */
@ -224,9 +223,7 @@ typedef struct {
} selection_t;
/************ Variables ************/
#ifndef NO_BRIGHTCOLOR
extern unsigned int colorfgbg;
#endif
extern unsigned char refresh_all;
#ifdef MULTI_CHARSET
extern encoding_t encoding_method;

View File

@ -60,7 +60,6 @@ unsigned long SavedModes = PrivMode_Default;
char *def_colorName[] = {
"rgb:aa/aa/aa", "rgb:0/0/0", /* fg/bg */
"rgb:0/0/0", /* 0: black (#000000) */
#ifndef NO_BRIGHTCOLOR
/* low-intensity colors */
"rgb:cc/00/00", /* 1: red */
"rgb:00/cc/00", /* 2: green */
@ -71,7 +70,6 @@ char *def_colorName[] = {
"rgb:aa/aa/aa", /* 7: white */
/* high-intensity colors */
"rgb:33/33/33", /* 8: bright black */
#endif /* NO_BRIGHTCOLOR */
"rgb:ff/00/00", /* 1/9: bright red */
"rgb:00/ff/00", /* 2/10: bright green */
"rgb:ff/ff/00", /* 3/11: bright yellow */
@ -1689,7 +1687,6 @@ process_sgr_mode(unsigned int nargs, int arg[])
}
/* find if fg/bg matches any of the normal (low-intensity) colors */
#ifndef NO_BRIGHTCOLOR
void
set_colorfgbg(void)
{
@ -1748,7 +1745,6 @@ set_colorfgbg(void)
colorfgbg = SET_BGCOLOR(colorfgbg, i);
}
}
#endif /* NO_BRIGHTCOLOR */
void
set_title(const char *str)

View File

@ -99,10 +99,6 @@ enum color_list {
Magenta3Color,
Cyan3Color,
maxColor, /* minColor + 7 */
# ifdef NO_BRIGHTCOLOR
WhiteColor = maxColor,
maxBright = maxColor,
# else
AntiqueWhiteColor = maxColor,
minBright, /* maxColor + 1 */
Grey25Color = minBright,
@ -114,7 +110,6 @@ enum color_list {
CyanColor,
maxBright, /* minBright + 7 */
WhiteColor = maxBright,
# endif
# ifndef NO_CURSORCOLOR
cursorColor,
cursorColor2,
@ -186,11 +181,7 @@ extern void process_xterm_seq(void);
extern void process_window_mode(unsigned int, int []);
extern void process_terminal_mode(int, int, unsigned int, int []);
extern void process_sgr_mode(unsigned int, int []);
#ifndef NO_BRIGHTCOLOR
extern void set_colorfgbg(void);
#else
# define set_colorfgbg() ((void)0)
#endif /* NO_BRIGHTCOLOR */
extern void set_title(const char *);
extern void set_icon_name(const char *);
extern void append_to_title(const char *);

View File

@ -692,14 +692,8 @@ set_window_color(int idx, const char *color)
i = atoi(color);
if (i >= 8 && i <= 15) { /* bright colors */
i -= 8;
# ifndef NO_BRIGHTCOLOR
PixColors[idx] = PixColors[minBright + i];
# endif
}
# ifndef NO_BRIGHTCOLOR
else
# endif
if (i >= 0 && i <= 7) { /* normal colors */
} else if (i >= 0 && i <= 7) { /* normal colors */
PixColors[idx] = PixColors[minColor + i];
} else {
print_warning("Color index %d is invalid.\n", i);