W3C home > Mailing lists > Public > www-style@w3.org > November 2015

Re: [css-text] text-transform: capitalize Word Boundaries too strict

From: Jonathan Kew <jfkthame@gmail.com>
Date: Tue, 10 Nov 2015 21:28:21 +0000
To: Sebastian Zartner <sebastianzartner@gmail.com>, Adam Rich <adamzr@gmail.com>
Cc: www-style list <www-style@w3.org>
Message-ID: <56426175.5050303@gmail.com>
On 10/11/15 19:04, Sebastian Zartner wrote:
> CSS Text Module Level 3 doesn't define what to consider as word
> boundary. It lets it up to the user agent to determine this. The related
> paragraph says this:
>
> "For capitalize, what constitutes a “word“ is UA-dependent; [UAX29] is
> suggested (but not required) for determining such word boundaries.
> Authors should not expect capitalize to follow language-specific
> titlecasing conventions (such as skipping articles in English)."
>
> Note that Gecko actually capitalizes the words as you expect in your
> examples.

On the other hand, if you capitalize text with things like "left/right, 
forward/back", Gecko gives you "Left/right, Forward/back", which doesn't 
look as good as the Webkit result "Left/Right, Forward/Back".

Basically, you can't win -- there's no simple, correct answer without 
sophisticated (language- and context-specific) analysis of the content 
that would be way out of scope for CSS.

text-transform:capitalize is a quick hack that may sometimes be better 
than nothing, but should never be relied on if you want high-quality 
typography.

JK

>
> Sebastian
>
> On 6 November 2015 at 09:30, Adam Rich <adamzr@gmail.com
> <mailto:adamzr@gmail.com>> wrote:
>
>     Hi,
>
>     I am using text-transform: capitalize; and I'm finding that it
>     treats punctuation within a word as a word boundary. For example:
>
>     word(s) gets transformed into Word(S)
>     afortunado/a gets transformed into Afortunado/A
>
>     In these cases, the S and the A should not be capitalized. In the
>     first case, the S is there to indicate that the word may be plural.
>     In the second case, the word is Spanish and the A is there because
>     the adjective could be for a male or female reader.
>
>     Can the word boundary rules get adjusted to deal with these cases?
>
>     Thanks,
>     - Adam
>
>
Received on Tuesday, 10 November 2015 21:28:51 UTC

This archive was generated by hypermail 2.4.0 : Friday, 25 March 2022 10:08:58 UTC