0

Very newbie question, sorry in advance if it comes out to be a simple answer, but my Helvetica font isn't showing up. This is my code:

@import "..\fonts\Helvetica";
@import "..\fonts\Neue Helvetica";

body {
    background: #E1E1E1;
    font-family: Helvetica Neue, Arial, serif;
}

It always shows up as Arial! I don't have Helvetica Neue installed on my system, even though I have the .ttf, because I wanna include it on my site and just call an import there so everyone can see it, regardless of their installation. I've got them in the same project under a different folder path as shown above. How can I accomplish this? Thanks!

4

2 回答 2

3

您不能合法地将 Helvetica 用作可下载字体,也不能引用@import. 要开始使用可下载字体(网络字体),请查看http://www.google.com/webfonts

于 2013-01-12T09:17:38.327 回答
2

尝试以下操作:

/* These links need to point to actual ttf files and be relative to your css file */
@font-face {font-family: "Helvetica"; src: url('../fonts/Helvetica.ttf') format('truetype');}
@font-face {font-family: "Helvetica Neue"; src: url('../fonts/HelveticaNeue.ttf') format('truetype');}


body {
    background: #E1E1E1;
    font-family: 'Helvetica Neue', Helvetica-Neue, HelveticaNeue, Arial, sans-serif;
}

不同的系统可能会以不同的方式命名 Helvetica Neue,因此上面有 3 个指令。您可以使用 FireBug 或 Chrome/Safari 检查器来查看您的系统识别出哪一个。

但是,我怀疑您正在尝试的操作超出了您的 Helvetica 许可证的允许使用范围。您应该考虑从fonts.com获得许可。

此外,不确定为什么您会选择提供 serif 作为备用字体,因为 Arial 和 Helvetica Neue 都是无衬线字体。

于 2013-01-12T04:34:19.487 回答