Re: collected groff man pages and performance (was: Syntax errors in makeindex.1)

"G. Branden Robinson" <[email protected]> Sat, 16 May 2026 13:58:36 -0500
Newsgroups gmane.comp.printing.groff.general
Message-ID <20260516185836.diodaxjiz6qzcdwn@illithid>
At 2026-05-12T22:49:37-0400, Larry Kollar wrote:
> Sebastien Peterson-Boudreau <[email protected]>
> wrote:
> > I am not expert on microtypography, so I could totally be in the
> > wrong here, but this approach (adjusting punctuation before all line
> > breaks) seems maybe a bit naïve? It would also adjust punctuation at
> > the ends of lines when left justified or centered. Perhaps because
> > the adjustment is so small (_micro_typography) this isn't
> > significant.
> 
> Given a right margin, any line that doesn’t reach the right margin
> should be passed through unchanged.
> 
> > With this in mind, though, I believe the hangpunc program could
> > possibly be written in ~5 lines of sed(1), ~2 lines of awk(1) or 1
> > line of perl* :p
> 
> I was working in awk[1], and it was a lot more than 2 lines. First, it
> has to check the resolution[2]. The plan was to buffer an entire line,
> determine whether it ended in a “favored” punctuation mark at the
> right margin, then add interword spacing as needed (or pass it through
> in most cases). If it ended up as 10, or even 20 lines of awk, I’d be
> thrilled.

Another thing that might help is to have the source document record
where the right margin is by having the formatter compute it and then
issue it as a "trout" comment for collection and interpretation by your
filter.  This could be more reliable than doing it yourself in AWK, and
almost certainly preferable to doing arithmetic in sed(1).[A]

Sketch:

$ printf '.po 1i\n.in 2i\n.ll 3i\n.nr right-margin \\n[.o]+\\n[.i]+\\n[.l]\n\\!# right-margin=\\n[right-margin]\n' \
  | groff -Z
x T ps
x res 72000 1 1
x init
p1
# right-margin=432000
x trailer
V792000
x stop

> [2] As I mentioned earlier, groff has a 1/1000 pt resolution,

On the "ps" and "pdf" devices, yet.  Others vary.

$ find font -name DESC -or -name DESC.in | sort | xargs grep -w res
font/devX100-12/DESC:res 100
font/devX100/DESC:res 100
font/devX75-12/DESC:res 75
font/devX75/DESC:res 75
font/devdvi/DESC.in:res 57816
font/devlbp/DESC.in:res 300
font/devpdf/DESC.in:res 72000
font/devps/DESC.in:res 72000

Regards,
Branden

[A] apologies to Greg Ubben
signature.asc (application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE-----

iQIzBAABCAAdFiEEh3PWHWjjDgcrENwa0Z6cfXEmbc4FAmoIvlQACgkQ0Z6cfXEm
bc7TEQ//VZxpv0btpJ4YVLNCpwT1V3LTB+x/mmWrjFkFTwHO4S6uPLCfbQswnFQE
/No/V1EGRqhKzccycPngDwGdm6tQf4tUEpNygbI/PNdcNwozVdCBDwbI1eKmMnid
iszO+3RD31Z1XAAgTI5+ZdR+3IwfFyVs3EWtvqx8kRNrsGQZgxIcUKvSeXOwMCkA
ilCO3D62bjnzYIDp69wAkWQT/Tuweu1vuTtyXpe06w4FrVEB3eK3IUdwuAYdiS4+
hxeGx7eL2azCcZwxKr7oPUVnMhbElDzbDxTcJTTm2cAKV4glbFzTfcte/f+hVylw
Eih3reF7W3cNqtYY6v2Mhx7xOpdPEv0hcMPkbOSfDpaTEam8b0KmkvcnR5C1zyuI
ImFIbbSkagK6MDyrliEnc96tJgefO8nrtuPmWK8oH+BRormukJqaotCYSH7ZBtK6
Npxha3kXc0mTOMOzWkyo6tJVJ/z5VhMUuThj+fPNKJ9aL5oPcXdgwlqFtXYEVNjJ
LYdecFsewu96vDOvBrHqa1pnkv4QbaP2htGxv+oU2lkrPOZbu/AfZeHLCp/sMWZY
n0IImv7qlLdVFeNMuqhG55bh1FHyIBwl6ohcbNMP9g3VI5OkEZ4mCs2S+9Uzah83
KTehkbU+rfB4Kk8wBN3PoAT9A/DPOz7RusVdE8qOOdFh0LfipoM=
=suc3
-----END PGP SIGNATURE-----