3

我正在将@font-face mixin 与 Compass (0.11.beta.1) 一起使用,并且无法定义我的粗体和斜体字体。

我可以通过以下代码成功加载和使用字体:

@include font-face("PTSerif", font-files("/path/to/font/PTF55F_W.ttf", truetype), "/path/to/font/PTF55F_W.eot");

但是我找不到定义粗体字体的方法。消息来源说 style 参数已被弃用,尝试使用它对输出 .css 文件没有影响。

@mixin font-face($name, $font-files, $eot: false, $postscript: false, $style: false) {
  @if $postscript or $style {
    @warn "The $postscript and $style variables have been deprecated in favor of the Paul Irish smiley bulletproof technique."; }
  @font-face {
    font-family: quote($name);
    @if $eot {
  src: font-url($eot); }
    src: local("☺"), $font-files; } }

我目前有两种选择:

  1. 之后编辑 .css 文件。不利于可维护性
  2. 为不同的样式定义不同的字体(也不理想,但目前最可行)例如

    @include font-face("PTSerif")
    @include font-face("PTSerif-B")

无法找到如何正确执行此操作的任何示例 - 能够使用 font-weight:bold;

提前致谢。

4

2 回答 2

1

这是一个结合常规、粗体和斜体的示例,我工作得很好:@font-face :: IM FELL ENGLISH

于 2011-03-01T10:17:46.580 回答
0

acarabott,我前段时间为此做出了 compass 的承诺,它似乎附带 0.12.alpha。

注意这里的 $weight 和 $style 参数:http: //beta.compass-style.org/reference/compass/css3/font_face/

于 2011-10-08T20:38:45.977 回答