How to ensure text remains visible during web font load Astra

No results found. Try again with different words?

Search must be at least 3 characters.

How to ensure text remains visible during web font load Astra

When you analyze the website with PageSpeed Insight, you might encounter this error that “Ensure text remains visinle during web font load” from time to time. In this document, we will explain how to fix this error while using the Astra theme.

Why this error occurs?

When a browser detects that a text has a custom font applied, it waits for the font to download. Text will remain invisible till then. The customised font is immediately used after it has finished downloading. This normally doesn’t occur if you are using the default fonts; however, mostly occurs when you are using a custom font or using a plugin to insert the custom fonts.

When you test the speed of the website, this reaction of the browser is responsible for showing the error “Ensure text remains visible during web font loading”.

How to rectify this error?

To rectify this error, you will need to ensure that during the time that the browser loads your custom font, it should displaythe default fonts. Once the browser downloads the custom fonts, it should then swap the default fonts with the custom one.

Google Fonts

For Google fonts, you can simply use the plugin named “Swap Google Fonts Display” which can be downloaded from here. Once you have downloaded and install the plugin, it will automatically search for any Google Fonts script and will append display=swap to the URL. This will ensure that the browser loads the deafult fonts during the time any custom fonts are being downloaded.

ast-swap-google-fonts

Other Fonts

When you are using a plugin to insert custom fonts to your website, you will need to either contact the plugin creators or you can edit the plugin code . Here is an example on how to edit the plugin code. In this example, we are using a plugin developed by us named “Custom Font”.

Step 1: From your WordPress dashboard, navigate to the Plugins and select Plugin File Editor

Astra Plugin Editor

Step 2: Select the plugin that is responsible for injecting custom fonts on your website.

Step 3: Locate the .css file inside the plugin code. In our case the CSS file is located inside the assets>CSS>bsf-custom-font.css. Please note the every plugin will have different paths for the CSS file. Please contact the plugin creators, if you are not sure where to find the css file of the custom font.

Step 4: Copy and paste the code below at the bottom of the .css file and click on the update file button.

@font-face{
	font-family: cambodian
	font-display: swap;
}

Once you have followed the steps, the error “Ensure text remains visinle during web font load” will be fixed.

Was this article helpful?
Did not find a solution? We are here to help you succeed.

Related Docs

Scroll to Top
Now choose your preferred
page builder addon
Choose your preferred page builder addon

Download is Just A Click Away!

Enter your email address and be the first to learn about updates and new features.

Download Free Astra Theme - Modal Popup Form