Closed i-like-robots closed 4 years ago
I have scheduled a chat with @notlee to discuss web font loading for 2020.
We currently configure 5 fonts in our CSS https://github.com/Financial-Times/n-ui-foundations/blob/master/typography/main.scss#L5-L15
But only 4 are configured to be ~loaded~ watched by o-typography
: https://github.com/Financial-Times/o-typography/blob/ce625323d492395784f384358a6e65d0c43df484/src/js/typography.js#L25-L46
Hey, o-typography
js doesn't load fonts. It stores which fonts have loaded (in a cookie 😷) and switches some class names so we can resize fallback fonts, to minimise the effect of FOUT. We don't resize all fallback fonts faces, only four, but may use more
Have replaced "loaded" with "watched" =]
I'm going to close this as #770 has centralised all of the font loading configuration and information.
The implementation of web fonts is currently split between the shell and layout components and is comprised of several parts:
o-typography
component (layout)It is not ideal having the implementation split between so many components. The integration is also not accessible from apps so there is no way to indicate which fonts are needed and which aren't.
Most importantly, the embedded JS snippet should be placed in the document
<head>
to avoid FOUT but since the<Shell />
component does not provide a client-side JS module that would mean initialisingo-typography
separately elsewhere 😬In short we need to solve the following problems:
References