From f5f51938f72359dd9a48036be62730a881cfb670 Mon Sep 17 00:00:00 2001 From: Andrea Bogazzi Date: Sat, 26 Mar 2016 12:42:03 +0100 Subject: [PATCH 1/4] add check for this.styles[i] --- src/shapes/itext.class.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/shapes/itext.class.js b/src/shapes/itext.class.js index b7c0ceb75d0..d7575b376f5 100644 --- a/src/shapes/itext.class.js +++ b/src/shapes/itext.class.js @@ -879,6 +879,16 @@ } }, + /** + * This function is a TEMPORARY fix before restyling svg export + * and tspan generation + * @param {Number} lineIndex + * @private + */ + hasStyleOnLine: function(lineIndex) { + return this.styles[lineIndex]; + }, + /** * @param {Number} lineIndex * @param {Number} charIndex From 55da566d3731ebfd2b0660655ed8bc0d1e39a674 Mon Sep 17 00:00:00 2001 From: Andrea Bogazzi Date: Sat, 26 Mar 2016 12:44:11 +0100 Subject: [PATCH 2/4] Update textbox.class.js --- src/shapes/textbox.class.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/shapes/textbox.class.js b/src/shapes/textbox.class.js index 8e2ada9fd84..226e10e2b4f 100644 --- a/src/shapes/textbox.class.js +++ b/src/shapes/textbox.class.js @@ -131,6 +131,23 @@ return map; }, + /** + * This function is a TEMPORARY fix before restyling svg export + * and tspan generation + * @param {Number} lineIndex + * @private + */ + hasStyleOnLine: function(lineIndex) { + if (this._styleMap) { + var map = this._styleMap[lineIndex]; + if (!map) { + return null; + } + lineIndex = map.line; + } + return this.styles[lineIndex]; + }, + /** * @param {Number} lineIndex * @param {Number} charIndex From 0785bd9a320b27e9e3c3ce959503b13b01530c26 Mon Sep 17 00:00:00 2001 From: Andrea Bogazzi Date: Sat, 26 Mar 2016 12:47:20 +0100 Subject: [PATCH 3/4] check properly if there is style on the line --- src/mixins/itext.svg_export.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mixins/itext.svg_export.js b/src/mixins/itext.svg_export.js index 5b7f83debe5..3017d4ea58b 100644 --- a/src/mixins/itext.svg_export.js +++ b/src/mixins/itext.svg_export.js @@ -9,7 +9,7 @@ * @private */ _setSVGTextLineText: function(lineIndex, textSpans, height, textLeftOffset, textTopOffset, textBgRects) { - if (!this.styles[lineIndex]) { + if (!this.hasStyleOnLine(lineIndex)) { fabric.Text.prototype._setSVGTextLineText.call(this, lineIndex, textSpans, height, textLeftOffset, textTopOffset); } From e3e8984ec9bb1ae83da5a7a0491d723ba6dadbdd Mon Sep 17 00:00:00 2001 From: Andrea Bogazzi Date: Sat, 26 Mar 2016 13:00:37 +0100 Subject: [PATCH 4/4] fixes trailing spaces --- src/shapes/textbox.class.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/shapes/textbox.class.js b/src/shapes/textbox.class.js index 226e10e2b4f..0142b2c0e70 100644 --- a/src/shapes/textbox.class.js +++ b/src/shapes/textbox.class.js @@ -147,7 +147,7 @@ } return this.styles[lineIndex]; }, - + /** * @param {Number} lineIndex * @param {Number} charIndex