html - 无法解码下载的字体和 OTS 解析错误 : invalid version tag

标签 html css fonts roboto

我收到错误:

Failed to decode downloaded font and OTS parsing error: invalid version tag

我的代码在我的 CSS 文件中:

@import url("../fonts/roboto/roboto.css");

然后,在 roboto.css 文件中,我有以下代码。

/* Roboto Fontkit (LOCAL)
-----------------------------------------*/
/*(1) Roboto-Regular-webfont
.......................................*/
@font-face {
  font-family: "Roboto";
  src: url("Roboto-Regular-webfont.eot");
  src: url("Roboto-Regular-webfont.eot?#iefix"), url("Roboto-Regular-webfont.woff") format("woff"), url("Roboto-Regular-webfont.ttf") format("truetype"), url("Roboto-Regular-webfont.svg#Roboto") format("svg");
  font-weight: normal;
  font-style: normal;
}
/*(2) Roboto-Italic-webfont
.......................................*/
@font-face {
  font-family: "Roboto";
  src: url("Roboto-Italic-webfont.eot");
  src: url("Roboto-Italic-webfont.eot?#iefix"), url("Roboto-Italic-webfont.woff") format("woff"), url("Roboto-Italic-webfont.ttf") format("truetype"), url("Roboto-Italic-webfont.svg#Roboto") format("svg");
  font-weight: normal;
  font-style: italic;
}
/*(3) Roboto-Medium-webfont
.......................................*/
@font-face {
  font-family: "Roboto";
  src: url("Roboto-Medium-webfont.eot");
  src: url("Roboto-Medium-webfont.eot?#iefix"), url("Roboto-Medium-webfont.woff") format("woff"), url("Roboto-Medium-webfont.ttf") format("truetype"), url("Roboto-Medium-webfont.svg#Roboto") format("svg");
  font-weight: 500;
  font-style: normal;
}
/*(4) Roboto-MediumItalic-webfont
.......................................*/
@font-face {
  font-family: "Roboto";
  src: url("Roboto-MediumItalic-webfont.eot");
  src: url("Roboto-MediumItalic-webfont.eot?#iefix"), url("Roboto-MediumItalic-webfont.woff") format("woff"), url("Roboto-MediumItalic-webfont.ttf") format("truetype"), url("Roboto-MediumItalic-webfont.svg#Roboto") format("svg");
  font-weight: 500;
  font-style: italic;
}
/*(5) Roboto-Bold-webfont
.......................................*/
@font-face {
  font-family: "Roboto";
  src: url("Roboto-Bold-webfont.eot");
  src: url("Roboto-Bold-webfont.eot?#iefix"), url("Roboto-Bold-webfont.woff") format("woff"), url("Roboto-Bold-webfont.ttf") format("truetype"), url("Roboto-Bold-webfont.svg#Roboto") format("svg");
  font-weight: bold;
  font-style: normal;
}
/*(6) Roboto-BoldItalic-webfont
.......................................*/
@font-face {
  font-family: "Roboto";
  src: url("Roboto-BoldItalic-webfont.eot");
  src: url("Roboto-BoldItalic-webfont.eot?#iefix"), url("Roboto-BoldItalic-webfont.woff") format("woff"), url("Roboto-BoldItalic-webfont.ttf") format("truetype"), url("Roboto-BoldItalic-webfont.svg#Roboto") format("svg");
  font-weight: bold;
  font-style: italic;
}
/*(7) Roboto-Light-webfont
.......................................*/
@font-face {
  font-family: "Roboto";
  src: url("Roboto-Light-webfont.eot");
  src: url("Roboto-Light-webfont.eot?#iefix"), url("Roboto-Light-webfont.woff") format("woff"), url("Roboto-Light-webfont.ttf") format("truetype"), url("Roboto-Light-webfont.svg#Roboto") format("svg");
  font-weight: 300;
  font-style: normal;
}
/*(8) Roboto-LightItalic-webfont
.......................................*/
@font-face {
  font-family: "Roboto";
  src: url("Roboto-LightItalic-webfont.eot");
  src: url("Roboto-LightItalic-webfont.eot?#iefix"), url("Roboto-LightItalic-webfont.woff") format("woff"), url("Roboto-LightItalic-webfont.ttf") format("truetype"), url("Roboto-LightItalic-webfont.svg#Roboto") format("svg");
  font-weight: 300;
  font-style: italic;
}
/*(9) Roboto-Black-webfont
.......................................*/
@font-face {
  font-family: "Roboto";
  src: url("Roboto-Black-webfont.eot");
  src: url("Roboto-Black-webfont.eot?#iefix"), url("Roboto-Black-webfont.woff") format("woff"), url("Roboto-Black-webfont.ttf") format("truetype"), url("Roboto-Black-webfont.svg#Roboto") format("svg");
  font-weight: 900;
  font-style: normal;
}
/*(10) Roboto-BlackItalic-webfont
.......................................*/
@font-face {
  font-family: "Roboto";
  src: url("Roboto-BlackItalic-webfont.eot");
  src: url("Roboto-BlackItalic-webfont.eot?#iefix"), url("Roboto-BlackItalic-webfont.woff") format("woff"), url("Roboto-BlackItalic-webfont.ttf") format("truetype"), url("Roboto-BlackItalic-webfont.svg#Roboto") format("svg");
  font-weight: 900;
  font-style: italic;
}

我不确定是什么导致了我遇到的错误。这似乎应该工作得很好。

我根本没有修改 CSS 文件。

最佳答案

当您将字体上传到您的服务器时,您是否确定您处于二进制模式而不是 ASCII(文本)?那是我的问题,以正确的模式再次上传文件解决了我的问题。

关于html - 无法解码下载的字体和 OTS 解析错误 : invalid version tag,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36487083/

相关文章:

javascript - 如何加载 leanmodal div 内容 onclick

javascript - 在容器中单击的位置创建 div

javascript - HTML 的简单 Javascript 和 CSS 弹出窗口不起作用

python - Pandas根据Excel中的条件更改字体颜色并保存到相同的excel python

ios - 如何以编程方式在 iOS 应用程序中添加马拉雅拉姆字体(印度)

javascript - 如何在没有图像和通过属性的情况下在jquery中计算li

javascript - 如何自动加载 iframe 元素

javascript - 动态生成的嵌套 DIV 中的 OnMouseOver 事件无响应

css - 修改文本框宽度以显示xhtml primefaces中的所有数据

android改变listview的字体和颜色