Skip to content

Instantly share code, notes, and snippets.

@techmagus
Created June 4, 2013 13:28
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save techmagus/5705908 to your computer and use it in GitHub Desktop.
Save techmagus/5705908 to your computer and use it in GitHub Desktop.
font-face mixin override with unicode-range and local('') support.
// ______________________________________________________________________ //
// 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;
}
}
}
@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),
);
@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