@ font-face不能使用chrome [英] @font-face not working on chrome

查看:886
本文介绍了@ font-face不能使用chrome的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是最新版本的Google Chrome,它不会呈现字体。

I'm using the latest version of google chrome and it won't render font face at all.

我正在运行Debian Linux,所有其他浏览器(包括Chromium)都会正确显示包含的字体。

I'm running Debian Linux, and all other browsers , including Chromium , show included fonts properly.

字体声明我使用的是:

@font-face {
    font-family: Dejaweb;
    src: url('DejaWeb.ttf');
}

@font-face {
    font-weight: bold;
    font-family: Dejaweb;
    src: url('DejaWeb-Bold.ttf');
}


推荐答案

不适用于我所认为的兼容浏览器,我把它放在我的.htaccess文件。据推测,一些浏览器不会加载托管在其他域上的字体,而这一点的代码进行故障排除,但有时它是强制加载字体以及托管在同一个域上唯一的补救办法。一般来说,它是Firefox的问题,而不是Chrome,但我刚刚使用它来强制在Chrome中的字体,而Firefox是正常工作。 Go图。

Whenever @font-face inexplicably doesn't work for me in the supposedly compliant browsers, I drop this in my .htaccess file. Supposedly some browsers won't load fonts hosted on other domains, and this bit of code troubleshoots that, but sometimes it is the only remedy to force fonts to load that are hosted on same domain as well. Generally its more of an issue with Firefox than with Chrome, but I just now used this to force fonts in Chrome while Firefox was working fine. Go figure.

<FilesMatch "\.(ttf|otf|eot)$">
<IfModule mod_headers.c>
Header set Access-Control-Allow-Origin "*"
</IfModule>
</FilesMatch>

另一个奇怪的事情,我发生了@ font-face语法是,在名称中正确加载字体文件。这只是一个问题一次,经过反复打击我的头对办公桌故障排除@ font-face一束不同的方式,作为最后的手段我改变了所有的字体文件和字体家族名称为小写字符,它工作正常我认为这是一个问题在永不过时的IE,只有一个网站,正在做,完全相同的语法在另一个网站工作正常与大小写字符)。

Another inexplicably weird thing I have had happen with the @font-face syntax was that it wouldn't load font files properly with caps in the name. This only was an issue once, and after repeatedly banging my head against the desk troubleshooting @font-face a bunch of different ways, as a last resort I changed all font files and font-family name to lowercase characters, and it worked fine (I think that was an issue in ever-finicky IE, and only one website I was doing, exact same syntax on another website worked fine with upper and lowercase characters).

这篇关于@ font-face不能使用chrome的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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