Re: Suggestion: A new text attribute to scale the size of text to follow the size of a box

On Thursday 29 April 2010 21:45:13 Brad Kemper wrote:
> Actually, come to think of it, I believe we had talked before about
> using this for scaling too, via a different value.
>
> It's really more for width than height though. Height is more an
> aspect of line-height than of anything font-size or text-align could
> do by themselves.

Yes, we discussed this in the context of justification, i.e., 
the 'text-align' property. But we have been going back and forth about 
what to do with text of more than one line and thus the simple case, a 
single line, hasn't progressed much either.

The idea is that, once we know how to handle the general case, the 
special case of a single line will be easy. (Maybe you'll have to 
set 'white-space: nowrap' to force a single line, but that depends on 
how we actually solve the general case.)

The problem is the following. It is easy enough to find examples (in 
books, in magazines, in advertisements...) of text over two, three or 
even more lines in which every line has a different font size such that 
all lines are exactly the same length. The question is how the author 
balanced the number of line breaks, their positions, and the font 
sizes: when is the result optimal (or at least good enough)?

We can add 'min-font-size' and 'max-font-size' to avoid unreadably small 
or large text, but even then there are still solutions that look better 
than others.

One idea is to stay as close as possible to the value of the 'font-size' 
property, for some definition of "close to."

Another is to minimize the number of lines, i.e., rather make the text a 
bit smaller (up to the minimum font size) than add extra line breaks.

Another option is to forget about optimizing line breaks at all and just 
trust that the author will put explicit <br> in the text.

Based on that last option, we considered allowing automatic font sizes 
*only* on the last line of a block of text, where last line is every 
line before a forced line break. Hence the keyword 'size' on 
the 'text-align-last' property. (In the most recent draft, that keyword 
was again dropped, because of these open issues.)

Maybe the people here can collect some evidence of how line breaks are 
chosen: If you justify text by changing the font size, is that always 
after choosing line breaks by hand, or are there cases where the line 
breaks may be chosen by the computer?

If the former, we can adopt the relative simple solution 
of 'text-align-last: size' that just adjusts the size of text on a 
single line: choosing line breaks remains an independent operation, 
unchanged from how it works in CSS2, and justifying last lines is an 
extra step that happens afterwards. (There still is the problem of what 
happens when you reach 'min-font-size': does that cause overflow?)

If the latter, we need to decide if we want a precise algorithm or can 
leave it to implementations to compete on how pleasing to the eye they 
can make the text.


> > From: "Brad Kemper" <brad.kemper@gmail.com>
> > Sent: Thursday, April 29, 2010 7:49 PM

> >> That is already covered by this:
> >>
> >> http://www.w3.org/TR/2007/WD-css3-text-20070306/#text-align-last



Bert
-- 
  Bert Bos                                ( W 3 C ) http://www.w3.org/
  http://www.w3.org/people/bos                               W3C/ERCIM
  bert@w3.org                             2004 Rt des Lucioles / BP 93
  +33 (0)4 92 38 76 92            06902 Sophia Antipolis Cedex, France

Received on Friday, 30 April 2010 14:17:33 UTC