今天我更新了字体Awesome包到4.3.0,注意到增加了woff2字体。该文件在CSS中链接,所以我需要配置nginx来正确地服务woff2文件。

目前我有这个块在nginx配置字体:

location ~* \.(otf|eot|woff|ttf)$ {
    types     {font/opentype otf;}
    types     {application/vnd.ms-fontobject eot;}
    types     {font/truetype ttf;}
    types     {application/font-woff woff;}
}

woff2字体的正确mime类型是什么?

我在我公司的网站上使用@font-face,它工作/看起来很棒。除了Firefox和Chrome会在。woff文件上抛出404错误。IE不会抛出错误。我有字体位于根,但我已经尝试了css文件夹中的字体,甚至给出字体的整个url。如果从我的css文件中删除这些字体,我不会得到404,所以我知道这不是语法错误。

另外,我使用fontsquirrel工具创建@font-face字体和代码:

@font-face {
  font-family: 'LaurenCBrownRegular';
  src: url('/laurencb-webfont.eot');
  src: local('☺'), 
    url('/laurencb-webfont.woff') format('woff'), 
    url('/laurencb-webfont.ttf') format('truetype'), 
    url('/laurencb-webfont.svg#webfontaaFhOfws') format('svg');
  font-weight: normal;
  font-style: normal;
}

@font-face {
  font-family: 'FontinSansRegular';
  src: url('/fontin_sans_r_45b-webfont.eot');
  src: local('☺'), 
    url('/fontin_sans_r_45b-webfont.woff') format('woff'), 
    url('/fontin_sans_r_45b-webfont.ttf') format('truetype'), 
    url('/fontin_sans_r_45b-webfont.svg#webfontKJHTwWCi') format('svg');
  font-weight: normal;
  font-style: normal;
}

WOFF字体应该作为什么mime类型?

我正在服务truetype (ttf)字体作为字体/truetype和opentype (otf)作为字体/opentype,但我找不到WOFF字体的正确格式。

我已经尝试了字体/woff,字体/webopen,和字体/webopentype,但Chrome仍然抱怨:

资源解释为字体,但使用MIME类型应用程序/字节流传输。

有人知道吗?