2011-06-30 43 views
16

我只在Firefox中遇到webfonts问题,所有其他浏览器(包括IE)都能正常工作。Firefox webfonts无法加载

我的问题是webfonts根本不会加载。

我已经看过这个可能的解决方案,编辑htaccess文件(http://www.fontsquirrel.com/blog/2010/11/troubleshooting-font-face-problems),但我没有运气。

,我唯一能说的另一件事是在Firefox的错误控制台,我得到以下警告:

Error in parsing value for "src". Skipped to the next declaration.

这里是我的font-face代码示例:

@font-face { 
    font-family:AngelinaRegular; 
    src:url(../fonts/angelina-webfont.eot); 
    src:url(../fonts/angelina-webfont.eot?iefix) format(eot), url(../fonts/angelina-webfont.woff) format(woff), url(../fonts/angelina-webfont.ttf) format(truetype), url(../fonts/angelina-webfont.svg#webfontOvuhCGpN) format(svg); 
    font-weight:normal; 
    font-style:normal; 
} 

任何想法?

回答

28

根据我的经验,Firefox是挑剔的@font-face规则预计报价:

@font-face { 
    font-family: AngelinaRegular; 
    src: url('../fonts/angelina-webfont.eot'); 
    src: url('../fonts/angelina-webfont.eot?#iefix') format('embedded-opentype'), 
     url('../fonts/angelina-webfont.woff') format('woff'), 
     url('../fonts/angelina-webfont.ttf') format('truetype'), 
     url('../fonts/angelina-webfont.svg#webfontOvuhCGpN') format('svg'); 
    font-weight: normal; 
    font-style: normal; 
} 
+1

这正是它是什么,感谢您的帮助。 – user127181

+2

**不要忘记在'format()'中添加引号!** :) – m93a

0

我在最后几天遇到同样的问题。 发现了很多技巧和解决方案,但他们都没有为我工作。 然后我使用的的buildin webdeveloper控制台(STRG +移+ K),而不是萤火虫和瞧,我看到错误:

[14:18:36.161] GET http://www.example.com/font/fontawesome-webfont.ttf?v=3.2.0 [HTTP/1.1 401 Authorization Required 21ms] 

是,一个401错误,因为页面位于后方的htaccess的登录! 当我禁用htaccess授权时,一切正常!

这当然只是一个解决方法,没有解决方案,但是,在你得到像我一样的危险之前,注意你的站点是否在htaccess登录后面。能为您节省大量的时间;)

你可以运行到另一个问题:HTTP & HTTPS 如果使用这两种协议在您的网站,嵌入这样的字体:

src: url('//www.example.com/fonts/webfont.eot'); 

代替这个:

src: url('http://www.example.com/fonts/webfont.eot'); 

希望能帮助别人。我失去了很多时间,因为这& $!§%&#*

1

哈,我坐了很长时间试图解决这个问题 - 对我来说,修复是分别调用每个src - 即,而不是(fontsquirrel生成的代码):

@font-face { 
    font-family: 'comic_bookregular'; 
    src: url('comic_book-webfont.eot'); 
    src: url('comic_book-webfont.eot?#iefix') format('embedded-opentype'), 
     url('comic_book-webfont.svg#comic_bookregular') format('svg'); 
     url('comic_book-webfont.woff') format('woff'), 
     url('comic_book-webfont.ttf') format('truetype'), 

font-weight: normal; 
font-style: normal; 

} 

我这样做:

@font-face { 
    font-family: 'comic_bookregular'; 
    src: url('../fonts/comic_book-webfont.eot'); 
    src: url('../fonts/comic_book-webfont.eot?#iefix') format('embedded-opentype'); 
    src: url('../fonts/comic_book-webfont.svg#comic_bookregular') format('svg'); 
    src: url('../fonts/comic_book-webfont.woff') format('woff'); 
    src: url('../fonts/comic_book-webfont.ttf') format('truetype'); 

    font-weight: normal; 
    font-style: normal; 

    } 

如果你看,fontsquirrel代码实际上有一个 ';'哪里应该有','但只是修复,没有帮助。出于某种原因,用分号关闭所有src的时候完成了这项工作,当没有其他的时候。

+0

对我不起作用:-( –

0

经过淘洗stackoverflow尝试每一个建议,并没有他们的工作,我发现我的代码后修复,使其工作出了什么问题。我在字体声明之间省略了逗号。

font-family: "GiveMeTime" sans-serif; 

,而不是

font-family: "GiveMeTime", sans-serif; 

,并因为它在其他浏览器工作,我没有注意到这个错误。任何其他人有这个问题,检查它不是一个简单的字体堆栈错误!

1

我也经历过多次的一些问题是关于:config设置gfx.downloadable_fonts.enabled,当设置为false时,客户端不会下载任何字体,使得webMail与webfont图标相当糟糕,正如我在雅虎和办公室看到的365 webmails ...

0

我刚才有同样的问题。问题是字体名称略有不同。 @ font-face中的font-family属性和我在该类中使用的字体有不同的版式。 显然,计算机网络浏览器比平板电脑更宽容。