4 ms·
Yeah, I agree with all of that. I had a new idea as I woke up today about the layout problem of reconciling a character-cell grid with proportional text, but I
by kragen 2y ago
Yeah, I agree with all of that.
I had a new idea as I woke up today about the layout problem of reconciling a character-cell grid with proportional text, but I don't have it fully understood yet. Basically the idea is that, if you know that a given span of text contains no internal horizontal alignment constraints—for example, a line of a paragraph, or a table-header column title—you can lay it out with internal proportional spacing.
If you run xterm with a proportional font, for example as
xterm -fn '-*-helvetica-*-r-*-*-18-*-*-*-*-*-*-*'
you can get a sort of crude approximation of this behavior; each string it receives from the process in the pty as a single operation gets drawn as a single string and therefore has reasonable horizontal spacing internally, but characters drawn one at a time get placed one by one at their properly horizontally-aligned location. So if you type "ls -al", the six characters show up far apart because they appear one by one; if you then type ^U^Y to erase and redraw them, they appear together as a single string.
(I kind of hate Helvetica, but because it's so proportional, it's the font that demonstrates this xterm behavior most clearly.)
xterm is doing this by accident, and so it does things like fail to erase characters that should be erased, use a far-too-wide width for each character column, and not tab to a requested column even when processing actual tab characters (like in ls -Ca output). But you could, I think, improve the behavior substantially with a few small changes.
First, you'd need some kind of explicit indication of which spans contained no internal alignment restrictions, instead of just using the stochastic clue of which characters showed up in a single read() call, which I think is what it's doing.
Second, you could allow each column of the character-cell grid to contract to contain only the characters it needs to contain, rather than giving them fixed locations; using a narrower-than-one-en width for the space character (as your -.3ch kind of does) would probably help with that.
Third, you could probably stretch and squish the actual letterforms themselves—TeX doesn't do this (though it does adjust interletter spacing), and hot lead can't, but medieval scribes did it constantly, and such "microtypography" is coming back into vogue. The place I see it most conspicuously is in the Android Heliboard autocorrection buttons displaying candidate words, though in a fairly crude and rebarbatively exaggerated form.
Fourth, certain glyphs (such as box-drawing characters) definitely have to be stretched to fill out the entire requested space.
I'm not sure this is a good idea, but it might work acceptably.
I look forward to seeing what you come up with!
- joveian 2y agoThanks for the thoughts and encouragement :). Microtypography is interesting and contracting letters to justify would definitely make a lot of sense when starting with a near monospace proportional font. It looks like a nice keyword used in a few other ways as well in some interesting typography articles :).