groff
[Top][All Lists]
Advanced

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

Re: [Groff] underlining in nroff


From: Ralph Corderoy
Subject: Re: [Groff] underlining in nroff
Date: Thu, 29 Mar 2001 10:10:35 +0100

Hi Werner,

This answer is based on reading Plan 9 source of troff, which includes
nroff.  Consequently it could well be different to `traditional' nroff
behaviour.

> . It seems to me that with the current ditroff output language, the
>   difference between .ul and .cu can't be implemented in a
>   straightforward manner.  The only solution with the current protocol
>   is, for .ul, to switch back the font to \fR for all spaces so that
>   space characters aren't underlined.  Or is there another solution?
>   Can someone please check the ditroff output how the difference is
>   implemented?

I don't have a running system to check.  From the source it appears
that .cu is identical to .ul except that a variable `cu' is incremented
for later parts of the code to check.  The pertinent place seems to be
where the input character, if translated into something resembling a
space, is forced into being an underscore character in the default
font.

    Tchar gettch(void)
    {
            extern int c_isalnum;
            Tchar i;
            int j;

            if (TROFF)
                    return getch();

            i = getch();
            j = cbits(i);
            if (ismot(i) || fbits(i) != ulfont)
                    return(i);
            if (cu) {
                    if (trtab[j] == ' ') {
                            setcbits(i, '_');
                            setfbits(i, FT);        /* default */
                    }
                    return(i);
            }
            /* should test here for characters that ought to be underlined */
            /* in the old nroff, that was the 200 bit on the width! */
            /* for now, just do letters, digits and certain special chars */
            if (j <= 127) {
                    if (!isalnum(j))
                            setfbits(i, FT);
            } else {
                    if (j < c_isalnum)
                            setfbits(i, FT);
            }
            return(i);
    }


Ralph.


reply via email to

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