为什么一种字体在IE中工作,而另一种字体不工作

时间:2014-02-21 16:29:19

标签: html css font-face true-type-fonts

HTML

<span style="font-family: 'blackjackregular'; font-size: 18pt;">My</span>
<span style="font-family: 'trajanpro'; font-size: 14pt;">WEST</span>

字体css:

@font-face {
    font-family: 'trajanpro';
    src: url('trajanpro-regular.eot');
    src: url('trajanpro-regular.eot?#iefix') format('embedded-opentype'),
         url('trajanpro-regular.woff') format('woff'),
         url('trajanpro-regular.ttf') format('truetype'),
         url('trajanpro-regular.svg#trajanpro_regular') format('svg');
    font-weight: normal;
    font-style: normal;
}

@font-face {
    font-family: 'blackjackregular';
    src: url('blackjar-webfont.eot');
    src: url('blackjar-webfont.eot?#iefix') format('embedded-opentype'),
         url('blackjar-webfont.woff') format('woff'),
         url('blackjar-webfont.ttf') format('truetype'),
         url('blackjar-webfont.svg#blackjackregular') format('svg');
    font-weight: normal;
    font-style: normal;
}

IE显示:

enter image description here

FF和Chrome显示:

enter image description here

正如您所看到的,在IE和其他浏览器中MY都是正确的,但为什么WEST不会在IE中更改字体?

2 个答案:

答案 0 :(得分:3)

Trajan Pro是Adobe的专有字体,可能没有将其作为网络字体嵌入的许可。用@font-face嵌入它可能违反了EULA。要使用它,您需要使用Typekit之类的服务。请在此处查看详细信息:https://typekit.com/fonts/trajan-pro-3

编辑:

经过多次挖掘后,这是一个有趣的link,声明IE在EOT文件中实现了一个限制字体使用的标志。其他浏览器不实现此功能,或计划,因此行为不同。

答案 1 :(得分:2)

似乎是IE应用的字体上的EOT标志,而另一个浏览器则没有,正如Jacek Glen所说。

您应该检查免费相当于Trajan,例如Cinzel http://www.google.com/fonts/specimen/Cinzel

我不确定,但请尝试:

@font-face {
font-family: 'trajanpro';

src: url('trajanpro-regular.eot?#iefix') format('embedded-opentype'),
     url('trajanpro-regular.woff') format('woff'),
     url('trajanpro-regular.ttf') format('truetype'),
     url('trajanpro-regular.svg#trajanpro_regular') format('svg');
font-weight: normal;
font-style: normal;
}

@font-face {
font-family: 'blackjackregular';

src: url('blackjar-webfont.eot?#iefix') format('embedded-opentype'),
     url('blackjar-webfont.woff') format('woff'),
     url('blackjar-webfont.ttf') format('truetype'),
     url('blackjar-webfont.svg#blackjackregular') format('svg');
font-weight: normal;
font-style: normal;
}

我刚删除了第一个“src”属性,该属性不会被指定两次。不知道为什么那对“我的”而不是“西方”有用......

相关问题