Site logo

Archived topic

Font Styling Question

12 replies · Started by Karen on May 1, 2020

Viewing posts 1–13 of 13

Hi there,

I'm wondering if you have any ideas for how to get rid of the font flash that initially happens when my website is loaded. I'm using josefin sans and work sans. Is there some css that I can add to load the fonts quicker and avoid FOUT?

Thanks so much,

Karen

Hi there,

Does the issue happen if you disable WP Rocket?

Let me know :)

Hi Leo,

It does still happen when disabling WP Rocket. Thanks for your help.

Karen

I can follow up with them to see if they have any ideas as well.

Hi there,

This is likely happening because you're using "swap" in your Google fonts call.

What happens if you remove this function?:

add_filter( 'generate_google_font_display', function() {
    return 'swap';
} );

Hi,

Thanks for your response. Where is this located so I can remove it?

It would have been added by you/someone working on your site. Maybe in your child theme functions.php file? Or a plugin named Code Snippets?

Hmmm, I don't have code snippets anymore but perhaps it was added by a previous child theme. Thanks for your help anyways.

There are no custom functions added to your site at all?

I never added that custom function in and I've been with GP for a little while now. I do have some custom functions but nothing related to font swap. Could it be WP Rocket? I disabled that and tried and a bunch of different settings but still had the same issue. The only time I wasn't getting the flash was when I was using system stack.

It looks like the swap parameter is gone now, and I'm no longer seeing the FOUT issue. Is it working on your end now?

It does seem to be working right now. With a slight flash on the logo part, but I'm ok with it. It must have been my WP Rocket settings. Thanks so much for your help!

Karen

No problem! :)

This archived topic is closed to new replies.