我想自己托管Material Design Icon字体。我跟着他们的developer guide。所以我下载了图标字体from here,将eot
,ttf
,woff
和woff2
文件复制到我的项目目录中并将其包含在我的CSS中。但是我收到了很多错误:
问题是为什么以及如何解决它。 SSCCE如下:
/* fallback */
@font-face {
font-family: 'Material Icons';
font-style: normal;
font-weight: 400;
src: url('fonts/material/MaterialIcons-Regular.eot');
/* For IE6-8 */
src: local('Material Icons'), local('MaterialIcons-Regular'), url('fonts/material/MaterialIcons-Regular.woff2') format('woff2'), url('fonts/material/MaterialIcons-Regular.woff') format('woff'), url('fonts/material/MaterialIcons-Regular.ttf') format('truetype');
}
.material-icons {
font-family: 'Material Icons';
font-weight: normal;
font-style: normal;
font-size: 24px;
/* Preferred icon size */
display: inline-block;
line-height: 1;
text-transform: none;
letter-spacing: normal;
word-wrap: normal;
white-space: nowrap;
direction: ltr;
/* Support for all WebKit browsers. */
-webkit-font-smoothing: antialiased;
/* Support for Safari and Chrome. */
text-rendering: optimizeLegibility;
/* Support for Firefox. */
-moz-osx-font-smoothing: grayscale;
/* Support for IE. */
font-feature-settings: 'liga';
}

<!DOCTYPE html>
<html>
<head>
<link type="text/css" rel="stylesheet" href="styles.css" />
<link type="text/css" rel="stylesheet" href="material.min.css" />
<script type="text/javascript" src="jquery.min.js"></script>
<script type="text/javascript" src="material.min.js"></script>
</head>
<body>
<button class="mdl-button mdl-js-button"><i class="material-icons">chevron_left</i>
</button>
</body>
</html>
&#13;
问题是为什么以及如何解决这个问题?
我的项目层次结构:
答案 0 :(得分:0)
如果通过“保存链接”从Web浏览器下载了字体,则可能会下载不完整的ASCII版本而不是二进制版本。我也遇到了这个问题,并从Jodamo5 here找到了解决方案 附言,如果您不使用FTP,还可以从浏览器下载完整的master.zip文件,并从zip中提取所需的字体文件。