我想在网站上使用自定义字体,我管理(通过FontSquirrel)使其在Chrome,Safari甚至Internet Explorer中运行,但不在Firefox中。
这是我的代码:
@font-face {
font-family: 'RaspoutineClassic';
src: url('http://vukdeveloper.uk.to/klice/font/RaspoutineClassic-webfont.eot');
src: url('http://vukdeveloper.uk.to/klice/font/RaspoutineClassic-webfont.eot?#iefix') format('embedded-opentype'),
url('http://vukdeveloper.uk.to/klice/font/RaspoutineClassic-webfont.woff2') format('woff2'),
url('http://vukdeveloper.uk.to/klice/font/RaspoutineClassic-webfont.woff') format('woff'),
url('http://vukdeveloper.uk.to/klice/font/RaspoutineClassic-webfont.ttf') format('truetype'),
url('http://vukdeveloper.uk.to/klice/font/RaspoutineClassic-webfont.svg#raspoutine_classicitalic') format('svg');
font-weight: normal;
font-style: normal;}
这是网站:vukdeveloper.uk.to/klice
我还将此添加到.htaccess文件中,但也没有这样的运气。
<FilesMatch "\.(ttf|otf|eot)$">
<IfModule mod_headers.c>
Header set Access-Control-Allow-Origin "*"
</IfModule>
</FilesMatch>
您能否建议进行任何更改以使其发挥作用?
答案 0 :(得分:1)
Firefox正在请求
http://vukdeveloper.uk.to/klice/css/font/RaspoutineClassic.otf
http://vukdeveloper.uk.to/klice/css/font/RaspoutineClassic.woff
http://vukdeveloper.uk.to/klice/css/font/RaspoutineClassic.ttf
并且每人获得404.
它请求那些的原因是在http://vukdeveloper.uk.to/klice/css/slicknav.css中你有相同字体系列名称的另一个@font-face
声明,它给出了字体文件的错误路径:
@font-face {
font-family: 'RaspoutineClassic';
src: url('font/RaspoutineClassic.eot?#iefix') format('embedded-opentype'), url('font/RaspoutineClassic.otf') format('opentype'),
url('font/RaspoutineClassic.woff') format('woff'), url('font/RaspoutineClassic.ttf') format('truetype'), url('font/RaspoutineClassic.svg#RaspoutineClassic') format('svg');
font-weight: normal;
font-style: normal;
}