Sunday, July 30, 2017

[wvrvhuym] Packing shiftable rectangles

Consider an orthography in which a letter may be shifted up or down so long as it intersects the baseline.  For example, the lowercase letter g may be shifted up so that its tail sits on the baseline, or shifted down so the top of the letter is tangent to the baseline.  This is different from traditional English orthography.

Given this flexibility for each letter, pack words in a paragraph in as little vertical space as possible, avoiding overlapping letters.  If spacing between words, i.e., horizontal justification, is solved first (by normal methods), then the vertical position of letters could be (somewhat) easily solved with a system of springs.  Each letter prefers to be centered on each line's baseline, and the top line and bottom line prefer to be as close as possible.  Minimize the total potential energy.

More complicated is if horizontal spacing is adjusted simultaneously with vertical positions of each letter.  Shift a word left or right to fit in the nooks and crannies of the word below it.

This may be difficult to read it the baseline is not marked.  Maybe alternating lines are in different colors.

For a more sophisticated model, the range a letter may be shifted may be different from its total vertical height.

Inspired by this bunch of text with letters of many different sizes.  There, a single tall letter determined the height of the line.

No comments :