【发布时间】:2012-11-03 06:59:40
【问题描述】:
我一直在做 asp.net 网站开发,但从未实现过完整的 asp.net 网站并托管它。我一直在开发一个 asp.net 网站并将其托管在 windows 服务器上。
我有几个在网站中使用的自定义网络字体(付费字体)。我已经在我的项目文件夹中包含了网络字体和样式的文件,并在我的样式表中正确引用了它们。
我使用@font-face 来引用样式表中的字体:
@font-face {
font-family: 'fontname';
src: url('/fonts/webfonts/font.eot');
src: url('/fonts/webfonts/font.eot?#iefix') format('embedded-opentype'),
url('/fonts/webfonts/font.woff') format('woff'),
url('/fonts/webfonts/font.ttf') format('truetype');
font-weight: normal;
font-style: normal;
}
但是,网页字体没有加载到网站中。
经过一番研究,我发现我们需要在 web.config 类型中添加 mime 类型,以便 windows 服务器识别该字体格式。然后,我还在 web.config 文件中引用了 mime 类型如下:
<system.webServer>
<staticContent>
<mimeMap fileExtension=".woff" mimeType="application/x-font-woff" />
</staticContent>
</system.webServer>
但是,它也不起作用。谁能告诉我,我们如何加载这些字体。
【问题讨论】: