/**
 * This mixin requires your font files to follow the following naming convention:
 *
 * basename_weight(-style).filetype
 *
 * You only need to specify style if it's something other than normal
 *
 * Make sure you check your config.rb for the fonts directory settings. I think this
 * defaults to {css-folder}/fonts.
 *
 * File naming convention examples:
 * Museo_300-italic.woff
 * Museo_Slab_500.ttf
 */

@import 'compass/css3/font-face';

@mixin webfont($name, $base_filename, $weights, $style: 'normal') {
    
    // Add i.e. "-italic" to italic style fonts
    $style : '';
    @if $style != 'normal' {
        $style : '-#{$style}';
    }

    @each $weight in $weights {
        @include font-face(
            $name,
            font-files(
                '#{$base_filename}_#{$weight}#{$style}.woff', woff, 
                '#{$base_filename}_#{$weight}#{$style}.ttf', ttf), 
            '#{$base_filename}_#{$weight}#{$style}.eot', 
            $weight
        );
    }
}

@include webfont('Museo', '../font/museo/Museo', 300 500 700);

/*
 * Example mixin usage, with multiple weights:
 * 
 * @include webfont('Museo', '../font/museo/Museo', 300 500 700);
 *
 * Output: 
 *
 * @font-face {
 *   font-family: "Museo";
 *   src: url('../font/museo/Museo_300.eot');
 *   src: url('../font/museo/Museo_300.eot?#iefix') format('eot'), 
 *        url('../font/museo/Museo_300.woff') format('woff'), 
 *        url('../font/museo/Museo_300.ttf') format('truetype');
 *   font-weight: 300;
 * }
 * 
 * @font-face {
 *   font-family: "Museo";
 *   src: url('../font/museo/Museo_500.eot');
 *   src: url('../font/museo/Museo_500.eot?#iefix') format('eot'), 
 *        url('../font/museo/Museo_500.woff') format('woff'), 
 *        url('../font/museo/Museo_500.ttf') format('truetype');
 *   font-weight: 500;
 * }
 * 
 * @font-face {
 *   font-family: "Museo";
 *   src: url('../font/museo/Museo_700.eot');
 *   src: url('../font/museo/Museo_700.eot?#iefix') format('eot'), 
 *        url('../font/museo/Museo_700.woff') format('woff'), 
 *        url('../font/museo/Museo_700.ttf') format('truetype');
 *   font-weight: 700;
 * }
 */