W3C home > Mailing lists > Public > www-style@w3.org > May 2009

[css3-text] Author-assisted line breaking and justification

From: Bert Bos <bert@w3.org>
Date: Wed, 27 May 2009 19:59:05 +0200
To: W3C style mailing list <www-style@w3.org>
Message-Id: <200905271959.05456.bert@w3.org>
Wild idea ahead...

A general philosophy of CSS is that UAs may, to some extent, find their 
own balance between speed and quality. With respect to line breaking, 
that means UAs may use simple "first fit" line breaking and unlimited 
stretching of spaces, but may also try to balance the looseness of 
adjacent lines. Designers can forbid letter spacing, but cannot force 
it to be used. And we're adding hyphenation in the same way: designers 
will probably be able to allow or disallow it, but not force UAs to use 
it.

UAs are also free to use more advanced techniques, such as 
avoiding "rivers" (spaces at the same place in adjacent lines), 
limiting the stretching of spaces based on the line height, optically 
aligning glyphs at the margin, and varying the glyphs themselves: 
replace a glyph by a variant of different width, use optional 
ligatures, and even vary the width of a glyph slightly (without 
changing the thickness of the strokes) as proposed by Hermann Zapf.

But I'm proposing to allow one more:

One technique that is used for extremely high-quality typesetting 
requires help from the author: when there is no good way to break 
lines, the author may be willing to change his text. Obvious changes 
include using or not using an abbreviation and replacing a word by a 
synonym. Changing the word order, or completely rewriting a sentence is 
also possible. Some authors who care a lot about the look of their 
books insist on being given this option. (I've done it myself for texts 
that were to be printed.)

In the context of CSS, this requires two things: support in the mark-up 
and support in CSS.

When a UA cannot ask the author for help, the author must have provided 
his alternatives beforehand, i.e., in the form of mark-up. A simple 
example that works for abbreviations is the ABBR element in HTML. The 
style sheet might allow the TITLE attribute to be used instead of the 
content. (But using ABBR for other kinds of alternatives is probably 
abuse of mark-up and not helpful for accessibility.)

On the CSS side, we would need a way to indicate which part of a 
document is an alternative for which other part. I think we may assume 
that the part to replace is an element (i.e., not a partial element), 
thus a normal selector suffices. The easiest case is if the replacement 
is an attribute, as in the case of ABBR, so that the existing 'attr()' 
notation can be used:

    abbr { text-align-alternative: attr(title) }

... (I'll stop here. Maybe it inspires somebody?)



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, 27 May 2009 17:59:39 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:20:18 GMT