fix styles when measuring

This commit is contained in:
inssein 2015-06-11 10:55:18 -07:00
parent 7b581b4753
commit 079a6f4e30
2 changed files with 2 additions and 4 deletions

View file

@ -292,7 +292,7 @@
var loc = this.get2DCursorLocation(index);
if (!this._getLineStyle(loc.lineIndex)) {
this._setLineStyle(loc.lineIndex, {})
this._setLineStyle(loc.lineIndex, {});
}
if (!this._getStyleDeclaration(loc.lineIndex, loc.charIndex)) {

View file

@ -208,9 +208,7 @@
charOffset = charOffset || 0;
for (var i = 0; i < text.length; i++) {
decl = this._getStyleDeclaration(lineIndex, i + charOffset);
if (decl) {
if (this.styles && this.styles[lineIndex] && (decl = this.styles[lineIndex][i + charOffset])) {
ctx.save();
width += this._applyCharStylesGetWidth(ctx, text[i], lineIndex, i, decl);
ctx.restore();