Skip to content

Commit 0b0ba79

Browse files
authored
Merge pull request #131 from GrabarzUndPartner/beta
Beta
2 parents afde610 + c31fb30 commit 0b0ba79

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

lib/classes/Font.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export default class Font {
1919
async load () {
2020
if (!global.document.fonts.check(`${this.style} ${this.weight} 12px '${this.family}'`)) {
2121
const result = Array.from(global.document.fonts.keys()).find((f) => {
22-
return f.family === this.family && f.style === this.style && f.weight === String(this.weight);
22+
return f.family === this.family && f.style === this.style && weightNormalize(f.weight) === weightNormalize(this.weight);
2323
});
2424
await result.load();
2525
}
@@ -58,3 +58,15 @@ function createSelector (rootSelector, selector) {
5858
function wrapByMedia (style, media) {
5959
return (media && `@media ${media} { ${style} }`) || style;
6060
}
61+
62+
function weightNormalize (weight) {
63+
weight = String(weight);
64+
switch (weight) {
65+
case '400':
66+
return 'normal';
67+
case '700':
68+
return 'bold';
69+
default:
70+
return weight;
71+
}
72+
}

0 commit comments

Comments
 (0)