How to make load of google font be lazy?

AI-generated summary

The discussion revolves around making Google Font loading lazy due to slow load times caused by requests to Google Fonts. hnaseri initially faces the issue, and pmusaraj suggests using the core site setting for fonts, but hnaseri reveals that core settings are already in use. awesomerobot identifies the theme as the source of the problem, specifically the Roboto font, and proposes solutions: removing the Google Fonts include, switching to a locally served font, or adding font-display: swap; to the @font-face rule.

We have a stupid government that blocks google services whenever something happens :man_facepalming: .
Today I realized that my forum was loading very slowly (blank page for about 10 seconds or more). Then I realized that there is a request to google fonts in the header, and its not lazy load. So it waits until it gives timeout and then the forum would load.

How can we make this request lazy?

Can you try using the core site setting for fonts? I believe that one does not use Google Fonts at all, so the request will be local, and therefore should be much faster for you.

its already using core site settings.

It looks like the font causing the issue is Roboto, and your site settings are set to use Arial… so the font is likely coming from a theme.

You can remove the include that’s reaching out to Google’s servers from the theme and switch to using Roboto from your site settings. You can alternatively download Roboto and include it as a theme asset. We have a guide for creating a theme component with a locally served font here: Create and share a font theme component

You can also try adding font-display: swap; to your @font-face rule: `font-display` for the Masses | CSS-Tricks