@import '../functions/font-source-declaration';

@mixin fontface($family, $path, $weight: normal, $style: normal) {
    @font-face {
        font-family: $family;
        font-weight: $weight;
        font-style: $style;
        src: font-src-declaration($path);
        font-display: swap;
    }
}

@mixin font($family, $file, $weight: normal, $style: normal) {
    @include fontface($family, $assetsFonts + '/' + $file, $weight, $style);
}
  
@mixin font-files($fonts) {
    @if length($fonts) > 0 {
        $l: length(nth($fonts,1));

        @if $l > 0 {
            @if ($l == 1) {
                @include font(nth($fonts, 1), nth($fonts, 2), nth($fonts, 3), nth($fonts, 4));
            }
            @else if ($l > 1) {
                @each $f in $fonts {
                    @include font(nth($f, 1), nth($f, 2), nth($f, 3), nth($f, 4));
                }
            }
        }
    }
}
