| 16 | |
| 17 | // Build one `src` entry per source file. |
| 18 | const getSourceValue = ( |
| 19 | face: FontFace, |
| 20 | source: FontSource, |
| 21 | resolver?: UrlResolver, |
| 22 | ): string => { |
| 23 | const url = resolver |
| 24 | ? resolver({ face, source }) |
| 25 | : `./files/${source.filename}`; |
| 26 | |
| 27 | let format = 'woff'; |
| 28 | if (source.format === 'woff2') { |
| 29 | // Special format to make it clear to browsers that this is a variable font. |
| 30 | format = face.isVariable ? 'woff2-variations' : 'woff2'; |
| 31 | } else if (source.format === 'ttf') { |
| 32 | format = 'truetype'; |
| 33 | } |
| 34 | |
| 35 | return `url(${url}) format('${format}')`; |
| 36 | }; |
| 37 | |
| 38 | const getFaceComment = (family: string, face: FontFace): string => { |
| 39 | const axisOrWeight = |