|
| 1 | +const fontURLs = { |
| 2 | + BarlowCondensed: |
| 3 | + 'url(https://fonts.googleapis.com/css2?family=Barlow+Condensed:wght@300;500;600&display=swap)', |
| 4 | + SairaCondensed: |
| 5 | + 'url(https://fonts.googleapis.com/css2?family=Saira+Condensed:wght@600;700;800&display=swap)', |
| 6 | + PTSansNarrow: 'url(https://fonts.googleapis.com/css2?family=PT+Sans+Narrow:wght@700&display=swap)' |
| 7 | +} |
| 8 | + |
| 9 | +const fontBarlowCondensedLight = new FontFace('Barlow Condensed', fontURLs.BarlowCondensed, { |
| 10 | + style: 'normal', |
| 11 | + weight: '300' |
| 12 | +}) |
| 13 | + |
| 14 | +const fontBarlowCondensedMedium = new FontFace('Barlow Condensed', fontURLs.BarlowCondensed, { |
| 15 | + style: 'normal', |
| 16 | + weight: '500' |
| 17 | +}) |
| 18 | + |
| 19 | +const fontBarlowCondensedSemibold = new FontFace('Barlow Condensed', fontURLs.BarlowCondensed, { |
| 20 | + style: 'normal', |
| 21 | + weight: '600' |
| 22 | +}) |
| 23 | + |
| 24 | +const fontSairaCondensedSemibold = new FontFace('Saira Condensed', fontURLs.SairaCondensed, { |
| 25 | + style: 'normal', |
| 26 | + weight: '600' |
| 27 | +}) |
| 28 | + |
| 29 | +const fontSairaCondensedBold = new FontFace('Saira Condensed', fontURLs.SairaCondensed, { |
| 30 | + style: 'normal', |
| 31 | + weight: '700' |
| 32 | +}) |
| 33 | + |
| 34 | +const fontSairaCondensedExtrabold = new FontFace('Saira Condensed', fontURLs.SairaCondensed, { |
| 35 | + style: 'normal', |
| 36 | + weight: '800' |
| 37 | +}) |
| 38 | + |
| 39 | +const fontPTSansNarrowBold = new FontFace('Saira Condensed', fontURLs.SairaCondensed, { |
| 40 | + style: 'normal', |
| 41 | + weight: '700' |
| 42 | +}) |
| 43 | + |
| 44 | +export const fonts = { |
| 45 | + install() { |
| 46 | + Promise.all([ |
| 47 | + fontBarlowCondensedLight.load(), |
| 48 | + fontBarlowCondensedMedium.load(), |
| 49 | + fontBarlowCondensedSemibold.load(), |
| 50 | + fontSairaCondensedSemibold.load(), |
| 51 | + fontSairaCondensedBold.load(), |
| 52 | + fontSairaCondensedExtrabold.load(), |
| 53 | + fontPTSansNarrowBold.load() |
| 54 | + ]).then(() => { |
| 55 | + document.fonts.add(fontBarlowCondensedLight) |
| 56 | + document.fonts.add(fontBarlowCondensedMedium) |
| 57 | + document.fonts.add(fontBarlowCondensedSemibold) |
| 58 | + document.fonts.add(fontSairaCondensedSemibold) |
| 59 | + document.fonts.add(fontSairaCondensedBold) |
| 60 | + document.fonts.add(fontSairaCondensedExtrabold) |
| 61 | + document.fonts.add(fontPTSansNarrowBold) |
| 62 | + }) |
| 63 | + } |
| 64 | +} |
0 commit comments