File tree Expand file tree Collapse file tree 1 file changed +4
-6
lines changed Expand file tree Collapse file tree 1 file changed +4
-6
lines changed Original file line number Diff line number Diff line change @@ -494,9 +494,7 @@ var CanvasGraphics = (function canvasGraphics() {
494
494
var fontHeight = text .geom .vScale * fontSize ;
495
495
496
496
div .style .fontSize = fontHeight + 'px' ;
497
- // TODO: family should be '= font.loadedName', but some fonts don't
498
- // have spacing info (cf. fonts.js > Font > fields > htmx)
499
- div .style .fontFamily = 'serif' ;
497
+ div .style .fontFamily = this .current .font .loadedName || 'serif' ;
500
498
div .style .left = text .geom .x + 'px' ;
501
499
div .style .top = (text .geom .y - fontHeight ) + 'px' ;
502
500
div .innerHTML = text .str ;
@@ -560,8 +558,8 @@ var CanvasGraphics = (function canvasGraphics() {
560
558
current .x += charWidth ;
561
559
562
560
text .str += unicodeToChar (glyph .unicode );
563
- text .canvasWidth += charWidth ;
564
561
text .length ++;
562
+ text .canvasWidth += charWidth ;
565
563
}
566
564
ctx .restore ();
567
565
} else {
@@ -582,9 +580,9 @@ var CanvasGraphics = (function canvasGraphics() {
582
580
ctx .fillText (char , width , 0 );
583
581
width += charWidth ;
584
582
585
- text .str += char ;
586
- text .canvasWidth += charWidth ;
583
+ text .str += char === ' ' ? ' ' : char ;
587
584
text .length ++;
585
+ text .canvasWidth += charWidth ;
588
586
}
589
587
590
588
current .x += width ;
You can’t perform that action at this time.
0 commit comments