, 1 min read
Halving Google Font Load Times
This very blog is using Google fonts. Initially I used only system fonts. The drawback of system fonts is that they are not necessarily installed on all devices. Therefore the appearance of this blog is not the same on different devices.
A simple trick can halve the load times of various Google fonts: specifying that one only wants latin glyphs, and not cyrillic glyphs. I am not using cyrillic letters in this blog.
Previously I used:
@import url("https://fonts.googleapis.com/css2?family=Merriweather:ital,wght@0,400;0,700;1,400;1,700&family=Noto+Sans+Mono:wght@400;700&family=UnifrakturMaguntia&display=swap");
Now I use
@import url("https://fonts.googleapis.com/css2?family=Merriweather&subset=latin:ital,wght@0,400;0,700;1,400;1,700&family=Noto+Sans+Mono&subset=latin:wght@400;700&family=UnifrakturMaguntia&display=swap");
There is no need to specify subset=latin
for Unifraktur Magunta, as this fonts does not offer cyrillic, or any other non-latin glyphs.
This simple addition halves the required transferred bytes.
Reference: Optimize web fonts