Fix font and spaces
This commit is contained in:
parent
9ebec03ddc
commit
686f275830
@ -494,9 +494,7 @@ var CanvasGraphics = (function canvasGraphics() {
|
|||||||
var fontHeight = text.geom.vScale * fontSize;
|
var fontHeight = text.geom.vScale * fontSize;
|
||||||
|
|
||||||
div.style.fontSize = fontHeight + 'px';
|
div.style.fontSize = fontHeight + 'px';
|
||||||
// TODO: family should be '= font.loadedName', but some fonts don't
|
div.style.fontFamily = this.current.font.loadedName || 'serif';
|
||||||
// have spacing info (cf. fonts.js > Font > fields > htmx)
|
|
||||||
div.style.fontFamily = 'serif';
|
|
||||||
div.style.left = text.geom.x + 'px';
|
div.style.left = text.geom.x + 'px';
|
||||||
div.style.top = (text.geom.y - fontHeight) + 'px';
|
div.style.top = (text.geom.y - fontHeight) + 'px';
|
||||||
div.innerHTML = text.str;
|
div.innerHTML = text.str;
|
||||||
@ -560,8 +558,8 @@ var CanvasGraphics = (function canvasGraphics() {
|
|||||||
current.x += charWidth;
|
current.x += charWidth;
|
||||||
|
|
||||||
text.str += unicodeToChar(glyph.unicode);
|
text.str += unicodeToChar(glyph.unicode);
|
||||||
text.canvasWidth += charWidth;
|
|
||||||
text.length++;
|
text.length++;
|
||||||
|
text.canvasWidth += charWidth;
|
||||||
}
|
}
|
||||||
ctx.restore();
|
ctx.restore();
|
||||||
} else {
|
} else {
|
||||||
@ -582,9 +580,9 @@ var CanvasGraphics = (function canvasGraphics() {
|
|||||||
ctx.fillText(char, width, 0);
|
ctx.fillText(char, width, 0);
|
||||||
width += charWidth;
|
width += charWidth;
|
||||||
|
|
||||||
text.str += char;
|
text.str += char === ' ' ? ' ' : char;
|
||||||
text.canvasWidth += charWidth;
|
|
||||||
text.length++;
|
text.length++;
|
||||||
|
text.canvasWidth += charWidth;
|
||||||
}
|
}
|
||||||
|
|
||||||
current.x += width;
|
current.x += width;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user