File tree 1 file changed +13
-1
lines changed
1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ export default class Font {
19
19
async load ( ) {
20
20
if ( ! global . document . fonts . check ( `${ this . style } ${ this . weight } 12px '${ this . family } '` ) ) {
21
21
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 ) ;
23
23
} ) ;
24
24
await result . load ( ) ;
25
25
}
@@ -58,3 +58,15 @@ function createSelector (rootSelector, selector) {
58
58
function wrapByMedia ( style , media ) {
59
59
return ( media && `@media ${ media } { ${ style } }` ) || style ;
60
60
}
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
+ }
You can’t perform that action at this time.
0 commit comments