字体在IIS 8.0中不工作 [英] Font Face isn't working in IIS 8.0

查看:283
本文介绍了字体在IIS 8.0中不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个font-face在我的程序生成从字体松鼠我只是不能得到它的工作在IIS中,它的工作原理localhost。我向我的MIME添加了应用程序/ font-woff 文章类型,但它仍然不想工作。

 上下文
- 字体
----字体位置
--css文件

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 '),
url('Fonts / subway-webfont.woff')format('woff'),
url('Fonts / subway-webfont.ttf')format('truetype');
font-weight:normal;
font-style:normal;
}

EDIT CURRENT MIME
$ b

我使用默认的IIS 8 MIME font / x-woff

解决方案

很高兴看到WOFF2被包括在Font Squirrel字体!虽然IIS 8不需要为 WOFF 添加mime类型,但它需要一个 WOFF2 。 W3C 建议

  application / font-woff2 

有关 WOFF2 请参阅这里



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

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


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

解决方案

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" />

这篇关于字体在IIS 8.0中不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆