/* *****************************************************************************
*
*  Fonts mixins
*
* ***************************************************************************** */

@mixin font-face($name, $path, $weight: null, $style: null, $exts: woff2 woff ttf) {
  $src: null;
  $extmods: ();
  $formats: (
          otf: "opentype",
          ttf: "truetype"
  );

  @each $ext in $exts {
    $extmod: if(map-has-key($extmods, $ext), $ext + map-get($extmods, $ext), $ext);
    $format: if(map-has-key($formats, $ext), map-get($formats, $ext), $ext);
    $src: append($src, url(quote($path + "." + $extmod)) format(quote($format)), comma);
  }

  @font-face {
    font-family: quote($name);
    src: $src;
    font-weight: $weight;
    font-style: $style;
    font-display: swap;
  }
}
