我想使用Google Fonts添加一个字体,但是我发现了一些奇怪的行为。
我想仅添加拉丁字符集的字体,不需要拉丁扩展、西里尔文或西里尔文扩展字符集,以减轻代码负担。我知道这是默认行为,所以我按照以下方式操作:
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Philosopher">
在Firefox中(以及其他不支持WOFF2的浏览器中),我获得了正确的输出:@font-face {
font-family: 'Philosopher';
font-style: normal;
font-weight: 400;
src: local('Philosopher'), url(http://fonts.gstatic.com/s/philosopher/v7/OttjxgcoEsufOGSINYBGLbrIa-7acMAeDBVuclsi6Gc.woff) format('woff');
}
但在Chrome中,我得到了这个:
/* cyrillic */
@font-face {
font-family: 'Philosopher';
font-style: normal;
font-weight: 400;
src: local('Philosopher'), url(http://fonts.gstatic.com/s/philosopher/v7/OttjxgcoEsufOGSINYBGLV4sYYdJg5dU2qzJEVSuta0.woff2) format('woff2');
unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
/* latin */
@font-face {
font-family: 'Philosopher';
font-style: normal;
font-weight: 400;
src: local('Philosopher'), url(http://fonts.gstatic.com/s/philosopher/v7/OttjxgcoEsufOGSINYBGLZQV2lvL5Ba9FjAYK6Lx0Qk.woff2) format('woff2');
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215, U+E0FF, U+EFFD, U+F000;
}
我以为,也许拉丁字符子集不再是默认行为了,所以我在我的<link>
中添加了subset
GET参数:
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Philosopher&subset=latin">
但它并没有改变输出结果。当我使用&subset=cyrillic
时,Firefox中会发生变化,但Chrome的输出结果仍然相同。
有没有一种方法只输出拉丁子集?
或者说,如果页面上不需要WOFF2和unicode-range,它们就不会被下载吗?在这种情况下,从CSS文件中删除cyrillic调用只能获得8行代码,也就是大约300字节,这根本不值得吗?