[英]Manipulate unicode-range while importing from Google Fonts
My question can be seen as a follow-up of this answer<\/a> .我的问题可以看作是这个
答案<\/a>的后续。
@import url("http://fonts.googleapis.com/css?family=Lato:300,400,700");
If you want set the range while you are importing, just add to the link the variable 'subset'. 如果要在导入时设置范围,只需将变量“subset”添加到链接即可。
For example: 例如:
@import url("http://fonts.googleapis.com/css?family=Lato:300,400,700&subset=latin");
Or, if the text is very small you can change the subset variable for text, and add the content inside. 或者,如果文本非常小,您可以更改文本的子集变量,并在其中添加内容。
For example: 例如:
@import url("http://fonts.googleapis.com/css?family=Inconsolata&text=Hello");
unicode-range<\/code> ?
什么是unicode-range<\/code> ?
<\/h2> It's a prop used to tell the browser when to download<\/strong> a font file.
这是一个用来告诉浏览器何时下载<\/strong>字体文件的道具。 As soon as any character that belongs to the given range is rendered: the font file is downloaded.
只要呈现属于给定范围的任何字符:下载字体文件。
The unicode-range<\/code> is not<\/strong> intended to assign the style to the characters from the given range .
unicode-range<\/code>并不<\/strong>打算将样式分配给给定 range 中的字符。
![](/img/trans.png)
Solution解决方案<\/h2>The best option is to use the text<\/code> parameter to get a font file per style that contains just the characters you need, in this case the range [0-9]<\/code> .
最好的选择是使用text<\/code>参数来获取每个样式的字体文件,其中只包含您需要的字符,在本例中为[0-9]<\/code>范围。
![](/img/trans.png)
URL:网址:
![](/img/trans.png)
https:\/\/fonts.googleapis.com\/css?family=Lato:300,400,700&text=0123456789<\/code><\/pre> Google Fonts response:谷歌字体回复:
@font-face { font-family: 'Lato'; font-style: normal; font-weight: 300; src: url(https:\/\/fonts.gstatic.com\/l\/font?kit=S6u9w4BMUTPHh7USewqdFhfZ3-4B28Jv7vc&skey=91f32e07d083dd3a&v=v22) format('woff2'); } @font-face { font-family: 'Lato'; font-style: normal; font-weight: 400; src: url(https:\/\/fonts.gstatic.com\/l\/font?kit=S6uyw4BMUTPHvxwiUT-eLhTc2OsC1s0&skey=2d58b92a99e1c086&v=v22) format('woff2'); } @font-face { font-family: 'Lato'; font-style: normal; font-weight: 700; src: url(https:\/\/fonts.gstatic.com\/l\/font?kit=S6u9w4BMUTPHh6UVewqdFhfZ3-4B28Jv7vc&skey=3480a19627739c0d&v=v22) format('woff2'); }<\/code><\/pre>"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.