diff options
author | wlemb <wlemb> | 2002-06-20 05:58:35 +0000 |
---|---|---|
committer | wlemb <wlemb> | 2002-06-20 05:58:35 +0000 |
commit | e7b5a67c456d819aafaf5cdc2a5beee2df03027b (patch) | |
tree | b3c4b926406e2d1b82dfb4bd03d5d2270fc75fd3 /src/devices/grotty | |
parent | 97c74b11db54daf736921b3c54a208c160a0816d (diff) | |
download | groff-e7b5a67c456d819aafaf5cdc2a5beee2df03027b.tar.gz |
* src/devices/grops/ps.cc (ps_printer::special): Fix error message.
* src/devices/grotty/tty.cc (tty_printer::special): Add `sgr'
keyword to enable/disable SGR output.
(tty_printer::change_fill_color): New function.
* NEWS, src/devices/grotty/grotty.man: Document `sgr' special.
* src/roff/troff/input.cc (output_request): Add missing `tok.next()'
call.
Diffstat (limited to 'src/devices/grotty')
-rw-r--r-- | src/devices/grotty/grotty.man | 17 | ||||
-rw-r--r-- | src/devices/grotty/tty.cc | 41 |
2 files changed, 55 insertions, 3 deletions
diff --git a/src/devices/grotty/grotty.man b/src/devices/grotty/grotty.man index 3be01b96..1f148de6 100644 --- a/src/devices/grotty/grotty.man +++ b/src/devices/grotty/grotty.man @@ -98,9 +98,9 @@ by the sequence .SM BACKSPACE .IR c '. At the same time, color output is disabled. -The same effect can be achieved by setting the +The same effect can be achieved by setting either the .B GROFF_NO_SGR -environment variable. +environment variable or using the `sgr' X command (see below). .LP For SGR support, it is necessary to use the .B \-R @@ -278,6 +278,19 @@ isn't used. Print the version number. . . +.SH USAGE +.B grotty +understands a single X command produced using the +.B \[rs]X +escape sequence. +.TP +.BI \[rs]X'tty:\ sgr\ n ' +If +.I n +is non-zero or missing, enable SGR output (this is the default), otherwise +use the old drawing scheme for bold and underline. +. +. .SH ENVIRONMENT .TP .B GROFF_NO_SGR diff --git a/src/devices/grotty/tty.cc b/src/devices/grotty/tty.cc index a2e82989..81183b88 100644 --- a/src/devices/grotty/tty.cc +++ b/src/devices/grotty/tty.cc @@ -192,6 +192,7 @@ public: void draw(int code, int *p, int np, const environment *env); void special(char *arg, const environment *env, char type); void change_color(const environment *env); + void change_fill_color(const environment *env); void put_char(unsigned int); void put_color(unsigned char, int); void begin_page(int) { } @@ -355,8 +356,41 @@ void tty_printer::add_char(unsigned int c, void tty_printer::special(char *arg, const environment *env, char type) { - if (type == 'u') + if (type == 'u') { add_char(*arg - '0', env->hpos, env->vpos, env->col, env->fill, CU_MODE); + return; + } + if (type != 'p') + return; + char *p; + for (p = arg; *p == ' ' || *p == '\n'; p++) + ; + char *tag = p; + for (; *p != '\0' && *p != ':' && *p != ' ' && *p != '\n'; p++) + ; + if (*p == '\0' || strncmp(tag, "tty", p - tag) != 0) { + error("X command without `tty:' tag ignored"); + return; + } + p++; + for (; *p == ' ' || *p == '\n'; p++) + ; + char *command = p; + for (; *p != '\0' && *p != ' ' && *p != '\n'; p++) + ; + if (*command == '\0') { + error("empty X command ignored"); + return; + } + if (strncmp(command, "sgr", p - command) == 0) { + for (; *p == ' ' || *p == '\n'; p++) + ; + int n; + if (*p != '\0' && sscanf(p, "%d", &n) == 1 && n == 0) + old_drawing_scheme = 1; + else + old_drawing_scheme = 0; + } } void tty_printer::change_color(const environment *env) @@ -364,6 +398,11 @@ void tty_printer::change_color(const environment *env) add_char(0, env->hpos, env->vpos, env->col, env->fill, COLOR_CHANGE); } +void tty_printer::change_fill_color(const environment *env) +{ + add_char(0, env->hpos, env->vpos, env->col, env->fill, COLOR_CHANGE); +} + void tty_printer::draw(int code, int *p, int np, const environment *env) { if (code != 'l' || !draw_flag) |