【发布时间】:2017-11-21 04:52:33
【问题描述】:
我下载了一种名为“Clunk”的 TTF 字体,并尝试将其应用于某些文本。
这是我正在使用的代码:
<html>
<head>
<style>
@font-face {
font-family: clunk;
src: url('clunk.ttf');
}
h1 {
font-family: clunk;
}
</style>
</head>
<body>
<h1 id="logo">Test</h1>
</body>
</html>
这似乎不起作用,Chrome 给了我两个错误:
Failed to decode downloaded font: (path to the file)
OTS parsing error: incorrect entrySelector for table directory
在 Firefox 中,出现以下错误:
downloadable font: bad search range (font-family: "clunk" style:normal weight:normal stretch:normal src index:0) source: (path to the file) test.html:4:12
downloadable font: incorrect entrySelector for table directory (font-family: "clunk" style:normal weight:normal stretch:normal src index:0) source: (path to the file) test.html:4:12
downloadable font: rejected by sanitizer (font-family: "clunk" style:normal weight:normal stretch:normal src index:0) source: (path to the file)
我在 Google 上搜索了这些错误,但这个问题似乎非常广泛,而且很难找到最少的示例。在这种简单情况下会导致错误的原因是什么?
【问题讨论】:
-
你在用git吗?
标签: css fonts font-face webfonts