Re: [css3-box] a width that is a little less than 'fit-content'

On Wednesday 16 September 2009, Brad Kemper wrote:
> On Sep 15, 2009, at 11:21 PM, Andrew Fedoniouk wrote:
> > That if I understand properly what that "fit and then
> > shrink more" idea actually means.
>
> I understood it to mean: Make the text box as big as you can without
> overflowing its parent container. This determines where the text
> wraps. Then shrink the width of the box as much as you can without
> having to re-wrap the text.

That's pretty close, I think. But do you really mean "without having to 
re-wrap" or do you mean "without the box changing height"?

It may be easier to understand the original idea if you take as an 
example not a piece of text, but two identical images: the images have 
fixed size and there is no flexible space between them. They either fit 
on one line or they don't. If you wrap a box around the pair of them, 
the box will be either as wide as two images or as wide as one. There 
is no ambiguity.

But I gave an example with text to show where the problem lies. Text has 
a lot of flexibility. You can make it take up more or less space 
without the reader noticing. High-end systems not only stretch the 
spaces, but also shrink them. And they put the letters closer together 
if necessary, too. There is even an algorithm by Herman Zapf that 
changes the shape of the letters themselves by a tiny amount to gain 
(or lose) space for an extra letter on the line. So if the definition 
is just "lay out the content and then make it as narrow as possible," 
you may end up with something that is much narrower than you wanted and 
looks positively ugly.

You'd want something that is "optimal" within the constraints of a given 
space. But without prescribing a precise line breaking algorithm, it's 
difficult to define "optimal." (And the result will be different in 
different implementations, but that isn't a big problem.)



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 Wednesday, 16 September 2009 10:10:29 UTC