2014-11-02 101 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