Safari和IE不能读取TTF和EOT字体

时间:2022-06-28 07:01:08
  1. I have trouble reading a font in Safari. I converted OTF to TTF - two bold and regular fonts. Both are fine in Chrome and Firefox. But in Safari, only the bold font is works, regular does not.

    我在Safari中阅读字体有困难。我将OTF转换为TTF -两个粗体和常规字体。这两款产品在Chrome和火狐上都不错。但是在Safari中,只有粗体是有效的,普通字体不是。

  2. IE does not read the EOT font which I have converted from a website. Is there any better way to convert OTF to EOT?

    IE不读取我从网站上转换过来的EOT字体。有没有更好的方法把OTF转换成EOT?

Here is my code:

这是我的代码:

<style type="text/css">
//Bariol_Bold
@font-face{
    font-family: Bariol_Bold;
    src:url("fonts/bariol_bold.eot"); /*For ie browser*/
}

@font-face{ 
    font-family: Bariol_Bold;
    src:url("fonts/bariol_bold.ttf"); /*For other browsers*/
}

//Bariol_Regular
@font-face{
    font-family:bariol_regular;
    src:url("fonts/bariol_regular.eot"); /*For ie browser*/
}

@font-face{ 
    font-family: bariol_regular;
    src:url("fonts/bariol_regular.ttf"); /*For other browsers*/  
</style>

<p style="font-family: Bariol_Bold; font-size: 20px;">hello world</p>
<p style="font-family: bariol_regular; font-size: 20px;">hello world</p>

1 个解决方案

#1


5  

You should check Paul Irish's Bulletproof @font-face Syntax or FontSpring's @font-face Syntax which needs multiple declarations of the the same font in different file types to server multiple browsers.

您应该检查Paul Irish的防弹@font-face语法,或者FontSpring的@font-face语法,这些语法需要在不同的文件类型中为多个浏览器声明相同字体。

The basic declaration is like

基本的声明是这样的。

@font-face {
  font-family: 'MyFontFamily';
  src: url('myfont-webfont.eot?#iefix') format('embedded-opentype'), 
   url('myfont-webfont.woff') format('woff'), 
   url('myfont-webfont.ttf')  format('truetype'),
   url('myfont-webfont.svg#svgFontName') format('svg');
}

I also prefer FontSquirrel's @font-face Generator but you can Google other alternatives. FontSquirrel just needs one font to be converted and it will provide you with a basic .zip file that contains necessary font types plus a sample demo of the fonts generated.

我也更喜欢FontSquirrel的@font-face生成器,但是您可以谷歌其他替代方法。FontSquirrel只需要转换一种字体,它将为您提供一个基本的.zip文件,其中包含必要的字体类型,以及生成的字体示例演示。

#1


5  

You should check Paul Irish's Bulletproof @font-face Syntax or FontSpring's @font-face Syntax which needs multiple declarations of the the same font in different file types to server multiple browsers.

您应该检查Paul Irish的防弹@font-face语法,或者FontSpring的@font-face语法,这些语法需要在不同的文件类型中为多个浏览器声明相同字体。

The basic declaration is like

基本的声明是这样的。

@font-face {
  font-family: 'MyFontFamily';
  src: url('myfont-webfont.eot?#iefix') format('embedded-opentype'), 
   url('myfont-webfont.woff') format('woff'), 
   url('myfont-webfont.ttf')  format('truetype'),
   url('myfont-webfont.svg#svgFontName') format('svg');
}

I also prefer FontSquirrel's @font-face Generator but you can Google other alternatives. FontSquirrel just needs one font to be converted and it will provide you with a basic .zip file that contains necessary font types plus a sample demo of the fonts generated.

我也更喜欢FontSquirrel的@font-face生成器,但是您可以谷歌其他替代方法。FontSquirrel只需要转换一种字体,它将为您提供一个基本的.zip文件,其中包含必要的字体类型,以及生成的字体示例演示。