0

I'm using following code to display a custom font in my ASP.NET web site:

<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()">

it works fine in FireFox, but IE and chrome don't display my custom font (this custom font is located in my server, in the folder which contains my ASPX file, font is downloaded on systems that don't have it in firefox, but I think IE and chrome cannot download it and another existing font is used). what is going wrong here?

4

1 回答 1

0

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');

}
}
于 2013-02-21T08:27:29.277 回答