字体面不是在IE和铬
问题描述:
工作我用下面的代码在我的ASP.NET网站显示自定义字体:字体面不是在IE和铬
<style type="text/css">
@font-face {
font-family: 'B Mitra';
src: url('BMitra.ttf') format('truetype'); /* IE9 Compat Modes */
src: url('BMitra.ttf?#iefix') format('truetype'), /* IE6-IE8 */
url('BMitra.ttf') format('truetype'), /* Modern Browsers */
url('BMitra.ttf') format('truetype'); /* Safari, Android, iOS */
}
</style>
</head>
<body style="font-family:B Mitra;" onload="pageLoad()">
它工作在Firefox罚款,但IE和Chrome不要” t显示我的自定义字体(这个自定义字体位于我的服务器,在包含我的ASPX文件的文件夹中,字体在没有它在Firefox中的系统上下载,但我认为IE和Chrome无法下载它和另一个现有的字体被使用)。这里出了什么问题?
答
http://www.adtrak.co.uk/blog/font-face-chrome-rendering/
你为什么只调用相同的格式( 'TrueType字体')一遍又一遍?在它旁边注释并不能解决现代浏览器的问题。我认为你还需要其他文件格式?也就是说,通常为:
@font-face {
font-family: 'chunk-webfont';
src: url('../../includes/fonts/chunk-webfont.eot');
src: url('../../includes/fonts/chunk-webfont.eot?#iefix') format('eot'),
url('../../includes/fonts/chunk-webfont.woff') format('woff'),
url('../../includes/fonts/chunk-webfont.ttf') format('truetype'),
url('../../includes/fonts/chunk-webfont.svg') format('svg');
font-weight: normal;
font-style: normal;
}
@media screen and (-webkit-min-device-pixel-ratio:0) {
@font-face {
font-family: 'chunk-webfont';
src: url('../../includes/fonts/chunk-webfont.svg') format('svg');
}
}
答
< IE9支持EOT,不TTF,和你有太多的代码存在。如果您需要支持旧版本的IE,请使用http://reisio.com/examples/webfonts/,如果您不支持,请仅使用一个WOFF的引用。
谢谢,但我只有一个ttf文件,我怎么能找到我的字体的其他格式?我应该转换它们吗?你的意思是我应该使用其他格式的IE或铬?一切工作正常FireFox – 2013-02-21 08:30:26
转换将是最简单的,这是我会做的。有几个地方可以做到这一点,就像这里 http://www.fontsquirrel.com/tools/webfont-generator – emmy 2013-02-21 08:36:55
如果你不转换,这个人有你需要的字体需要你需要的格式 https://github.com/sobhe/jahadi/tree/master/static/fonts – emmy 2013-02-21 08:44:06