A
A
Andrey Fedorov2020-04-20 10:47:26
css
Andrey Fedorov, 2020-04-20 10:47:26

Why does Google Fonts load extra fonts and how to get rid of it?

It is necessary to reduce the number of requests to the server when loading site pages. They cut everything that was not needed. Now we are trying to cut it is not much needed.

We have a request in Goole Fonts:

https://fonts.googleapis.com/css?family=Roboto:300,400,500,700&display=swap&subset=cyrillic

For this request, Google gives 8 files. It seems to be logical, 4 "thicknesses" and two subsets latin and cyrillic.

Cyrillic was removed for the test
https://fonts.googleapis.com/css?family=Roboto:300,400,500,700&display=swap

But Google Fonts still gives 8 files.

What's happening?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
R
Rsa97, 2020-04-20
@Rsa97

If you look at what exactly is given by the link:
1. normal, 300, cyrillic-ext + cyrillic + greek-ext + greek + vietnamese + latin-ext
2. normal, 300, latin
3. normal, 400, cyrillic-ext + cyrillic + greek-ext + greek + vietnamese + latin-ext
4. normal, 400, latin
5. normal, 500, cyrillic-ext + cyrillic + greek-ext + greek + vietnamese + latin-ext
6. normal, 500, latin
7 .normal, 700, cyrillic-ext + cyrillic + greek-ext + greek + vietnamese + latin-ext
8. normal, 700, latin

L
Lynn "Coffee Man", 2020-04-20
@Lynn

First, the CSS rendered is actually browser dependent.
Secondly, it does not “load”, but gives links. In reality, a font file with a Greek subset will only load if you have Greek letters in your text.
In general, in this place you do not need to try to be smarter than Google.
UPD: And in general, you need to switch to APIv2 https://developers.google.com/fonts/docs/css2

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question