我正在创建一个HTML文件,该文件使用自定义字体。在文件中通过“ @ font-face” css样式引用字体。
最初,我使用从本地路径引用的Web字体工具包测试了HTML。带有这些自定义字体的HTML。
<!DOCTYPE html>
<html>
<head>
<title></title>
<style type="text/css">
@font-face {
font-family: 'Alfa Slab One';
src: url('fonts/AlfaSlabOne/AlfaSlabOne-Regular.eot');
src: url('fonts/AlfaSlabOne/AlfaSlabOne-Regular.eot?#iefix') format('embedded-opentype'),
url('fonts/AlfaSlabOne/AlfaSlabOne-Regular.woff2') format('woff2'),
url('fonts/AlfaSlabOne/AlfaSlabOne-Regular.woff') format('woff');
font-weight: normal;
font-style: normal;
}
h1 {font-family: 'Alfa Slab One';}
</style>
</head>
<body>
<h1>Full Name</h1>
</body>
</html>
然后,我将Web字体工具包上传到登台服务器上,并更新了stylesheet.css以映射引用服务器的本地路径。同样,我更新了我的.HTML文件,以引用用于加载字体的登台服务器路径。但是,这次,我没有使用相同自定义字体的HTML 。而是加载了一些其他默认字体。
<!DOCTYPE html>
<html>
<head>
<title></title>
<style type="text/css">
@font-face {
font-family: 'Alfa Slab One';
src: url('http://www.micronew.rebuildsucceeded.com/LogoFonts/AlfaSlabOne/AlfaSlabOne-Regular.eot');
src: url('http://www.micronew.rebuildsucceeded.com/LogoFonts/AlfaSlabOne/AlfaSlabOne-Regular.eot?#iefix') format('embedded-opentype'),
url('http://www.micronew.rebuildsucceeded.com/LogoFonts/AlfaSlabOne/AlfaSlabOne-Regular.woff2') format('woff2'),
url('http://www.micronew.rebuildsucceeded.com/LogoFonts/AlfaSlabOne/AlfaSlabOne-Regular.woff') format('woff');
font-weight: normal;
font-style: normal;
}
h1 {font-family: 'Alfa Slab One';}
</style>
</head>
<body>
<h1>Full Name</h1>
</body>
</html>
我还使用“ Google字体”的自定义字体进行了测试,它们运行良好;但是在登台服务器引用的情况下,由于某种未知原因,它会失败。
有人对此有任何线索吗?
注释:-