- From: Jonathan Frech via GitHub <noreply@w3.org>
- Date: Sat, 31 May 2025 19:15:54 +0000
- To: public-css-archive@w3.org
jfrech has just created a new issue for https://github.com/w3c/csswg-drafts: == [css-text-4] Add an optional second value to `hyphenate-character` to render the unchosen `­` == ### Status quo Currently, `hyphenate-character`'s values are defined as (cf. https://www.w3.org/TR/css-text-4/#hyphenate-character [2025-05-31]) ```` hyphenate-character = auto | <string> ```` with the semantics that when a `­` word-break opportunity is taken, the `­` character is rendered as the given string (which has an `auto` default). When a `­` word-break opportunity isn't taken, the `­` character isn't rendered. ### Proposal I propose adding a second, optional argument to `hyphenate-character` with default value `""` that specifies the rendering of a `­` character whose word-break opportunity isn't taken: ```` hyphenate-character = auto | <string> | <string> <string> ```` The rendered, untaken `­` becomes part of the physical text with regards to selection ranges. ### Motivation Hyphenation rules in modern English (e.g. `en-GB`) and German after the spelling reform (e.g. `de-DE`) fit `hyphenate-character`'s model well: when you can break, break and add a hyphen, else don't break and leave the word alone. However, when typesetting German preceding the spelling reform (language code `de-DE-1901`), hyphenation *may add and remove letters*: ````text ((de-DE-1901)) Nach Tagen der Suche konnte sie eine Pampelmuse entdecken, und begann, ein Stilleben anzufertigen. ^^ "ck" -> "k-k" ^^ "ll" -> "ll-l" Nach Tagen der Suche konnte sie eine Pampelmuse entdek- ken, und begann, ein Still- leben anzufertigen. ```` *Adding* letters `"ll" -> "ll-l"` when breaking can be achieved with contemporary CSS: ````html <p lang="de-DE-1901">Nach Tagen der Suche konnte sie eine Pampelmuse entdecken, und begann, ein <span style="hyphenate-character: 'l-';">Stil­le</span>­ben anzufertigen.</p> ```` But *changing* letters `"ck" -> "k-k"` when breaking, to my knowledge, cannot be achieved in pure CSS (I have written an ECMAScript resize observer which changes letters' `display: none` styling, though it possibly falls into a never-ending loop when the font rendering gives different characters too dissimilar widths). With an unused-`­` text parameter to `hyphenate-character`, the break opportunity could be aptly described: ````html <p lang="de-DE-1901">Nach Tagen der Suche konnte sie eine Pampelmuse ent­<span style="hyphenate-character: 'k-' 'c';">de­ken</span>, und begann, ein Stilleben anzufertigen.</p> ```` ### Raison d'ĂȘtre I think adding an as-described non-taken `­` rendering argument to `hyphenate-character` opens up the possibility for correctly breaking justified `de-DE-1901` text, a feature CSS is currently lacking, through a generic feature without introducing `de-DE-1901`-specific styling rules. Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/12255 using your GitHub account -- Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Saturday, 31 May 2025 19:15:55 UTC