简体   繁体   English

"从 Google 字体导入时操作 unicode-range"

[英]Manipulate unicode-range while importing from Google Fonts

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");

Documentation 文档

What is 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 中的字符。

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>范围。

URL:网址:

 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.

相关问题 CJK字符的CSS Unicode范围 - CSS unicode-range for CJK characters 如何对数字使用“unicode-range” - How to use “unicode-range” for numbers 错误:CSS:unicode-range:太多的值或无法识别的值 - Error: CSS: unicode-range: Too many values or values are not recognized 使拉丁字体小于希伯来语(unicode-range) - Making a Latin font smaller than Hebrew (unicode-range) 如何知道浏览器将使用哪个 unicode-range 来预加载字体? - How to know which `unicode-range` will be used by the browser for preload a font? CSS3 unicode-range在Firefox中不起作用 - CSS3 unicode-range does not work in Firefox 从 Google fonts 导入 fonts 并将其添加到 CreateGlobalStyle 无法正常工作 - Importing fonts from Google fonts and adding it to CreateGlobalStyle not working properly 我可以使用CSS“ unicode-range”在整个(第三方)页面上指定字体吗? - Can I use CSS “unicode-range” to specify a font across an entire (third party) page? W3C CSS 验证器在@font-face unicode-range 上给出错误 - W3C CSS validator is giving errors on @font-face unicode-range 如何使@font-face 中的 unicode-range 仅加载拉丁字符? (CSS) - How do I make the unicode-range in @font-face for only load Latin characters? (css)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM