简体   繁体   English

在asp.net中嵌入字体

[英]embedding fonts in asp.net

I am trying to embed some fonts via a CSS file for my asp.net website but without success. 我试图通过CSS文件为asp.net网站嵌入一些字体,但没有成功。

Here is the code for the CSS: 这是CSS的代码:

@font-face {
  font-family: Segoe UI;
  src: url('SEGOEUI.ttf');
}

@font-face {
  font-family: Segoe WP;
  src: url('SEGOEWP.ttf');
}
body  
{
    background: Black;
    font-size: .80em;
    font-family:'Segoe WP';
    margin: 0px;
    padding: 0px;
    color: black;
}

And the CSS file and fonts are all within the Styles folder which is in the root of the site. CSS文件和字体都位于网站根目录的Styles文件夹中。 Running IE10 and Win 7. 运行IE10和Win 7。

What am I missing in getting this to work? 使它正常工作我缺少什么?

UPDATE: I have converted the fonts to EOT and called them like this: 更新:我已经将字体转换为EOT并这样称呼它们:

@font-face {
      font-family: 'Segoe UI';
      src: url('SEGOEUI.eot');
    }

    @font-face {
      font-family: 'Segoe WP';
      src: url('SEGOEWP.eot');
    }

But still nothing. 但是仍然没有。

TTF doesn't seem to be supported by IE. IE似乎不支持TTF。 See http://www.w3schools.com/css3/css3_fonts.asp . 参见http://www.w3schools.com/css3/css3_fonts.asp

Internet Explorer 9+ , Firefox, Chrome, Safari, and Opera support the WOFF (Web Open Font Format) font. Internet Explorer 9 + ,Firefox,Chrome,Safari和Opera支持WOFF (Web开放字体格式)字体。

Firefox, Chrome, Safari, and Opera support fonts of type TTF (True Type Fonts) and OTF (OpenType Fonts). Firefox,Chrome,Safari和Opera支持TTF(True Type字体)和OTF(OpenType字体)类型的字体。

Internet Explorer also supports EOT (Embedded OpenType) fonts. Internet Explorer还支持EOT(嵌入式OpenType)字体。

Which means WOFF or EOT could be a way to go for you. 这意味着WOFF或EOT可能是您的理想选择。 There are many free online font converters, you can try http://www.font2web.com/ or http://ttf2woff.com/ . 有许多免费的在线字体转换器,您可以尝试http://www.font2web.com/http://ttf2woff.com/

In IE you have to specify the real font name, some converter give the font after conversion a generated name by generator witch IE can't handle. 在IE中,您必须指定真实的字体名称,某些转换器会在转换后为字体提供一个由IE无法处理的生成器名称。 Use this website http://www.font-face-generator.com/ and for fonts with spaced in name use double quotes like 使用此网站http://www.font-face-generator.com/ ,对于名称中带有空格的字体,请使用双引号,例如

font-family: "Segoe UI", Arial;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM