W3C home > Mailing lists > Public > public-css-archive@w3.org > September 2020

[csswg-drafts] [css-conditional] language specific support for hyphenation and justification (#5530)

From: fantasai via GitHub <sysbot+gh@w3.org>
Date: Fri, 18 Sep 2020 19:47:23 +0000
To: public-css-archive@w3.org
Message-ID: <issues.opened-704615052-1600458442-sysbot+gh@w3.org>
fantasai has just created a new issue for https://github.com/w3c/csswg-drafts:

== [css-conditional] language specific support for hyphenation and justification ==
@frivoal wrote in https://lists.w3.org/Archives/Public/www-style/2015Jun/0160.html :+1: 
> Many people (here's one example[1]) recommend that justification should only be used if you can also do hyphenation, as otherwise it looks bad.
> To do that in a browser, you may be tempted to write this:
> ```
>   p { text-align: left; }
>   @supports (hyphens: auto) {
>     p {
>       hyphens: auto;
>       text-align: justify;
>     }
>   }
> ```
> However, it doesn't quite do cut it.
> **Problem 1**
> Support for hyphenation is language dependent. Even if a browser properly implements the 'hyphens' property, it may not have a dictionary to do it for the language at hand.
> **Problem 2**
> "justification should only be done if you can also do hyphenation" is only true in some languages. For example, Japanese does not use hyphenation to do justification (See [2] for how it's done instead), and languages using the Arabic script can do pretty justification using kashida[3].
> <hr>
> Problem 1 would be addressed if we added something like
>   @supports hyphenation-language(fr) {...}
> but it seems awfully specific and narrow.
> Problem 2 can be handled by authors using :lang() selectors, so it is less of an issue. However, for stylesheets meant to be used over an open ended set of languages, being exhaustive is really tedious, and authors are unlikely to have the linguistic knowledge to do this properly.
> We could generalize a little bit, and go with something like (to be bikesheded):
>   @supports nice-justification(fr) {...}
> where the condition evaluates to true if one of the following is true:
> - The language should use hyphenation and the browser has the necessary resources to do it
> - The language should use some other approach (kashida, etc) and the browser knows how to do at least one of the acceptable techniques
> - The language is known not to need any language-specific algorithm or resource to justify well
> This is broader than @supports hyphenation-language(), but not by a whole lot, and it deciding which languages need what may be quite controversial, so I am not sure that's a great idea either.
> Any idea on how to solve this well?
> -- Florian
> [1] http://practicaltypography.com/justified-text.html
> [2] http://www.w3.org/TR/jlreq/
> [3] https://en.wikipedia.org/wiki/Kashida

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

Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Friday, 18 September 2020 19:47:25 UTC

This archive was generated by hypermail 2.4.0 : Tuesday, 5 July 2022 06:42:16 UTC