groff
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Groff] color support in grotty


From: Ruslan Ermilov
Subject: Re: [Groff] color support in grotty
Date: Wed, 16 Oct 2002 18:52:12 +0300
User-agent: Mutt/1.3.99i

On Thu, Feb 07, 2002 at 09:33:25AM +0100, Werner LEMBERG wrote:
> 
> Finally, here it is!
> 
> 
> I've finished color support in grotty and committed it to the CVS.
> SGR escape sequences will be the new default.  At the same time, I've
> added two new options to nroff.
> 
OK, now that FreeBSD 5.0-CURRENT has Groff 1.18.1 in...

We have learned a few pitfalls with this new behavior of grotty(1).
The biggest problem here is that grotty(1) emits ANSI SGR sequences
to print bold and italic characters directly, but FreeBSD's default
textual console terminal, cons25, renders "underscore" attribute the
same as the "bold" attribute, as well as the Linux's one does.  On
the other hand, classical nroff(1) filters like ul(1) and more(1)
respect the TERM setting and pick up the correct escape sequences
to enter the underscored mode (and fall back to using the "reverse"
attribute if "underscore" is not available).  I mistakenly thought
that adding the -r option to grotty(1) would solve this problem,
but this turned out to worsen the output on terminals that support
underlining, e.g. XFree86's "xterm".  So using -r generally is not
allowed.

Another thing to remember is that nroff(1) is often used by man(1)
to create preformatted manpages, catpages.  And these catpages
should preferably be viewable on a wide variety of terminals all
around.  As of this writing, FreeBSD runs nroff(1) with the -c
option when creating catpages.  I am also interested in hearing
what other operating system do with this.

On yet another hand, most nowadays terminals seem to support the
ANSI SGR foreground/background color sequences, so I thought that
it maybe worth separating the drawing of bold/italic fonts from
the color output in grotty(1).  The attached patch modifies the
-c option in such a way that if it is specified once, it causes
grotty(1) to revert to the old drawing method for bold and italic
characters (using the backspace), but the ANSI SGR color escapes
are not disabled.  If specified more than once, it also disables
the color output.  (The patch also fixes the nroff(1) "usage".)

As a side note, it would be great if troff(1) also provided the
\n[.m] and \n[.M] read-only registers to represent the respective
current colors.  This would be extremely useful when adding
color support to groff_mdoc(7).


Cheers,
-- 
Ruslan Ermilov          Sysadmin and DBA,
address@hidden          Sunbay Software AG,
address@hidden          FreeBSD committer,
+380.652.512.251        Simferopol, Ukraine

http://www.FreeBSD.org  The Power To Serve
http://www.oracle.com   Enabling The Information Age

Attachment: p
Description: Text document


reply via email to

[Prev in Thread] Current Thread [Next in Thread]