Archived topic
Google Fonts in GP - adding '&text=' and change 'unicode-range'
3 replies · Started by _blank on September 26, 2021
Hello GP support
Thanks for all your ongoing support! :)
I am currently using a few google fonts on my site selected from the customizer- ‘Great Vibes’ for the site title and ‘Alice’ for Headings.
I was wondering as I am only using the google font ‘Great Vibes’ for my site title - is it possible to optimize this by adding a text= to my google font request URL in GeneratePress?
Example
<link href='//fonts.googleapis.com/css?family=Great+Vibes&text=SiteTitle' rel='stylesheet'>
Also is it possible to change the unicode-range for my google font heading ‘Alice’?
Many thanks,
Daniel
Hi there,
I've checked the site you've linked and basing from its network activity, It seems to be using the FF fonts.
- Kaisei Tokumin
- Noto Sans (multiple variants)
But on further digging, Alice, Great Vibes and Lato seem to have hitched on Noto Sans' font request as well (as you've mentioned) - https://share.getcloudapp.com/Qwu5ZLWg
is it possible to optimize this by adding a text= to my google font request URL in GeneratePress?
To answer the question:
It won't really matter if you do this because the font-family file loaded is the same.
As for the unicode range, there's no filter directly for it, but we can insert a unicode param if you're already using generate_google_font_display filter to set font-display: swap;.
Example: adding subset=latin.
add_filter( 'generate_google_font_display', function() {
return 'swap&subset=latin';
} );
That makes sense.
Thank you for taking the time to look at it Elvin! :)
No problem. Glad to be of any help. :)