Created
June 4, 2013 13:28
-
-
Save techmagus/5705908 to your computer and use it in GitHub Desktop.
font-face mixin override with unicode-range and local('') support.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ______________________________________________________________________ // | |
// font-face mixin override // | |
// ______________________________________________________________________ // | |
@mixin font-face( | |
$name, | |
$font-files, | |
$eot: false, | |
$weight: false, | |
$style: false, | |
$unicode-range: false, | |
$local: false | |
) { | |
$iefont: unquote("#{$eot}?#iefix"); | |
@font-face { | |
font-family: quote($name); | |
@if $eot { | |
src: font-url($eot); | |
$font-files: font-url($iefont) unquote("format('embedded-opentype')"), $font-files; | |
} | |
@if $local { | |
src: local(quote($local)), $font-files; | |
} @else { | |
src: $font-files; | |
} | |
@if $unicode-range { | |
unicode-range: $unicode-range; | |
} | |
@if $weight { | |
font-weight: $weight; | |
} | |
@if $style { | |
font-style: $style; | |
} | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@include font-face( | |
"myfont", | |
font-files( | |
"myfont.woff", woff, | |
"myfont.ttf", opentype, | |
"myfont.svg#webfontJRppkSIE", svg | |
), | |
"myfont.eot", | |
normal, | |
normal, | |
(U+1700-1714, U+1735-1736), | |
☺ | |
); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@font-face { | |
font-family: "myfont"; | |
src: url('myfont.eot'); | |
src: local("☺"), url('myfont.eot?#iefix') format('embedded-opentype'), url('myfont.woff') format('woff'), url('myfont.ttf') format('opentype'), url('myfont.svg#webfontJRppkSIE') format('svg'); | |
unicode-range: U+1700-1714, U+1735-1736; | |
font-weight: normal; | |
font-style: normal; } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment