Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to specify a font version in the google fonts api?

A Google font we use (Pacifico) recently had a rather radical redesign to the capital 'L'. As we use this for our product with a name begging with 'L' this caused a rather radical change in the look to our product.

Digging into it, I noticed that the url for the fonts had changed from

fonts.gstatic.com/s/pacifico/v7/Q_Z9mv4hySLTMoMjnk_rCXYhjbSpvc47ee6xR_80Hnw.woff2

to

fonts.gstatic.com/s/pacifico/v8/Q_Z9mv4hySLTMoMjnk_rCXYhjbSpvc47ee6xR_80Hnw.woff2

but that the previous v7 urls still worked. So, for now, I have added hardcoded font references to that version.

Is it possible, though, to instead link to a particular version of a font?

<link href='https://fonts.googleapis.com/css?family=Pacifico' rel='stylesheet' type='text/css'>

So, somehow specify a version in the above link?

I have tried various guesses, such as:

https://fonts.googleapis.com/css?family=Pacifico&version=7
https://fonts.googleapis.com/css?family=Pacifico&version=v7
https://fonts.googleapis.com/css?family=Pacifico:v7

but to no avail.

like image 264
lukens Avatar asked Dec 17 '16 10:12

lukens


People also ask

Can Google Fonts be modified?

Yes, text in bitmap images or vector graphics made with fonts from Google Fonts can be modified, because the result isn't another font, but an image of text. You can also modify fonts themselves with font editor tools, subject to the license conditions.

What is Google Fonts API key?

It allows apps to query Google Fonts for the available font families. The REST API supplies data in the JSON format that includes the styles and scripts (called subsets in Google Fonts) in each family. The API can sort the list of families alphabetically, by date added, by number of styles, by trend, or by popularity.


1 Answers

The recommended way to stick with a particular version is to self-host it.

Google does not and will not have a versioning option.
The API v7 hack you're using is officially not recommended, and may break.

A Google Fonts employee “davelab6” has been responding to several questions like yours on the Google Fonts github. This question is much like yours and has a brief answer from him. It also links to several other issues with spirited discussion about a similar change.
The upshot is that Google has considered offering a versioning feature and rejected it for several reasons. They say the vast majority of users will be fine with the latest version of a font, and the rest can self-host the version they like.

As for how to self-host, I'm out of my depth, but there's a question about it here with several answers.

like image 55
Jacktose Avatar answered Oct 25 '22 05:10

Jacktose