diff --git a/src/style/CharacterStyle.js b/src/style/CharacterStyle.js index b42e0055..8a4ec85c 100644 --- a/src/style/CharacterStyle.js +++ b/src/style/CharacterStyle.js @@ -43,7 +43,7 @@ var CharacterStyle = this.CharacterStyle = PathStyle.extend(/** @lends Character font: 'sans-serif' }), _owner: TextItem, - _style: 'style', + _style: 'style' /** * CharacterStyle objects don't need to be created directly. Just pass an @@ -74,5 +74,9 @@ var CharacterStyle = this.CharacterStyle = PathStyle.extend(/** @lends Character // Override leading to return fontSize * 1.2 by default, when undefined var leading = this.base(); return leading != null ? leading : this.getFontSize() * 1.2; + }, + + getFontStyle: function() { + return this._fontSize + 'px ' + this._font; } }); diff --git a/src/text/PointText.js b/src/text/PointText.js index f3ced038..d31089c9 100644 --- a/src/text/PointText.js +++ b/src/text/PointText.js @@ -72,7 +72,7 @@ var PointText = this.PointText = TextItem.extend(/** @lends PointText# */{ if (!this._content) return; this._setStyles(ctx); - ctx.font = this.getFontSize() + 'px ' + this.getFont(); + ctx.font = style.getFontStyle(); ctx.textAlign = this.getJustification(); var leading = this.getLeading(); for (var i = 0, l = this._lines.length; i < l; i++) { @@ -97,7 +97,7 @@ var PointText = this.PointText = TextItem.extend(/** @lends PointText# */{ x = 0; // Measure the real width of the text. Unfortunately, there is no // sane way to measure text height with canvas - context.font = this.getFontSize() + 'px ' + this.getFont(); + context.font = this._style.getFontStyle(); var width = 0; for (var i = 0, l = this._lines.length; i < l; i++) width = Math.max(width, context.measureText(