字体文件的正确MIME类型是什么? [英] What is the correct MIME type for a font file?

查看:682
本文介绍了字体文件的正确MIME类型是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法找到指定任何和/或每种文件格式的正确MIME类型的规范源。我所发现的所有资料似乎与彼此和/或 IANA MIME键入RFC和相关列表


$ b $

虽然我对 .otf (OpenType)和特别感兴趣。 ttf (TrueType)文件类型,一个理想的答案将提供一个规范的资源来确定广泛的字体文件格式的MIME类型,如维基百科页面的字体文件部分:文件格式列表 。然而,鉴于我找不到这样的资源,似乎完全有可能没有这样的规范的参考。



我想进一步澄清,我没有看对于工作的MIME类型,而对于规范的MIME类型适用于字体的正确MIME类型的选定答案指出字体/ opentype 可用于 .otf 文件。然而,由于最高的答案(由@djsadinoff)解释, font 不是有效的IANA内容类型,这不能是正确的MIME类型。

解决方案

对于您的问题,您可能不知道字体类型的事实。使用此链接字体MIME类型

roc 有关Web字体的报道,其中短版本是非IE浏览器是否应该支持字体的DRM格式。 (也许他们是否可以支持TrueType和OpenType)。我真的不认为我们应该支持字体的DRM格式。看起来它会在网络上创下一个不好的先例,如果供应商不强制执行正确的事情,可能会使供应商承担责任,并且使作者的事情复杂化。 W3C已经创建了草案一个EOT工作组; EOT(Embedded OpenType)是微软所倡导的DRM格式。我不知道EOT是如何引导Web充分发挥潜力的,但是我们将会看到它是什么。



除了格式问题,它可能是值得考虑的为字体引入一个MIME类型。 (如果现在实现的时间太晚,可能就太迟了。)好处在于,任意文件(比如text / html文件)不会被解释为字体。不利的一面是,它使作者稍微难一些,因为他们必须确保他们正确地标记。 (在Web上的图像(除了SVG)和JavaScript不检查资源是否具有正确的MIME类型,对于图像浏览器嗅探图像签名和从脚本元素加载的东西是简单的执行(确实不太好) 。)



鉴于支持@ font-face将在Opera,Safari和Firefox中快速发布,因此需要尽快决定。可能在相关的MIME类型通过IETF标准化之前。另一个复杂因素是OpenType和TrueType可以携带otf和ttf作为扩展,操作系统可以很好地处理它。有一个单一的MIME类型可能可以工作,就像XHTML和SVG都可以使用text / xml。


I have not been able to find a canonical source that indicates the correct MIME type for any and/or each type of file format. All the sources that I have found appear to contradict each other and/or the IANA MIME type RFCs and their associated list.

While I am particularly interested in .otf (OpenType) and .ttf (TrueType) file types, an ideal answer would provide a canonical resource for determining the MIME types for a broad spectrum of font file formats, such as those listed on the Font file section of the Wikipedia page: List of file formats. However, given that I can't find such a resource, it seems entirely possible that no such canonical reference exists.

I would like to further clarify that I am not looking for the working MIME type, but for the canonical MIME type. The selected answer to Proper MIME type for fonts states that font/opentype can be used for .otf file. However, as the highest voted answer (by @djsadinoff) explains, font is not a valid IANA content type and this cannot be the correct MIME type.

解决方案

For your question you may not know the fact about the font type. Use this link Font MIME Types.

roc reports on the Web Fonts battle of which the short version is whether the non-IE browsers should support a DRM format for fonts. (And maybe also whether they can support TrueType and OpenType out of the box.) I don’t really think we should support a DRM format for fonts. It seems like it would set a bad precedent on the Web, might make vendors liable if they don’t enforce things right, and complicates matters for authors.

The W3C has created a draft charter for an EOT Working Group; EOT (Embedded OpenType) being the DRM format Microsoft is advocating. I have no idea how EOT is leading the Web to its full potential, but we’ll see what comes of it.

Aside from the format issue it might be worth considering to introduce a MIME type for fonts. (If this is too late for implementations at this point it might be too late.) The upside is that arbitrary files (say, a text/html file) will not be interpreted as fonts. The downside is that it makes things slightly harder for authors as they have to make sure they label it correctly. (On the Web images (except SVG) and JavaScript are not checked as to whether the resource has the correct MIME type. For images the browser sniffs the image signature and something loaded from a script element is simply executed (not so good, indeed).)

Given that support @font-face will be shipping soonish in Opera, Safari, and Firefox this would need to be decided soon. Probably before the relevant MIME type is standardized through the IETF. Another complication is that OpenType and TrueType can carry either otf and ttf as extension and the operating system deals with it fine. Having a single MIME type for both could probably work though, just like XHTML and SVG can both use text/xml.

这篇关于字体文件的正确MIME类型是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆