【问题标题】:Bought a @font-face, not working in Firefox and IE买了一个@font-face,在 Firefox 和 IE 中无法使用
【发布时间】:2015-01-22 17:37:01
【问题描述】:

我的客户购买了要使用的字体。这是为其生成的代码:

@import url("//hello.myfonts.net/count/27ec77");

@font-face {font-family: 'FranklinGothicURWCon-Boo';
    src: url('www.mybariatricsolutionsseminars.com/new/styles/webfonts/27EC77_0_0.eot');
    src: url('www.mybariatricsolutionsseminars.com/new/styles/webfonts/27EC77_0_0.eot?#iefix') format('embedded-opentype'),
    url('www.mybariatricsolutionsseminars.com/new/styles/webfonts/27EC77_0_0.woff') format('woff'),
    url('www.mybariatricsolutionsseminars.com/new/styles/webfonts/27EC77_0_0.ttf') format('truetype');}

@font-face {font-family: 'FranklinGothicURWCon-Dem';
    src: url('www.mybariatricsolutionsseminars.com/new/styles/webfonts/27EC77_1_0.eot');
        src: url('www.mybariatricsolutionsseminars.com/new/styles/webfonts/27EC77_1_0.eot?#iefix') format('embedded-opentype'),
        url('www.mybariatricsolutionsseminars.com/new/styles/webfonts/27EC77_1_0.woff') format('woff'),
        url('www.mybariatricsolutionsseminars.com/new/styles/webfonts/27EC77_1_0.ttf') format('truetype');}

这适用于 Chrome,但不适用于 Firefox 或 Internet Explorer。看这里: http://www.mybariatricsolutionsseminars.com/new/

我尝试过的一些解决方案:

  1. 将此代码添加到 .htaccess。 (这不起作用。)

    AddType font/ttf .ttf
    AddType font/eot .eot
    AddType font/otf .otf
    AddType font/woff .woff
    
    <FilesMatch "\.(ttf|otf|eot|woff)$">
        <IfModule mod_headers.c>
            Header set Access-Control-Allow-Origin "*"
        </IfModule>
    </FilesMatch>
    
  2. 在源 URL 上添加 http://。 (这也没有用。)

【问题讨论】:

  • 在 www 前添加 http://。此外,它在 Chrome 中不起作用,您可能在本地安装了字体。
  • 您好,我仔细检查了它,当我删除上面的@font-face 代码时,字体在 Chrome 上不起作用。我还在所有这些上添加了 http://,但仍然没有运气。

标签: css internet-explorer firefox fonts font-face


【解决方案1】:

您的 mimetype 设置不正确。

查看 Chrome 开发工具会显示很多:

Resource interpreted as Font but transferred with MIME type text/html

假设您正在使用带有 .htaccess 文件的 apache,请添加:

AddType application/vnd.ms-fontobject  eot
AddType application/x-font-ttf         ttf ttc
AddType font/opentype                  otf
AddType application/x-font-woff        woff

到 .htaccess 文件。

【讨论】:

  • 您好,我已添加此代码。仍然没有加载字体。好消息它现在可以在 IE9 和 IE10 上运行。谢谢,现在唯一的问题是它仍然无法在 Firefox 上加载。
  • 好的..由于某些未知原因,字体没有在 IE 中再次加载。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2012-12-18
  • 1970-01-01
  • 1970-01-01
  • 2013-03-22
  • 2015-03-13
  • 2023-03-20
  • 2012-08-26
相关资源
最近更新 更多