[Resolved] Localize Google fonts

Home Forums Support [Resolved] Localize Google fonts

Home Forums Support Localize Google fonts

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #1605713
    Joy

    Hi there GP Team, Happy New Year! Hope you were all able to take a little break.

    We’ve recently had a site speed audit and our advisor has suggested localizing Google Fonts and suggested you might be able to help. I have had a look around the forum and found some similar topics but it all seems a little beyond me. Wondering if there is a simple way to do this?

    Many thanks in advance,
    Joy

    #1605717
    Elvin
    Staff
    Customer Support

    Hi,

    Please refer to our brief documentation on adding local fonts.
    https://docs.generatepress.com/article/adding-local-fonts/

    Let us know if you need further clarification.

    Happy new year! ๐Ÿ™‚

    A wise man once said:
    "Have you cleared your cache?"

    #1605758
    Joy

    Thanks Elvin. I think this is something different – i.e. not adding a font but localizing a font. This thread seemed to get close to what I need but looked super complex: https://generatepress.com/forums/topic/host-google-fonts-locally/

    Many thanks,
    joy

    #1605763
    Elvin
    Staff
    Customer Support

    Did you mean adding a font from google that isn’t currently added on the customizer?

    If that’s the case, try this:
    https://docs.generatepress.com/article/customizing-the-google-font-list/

    It’s the same link Leo provided on the thread.

    The last PHP snippet on the documentation allows you to “localize” a font to the customizer.

    Here’s how to add PHP – https://docs.generatepress.com/article/adding-php/

    Note: If its not from Google and is from something else, you’ll have to create your own @font-face import on CSS and add it in on the customizer this way.

    add_filter( 'generate_typography_default_fonts','tu_add_system_fonts' );
    function tu_add_system_fonts( $fonts ) {
    $fonts[] = 'Font Family name here';
    return $fonts;
    }

    Where $fonts[] value is the font-family property value of the @font-face you’ve imported.

    A wise man once said:
    "Have you cleared your cache?"

    #1605834
    Joy

    Thanks Elvin,

    I don’t think this is quite it but I don’t know enough to be sure! Let me close this thread and come back when I’ve figured out exactly what our advisor wants us to do.

    Many thanks,
    Joy

    #1605854
    Elvin
    Staff
    Customer Support

    No problem.

    You can keep this open if you want so you can comeback to this incase you need further clarification/s. ๐Ÿ™‚

    A wise man once said:
    "Have you cleared your cache?"

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.