groff
[Top][All Lists]
Advanced

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

Re: [Groff] grotty and \D'l 0 0'


From: Ralph Corderoy
Subject: Re: [Groff] grotty and \D'l 0 0'
Date: Fri, 30 Nov 2007 19:25:00 +0000

Hi Werner,

> There is an interesting problem which should be solved somehow,
> however I have no idea how to do it `right'.
> 
> Using grotty, this code
> 
>   x \D'l 1m 0' x
> 
>   x \D'l 0 1v' x
> 
> produces
> 
>   x --x
> 
>   x |
>     |x
> 
> [You have to use the current CVS or version 1.19.0 and earlier -- the
> versions inbetween handle this incorrectly.]

My old and crufty 1.18.1 on slightly different input produces

    $ cat w.tr
    X
    .br
    X\D'l 1m 0'X
    X\D'l 0 1v'X
    $ groff -Tutf8 w.tr | cat -s
    X
    X-X X|
         X

    $

> As can be seen, a line of length 1m (1v) is drawn as *two* character
> cells, not one, but still takes only a length (height) of one
> character cell.  This result may be surprising but it is the correct
> one so that it is completely analogous to the output of other devices
> -- it took a long time until I came to this conclusion :-)

I can believe it took a long time.  I puzzled over a pixel drawing
problem once for ages not knowing that accepted practice had already
worked out the "right way".  However, I'm not sure your output above, or
mine, is the "right" result.  :-)

Looking at the PostScript output of w.tr, I think this is a better
approximation.

    X
    X_X X
         |X

The horizontal line should be the baseline of the text, and only one
character long because we assume a fixed-width font.  I suppose you're
thinking of an em-dash being represented by two -- characters in plain
text so a 1m line should be two characters too.

Ideally, the vertical line would be zero-width but since this isn't
possible I think pictorially it is more similar to the PostScript to
have the vertical line to the left of the lower X.  Again, it's only one
character to match the PostScript which doesn't draw anything to the
right of the upper X.

> Now the interesting problem: It is not possible to generate a vertical
> or horizontal line which occupies just one character cell!  For
> example, saying
> 
>   x \D'l .1m 0' x
> 
>   x \D'l 0 .1v' x
> 
> produces
> 
>   x +x
> 
>   x +x
> 
> The line lengths are rounded to the next multiple of the horizontal
> and vertical device resolution, which is 0 here in both directions --
> the line more or less degenerates to a dot, represented with `+'.

Previous groffs, e.g. 1.18.1, used to do this though?

Cheers,


Ralph.





reply via email to

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