bramstein / typeset

TeX line breaking algorithm in JavaScript
BSD 2-Clause "Simplified" License
998 stars 74 forks source link

Demos with vars #26

Open dberlow opened 6 years ago

dberlow commented 6 years ago

This is all great to see again.

I'm interested, during this round of typographic bar-raising, in demonstrating uses for variations in concert with, or as a superior substitute for current practice of more traditional typography.

So, in the case of justification, I'd like to employ use of the x-transparency of letters and the word space, leaving the letter spacing and width axis out of it. The demo enclosed, from illustrator, shows how I can (manually), lengthen lines, via the word space, and shorten the lines with the XTRA axis. just demo.pdf

In the case of justifying text in circles, other non-collumnar composition, or with variable column width down the page, in the 21st century version, I would like to demonstrate the use both the above and per-line linespacing appropriate to the varying line lengths, with the descenders reacting via YTDE, growing longer for lines of text, and shrinking for shorter lines of text, along with the line spacing.

PhilterPaper commented 3 years ago

You might want to take a look at the Perl implementation of typeset, Text::KnuthPlass (PhilterPaper/text-knuthplass on GitHub) to see PDF typesetting using Knuth-Plass for line splitting. I took it over recently, and despite a few issues, it seems to do fairly well.

I would be interested in algorithms for best fit when column sides are not vertical, due to varying line lengths and non-rectangular target spaces. Is it worth adjusting line lengths to keep entire characters (ascenders and descenders) within "the zone"? Or is the amount of error generally too small to bother with? I'm concerned that finding characters poking their heads or feet into the margins would necessitate repeated runs of the paragraph-fitting code (adjusting line lengths) until everything just fits. It may be better to just leave a bit more space around the margins, and let bits of characters poke into it near the ends of lines.