Re: [css-text] New transform

On 1/4/16 09:03, Henrik Andersson wrote:
> The text-transform property is nice for the various effects that it can
> do. However, I think that it could do more.
>
> As such I propose a new value for the property.
>
> The new value is rot13. When this new transform is applied the
> characters in the text will be replaced according to the rot13
> substitution cipher.
>
> Here is an example of it being used:
>
> <style>
> .spoiler {
>      text-transform: rot13;
> }
> .spoiler:hover {
>      text-transform: none;
> }
> </style>
> <div class="spoiler">Today is an important day.</div>
>
>

I don't think I support this -- it's much too limited in scope, being 
essentially an English-only feature. (What will rot13 do with 
Latin-script text that includes lots of diacritics? Let alone non-Latin 
alphabets?)

If -- and it's a fairly big "if", in my mind -- we want new 
text-transform capabilities, I think we should instead consider a more 
generalized feature that allows authors to specify the desired transform 
or substitution. At a simple level, maybe a function modeled on the "tr" 
utility, which allows rot13 to be pretty trivially specified, but also 
allows alternative transforms, and could handle extended alphabets, etc:

   .spoiler {
     text-transform: tr("a-zA-Z", "n-za-mN-ZA-M");
   }

Or for a less cryptic (and more extensible) approach,

   @text-transform rot13 {
     match: "a"-"z" "A"-"Z"; /* could also support U+XXXX notation? */
     replace: "n"-"z" "a"-"m" "N"-"Z" "A"-"M";
     /* could also think about other kinds of transform... reverse?
        arbitrary text-munging functions? etc. */
   }

   .spoiler {
     text-transform: rot13;
   }

But I don't think rot13 by itself deserves a place as a built-in CSS value.

JK

Received on Friday, 1 April 2016 13:38:53 UTC