Bold, italic versions of Google Fonts should be loaded.
In Chrome (tested on MacOS, and apparently also the case on at least some versions of Windows), <b> or <strong> have no effect in body text. Other browser/OS combinations may use font substitution to create a "fake" bold, italic etc. that will be visibly inferior to the version that could be loaded if requested.
After #181, only the specified weight of font is requested from Google Fonts. This was presumably necessary because Google used to return the whole range by default (this is no longer the case; currently only 400 is returned if no weight is specified).
It seems that the best way to get the right weight for bold, italic, & bold italic is to request e.g. Open+Sans:400,400i,400b,400bi - this seems (currently, at least) to DTRT without requiring us to know what weights are available for the specified font.
As it is probably less likely that bold/italic will be used in titles/headers, consideration could be given to only requesting the extra versions of the font for the "mainfont" setting.
Comments (10)
-
-
reporter We were using Open Sans. It seems to be a browser/OS-dependent thing. Most browser/OS combinations will "fake up" what you have asked for, e.g. italic by slanting the regular font or bold by "widening" the regular font in some hacky way. Some either do not do this, or get it wrong.
In all cases, the results when using the real fonts will be superior.
As stated above, it seems from my initial testing that using the b,i,bi versions of a font is the best we can do now that there's no easy way to get everything (as different fonts have different weights available).
-
Could you describe the environment? OS and browsers used?
Could you test the same issue with other common fonts like Roboto, Montserrat, Source Sans or PT Sans?
-
reporter We noticed the problem was using Chrome on Sierra. But as mentioned above, "In all cases, the results when using the real fonts will be superior." - this applies to all browsers on all OS.
-
Thanks, that was what I would like to know. In the Google fonts Github there are many reports of wrong rendering when using Mac.
I agree the best way is to add the variants when loading the font.
Will you submit a patch?
-
reporter Yep, testing at the moment.
-
Thank you Nick
-
-
assigned issue to
- marked as enhancement
Waiting PR
-
assigned issue to
-
reporter Sorry, been a bit stuck with other moodling. Testing seems good, so I'll post PR asap.
-
- changed status to resolved
fix
#669Add italic style to Google Fonts request→ <<cset 1fb6addf3f8d>>
- Log in to comment
Can't reproduce the issue. Could you indicate what font are you testing?
Tested several Google Fonts and all apply <i> and <b> tags.
It is truth that some fonts do not include these variations but it is quite complex to manage the fonts and variants.