简体   繁体   English

CSS - 什么是字体松鼠网络字体生成器用于

[英]CSS - What is font squirrel webfont generator used for

I thought that the font squirrel webfont generator was used to make a font compatible for all the browsers.我认为font squirrel网络font squirrel生成器用于使字体兼容所有浏览器。 But I tried the classic但我试过经典

@font-face {
  font-family: myFirstFont;
  src: url(sansation_light.woff);
}

and it works for all the latest versions of the browsers Google Chrome , Mozilla Firefox , Opera , Microsoft Edge and even Internet Explorer ... Is it used for older versions of the above?它适用于所有最新版本的浏览器Google ChromeMozilla FirefoxOperaMicrosoft Edge甚至Internet Explorer ......它是否用于上述旧版本? Thanks谢谢

The reason webfont generators continue to generate old fonts is because they follow the principle of "If it's not broken, why remove it?". webfont 生成器之所以继续生成旧字体,是因为它们遵循“如果它没有坏,为什么要删除它?”的原则。

For example, EOT is is a font format that still occasionally shows up in font generators, despite being completely unnecessary in modern day.例如,EOT 是一种字体格式,尽管在现代完全没有必要,但它仍然偶尔出现在字体生成器中。 It supports Internet Explorer 6+.... and if you REALLY need to support a browser that's 20 years old, Font Squirrel can help with that.它支持 Internet Explorer 6+.... 如果您真的需要支持 20 岁的浏览器,Font Squirrel 可以提供帮助。

...But in the modern day, you only need WOFF and WOFF2. ...但在现代,您只需要 WOFF 和 WOFF2。 The other font flavors are obsolete and unnecessary because all modern browsers can use .woff , and most can use .woff2 .其他字体风格已过时且不必要,因为所有现代浏览器都可以使用 .woff ,并且大多数可以使用 .woff2 。

You can see compatibility here:您可以在此处查看兼容性:

WOFF: https://caniuse.com/woff WOFF: https : //caniuse.com/woff

WOFF2: https://caniuse.com/woff2 WOFF2: https ://caniuse.com/woff2

EOT: https://caniuse.com/eot EOT: https : //caniuse.com/eot

TTF/OTF: https://caniuse.com/ttf TTF/OTF: https : //caniuse.com/ttf

As you said, the solution provided by Font Squirrel works great for all modern browsers.正如您所说,Font Squirrel 提供的解决方案适用于所有现代浏览器。

However, if you need to target older versions I would recommend https://onlinefontconverter.com that generate a more complete @font-face css, also more font extensions are provided.但是,如果您需要针对旧版本,我建议https://onlinefontconverter.com生成更完整的 @font-face css,还提供更多字体扩展。

I use the following css when I need @font-face:当我需要@font-face 时,我使用以下 css:

@font-face{
  font-family:"Rage Italic";
  src:url("../fonts/RageItalic.eot");
  src:local("RageItalic"), local("RageItalic"), url("../fonts/RageItalic.woff") format("woff"), url("../fonts/RageItalic.ttf") format("truetype"), url("../fonts/RageItalic.svg#RageItalic") format("svg"); 
  font-weight: normal;
  font-style: normal;
}

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

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