0

所以,我已经尽一切努力让@font-face 在 Mozilla Firefox 3.6 中工作。问题是我很确定这是因为我想在我的 Tumblr 博客上使用@font-face,所以我在 Tumblr 上传器上上传了字体。

@font-face {
font-family: feel_scriptregular;
src: url(http://static.tumblr.com/3fk4soa/zKcm8o1y2/feel_script.otf);
src: url(http://static.tumblr.com/3fk4soa/IyZm8o1sa/feel_script-webfont.eot?#iefix) format(embedded-opentype),
     url(http://static.tumblr.com/3fk4soa/wgFm8o1tk/feel_script-webfont.woff) format(woff),
     url(http://static.tumblr.com/3fk4soa/wlLm8o1us/feel_script-webfont.ttf) format(truetype),
     url(http://static.tumblr.com/3fk4soa/tofm8o1vl/feel_script-webfont.svg#feel_scriptregular) format(svg);
}

它不适用于双引号 (")、单引号 (') 或没有任何引号,我不知道该怎么办了.. :/

4

2 回答 2

5

那是跨域字体问题:它们必须在同一个域上,或者必须有 HTTP-header “Access-Control-Allow-Origin”

nginx 的解决方案 - https://gist.github.com/1131897 & https://serverfault.com/questions/186965/how-can-i-make-nginx-support-font-face-formats-and-allow-访问控制允许-o

因此,只需在您自己的主机上上传您的字体并将您的 apache/nginx 修复为 servre 正确的标题。

于 2012-08-13T00:15:12.250 回答
2

这是一个跨域的东西,你不能从你自己的子域访问 static.tumblr.com。我之前通过在css中嵌入字体解决了这个问题。如果您转到此生成器并选择专家选项,您可以勾选“Base64 编码”框,它将在 tumblr 上工作,因为 .woff 和 .tft 数据是 css 的一部分。

于 2012-08-13T15:38:15.193 回答