stylesheets/toolkit/_fonts.scss in toolkit-2.0.0.alpha.10 vs stylesheets/toolkit/_fonts.scss in toolkit-2.0.0

- old
+ new

@@ -1,13 +1,15 @@ ////////////////////////////// // Enable ligatures ////////////////////////////// @mixin enable-ligatures($extend: null) { - $extend: if($extend != null, $extend, toolkit-get('extend ligatures')); + $extend: if($extend != null, $extend, toolkit-get('ligature extend')); @if $extend { - @extend %enable-ligatures; + @include toolkit-placeholder('enable ligatures') { + @include enable-ligatures; + } } @else { -webkit-font-feature-settings:"liga","dlig"; -moz-font-feature-settings:"liga=1, dlig=1"; -moz-font-feature-settings:"liga","dlig"; @@ -15,24 +17,111 @@ -o-font-feature-settings:"liga","dlig"; font-feature-settings: "liga","dlig"; } } -%enable-ligatures { - @include enable-ligatures; +////////////////////////////// +// Font Face +////////////////////////////// +@mixin font-face($name, $files, $weight: null, $style: null, $inline-woff: null) { + $weight: if($weight != null, $weight, toolkit-get('font face weight')); + $style: if($style != null, $style, toolkit-get('font face style')); + $inline-woff: if($inline-woff != null, $inline-woff, toolkit-get('font face inline woff')); + + $font-stack: (); + $font-src: ''; + $eot: false; + $font-extensions: ('eot': 'embedded-opentype', 'woff': 'woff', 'ttf': 'truetype', 'svg': 'svg'); + + @each $ext, $format in $font-extensions { + @if map-has-key($files, $ext) { + @if function-exists(inline-font-files) and $inline-woff == true and $ext == 'woff' { + $font-src: inline-font-files(map-get($files, $ext)); + } + @else if function-exists(font-url) { + $font-src: font-url(map-get($files, $ext)) format($format); + @if $ext == 'eot' { + $eot: $font-src; + $font-src: font-url(map-get($files, $ext) + '#iefix') format($format); + } + } + @else { + $font-src: url(map-get($files, $ext)) format($format); + @if $ext == 'eot' { + $eot: $font-src; + $font-src: url(map-get($files, $ext) + '#iefix') format($format); + } + } + $font-stack: append($font-stack, $font-src, 'comma'); + } + + } + + @at-root { + @font-face { + font-family: $name; + font-weight: $weight; + font-style: $style; + @if $eot { + src: $eot; + } + @if length($font-stack) > 0 { + src: $font-stack; + } + } + } } ////////////////////////////// +// Icon Font +// From http://icomoon.io +////////////////////////////// +@mixin icon-font($font-stack, $speak: null, $extend: null) { + $speak: if($speak != null, $speak, toolkit-get('icon font speak')); + $extend: if($extend != null, $extend, toolkit-get('icon font extend')); + + font-family: $font-stack; + @if $speak == false { + speak: none; + } + @include icon-font--core($extend); +} + +@mixin icon-font--core($extend: null) { + $extend: if($extend != null, $extend, toolkit-get('icon font extend')); + + @if $extend { + @include toolkit-placeholder('icon font core') { + @include icon-font--core(false); + } + } + @else { + font-style: normal; + font-weight: normal; + font-variant: normal; + text-transform: none; + line-height: 1; + + @include enable-ligatures($extend); + + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; + } +} + +////////////////////////////// // Font Fade In ////////////////////////////// @mixin content-fade-in($duration: null, $loading: null, $extend: null) { $duration: if($duration != null, $duration, toolkit-get('fade in duration')); $loading: if($loading != null, $loading, toolkit-get('fade in loading class')); $extend: if($extend != null, $extend, toolkit-get('fade in extend')); @if $extend == true and $duration == toolkit-get('fade in duration') and $loading == toolkit-get('fade in loading class') { - @extend %content-fade-in; + @include toolkit-placeholder('content fade in') { + @include content-fade-in($extend: false); + } } @else { opacity: 1; @if not mixin-exists('single-transition') { -webkit-transition: opacity $duration; @@ -44,10 +133,6 @@ #{$loading} & { opacity: 0; } } -} - -%content-fade-in { - @include content-fade-in($extend: false); } \ No newline at end of file