vertical spacing trivia challenge

2024-07-14 Thread G. Branden Robinson
*roff experts, I present to you another puzzler, not groff-specific.

Here's the qualifying question:

A.  You probably know that the `ps` request to change the type (point)
size of the font is honored only in troff mode, not by nroff.

You likely also know that the `ls` request to set the line spacing
goes way back to before typesetter roff.

Question: is the `vs` request (which sets the vertical spacing)
honored in nroff mode?

Now, here's the challenge.

*
*
*
*
*
spoiler space
*
*
*
*
*

B.  In nroff (or nroff mode in groff), what _units_ is the argument to
the `vs` request reckoned in?

C.  A point is less than a vee, right?

D.  What does nroff do if you request to alter the vertical spacing in
points?

E.  Attempt to address the foregoing questions empirically.  Compare the
results to the claims of CSTR #54.  Do they agree?

Enjoy your weekend!

Regards,
Branden


signature.asc
Description: PGP signature


Re: vertical spacing trivia challenge

2024-07-14 Thread Tadziu Hoffmann



[Spoilers ahead.]

> A   Question: is the `vs` request (which sets the vertical spacing)
> honored in nroff mode?

Yes.

> B.  In nroff (or nroff mode in groff), what _units_ is the argument
> to the `vs` request reckoned in?

I remember .vs always being given in points, with a default value of
12 pt, resulting in 6 lines per inch, or 66 lines per 11-inch sheet.

(I know this because I have set my terminal windows to a height of
67 lines, in order to display manual entries paginated for 11-inch
fan-fold line printer paper one page at a time, with an additional
line for the "less" prompt.)

Empirical tests with groff support this.  However, groff appears to
round different values for .vs immediately to a multiple of 12 pt,
and then consistently use that rounded number.  E.g.,

  echo -e '.sp 12p\n.nf\n.vs 6\na\nb\nc\nd' | nroff | less

only shows "d", i.e., 6 gets rounded down to zero.

[This is in contrast to a conceivable different model, in which
groff might internally keep a higher-resolution line tally, and
output a linefeed only when this surpasses the next grid position.]

> C.  A point is less than a vee, right?

Usually, but the vee can also be set to zero for special
formatting purposes.

> D.  What does nroff do if you request to alter the vertical
> spacing in points?

Not sure what is meant here.  I think it is always in points.
Or do you mean, if different values than the default are
requested?  Then, see above.

> E.  Attempt to address the foregoing questions empirically.
> Compare the results to the claims of CSTR #54.
> Do they agree?

[Now browsing CSTR #54...]
I can't see anything beyond it stating that the default scale
indicator for .vs is points, and that nroff rounds numerical
input to the actual resolution of its output device.
So I would say yes, they agree.  :-)


However: I remember Unix nroff also supporting terminals with
half-line capability, which groff doesn't.  Maybe someone here
has an old system they can use to test nroff's behavior when
formatting for one of these terminals?