Support » Plugin: Gutenberg » Stop Noto (Google Fonts) Loading

  • Resolved Kev

    (@kevquirk)


    Hi,

    I’ve implemented an editor stylesheet within my theme that uses system fonts. It’s all working fine and all elements of Gutenberg appear to be loading the correct fonts – Noto is not being loaded on any text elements that I can see.

    HOWEVER

    The Google Fonts stylesheet is still being loaded and I have no idea why. Being a privacy advocate, I have absolutely no intention of using Google Fonts on my site, and to be honest, I think it’s wrong that WordPress is using Google Fonts by default. Surely the default should always be system fonts, then people can add Google Fonts functionality if they wish.

    How can I stop Gutenberg from loading Google fonts all together?

    Here’s the font-family code from my editor stylesheet:

    
    /* Set fonts */
    h1,
    h2,
    h3,
    h4,
    h5,
    h6,
    #post-title-0 {
        font-family: helvetica, arial, sans-serif;
    }
    
    *,
    body,
    p,
    li,
    .response blockquote,
    p.has-background {
        font-family: Georgia, serif;
    }
    

    Thanks in advance.

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • James

    (@bonkerz)

    wp-editor-font is what you want to deregister to stop the Google Font loading in backend.

    Unfortunately many block elements have wp-editor-font as a dependency, so the $handle must still exist. So I re-register the handle linking to a blank file. There may be a more elegant way of doing that part.

    Adding this to your functions.php:

    // Stop Google Fonts loading in Editor.
    function deregister_google_font() {
    	// deregister google font.
    	wp_deregister_style( 'wp-editor-font' );
    	// reregister blank file so dependency exists.
    	wp_register_style( 'wp-editor-font', get_stylesheet_directory() . '/an-empty.css' );
    }
    add_action( 'admin_enqueue_scripts', 'deregister_google_font', 11 );

    There is active discussion about why Noto is being included, and why its not easy to turn it off.

    That worked perfectly. Thank you!

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