CSS @font-face 现在可用吗?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2219916/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Is @font-face usable now?
提问by eozzy
I have to use a fancy font in a project but I'd really like to avoid sifr and other ugly alternatives so I'm looking at @font-face.
我必须在项目中使用花哨的字体,但我真的很想避免 sifr 和其他丑陋的替代品,所以我正在查看 @font-face。
However, I'm really confused with several blog/sites offering different views on its usability. Is is ready yet? Which browsers support it today?
但是,我真的对几个博客/网站对其可用性提供不同的看法感到困惑。准备好了吗?目前哪些浏览器支持它?
Thanks
谢谢
回答by Jimmy Cuadra
Just about every browser implements it now. The only real catch is that Internet Explorer requires font files in its own OTF format and will not understand TTF format. Many sites that provide fonts for use with @font-face will provide you with both formats and the CSS necessary for them to display in both Internet Explorer and other browsers.
现在几乎每个浏览器都实现了它。唯一真正的问题是 Internet Explorer 需要其自己的 OTF 格式的字体文件,并且无法识别 TTF 格式。许多提供与@font-face 一起使用的字体的站点将为您提供这两种格式以及它们在 Internet Explorer 和其他浏览器中显示所需的 CSS。
Take a look at http://www.fontsquirrel.com/for a good example of a free library of fonts that come with pre-made @font-face downloads (both file formats and the relevant CSS.)
看看http://www.fontsquirrel.com/的一个很好的例子,它是一个免费的字体库,它带有预制的 @font-face 下载(文件格式和相关的 CSS)。
回答by arxpoetica
Paul Irish has outlined the current state of @font-face. Here's a slideshow and a small gathering in Boston reviewing it all:
Paul Irish 概述了@font-face 的现状。这是一个幻灯片和波士顿的一个小型聚会,回顾了这一切:
http://www.ustream.tv/recorded/4828154
http://www.ustream.tv/recorded/4828154
The quick answer is 95% of A+ browsers utilize it (FF 3.0 is the exception). Licensing can be tricky, but several tools are of aid, such as FontSquirrel, FontDeck, and FontSpring.
快速回答是 95% 的 A+ 浏览器都使用它(FF 3.0 是例外)。许可可能很棘手,但有几种工具可以提供帮助,例如 FontSquirrel、FontDeck 和 FontSpring。
Probably the hardest part of implementation is dealing with Firefox which has a FOUT ("flash of unstyled text") on load, though there are several workarounds, including:
实现中最难的部分可能是处理 Firefox,它在加载时具有 FOUT(“无样式文本的闪光”),尽管有几种解决方法,包括:
http://paulirish.com/2009/fighting-the-font-face-fout/
http://paulirish.com/2009/fighting-the-font-face-fout/
http://inspiringpixel.com/articles/web-design/fight-the-fout/240/
http://inspiringpixel.com/articles/web-design/fight-the-fout/240/
http://www.stevesouders.com/blog/2009/10/13/font-face-and-performance/
http://www.stevesouders.com/blog/2009/10/13/font-face-and-performance/