我正在将@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; } }
我目前有两种选择:
- 之后编辑 .css 文件。不利于可维护性
为不同的样式定义不同的字体(也不理想,但目前最可行)例如
@include font-face("PTSerif")
@include font-face("PTSerif-B")
无法找到如何正确执行此操作的任何示例 - 能够使用 font-weight:bold;
提前致谢。