0

我正在尝试找到font-family位于此处的 Helvetica Neue LT Std 97 Black Condensed 字体的 CSS 名称:http: //fontscore.com/fonts/Helvetica-Neue-LT-Std-97-Black-Condensed_22554.html

我正在使用@font-face将字体加载到网页上,如果尚未在用户计算机上,但是,如果首先在用户计算机上找到,我希望能够加载字体。我在这里尝试了几种方法,但这些方法都不起作用:

font-family:  HelveticaNeueLT Std Blk Cn
font-family:  HelveticaNeueLT Std ExtBlk Cn

调用 font-family 时我应该使用的这种字体的名称是什么?我可能也必须将 97 放在那里的某个地方,但没有任何效果,尝试了很多不同的方式来调用它。

这是我在 CSS 中使用的内容:

@font-face {
    font-family: hnc_font;
    src: local('HelveticaNeueLT Std Blk Cn'), local('HelveticaNeueLTStd-BlkCn'), url('../fonts/hnc.otf') format('opentype'), url('../fonts/hnc.woff') format('woff'), url('../fonts/hnc.ttf') format('truetype'), url('../fonts/hnc.svg') format('svg');
    font-weight: normal;
}

@font-face{ 
    font-family: MyFont_IE;
    src: url('../fonts/swiss_bc.eot'); 
}

.big_text
{
    padding-top: .4em;
    font-size: 5.5em;
    font-family: HelveticaNeueLT Std Blk Cn, HelveticaNeueLTStd-BlkCn, hnc_font, MyFont_IE;
}
4

3 回答 3

2

First of all try all your combinations by wrapping the name of the font in " quotes.

For example font-family: "Helvetica Neue LT Std 97 Black Condensed"

Then, the name that you call is defined by your @font-face declaration before the font-family. You can call it what ever you want.

For example if you first declare it like this

@font-face{
    font-family: "MY_FONT_NAME";
    src: url('PATH_TO/FONT_FILENAME.ttf');
}

you can later refer to it like this

font-family: "MY_FONT_NAME";

Edit based on the added CSS

try this

    .big_text
{
    padding-top: .4em;
    font-size: 5.5em;
    font-family: "HelveticaNeueLT Std Blk Cn", "HelveticaNeueLTStd-BlkCn", "hnc_font", "MyFont_IE";
}
于 2013-03-30T22:10:11.820 回答
1

Cheat with some javascript: http://jsfiddle.net/ucd2L/

var x = $("#test").css('font-family');
$("#test").append(x);

HTML

<p id="test">Text</p>
于 2013-03-30T22:11:19.787 回答
0

When using @font-face, there are two separate questions about font names.

The name you use in font-family declaration inside an @font-face rule is up to you, as long as it is a syntactically valid font name and you use that very same name in font-family declarations in normal CSS rules. So it can be font-family: foobar.

The name you use in the local(...) constructor when setting src in an @font-family rule must match the name under which the font is known in the system. It should be name you would use to get a local font in a font-family rule without any @font-face, and in principle it should be the PostScript name or the full name of the font, though browsers may accept other names too; see css - machine specific font-family.

于 2013-03-31T12:02:40.917 回答