From 6e6f02781d83e07fb9b77c9e307cf59b63a65e17 Mon Sep 17 00:00:00 2001 From: Andrea Bogazzi Date: Sat, 2 Mar 2019 14:18:58 +0100 Subject: [PATCH 1/3] sofarsomething,where iwas? --- src/shapes/circle.class.js | 2 +- src/shapes/textbox.class.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/shapes/circle.class.js b/src/shapes/circle.class.js index 2cc6a72bd6d..25039a47c3c 100644 --- a/src/shapes/circle.class.js +++ b/src/shapes/circle.class.js @@ -106,7 +106,7 @@ '\n' + '" ', 'COMMON_PARTS', ' />\n' ]; } return svgString; diff --git a/src/shapes/textbox.class.js b/src/shapes/textbox.class.js index 34b2a54f533..372b4552f0c 100644 --- a/src/shapes/textbox.class.js +++ b/src/shapes/textbox.class.js @@ -127,7 +127,7 @@ charCount++; realLineCount++; } - else if (this._reSpaceAndTab.test(textInfo.graphemeText[charCount]) && i > 0) { + else if (!this.graphemeSplit && this._reSpaceAndTab.test(textInfo.graphemeText[charCount]) && i > 0) { // this case deals with space's that are removed from end of lines when wrapping realLineCharCount++; charCount++; @@ -349,7 +349,7 @@ lineWidth += additionalSpace; } - if (!lineJustStarted) { + if (!lineJustStarted && !splitByGrapheme) { line.push(infix); } line = line.concat(word); From bd6c3ba0eaeb4cfb2f20f44b1fdc3101e8c76f5a Mon Sep 17 00:00:00 2001 From: Andrea Bogazzi Date: Sat, 2 Mar 2019 14:25:04 +0100 Subject: [PATCH 2/3] removed-word-joiners --- 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 372b4552f0c..9c269a4fd5c 100644 --- a/src/shapes/textbox.class.js +++ b/src/shapes/textbox.class.js @@ -68,7 +68,7 @@ * Use this regular expression to split strings in breakable lines * @private */ - _wordJoiners: /[ \t\r\u200B\u200C]/, + _wordJoiners: /[ \t\r]/, /** * Use this boolean property in order to split strings that have no white space concept. From 7749451b3e2f8a8b48ac394d91e26daebc26e01b Mon Sep 17 00:00:00 2001 From: Andrea Bogazzi Date: Sat, 2 Mar 2019 14:36:16 +0100 Subject: [PATCH 3/3] fix tests --- test/unit/circle.js | 4 ++-- test/unit/textbox.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/test/unit/circle.js b/test/unit/circle.js index ddbb9103c78..b75234b1e85 100644 --- a/test/unit/circle.js +++ b/test/unit/circle.js @@ -150,8 +150,8 @@ var circle = new fabric.Circle({ width: 100, height: 100, radius: 10, endAngle: Math.PI }); var svg = circle.toSVG(); var svgClipPath = circle.toClipPathSVG(); - assert.equal(svg, '\n\n\n'); - assert.equal(svgClipPath, '\t\n', 'half circle as clipPath'); + assert.equal(svg, '\n\n\n'); + assert.equal(svgClipPath, '\t\n', 'half circle as clipPath'); }); QUnit.test('fromElement', function(assert) { diff --git a/test/unit/textbox.js b/test/unit/textbox.js index 9a60129edc0..2adeb11363f 100644 --- a/test/unit/textbox.js +++ b/test/unit/textbox.js @@ -131,7 +131,7 @@ assert.equal(textbox.textLines[0], 'xa', 'first line match expectations spacing 800'); }); QUnit.test('wrapping with different things', function(assert) { - var textbox = new fabric.Textbox('xa\u200Bxb\u200Bxc\u200Cxd\u200Cxe ya yb id', { + var textbox = new fabric.Textbox('xa xb\txc\rxd xe ya yb id', { width: 16, }); assert.equal(textbox.textLines[0], 'xa', '0 line match expectations');