A Touch of Class

f. rainne
2006-02-20

CSS3 Text Evolutions

It's been a long time since I've given a status update on CSS3 Text, and I really owe a public draft. Hopefully we'll have one out soon, but in January I didn't feel I had completed enough of interest to warrant a new public draft. Right now the draft is changing quickly, though, and I want to have things out where people can comment.

First off, Paul Nelson of Microsoft is now co-editing the CSS3 Text draft with me. He works on international typography and related things at Microsoft and is heading work on Internet Explorer in Beijing as of this year. The two of us finally met last week. Between that and having a little more leeway for procrastinating on my other work, I'm doing a bit more on the CSS3 Text draft this month, heh. The annual W3C Technical Plenary is coming up, too, and I expect a lot of refinement and ideas from that.

One of the major themes in the revision of CSS3 Text is reducing the complexity in the spec. There were just too many properties and property combinations in the old CR, and this complexity is painful for both authors and implementors. We're aiming to simplify the spec so that it satisfies most needs without overburdening the language or the UA. The constraints for this revamp are:

  • maximize useful functionality
  • minimize complexity
  • align with what's already implemented, if anything

Obviously there's a tradeoff, and the trick is to aim for a solution that balances all three well.

The other major theme is speccing out more detail. Many properties were underspecified in the old draft, assumed esoteric knowledge in the unfortunate developer, left out lots of details, ignored interaction with other parts of the spec, or fell back on unspecified "language-specific" behavior. The point of having a spec is to make the spec-writer do the research once for everyone so the developers don't have to do it once apiece. (Well, that and it makes interoperability more attainable.)

I revamped white space, line breaking, and text wrapping last time and did a first pass on justification. Here's what I'm working on right now:

General Text Justification

The next draft adds support for Tibetan justification. I'm also in the midst of improving the justification prose in general. There will be more details on Arabic, a few corrections in the table (which has been reorganized to make it clearer), and the size value will be dropped. Paul plans to write an appendix on kashida justification.

East Asian Justification Trimming

Tweaking extra space in punctuation and kana glyphs is a common justification technique for East Asian text. We need to work out the details of exactly how that works, how it interacts with regular justification, how it applies to non-justified text, and whether indeed we need two separate properties to control it, as CSS3 Text CR specifies. There's someone from the Japanese company Justsystem coming to the plenary; he can expect to be ambushed and interrogated on said topic.

Text Decoration

We think there are too many text-decoration properties right now and would like to reduce them. I mean, how often do you want to set a red dashed underline with a blue wavy overline and a strike-through that's 5px thick and skips white space? Probably not often enough to offset the cost of the extra complexity needed to make that possible. We would like to keep the ability to pick colors and styles for the text decoration, though. They'll just all have to be the same when you have multiple decorations on the same element. :)

Shadows and Outlines

Text shadows are nothing new, but they're back in. I'm also adding a text-outline property in response to feedback from another WG. We'll see how they hold up under CR criteria.

One potential problem is the stacking rules. If I have a text shadow up and to the left, I believe, under normal line stacking rules it will paint over the actual text of the previous element. I'll have to see what Safari does, but I'm pretty sure we'd like to avoid that if possible, especially since it'll show up at otherwise invisible element boundaries.

Emphasis Marks

We decided to steal the font-emphasize property from the CSS3 Fonts draft and rename it text-emphasis. (We might give the Fonts module our kerning properties as compensation.)

Hanging Punctuation

The idea here is to take away the language-specific aspect and let the author decide whether they want just the first line's punctuation to hang or all lines to be affected. We also need to define which punctuation hangs, and how that interplays with justification and text indents.

Automatic Ellipsis

The text-overflow property has already been implemented by both IE and Safari. They don't really agree on how to do it, though. I need to sit down with Windows and Mac computers side by side and figure out what, exactly, they're doing. Then we need to figure out what, exactly, they should be doing, and then spec that. The old CR also has a few extra controls for this behavior, which may be dropped if there isn't a good argument for keeping them.