Experimental book page layout.
[wolnelektury.git] / src / wolnelektury / static / 2021 / css / utils / bourbon / utilities / _font-source-declaration.scss
1 @charset "UTF-8";
2
3 /// Builds the `src` list for an `@font-face` declaration.
4 ///
5 /// @link https://goo.gl/Ru1bKP
6 ///
7 /// @argument {string} $font-family
8 ///
9 /// @argument {string} $file-path
10 ///
11 /// @argument {boolean} $asset-pipeline
12 ///
13 /// @argument {list} $file-formats
14 ///
15 /// @return {list}
16 ///
17 /// @require {function} _contains
18 ///
19 /// @access private
20
21 @function _font-source-declaration(
22   $font-family,
23   $file-path,
24   $asset-pipeline,
25   $file-formats
26 ) {
27   $src: ();
28
29   $formats-map: (
30     eot:   "#{$file-path}.eot?#iefix" format("embedded-opentype"),
31     woff2: "#{$file-path}.woff2" format("woff2"),
32     woff:  "#{$file-path}.woff" format("woff"),
33     ttf:   "#{$file-path}.ttf" format("truetype"),
34     svg:   "#{$file-path}.svg##{$font-family}" format("svg"),
35   );
36
37   @each $key, $values in $formats-map {
38     @if _contains($file-formats, $key) {
39       $file-path: nth($values, 1);
40       $font-format: nth($values, 2);
41
42       @if $asset-pipeline == true {
43         $src: append($src, font-url($file-path) $font-format, comma);
44       } @else {
45         $src: append($src, url($file-path) $font-format, comma);
46       }
47     }
48   }
49
50   @return $src;
51 }