Re: Columns and other layouts

Ian wrote on Monday, April 28, 2003 at 12:58:03 PM:

>> Usually there are "good" and "bad" places to break a short sequence
>> of words, like a title or a heading --- as a page designer, I'd
>> like to be able to specify what sets of breaks are preferred.

> That's something to bring up with the UNICODE consortium, I'd say.
> What you are basically asking for is for codepoints that represent
> the order of breaking points on a line, much like U+00AD SOFT HYPHEN
> does with word hyphenation. This (and other content-specific
> effects) are probably out of scope of CSS, IMHO.

Most of the effect could be acheived in CSS, without the need to
sprinkle a document with extra characters. All you would need is a new
property (I think line-break is free, but perhaps not optimal) that
takes at least two values, normal and smooth (or similar). The
property wouldn't affect the width or height, just how the browser
chooses to break lines within those constraints.

Normal browser line break example:
    
    Then came the horses. Having four feet, these managed rather
    better than the foot-soldiers: but even they stumbled now and
    then; and it seemed to be a regular rule that, whenever a horse
    stumbled the rider fell off instantly. The confusion got worse
    every moment, and Alice was very glad to get out of the wood into
    an open place, where she found the White King seated on the
    ground, busily writing in his memorandum-book.

It's possible to minimize the differences between lines (e.g., until
the minimum and maximum line length are as close in length as
possible; or similar). This is done only by moving words to the next
line, not by using common justification methods (although now that I
think about it, applying something like this before justification
could be interesting, if not useful). The number of lines must not
increase.

Smooth line break example:
    
    Then came the horses. Having four feet, these managed rather
    better than the foot-soldiers: but even they stumbled now
    and then; and it seemed to be a regular rule that, whenever
    a horse stumbled the rider fell off instantly. The confusion
    got worse every moment, and Alice was very glad to get out of
    the wood into an open place, where she found the White King
    seated on the ground, busily writing in his memorandum-book.

Note: I did this by hand, so it probably isn't perfect. The difference
is slight with a paragraph (19 to 4). On the other hand, it makes such
a nice difference in headings that it would probably become UA
default.

Normal line break example:

    George Bush dons baseball cap, invites Chirac to a friendly game
    of baseball

Smooth line break example, in steps:

Step 1
    George Bush dons baseball cap, invites Chirac to a friendly
    game of baseball

Step 2
    George Bush dons baseball cap, invites Chirac to a
    friendly game of baseball

Step 3
    George Bush dons baseball cap, invites Chirac to
    a friendly game of baseball

Step 4
    George Bush dons baseball cap, invites Chirac
    to a friendly game of baseball

Step 5
    George Bush dons baseball cap, invites
    Chirac to a friendly game of baseball

Step 6 is thrown out because doing so would increase the difference.

I'm not a programmer, but the above looks trivial compared to most of
CSS2. It doesn't seem much more complicated than normal text flow. One
limitation of using CSS is this manner is that you can't guarantee
good line breaks. For example:

    North Korea nukes all of Japan
    in controversial video game

To avoid line breaks like that you'd need to change the content, so
CSS can't help. There are problems with long words, especially in
short lines; the smoothing has little to no effect. I'm okay with
that.

-- 
John Lewis

Received on Monday, 28 April 2003 21:53:09 UTC