From 3e75f63c7b3a880b656894a6a656f361306f397f Mon Sep 17 00:00:00 2001 From: kangax Date: Fri, 25 Oct 2013 11:06:58 +0200 Subject: [PATCH] Refactor iText again --- src/shapes/itext.class.js | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/src/shapes/itext.class.js b/src/shapes/itext.class.js index ed83d690..6a141d96 100644 --- a/src/shapes/itext.class.js +++ b/src/shapes/itext.class.js @@ -1607,8 +1607,23 @@ ? styleDeclaration.stroke.toLive(ctx) : styleDeclaration.stroke; } + ctx.lineWidth = styleDeclaration.strokeWidth || this.strokeWidth; + this._applyFontStyles(styleDeclaration); + + if (typeof styleDeclaration.shadow === 'string') { + styleDeclaration.shadow = new fabric.Shadow(styleDeclaration.shadow); + } + + this._setShadow.call(styleDeclaration, ctx); + + ctx.font = this._getFontDeclaration.call(styleDeclaration); + + return ctx.measureText(_char).width; + }, + + _applyFontStyles: function(styleDeclaration) { if (!styleDeclaration.fontFamily) { styleDeclaration.fontFamily = this.fontFamily; } @@ -1621,15 +1636,6 @@ if (!styleDeclaration.fontStyle) { styleDeclaration.fontStyle = this.fontStyle; } - if (typeof styleDeclaration.shadow === 'string') { - styleDeclaration.shadow = new fabric.Shadow(styleDeclaration.shadow); - } - - this._setShadow.call(styleDeclaration, ctx); - - ctx.font = this._getFontDeclaration.call(styleDeclaration); - - return ctx.measureText(_char).width; }, /**