Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[css-text][css-conditional] language specific support for hyphenation and justification #3164

Open
svgeesus opened this issue Sep 26, 2018 · 3 comments
Assignees
Labels
css-conditional-5 Current Work i18n-tracker Group bringing to attention of Internationalization, or tracked by i18n but not needing response.

Comments

@svgeesus
Copy link
Contributor

svgeesus commented Sep 26, 2018

from https://lists.w3.org/Archives/Public/www-style/2015Jun/0160.html by @frivoal

Many people (here's one example) 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 JLReq for how it's done instead), and languages using the Arabic script can do pretty justification using kashida.

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?

@xfq xfq added the i18n-tracker Group bringing to attention of Internationalization, or tracked by i18n but not needing response. label Oct 1, 2018
@svgeesus
Copy link
Contributor Author

svgeesus commented Dec 3, 2018

@frivoal you might have missed that I ported your issue to github

@svgeesus
Copy link
Contributor Author

ping @frivoal @dbaron

@frivoal
Copy link
Collaborator

frivoal commented Jul 14, 2020

Still think this would be good to solve, but this is a new feature request, not a bug against an existing one, so tagging against level 4 rather than 3

@frivoal frivoal self-assigned this Jul 14, 2020
@fantasai fantasai added css-conditional-5 Current Work and removed css-conditional-4 labels Dec 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
css-conditional-5 Current Work i18n-tracker Group bringing to attention of Internationalization, or tracked by i18n but not needing response.
Projects
None yet
Development

No branches or pull requests

4 participants