1
  • 我有一个 iframe,我通过样式表应用的自定义字体都没有加载(字体在样式表中正确应用,它只是不起作用)。
  • 我正在尝试在实际 iframe 中添加样式,而不是从父页面
  • 在样式表中正确定义了字体(并且我正在应用各种不同的字体类型,例如 .eot .otf .woff 和 .svg)。
  • 我还在 web.config 中正确配置了字体的 mime 类型,并且字体位于服务器上的正确位置(我正在托管实际字体)。
  • 浏览器的“控制台”中没有错误
  • 在 Firefox 的“网络”选项卡中,没有任何文件加载失败
  • 字体不会在任何浏览器上加载

任何想法发生了什么或我应该检查的其他任何东西?

这是样式表中的字体声明:

@font-face {
    font-family: 'TradeGothicLTBdCondTwenty';
    src: url('../fonts/lte50543.eot');
    src: url('../fonts/lte50543.eot') format('embedded-opentype'),
         url('../fonts/lte50543.woff') format('woff'),
         url('../fonts/lte50543.ttf') format('truetype'),
         url('../fonts/lte50543.svg#TradeGothicLTBdCondTwenty') format('svg');       
}

这是允许文件类型的 web.config 的 staticContent 部分:

<staticContent>
    <!-- HTML5 Web font MIMEtypes -->
    <remove fileExtension=".eot" />
    <mimeMap fileExtension=".eot" mimeType="application/vnd.ms-fontobject" />
    <remove fileExtension=".otf" />
    <mimeMap fileExtension=".otf" mimeType="font/otf" />
    <remove fileExtension=".woff" />
    <mimeMap fileExtension=".woff" mimeType="application/font-woff" />
    <!-- Proper SVG Serving -->
    <remove fileExtension=".svg" />
    <mimeMap fileExtension=".svg" mimeType="image/svg+xml"/>
    <remove fileExtension=".svgz" />
    <mimeMap fileExtension=".svgz" mimeType="image/svg+xml"/>
</staticContent>
4

1 回答 1

1

修复了这个。我们正在使用 TFS(Team Foundation Server)构建系统来部署站点,并且字体的 TFS 构建操作未设置为“如果较新则复制”,因此当重新部署站点时,字体实际上已被删除从服务器(我以前不得不手动部署它们以在服务器上进行测试)。

于 2013-10-28T20:41:16.480 回答