Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ensure text remains visible during webfont load not getting resolved in Google pagespeed insights

Ensure text remains visible during webfont load issue is not getting resolved in google pagespeed insights report even after adding font-display: fallback to the CSS.

How can I resolve the issue?

@font-face {
  font-family: Jura;
  src: url(../fonts/Jura-Regular.eot);
  src: url(../fonts/Jura-Regular.eot?#iefix) format('embedded-opentype'), url(../fonts/Jura-Regular.woff2) format('woff2'), url(../fonts/Jura-Regular.woff) format('woff'), url(../fonts/Jura-Regular.ttf) format('truetype'), url(../fonts/Jura-Regular.svg#svgFontName) format('svg');
  font-weight: 400;
  font-display: fallback;
}
like image 475
Hiran Narayanan Avatar asked Jan 20 '19 15:01

Hiran Narayanan


2 Answers

I got rid of it by adding font-display: swap;

@font-face{
    font-family:FontAwesome;
    font-display: swap;
    src:url(fonts/fontawesome-webfont.eot?v=4.5.0);
}
like image 116
K. Shaikh Avatar answered Sep 27 '22 20:09

K. Shaikh


This issue can be solved by adding an online JS library of the font-awesome between head tag on website.

https://fontawesome.com/how-to-use/with-the-api/setup/configuration#configuration

<html>
    <head>
        <script>
            FontAwesomeConfig = {searchPseudoElements: true}
        </script>
        <script src="https://use.fontawesome.com/releases/v5.12.0/js/all.js"></script>
   </head>
   <body></body>
</html>
like image 23
Sagar Pansuriya Avatar answered Sep 27 '22 20:09

Sagar Pansuriya