我一直在做asp.net web开发一段时间,但从未实现过一个完整的asp.net网站并托管它。我一直在研究一个asp.net网站并将其托管在Windows服务器上。在asp.net网站中加载web字体
我有几个自定义Web字体(付费字体),我在网站中使用。我在我的项目文件夹中包含了Web字体和样式的文件,并在我的样式表中正确引用了它们。
我已经使用了@字体面在我的样式表参照的字体:
@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类型中为Windows Server添加MIME类型来识别字体格式。然后,我还引用在web.config文件的MIME类型如下:
<system.webServer>
<staticContent>
<mimeMap fileExtension=".woff" mimeType="application/x-font-woff" />
</staticContent>
</system.webServer>
但是,它也不能正常工作。任何人都可以让我知道,我们如何加载这些字体。