File tree 1 file changed +6
-5
lines changed
1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change 61
61
elem . getBBox = function ( ) {
62
62
var text = elem . innerHTML ;
63
63
var fontSize = parseFloat ( elem . getAttribute ( 'font-size' ) ) ;
64
- var fontFamily = elem . getAttribute ( 'font-family' ) . toLowerCase ( ) ;
65
- var fontWeight = elem . getAttribute ( 'font-weight' ) . toLowerCase ( ) ;
66
- var fontStyle = elem . getAttribute ( 'font-style' ) . toLowerCase ( ) ;
64
+ var fontFamily = elem . getAttribute ( 'font-family' ) ;
65
+ if ( fontFamily ) fontFamily = fontFamily . toLowerCase ( ) ;
66
+ var fontWeight = elem . getAttribute ( 'font-weight' ) ;
67
+ if ( fontWeight ) fontWeight = fontWeight . toLowerCase ( ) ;
68
+ var fontStyle = elem . getAttribute ( 'font-style' ) ;
69
+ if ( fontStyle ) fontStyle = fontStyle . toLowerCase ( ) ;
67
70
68
71
var fontsArr = fontFamily . split ( ', ' ) ;
69
72
77
80
if ( ! font )
78
81
font = fonts [ 'verdana' ] ;
79
82
80
- // if (!font) console.log(fontFamily, fonts);
81
-
82
83
var scale = 1 / font . unitsPerEm * fontSize ;
83
84
84
85
var top = - font . ascender * scale ;
You can’t perform that action at this time.
0 commit comments