本文介绍了正确的Apache将AddType指令的字体MIME类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的@ font-脸嵌入字体(感谢)。在试图修复Chrome浏览器的约错误的MIME类型WOFF字体的警告,我发现了相互矛盾的建议质量。

每个人似乎都同意.eot字体(IE浏览器6-8?)应该使用提供

 将AddType应用程序/ vnd.ms-fontobject .eot

有关的.ttf字体(旧的非IE浏览器?)我看过

 将AddType应用程序/ x-字体TTF的.ttf
将AddType应用程序/八位字节流的.ttf
将AddType字体/ TrueType字体的.ttf
将AddType字体/ TTF .TTF

和为.woff字体(新标准?)我看过

 将AddType应用/ FONT-WOF .woff
将AddType应用程序/ x-字体WOFF .woff
将AddType应用程序/ x-WOFF .woff

我理解为将应用程序/字体WOFF,但直到标准是官方,的理解。

我意识到我的一半回答我的问题在提出,但真正的问题是:有没有什么应该被用于字体MIME类型权威性的指导或进一步的意见

更新(如果它是其他任何人的任何帮助):因为似乎没有什么权威的,我已经在我的.htaccess使用下面的字体MIME类型(其中至少会保持Chrome高兴)解决:

 将AddType应用程序/ vnd.ms-fontobject .eot
将AddType应用程序/ x-字体TTF的.ttf
将AddType应用程序/ x-字体WOFF .woff


解决方案

一般情况下,MIME类型来自RFC。
您可以在一个详尽的清单,但没有指字体扩展。
此外,文件草案,并执行不是指MIME类型来使用。
关于这个问题没有可靠的参考依据似乎是现在存在。

更新

W3C已经发布,现在作为WOFF的建议,并在你现在提及。的 -GKFX

I’m using @font-face for embedded fonts (thanks Paul Irish). In trying to fix Chrome’s warning about wrong MIME type for woff fonts, I’ve discovered a mass of conflicting suggestions.

Everyone seems to agree that .eot fonts (for IE 6-8?) should be served using

AddType application/vnd.ms-fontobject .eot

For .ttf fonts (older non-IE browsers?) I’ve seen

AddType application/x-font-ttf        .ttf
AddType application/octet-stream      .ttf
AddType font/truetype                 .ttf
AddType font/ttf                      .ttf

And for .woff fonts (the new standard?) I’ve seen

AddType application/font-wof          .woff
AddType application/x-font-woff       .woff
AddType application/x-woff            .woff

I understand the correct MIME type for woff will be application/font-woff, but until the standard is official, application/x-font-woff is understood by Chrome.

I realise I’ve half answered my question in asking it, but the question is really: is there any authoritative guidance or further advice about what MIME types should be used for fonts?

Update (in case it’s of any help to anyone else): since there seems to be nothing authoritative, I’ve settled on using the following font MIME types in my .htaccess (which at least keeps Chrome happy):

AddType application/vnd.ms-fontobject .eot
AddType application/x-font-ttf        .ttf
AddType application/x-font-woff       .woff
解决方案

Usually, MIME types come from RFC.You have a exhaustive list on the IANA site but none refers to the font extensions.Moreover, document describing WOFF format is draft and does not refer to the mime type to use.No reliable reference on the subject seems to exist for now.

Update

The W3C has now released WOFF as a recommendation, and in Appendix B defined the MIME type as application/font-woff. It's also been added to the IANA site that you mentioned now. -GKFX

这篇关于正确的Apache将AddType指令的字体MIME类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-18 02:40
查看更多