简体   繁体   English

使用网络字体会下载整个字形集吗?

[英]Does using a web font download the entire glyph set?

There is a question posed here at work whether if we use a CDN-based font, such as Font Awesome, if the entire font is downloaded right away, or if the glyphs are only fetched if actually used. 这里是否存在一个问题是我们是否使用基于CDN的字体(例如Font Awesome),是否立即下载了整个字体,还是仅在实际使用时才提取字形。

I have people who want to create custom "sub-sets" of font awesome to reduce page weight, and I'd like to know if this is really an issue. 我有些人想要创建很棒的自定义字体“子集”以减少页面重量,并且我想知道这是否真的是一个问题。

yes, it downloads the entire set. 是的,它将下载整个集合。 But the entire set is incredibly small compared to bitmap images. 但是与位图图像相比,整套图像非常小。 Since fonts are just vector images 由于字体只是矢量图像

**edit to answer your comment Does anyone have an idea about the weight of Font Awesome, in K? **编辑以回答您的评论有人对K字体真棒的重量有任何想法吗? It depends on the browser there are 4 different formats for the different browsers. 取决于浏览器,不同的浏览器有4种不同的格式。

  1. OTF 62kb OTF 62kb
  2. eot 38kb eot 38kb
  3. svg 198kb svg 198kb
  4. ttf 79kb ttf 79kb
  5. woff 44kb 沃夫44kb

It uses in its CSS this: 它在CSS中使用以下代码:

@font-face {
  font-family: 'FontAwesome';
  src: url('../../../fonts/fontawesome/fontawesome-webfont.eot?v=4.0.3');
  src: url('../../../fonts/fontawesome/fontawesome-webfont.eot?#iefix&v=4.0.3') format('embedded-opentype'), url('../../../fonts/fontawesome/fontawesome-webfont.woff?v=4.0.3') format('woff'), url('../../../fonts/fontawesome/fontawesome-webfont.ttf?v=4.0.3') format('truetype'), url('../../../fonts/fontawesome/fontawesome-webfont.svg?v=4.0.3#fontawesomeregular') format('svg');
  font-weight: normal;
  font-style: normal;
}

And the browser will pickup on whatever format it understands and download that one. 浏览器将选择其能理解的任何格式并下载该格式。 It will not download all of them. 它将不会全部下载。 It will only download the first file it understands 它将仅下载其了解的第一个文件

While file size is not a concern in most Western font sets, it does become cumbersome with Asian font sets which include some 7000 glyphs. 尽管大多数西方字体集都不关心文件大小,但是对于包含大约7000个字形的亚洲字体集,它的确变得麻烦。 Google Noto Sans CJK for example, is a nice looking web font, but weighs in between 1MB and 2MB for each font-weight. 例如,Google Noto Sans CJK是一种漂亮的网络字体,但是每种字体的权重在1MB到2MB之间。 Wondering how this is best approached. 想知道如何最好地解决这个问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM