Archived topic
Support for Google Fonts /css2 Variable Fonts
2 replies · Started by Jason on March 28, 2022
Variable fonts from Google are loaded from a different endpoint; i.e., /css2 instead of /css, which is what GeneratePress uses.
https://fonts.google.com/knowledge/using_type/loading_variable_fonts_on_the_web
Is it possible to make the endpoint filterable, please? I can't find a way to change this without modifying the source code.
For example:
return apply_filters( 'generate_google_fonts_uri', $google_fonts_uri );
Hi Jason,
There is no filter to modify the “endpoint”. /css works with variants of multiple font as well but an alternative to modifying the GP files manually to make the endpoint /css2 is to enqueue the fonts manually.
You can do this through a Hook Element or a plugin like Code Snippets.
Make sure to toggle Google Fonts off when you add it as a Font in Appearance > Customize > Typography: https://share.getcloudapp.com/wbuzKgr9
We’ll ask tom about this. Hope this clarifies. :)