【问题标题】:Firefox not support font-faceFirefox 不支持字体
【发布时间】:2023-04-03 09:34:01
【问题描述】:

Web 字体在 Firefox 中未正确呈现。它适用于 Chrome 浏览器。

下面是我的 CSS 代码,

@font-face {
    font-family: 'DINm';
    src: url('http://www.themediaverse.com.au/wp-content/themes/themediaverse/assets/fonts/DINWeb-Medium.eot');
    src: url('http://www.themediaverse.com.au/wp-content/themes/themediaverse/assets/fonts/DINWeb-Medium.eot?#iefix') format('embedded-opentype');
    src: url('http://www.themediaverse.com.au/wp-content/themes/themediaverse/assets/fonts/DINWeb-Medium.woff') format('woff');
    src: url('http://www.themediaverse.com.au/wp-content/themes/themediaverse/assets/fonts/DINComp-Medium.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;

  }

我在下面提到了网址, CSS Font-Face url not working?

我该如何解决这个问题?

谢谢。

【问题讨论】:

    标签: css firefox font-face


    【解决方案1】:

    这些链接指向不允许跨站点链接的字体文件。 Chrome 不遵循规范的那部分,但 Firefox 遵循。

    请参阅“已发布站点”部分https://stackoverflow.com/a/3704578/720912,了解如何配置服务器以允许链接到字体。

    【讨论】:

    • 谢谢@Boris。我发现来自 firebug 的“不允许的错误 URI 或跨站点访问”警告消息。我已将 security.fileuri.strict_origin_policy 属性中的值更改为 false(来自上面的链接)。但它不起作用。
    • 该首选项仅影响 file:// URI。同样,您需要“已发布网站”位。
    【解决方案2】:

    修改代码

    format ('truetype');

    format ('opentype');

    这应该适合你。

    这已在底部附近另一页引用的文章中列出,它对我有用。这个小提琴显示了工作示例:http://jsfiddle.net/Phlume/CMv8G/1/

    你应该看到这个:

    文章还提到,对于 otf 或 ttf 字体,您可以完全关闭 format 部分——它是可选的,因为格式是开放类型。

    【讨论】:

    • 上述解决方案对我不起作用。它将默认采用“信使”字体。我也检查过 chrome 浏览器...
    • 请在您的萤火虫中检查“测试 1...2...3..”的结果。这是“Courier”字体。
    • 是的..应该是..注意通用重置标签*{font-family:courier;}这会将所有内容设置为未在其他地方定义的快递。检查您在该站点上的字体文件是否有 ttf... 它设置为 DINComp-Medium 而其余所有设置为 DINWeb-Medium 可能字体设置不正确... 或无法使用在网络上?
    猜你喜欢
    • 2012-09-29
    • 2014-12-23
    • 2012-12-24
    • 2013-12-02
    • 1970-01-01
    • 2017-07-09
    • 1970-01-01
    • 2011-12-25
    • 2018-10-03
    相关资源
    最近更新 更多