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. — Larry [1] If this could be done in sed, all the better. I’d personally like to stick with POSIX- compatible scripting if possible. At least you didn’t mention Python. :-D [2] As I mentioned earlier, groff has a 1/1000 pt resolution, while the DWB- based *roffs use 1/10 pt resolution… that’s easily determined from `xr` or `x res` in the prologue, but it needs to be accounted for.
