-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathindex.js
50 lines (48 loc) · 943 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
function loadFont (obj = {}) {
if ('FontFace' in window) {
const font = new FontFace(
obj.name,
`url(${obj.url})`,
{
style: obj.style,
weight: obj.weight,
}
);
font.load().then(function() {
document.fonts.add(font);
});
}
}
function loadFonts () {
loadFont({
name: 'EB Garamond',
url: '/fonts/eb-garamond-v12-latin-600.woff2',
style: 'normal',
weight: '600'
})
loadFont({
name: 'EB Garamond',
url: '/fonts/eb-garamond-v12-latin-italic.woff2',
style: 'italic',
weight: '400'
})
loadFont({
name: 'EB Garamond',
url: '/fonts/eb-garamond-v12-latin-regular.woff2',
style: 'normal',
weight: '400'
})
loadFont({
name: 'EB Garamond Small Caps',
url: '/fonts/ebgaramondsc12-regular-webfont.woff2',
style: 'normal',
weight: '400'
})
loadFont({
name: 'Courier Prime',
url: '/fonts/courier-prime-v1-latin-regular.woff2',
style: 'normal',
weight: '400'
})
}
loadFonts();