[css4-fonts] font-size: auto

Sometimes you have a one-line box (or maybe 2 lines of text) with a fixed width and the text within should fill all of this. This could be done with either manually adjusting letter-spacing and word-spacing or with manually increasing the font-size until just before the last word breaks to the next line. This, however, does not work reliably since you can never know which font will be used in the end. For letter and word spacing the automated variant is known as justified text, i.e. “text-align: justify”, but for font sizing there is none.

Therefore I would like to suggest for level 4 of the Font module to make the ‘font-size’ property accept at least one new keyword, e.g. ‘auto’, ‘line-fill’, ‘width’ or ‘fill-x’, that facilitates the described behavior. 

I’m not sure there are also valid usecases for
a) shrinking the size until the complete text fits within one line,
b) increasing the size until the parent box’s height is used to the maximum extent by lines of text,
so I’m leaving that to level 5 or others to propose. Beware, though, that if these are future things to address ‘auto’ may not be the best choice for the suggested line fill keyword.

Received on Wednesday, 15 February 2012 11:44:09 UTC