Closed andronic90 closed 9 years ago
I'll start by saying that if you look at what is return to Chrome, the subset parameter is ignored and CSS for all subsets is returned that includes unicode-range
properties. This is a great feature for browsers, as it means they download the available subsets based on the unicode characters in the DOM. So if you have a font used with some English headline and the text is updated live on the page and includes some Russian name in Cyrillic, the browser will then fetch the Cyrillic subset and use it :)
The both links include subsets cyrillic and latin
Right, the latin subset is default and always included.
For my example I need to include 2 font with 2 different subset for example:
You can't do that with a single API URL, because the API has a single subset parameter.
Therefore you can request all the subsets for all the families you specify. Eg:
http://fonts.googleapis.com/css?family=Playfair+Display|Alef&subset=cyrillic,hebrew
returns:
@font-face {
font-family: 'Alef';
font-style: normal;
font-weight: 400;
src: local('Alef Regular'), local('Alef-Regular'), url(http://fonts.gstatic.com/s/alef/v5/VChiHjiAPQWXO24iGyJCTvesZW2xOQ-xsNqO47m55DA.woff2) format('woff2');
}
@font-face {
font-family: 'Playfair Display';
font-style: normal;
font-weight: 400;
src: local('Playfair Display'), local('PlayfairDisplay-Regular'), url(http://fonts.gstatic.com/s/playfairdisplay/v10/2NBgzUtEeyB-Xtpr9bm1CRpdoKZe3dinVOXWpk4Lo4o.woff2) format('woff2');
}
Which is the latin + cyrillic subset of Playfair and the latin + hebrew subset of Alef.
Supposing that Alef supported a cyrillic subset, and Playfair a hebrew subsets, and you didn't want to have users download Alef's latin + cyrillic + hebrew font file, only a latin + hebrew, while still having them download Playfair latin + cyrillic?
You'd need 2 URLs.
https://developers.google.com/fonts/docs/getting_started#Subsets example needs an update IMO; doesn't make sense that we show alternatives that are in fact yielding the same font (on non-unicode-range browsers). I'll take that aspect.
I updated https://developers.google.com/fonts/docs/getting_started#Subsets to have examples that will [on a non-unicode-range browser] in fact be different.
As far as I can tell, the subset
parameter does nothing. So it's weird to me that Google Fonts includes a UI to control which languages you want to include?
As far as I can tell, the subset parameter does nothing
You are likely looking with a browser that supports unicode-range, and thus is served all the subsets with the unicode-range hint so that the browser selectively downloads the subsets as needed by the DOM.
I just had the same WTF, but then found this thread.
Indeed, it serves subset-independent content for modern Chrome browsers. But if you try curl
-ing it, you'll see the difference:
➜ curl 'https://fonts.googleapis.com/css?family=Open+Sans:400,400i&subset=latin' 2>/dev/null | md5sum
> 0aec080b4f898792fa11cac5fab14bc2 -
➜ curl 'https://fonts.googleapis.com/css?family=Open+Sans:400,400i&subset=latin,latin-ext' 2>/dev/null | md5sum
> dcdb5737900513b9f33ca3eec772c6e7 -
➜ curl 'https://fonts.googleapis.com/css?family=Open+Sans:400,400i&subset=latin,latin-ext,cyrillics' 2>/dev/null | md5sum
> f0d117e94375eb3f0c50402cf0daf102 -
So glad I found this thread!
Note that if you specify a subset that isn't valid, rather than ignore that subset, a 404 is produced. This happens even on browsers with unicode range support where the subset is otherwise meaningless.
So essentially the subset
parameter is useless on browsers that support UTF-8, and it will only show the selected subsets on other browsers?
On a UA that supports unicode-range
(most these days, https://caniuse.com/#feat=font-unicode-range) we let the UA select the correct subset(s).
subset
specification still matters for environments that do not support unicode-range
.
Huh, what am I doing wrong? Whatever I do, I get basic Latin only. The GF website now only allows copying the basic stylesheet link, and if I try to modify that stylesheet by adding unicode-range
attributes, nothing changes.
@font-face {
font-family: 'Architects Daughter';
font-style: normal;
font-weight: 400;
font-display: swap;
src: url(https://fonts.gstatic.com/s/architectsdaughter/v11/KtkxAKiDZI_td1Lkx62xHZHDtgO_Y-bvTYlg4w.woff2) format('woff2');
/* unicode-range: U+0000-017C; */ /* does nothing */
}
Also a couple of issues with no reply from the team are lingering: #2507 #2230 #2480
I think deprecating the subset
parameter is a deterioration and makes everything more complicated. Obviously I must be missing something!
@davelab6
CSS for all subsets is returned that includes unicode-range properties.
Not true (at least, not anymore).
https://fonts.googleapis.com/css2?family=Noto+Serif returns references only for Latin, Cyrillic, Greek and Vietnamese subsets, even though "Noto Serif" contains more characters.
Without enforcing subsets I cannot get, say, Latin and Cyrillic subsets and character ∞
(U+221E), which is not included in any of the subsets automatically selected by Google Fonts.
Hello, In official documentation https://developers.google.com/fonts/docs/getting_started#Subsets
I don't see the difference between : http://fonts.googleapis.com/css?family=Philosopher&subset=cyrillic and http://fonts.googleapis.com/css?family=Philosopher&subset=latin,cyrillic
The both links include subsets cyrillic and latin
For my example I need to include 2 font with 2 different subset for example:
http://fonts.googleapis.com/css?family=Playfair+Display&subset=cyrillic|Aregular&subset=latin
Playfair Display with subset: cyrillic and Aregular with latin. How to make this request? Thanks.