我在Compass(0.11.beta.1)中使用@ font-face mixin并且无法定义粗体和斜体字体。Compass font-face mixin bold
我可以成功地加载和使用的字体用下面的代码:
@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字体面( “PTSerif”)
@include字体面( “PTSerif-B”)
一直没能找到如何做到这一点的任何适当的例子 - 能够使用font-weight:bold;
在此先感谢。
我专门询问有关使用罗盘做到这一点,似乎你的CSS是手工编码? 此外,你已经实现了与表达类,我想避免这一点。 – acarabott 2011-03-02 10:28:14