2014-11-02 99 views
6

我从ftp客户端*目录列出的ttf字体中列出了来自网络的ttf字体。我用在Mac OSX平台上的Firefox嵌入字体工作,我得到下面的Web控制台错误:为什么Firefox拒绝ttf字体

[17:59:49.201] downloadable font: rejected by sanitizer (font-family: "Cryv2" style:normal weight:normal stretch:normal src index:0) source: http://localhost/html5/css/fonts/new-fonts-ttf/CryUncial/Cryv2.ttf @ http://localhos/html5/css/embeddedFontDeclarations.css 

这是因为Windows TTF是不同的?或者文件损坏了?

如果是这样,是否有一种方法来筛选Web上的字体文件的可用性,或者将Windows ttf转换为更通用的文件?

为了IE浏览器的目的,我已经将ttf文件转换为eot文件,但我主要使用基于DOM的 浏览器以及Firefox在Mac OSX环境中使用本地预装的Apache服务器进行开发,创作和测试。

* ftp客户端是Fetch和文本编辑器是BBedit。 Firefox 12.0

+0

http://caniuse.com/#feat=ttf可以使用TTF,但它需要一个**完全无错误**之一,编码的Unicode,所以宋体是Firefox中的一个问题的例子。另外,用'w's加载它像'http:// www.xxx',以确保。 – 2014-11-02 01:20:32

回答

1

检查this out。

相关的文字:

You get this error if you run out of memory when loading the fontfile or if there is something wrong with the layout (contents) of the fontfile. This is a protection against bad or malicious font files. It is probably possible to disable the sanitizer by setting the pref gfx.downloadable_fonts.sanitize to false in about:config but then you are no longer protected. Use at your own risk. Do not blame Mozilla if you are infected with malware.

+0

自FF-32以来此选项不可用。沉着冷静:开发人员总是更好地了解他们的用户真正需要什么。 – 2015-02-12 15:47:16

4

http://caniuse.com/#feat=ttf

您可以使用TTF,但它需要一个完全无错误之一,而在采用Unicode编码,所以宋体是在Firefox中的问题的一个例子。

请参阅此以供参考:Wingdings font family does not seem to work on Firefox and Opera

此外,加载它像http://www.example.com/xxxw s到保证没有任何问题。当您在网站上测试时,有时候服务器会变得很奇怪。

下面是将ttf转换为一整套通用字体的方法:http://www.fontsquirrel.com/tools/webfont-generator。字体松鼠是一个不错的选择。 ;)

1

我从http://www.dafont.com/de/cry-uncial.font 下载的字体,用http://www.fontsquirrel.com/tools/webfont-generator

的唯一文件的工作是 “惊魂的uncial斜体 - crvy2i.ttf” 选中它。 其他两个字体文件已损坏。

我想你需要重建字体(用ttf编辑器)或者切换。


什么可能工作也是使用该ttf的转换字体。

您写道,您已将字体转换为“eot”。 尝试转换为“woff”和“svg”。

然后按照“eot,woff,svg”的顺序添加网址。 浏览器会使用第一个好的(https://stackoverflow.com/a/21155626/1163786)。 只需将腐败的ttf离开。

0

Firefox不支持.ttf字体,但会接受.woff字体。这种情况与仅接受.eot字体的Internet Explorer相同。尝试将.ttf转换为.woff或为您的字体找到.woff版本。

转换 - >http://everythingfonts.com/ttf-to-woff