【问题标题】:@fontface not finding font@fontface 找不到字体
【发布时间】:2013-07-14 14:47:08
【问题描述】:

我正在尝试使用 Entyo 字体,但无法正常工作。我将整个网站更改为字体,并且在加载页面时可以注意到明显的暂停,搜索但可能找不到字体?

我的 CSS:

@font-face {
font-family: 'EntypoRegular';
src: url('fonts/entypo-webfont.eot');
src: url('fonts/entypo-webfont.eot?#iefix') format('embedded-opentype'),
url('fonts/entypo-webfont.woff') format('woff'),
url('fonts/entypo-webfont.ttf') format('truetype'),
url('fonts/entypo-webfont.svg#EntypoRegular') format('svg');
font-weight: normal;
font-style: normal;

字体文件夹在根目录中。

谢谢

编辑:

文件夹结构:

Main
-> fonts
-> -> entypo.eot
-> -> entypo.svg
-> -> entypo.ttf
-> -> entypowoff
-> CSS
-> -> stylesheet with @fontface call
-> includes
-> Etc etc

将 url 更新为 //fonts/entypo.eot 等等。字体正在加载并在 Web 开发检查器中可见,但仍不显示在屏幕上。仅在 safari 和 chrome 中测试,两者结果相同

编辑:CSS 细节。

@charset "UTF-8";

@font-face {
    font-family: 'EntypoRegular';
    src: url('//fonts/entypo-webfont.eot');
    src: url('//fonts/entypo-webfont.eot?#iefix') format('embedded-opentype'),
    url('//fonts/entypo-webfont.woff') format('woff'),
    url('//fonts/entypo-webfont.ttf') format('truetype'),
    url('//fonts/entypo-webfont.svg#EntypoRegular') format('svg');
    font-weight: normal;
    font-style: normal;
}
html { -webkit-font-smoothing: antialiased; } /*global improvement on all fonts*/

body {
    font-family: "EntypoRegular", "Helvetica Neue Light", "Helvetica Neue",  Helvetica, Arial, "Lucida Grande", sans-serif;
    font-weight: 300;
    font-size-adjust:inherit;

}

我删除了所有不必要的内容

【问题讨论】:

  • 外部样式表还是页面本身中的上述css?如果在页面中,该页面相对于根在哪里?
  • 查看浏览器元素检查器的“net”选项卡,看看是不是字体请求需要这么长时间
  • @PeteScott 外部样式表,但所有其他样式都在应用并且可以正常工作。
  • 好的。请记住,字体文件的路径将与此样式表相关。如果此样式表位于站点的根目录中,则您的路径很好。否则他们不是。如果您可以向我们提供您的目录结构的概述,我们可以更具体一些(并且更确定这是否也是问题所在)
  • @PeteScott -.- 业余爱好者。更改了字体的路径。不再收到 404 错误,我可以在网络检查器中看到字体。但实际上仍然没有显示。

标签: css fonts font-face


【解决方案1】:

好的,总结一下: 第一个问题是由于相对路径略有偏离,所有这些都已排序。现在您的路径是正确的,并且您已经验证了字体正在加载但并未实际使用(出于好奇,您是如何验证的?)。

可能的问题:错误的 css(您发布的内容看起来不错)、浏览器兼容性(您使用的是什么浏览器/版本?)、损坏的字体文件(尝试重新下载)。

如果您在使用的任何浏览器中启动控制台/dom 检查器工具并检查正在应用的 css,您能否判断字体系列是否被其他规则覆盖?

【讨论】:

  • 抱歉,您已经告诉我您如何验证字体正在加载以及您使用的浏览器。
  • 我可能有动态链接,并且在处理登录时显示的链接时,我可能已注销...毕竟,感谢您的所有帮助不过,它毕竟不像我想要的那样:)
  • 墨菲定律。感谢您添加所有额外的细节。祝你好运!
  • 是的:) 虽然...现在我已经清理了代码等,但它看起来仍然无法正确显示字体。例如,“”由箭头表示。我仍然看到一个'',你知道吗?
  • 哦... ENTYPO。我读了八次,没有任何点击。他们的样式表是否已经为您设置了所有字符映射?
【解决方案2】:

您网站的元素是否实际使用该字体?

body {
  font-family: 'EntypoRegular', your-other-fallback-fonts;
}

【讨论】:

  • 不,你写的确实是我必须测试的。它每次都选择我的后备。 font-family: "EntypoRegular", "Helvetica Neue Light", "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2015-04-18
  • 2013-10-11
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2019-08-19
  • 2017-01-19
相关资源
最近更新 更多