@font-face 用于字体变体

发布于 2024-09-29 05:21:24 字数 1161 浏览 1 评论 0原文

有谁知道如何使用 Font Squirrel @font-face 套件生成器或类似的东西来输出字体的变体,即粗体变体?

我在我的网站上使用 Gill Sans,并将其设置为“font-weight:900”或“font-weight:bold”,这在我的机器上看起来很棒,因为它安装了字体。但是,如果我只是嵌入 Font Squirrel 生成的字体,我只能得到“常规”变体,而“粗体”则无法正确显示。

有谁知道嵌入字体粗体变体的方法?

Gill Sans 只有一个文件,当我上传它时,这是 Font Squirrel 给我的:

 @font-face {
      font-family: 'GillSansRegular';
      src: url('../fonts/gillsans-webfont.eot');
      src: local('☺'), url('../fonts/gillsans-webfont.woff') format('woff'), url('../fonts/gillsans-webfont.ttf') format('truetype'), url('../fonts/gillsans-webfont.svg#webfontDATch26L') format('svg');
 }

原始文件无疑包含粗体、斜体等信息,但我想知道 Font Squirrel 是否删除了变体,只剩下“常规”变体。

即使我只是向所有内容添加粗体,它也不会在任何地方显示为粗体:

 @font-face {
     font-family: 'GillSansBold';
     src: url('../fonts/gillsans-webfont.eot');
     src: local('☺'), url('../fonts/gillsans-webfont.woff') format('woff'), url('../fonts/gillsans-webfont.ttf') format('truetype'), url('../fonts/gillsans-webfont.svg#webfontDATch26L') format('svg');
     font-weight: bold;
 }

即使我从样式表中的其他任何位置删除所有字体系列和字体粗细,也没有任何内容是粗体的。一切都以 Gill Sans Regular 的形式显示。

Does anyone know how to use the Font Squirrel @font-face kit generator, or something similar, to output a variant of a font, i.e. the bold variant?

I am using Gill Sans on my website and it is set to "font-weight: 900" or "font-weight: bold," which looks great on my machine because it has the font installed. But if I just embed the font generated by Font Squirrel, I only get the "regular" variant and "bold" doesn't display correctly.

Does anyone know of a way to embed the bold variant of a font?

There is only one file for Gill Sans, and when I upload it, here is what Font Squirrel gave me:

 @font-face {
      font-family: 'GillSansRegular';
      src: url('../fonts/gillsans-webfont.eot');
      src: local('☺'), url('../fonts/gillsans-webfont.woff') format('woff'), url('../fonts/gillsans-webfont.ttf') format('truetype'), url('../fonts/gillsans-webfont.svg#webfontDATch26L') format('svg');
 }

The original file no doubt contains the information for bold, italic, etc., but I'm wondering if Font Squirrel strips out the variants, leaving me with only the "regular" variant.

Even if I just add bold to everything it doesn't show up bold anywhere:

 @font-face {
     font-family: 'GillSansBold';
     src: url('../fonts/gillsans-webfont.eot');
     src: local('☺'), url('../fonts/gillsans-webfont.woff') format('woff'), url('../fonts/gillsans-webfont.ttf') format('truetype'), url('../fonts/gillsans-webfont.svg#webfontDATch26L') format('svg');
     font-weight: bold;
 }

Nothing is bold even when I strip all font-familys and font-weights from anywhere else in my stylesheets. Everything just shows up as Gill Sans Regular.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

山川志 2024-10-06 05:21:24

我刚刚收到一封来自 Font Squirrel 的电子邮件:生成器不会在当前版本中分割 .dfont 文件,所以这解释了它。

I just received an email from Font Squirrel: the generator doesn't split .dfont files in the current version, so that explains it.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文