Font Face在IIS 8.0中不起作用(Font Face isn't working in IIS 8.0)

编程入门 行业动态 更新时间:2024-10-26 12:35:31
Font Face在IIS 8.0中不起作用(Font Face isn't working in IIS 8.0)

我有一个字体在我的程序生成从Font Squirrel我只是无法让它在IIS中工作,它在本地主机工作。 我将应用程序/ font-woff 文章添加到我的MIME类型,但它仍然不想工作。

Context --Fonts ----font location --css files

CSS

@font-face { font-family: 'wallStreetFont'; src: url('Fonts/subway-webfont.eot'); src: url('Fonts/subway-webfont.eot?#iefix') format('embedded-opentype'), url('Fonts/subway-webfont.woff2') format('woff2'), url('Fonts/subway-webfont.woff') format('woff'), url('Fonts/subway-webfont.ttf') format('truetype'); font-weight: normal; font-style: normal; }

编辑当前MIME

我使用默认IIS 8 MIME 字体/ x-woff

I have a font-face in my program generated from Font Squirrel I just can't get it to work in IIS, it works in localhost. I added application/font-woff article to my MIME Types but it still doesn't want to work.

Context --Fonts ----font location --css files

CSS

@font-face { font-family: 'wallStreetFont'; src: url('Fonts/subway-webfont.eot'); src: url('Fonts/subway-webfont.eot?#iefix') format('embedded-opentype'), url('Fonts/subway-webfont.woff2') format('woff2'), url('Fonts/subway-webfont.woff') format('woff'), url('Fonts/subway-webfont.ttf') format('truetype'); font-weight: normal; font-style: normal; }

EDIT CURRENT MIME

I am using the default IIS 8 MIME font/x-woff

最满意答案

很高兴看到WOFF2被包含在字体松鼠字体中! 虽然IIS 8不需要为WOFF添加的MIME类型,但它将需要一个用于WOFF2 。 W3C 建议 :

application/font-woff2

有关WOFF2更多信息,请参阅此处 。

要在IIS中添加mime类型,请修改Web.Config ,如下所示:

<?xml version="1.0" encoding="UTF-8"?> <configuration> <!-- ... --> <system.webServer> <!-- ... --> <staticContent> <!-- ... --> <mimeMap fileExtension=".woff2" mimeType="application/font-woff2" />

Great to see WOFF2 being included in Font Squirrel fonts! Whilst IIS 8 does not need a mime type added for WOFF it will need one for WOFF2. The W3C recommends:

application/font-woff2

For more info on WOFF2 see here.

To add the mime type in IIS, modify your Web.Config as follows:

<?xml version="1.0" encoding="UTF-8"?> <configuration> <!-- ... --> <system.webServer> <!-- ... --> <staticContent> <!-- ... --> <mimeMap fileExtension=".woff2" mimeType="application/font-woff2" />

更多推荐

本文发布于:2023-07-26 00:10:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1268303.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:中不   Face   Font   IIS   working

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!