From 279124cc19f2eb535d34723d5dfe720d6f033984 Mon Sep 17 00:00:00 2001 From: lyuba Date: Sun, 22 May 2011 01:32:34 +0200 Subject: [PATCH 1/2] font styles in the @font-face --- .../stylesheets/compass/css3/_font-face.scss | 21 ++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/frameworks/compass/stylesheets/compass/css3/_font-face.scss b/frameworks/compass/stylesheets/compass/css3/_font-face.scss index b110d25a..cd2529e1 100644 --- a/frameworks/compass/stylesheets/compass/css3/_font-face.scss +++ b/frameworks/compass/stylesheets/compass/css3/_font-face.scss @@ -6,6 +6,8 @@ // * $font-files is required using font-files('relative/location', 'format'). // for best results use this order: woff, opentype/truetype, svg // * $eot is required by IE, and is a relative location of the eot file. +// * $weight shows if the font is bold, defaults to normal +// * $style defaults to normal, might be also italic // * For android 2.2 Compatiblity, please ensure that your web page has // a meta viewport tag. // * To support iOS < 4.2, an SVG file must be provided @@ -13,10 +15,19 @@ // If you need to generate other formats check out the Font Squirrel // [font generator](http://www.fontsquirrel.com/fontface/generator) +// In order to refer to a specific style of the font in your stylesheets as +// e.g. "font-style: italic;", you may add a couple of @font-face includes +// containing the respective font files for each style and specying +// respective the $style parameter. + +// Order of the includes matters, and it is: normal, bold, italic, bold+italic. + @mixin font-face( $name, $font-files, - $eot: false + $eot: false, + $weight: normal, + $style: normal ) { $iefont: unquote("#{$eot}?iefix"); @font-face { @@ -25,12 +36,14 @@ src: font-url($eot); $font-files: font-url($iefont) unquote("format('eot')"), $font-files; } - src: $font-files; + src: $font-files; + font-weight: $weight; + font-style: $style; } } // EXAMPLE -// +font-face("this name", font-files("this.woff", "woff", "this.otf", "opentype"), "this.eot") +// +font-face("this name", font-files("this.woff", "woff", "this.otf", "opentype"), "this.eot", bold, italic) // // will generate: // @@ -40,4 +53,6 @@ // src: local("☺"), // url('fonts/this.otf') format('woff'), // url('fonts/this.woff') format('opentype'); +// font-weight: bold; +// font-style: italic; // } From fce52690b9069e84322f3c6bcdeb2c2885b6d4ed Mon Sep 17 00:00:00 2001 From: lyuba Date: Fri, 15 Jul 2011 23:31:30 +0200 Subject: [PATCH 2/2] font weight and style default to false --- .../compass/stylesheets/compass/css3/_font-face.scss | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/frameworks/compass/stylesheets/compass/css3/_font-face.scss b/frameworks/compass/stylesheets/compass/css3/_font-face.scss index cd2529e1..e3ecc8b6 100644 --- a/frameworks/compass/stylesheets/compass/css3/_font-face.scss +++ b/frameworks/compass/stylesheets/compass/css3/_font-face.scss @@ -26,8 +26,8 @@ $name, $font-files, $eot: false, - $weight: normal, - $style: normal + $weight: false, + $style: false ) { $iefont: unquote("#{$eot}?iefix"); @font-face { @@ -37,8 +37,12 @@ $font-files: font-url($iefont) unquote("format('eot')"), $font-files; } src: $font-files; - font-weight: $weight; - font-style: $style; + @if $weight { + font-weight: $weight; + } + @if $style { + font-style: $style; + } } }