Support for non-latin font fallbacks #29
Comments
Oh yes, Cyrillic please too! |
We can solve it the same way we did in Twenty Seventeen, which is using the language attribute on the html tag to define a different set of fonts. |
Is this semi-finalized?
If so then I'm happy to test Vietnamese. |
@philiparthurmoore: Go for it. 👍 |
@philiparthurmoore Are you going to implement this or shall I take over? |
@nielslange If you're referring to Vietnamese then yes, I'm happy to test it. If you're referring to other languages then go for it. I'm only interested in Vietnamese. |
👨💻 Implementation |
@nielslange Is there a reason why we want to load a seperate CSS file for each language instead of doing it how it was done in Twenty Seventeen? https://github.com/WordPress/twentyseventeen/blob/master/style.css#L584 |
@grappler I decided to outsource the language support to avoid that all additional languages get loaded all the time. I don't see any benefits in loading Cyrillic, Greek, Hebrew, etc. when the site language is set to English. Given the fact that on language CSS file has 80+ lines of code, we would load 900+ extra lines of code, that are not necessary for languages with a Latin character set. What issues do you see handling the language support by separate files? |
Thanks @nielslange for getting all these PRs up and running. Just noting that I've updated the main issue above to include links to each PR: That way we can use this thread to keep track of which ones have been tested, approved, and merged. |
Thanks, @kjellr!
@philiparthurmoore Feel free to test the Vietnamese implementation, which can be found on #347. |
@nielslange Thanks a ton - I'll take care of that on Saturday. |
You do know that you can get the user's installed font by using |
The proposed solution for the is very thorough, which is great but I think @joyously’s suggestion might be ideal here. I’m worried that adding so many additional language-specific font-styles would be really difficult to maintain and keep in-sync with the theme’s selectors. Twenty Seventeen only had one font, so there’s far fewer selectors to consider compared to Twenty Nineteen, where we have 2 fonts that get switched back and forth depending on context. As suggested, if we rely on the browser’s font setting for non-en languages, then something like this would be more simple and wouldn’t add nearly as much CSS weight if it were included in
If that’s too aggressive, we could also go with something more specific that still skips over the theme’s selectors. This would still cut down on the number of selectors needed to support languages for fonts and it’d be small enough to include in the main stylesheet too:
Curious what your thoughts are on this @philiparthurmoore & @nielslange. I tried both snippets in my Chrome/Mac os browser but not sure how well it would work everywhere in real-world scenarios. |
@allancole I'd be more in favor of a |
@allancole In general I like the idea of unsins less code to keep the language support maintainable. Your code snippets above will not work due to CSS Specificity. Having said that, if you add I’m on the road currently, but will adjust the code later today. |
Hi @nielslange ! If it enqueues css separately, I suggest renaming the folder to |
Hi! Sorry, I just couldn't find a time to follow up after submitting the issue. Huge thanks in recognizing and considering this issue, and great to see this moving forward. |
I've closed all single language support PRs in favour of #383. @slaFFik Feel free to test the Cyrillic implementation. |
Looking at the _fonts.scss, most of the specified fonts -- as I am aware -- only support Latin alphabets. They do not support or only very limited support for non-latin alphabets.
In addition to that, serif fonts are specified as the primary body font.
$font__body: "Hoefler Text", "Baskerville Old Face", Garamond, "Times New Roman", serif;
In Japanese, non-serif fonts are more commonly used on the web. If serif fonts are used, we need to consider the choice of them very carefully, else readability and aesthetics become absolutely terrible.
Are there any similar cases in any other languages? I am not sure.
The same issue regarding better support for non-latin font fallbacks was raised and applied in the development of twentyseventeen WordPress/twentyseventeen#59
I would like to raise this issue for same matter to be considered in Twentynineteen too.
19-Oct Edit by designsimply
List of alphabets supported in
twentyseventeen
that we also want to try support:Checklist for
twentynineteen
PRs:Add Cyrillic language support #343Add non-latin language support #383)Add Greek language support #344Add non-latin language support #383)Add Hebrew language support #345Add non-latin language support #383)Add Arabic language support #346Add non-latin language support #383)Add Vietnamese language support #347Add non-latin language support #383)Add Thai language support #348Add non-latin language support #383)Add Japanese language support #341Add non-latin language support #383)Add Korean language support #349Add non-latin language support #383)Add Chinese language support #351Add non-latin language support #383)Add Devanagari language support #352Add non-latin language support #383)Add Gujarati language support #353Add non-latin language support #383)The text was updated successfully, but these errors were encountered: