Originally found/fixed during the #33/#34/#35/#36 series of pretty-printing PRs.
Before this PR, we were treating all text the same, regardless of style, but this PR introduces the concept of "fractional columns" (integer multiples of 0.1ch, because our font-sizes are always integer multiples of 0.1em).
The result is much more accurate, and so far appears to perfectly match browser behavior (i.e. the transition of MAX_LINE_WIDTH from N-1 to N, where multi-line layout gets replaced with single-line layout, results in a line that "tightly fits" in a max-width: Nch container, with no spurious gaps or overflows).
Note however that the increased accuracy makes the layout favor HTML over plaintext (and we don't have a plaintext-vs-HTML "simultaneous layout", nor a way to hint what the output of pretty layout will be used for), so the plaintext output may feel more inconsistent as a result (but its aesthetics are of dubious value anyway).
Originally found/fixed during the #33/#34/#35/#36 series of pretty-printing PRs.
Before this PR, we were treating all text the same, regardless of style, but this PR introduces the concept of "fractional columns" (integer multiples of
0.1ch
, because ourfont-size
s are always integer multiples of0.1em
).The result is much more accurate, and so far appears to perfectly match browser behavior (i.e. the transition of
MAX_LINE_WIDTH
fromN-1
toN
, where multi-line layout gets replaced with single-line layout, results in a line that "tightly fits" in amax-width: Nch
container, with no spurious gaps or overflows).Note however that the increased accuracy makes the layout favor HTML over plaintext (and we don't have a plaintext-vs-HTML "simultaneous layout", nor a way to hint what the output of pretty layout will be used for), so the plaintext output may feel more inconsistent as a result (but its aesthetics are of dubious value anyway).