Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Request different characters per font with Google Fonts?

Google Fonts supports loading specific characters of a font:

http://fonts.googleapis.com/css?family=Inconsolata&text=Hello

Google Fonts also supports loading multiple families and styles with one request:

http://fonts.googleapis.com/css?family=Tangerine:bold,bolditalic|Inconsolata:italic|Droid+Sans

Is there a way to load different character sets for different families without making multiple requests? It seems that since text is a separate query parameter the answer is "no, the text param applies to all requested families and styles`, but figured I'd throw it out there...

UPDATE: @Gothburz' answer shows it's possible to load specific subsets of multiple fonts with one request, but I haven't found a way to load specific text ranges with one request.

like image 634
ericsoco Avatar asked Nov 06 '15 17:11

ericsoco


1 Answers

You can add character subsets in the URL using extra parameter &subset with comma separated value, like this:

<link href='//fonts.googleapis.com/css?family=Open+Sans:400italic,700italic,400,700|Ubuntu:400,700,400italic,700italic&subset=latin,latin-ext' rel='stylesheet' type='text/css'>

Example of multipls subsets & fonts:

<link href='http://fonts.googleapis.com/css?family=Open+Sans:700,300&subset=latin,cyrillic|PT+Sans:400,700&subset=latin,cyrillic' rel='stylesheet' type='text/css'>
like image 146
Peter Girnus Avatar answered Sep 24 '22 05:09

Peter Girnus