[csswg-drafts] [css-text] `text-transform` for local quotation marks from `quotes` (#12441)

Crissov has just created a new issue for https://github.com/w3c/csswg-drafts:

== [css-text] `text-transform` for local quotation marks from `quotes` ==
Note: I imagined this had been discussed before but could not find anything in the issues of this repository – maybe it was on www-style many years ago. Pointers are very welcome. 

Even if we ever got the `@text-transform` at-rule proposed by @frivoal with its [`position` descriptor](https://specs.rivoal.net/css-custom-tt/#position-desc) approved #3132, it would probably not be flexible enough to turn straight ASCII quotation marks and apostrophes and dashes into curly, typographic ones reliably and i18n-y. 
I wish I could just specify something like:

~~~~ css
  text-transform: local-punctuation;
~~~~

to turn `"` and `'` into fancier variants appropriate for the current locale, as optionally specified by the `quotes` property and available [within `content` as keywords](https://drafts.csswg.org/css-content-3/#quote-values). 

This should take flanking into account, of course, and would ideally be able to distinguish a single quotation mark from an apostrophe where they should be presented by different glyphs. 

Also, spaced plain hyphens `-` would be replaced by either en or em dashes. Although this keyword would require context awareness of one or two adjacent characters in implementations, I don’t believe that the glyph replacement model of `text-transform` would really work with turning multi-char strings into single glyphs, e.g. LaTeX’s or smartypants’ `--` and `---` or `...`. This will therefore never fulfill everybody’s needs, but could still solve a lot. 

Outside roman script, there are possibly more applications that could be included, e.g. the semicolon-like Greek question mark generated from pain `?`. East-Asian full-width variants would be out of scope of this keyword, though, because they are already covered by the `full-width` keyword. 

This proposed feature would be most useful with content that the author has no control over. This may be user-generated but does not need to be. One could argue that server-side processing of the source text should be the better solution, but text processing at this level is also not always available to the CSS author; or the publisher might want to keep the original source text unchanged for some reason. I, for one, would immediately use it in my user stylesheet on the English Wikipedia whose style guide still forbids typographic punctuation.

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/12441 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Thursday, 3 July 2025 12:50:18 UTC