groff
[Top][All Lists]
Advanced

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

Re: Point Size II: Electric Boogaloo (.ps 0)


From: Ingo Schwarze
Subject: Re: Point Size II: Electric Boogaloo (.ps 0)
Date: Mon, 6 Apr 2020 11:24:12 +0200
User-agent: Mutt/1.12.2 (2019-09-21)

Hi Branden,

G. Branden Robinson wrote on Mon, Apr 06, 2020 at 06:38:09PM +1000:

> Or: Have You TRIED ".ps 0" Lately?

You made me try it right now.

> I'll bet you haven't.
> 
> CSTR #54 (1992) says:
> 
> .ps ±N    Point size set to ±N.  Alternatively embed \sN or ±N.  Any
>           positive size value may be requested; if invalid, the next
>           larger valid size will result, with a maximum of 36.
> 
> Does this imply that a zero value cannot be requested?
> 
> If it cannot be requested, does that make it "invalid"?  And if so,
> should the "next larger valid size" result?

Yes and yes, apparently.

> The groff Texinfo manual says:
> 
>      The size 0 (for both '.ps'

This part is apparently incorrect.

>      and '\s'), or no argument (for '.ps'
>      only), goes back to the previous size.

That's apparently all correct.

> But check this out:
> 
> $ sed -n '/^void point_size/,/^}/p' src/roff/troff/env.cpp
> void point_size()
> {
>   int n;
>   if (has_arg() && get_number(&n, 'z', curenv->get_requested_point_size())) {
>     if (n <= 0)          // <--------- ****** THIS RIGHT HERE ******
>       n = 1;
>     curenv->set_size(n);
>   }
>   else
>     curenv->set_size(0);
>   skip_line();
> }
> 
> Checking "git blame" on the highlighted conditional, I find:
> 
> 71e9155c3 troff/env.cc (James Clark 1993-03-03 13:14:51 -0500 1241)
> 
> So what do y'all wanna do?
> 
> Fix the documentation, or fix the test?

Fix the documentation.

Heirloom troff, Plan 9 troff, and groff all consistently treat .ps 0
as "go to the minimum point size" and both \s0 and .ps without
argument as "go back to the previous point size".

Commands used for testing:

  printf 'text\n.ps 36\nlarge\n.ps 0\nsmall\n' | ...
  printf 'text\n.ps 36\nlarge\n.ps\nsmall\n' | ...
  printf 'text\n.ps 36\nlarge\n\\s0small\n' | ...

  ... | groff > tmp.ps
  ... | /usr/local/heirloom-doctools/bin/troff | \
        /usr/local/heirloom-doctools/bin/dpost > tmp.ps
  ... | 9 troff | 9 tr2post > tmp.ps

I don't have a PDP-9 around for testing, but when all three
implementations agree, that's likely because that's what the
original did, in particular when CSTR #54 says the same.

Yours,
  Ingo



reply via email to

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