开发者

Compass font-face mixin bold

开发者 https://www.devze.com 2023-02-14 10:54 出处:网络
I am using the @font-face mixin with Compass (0.11.beta.1) and having trouble defining my bold and italic fonts.

I am using the @font-face mixin with Compass (0.11.beta.1) and having trouble defining my bold and italic fonts.

I can successfully load and use fonts with the following code:

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

However I can't find a way to define the bold font-face. The source says that the style argument has been deprecated, and trying to use it has no effect on the output .css file.

@mixin font-face($name, $font-files, $eot: false, $postscript: false, $style: false) {
  @if $pos开发者_开发问答tscript 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; } }

I currently have two alternatives:

  1. Edit the .css files afterwards. No good for maintainability
  2. Define different fonts for the different styles (also not ideal, but currently the mos workable) e.g.

    @include font-face("PTSerif")

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

Haven't been able to find any examples of how to do this properly- being able to use font-weight:bold;

Thanks in advance.


Here's an example of combining regular, bold and italic that I have working just fine: @font-face :: IM FELL ENGLISH.


acarabott, I've made a commit to compass for this some time ago, and it seems to ship with 0.12.alpha.

Notice the $weight and $style parameters here: http://beta.compass-style.org/reference/compass/css3/font_face/

0

精彩评论

暂无评论...
验证码 换一张
取 消