diff --git a/src/core/text/TextMetrics.js b/src/core/text/TextMetrics.js index c4f32e1..904f4e6 100644 --- a/src/core/text/TextMetrics.js +++ b/src/core/text/TextMetrics.js @@ -106,6 +106,7 @@ // Greedy wrapping algorithm that will wrap words as the line grows longer // than its horizontal bounds. let result = ''; + const firstChar = text.charAt(0); const lines = text.split('\n'); const wordWrapWidth = style.wordWrapWidth; const characterCache = {}; @@ -142,7 +143,7 @@ } else { - if (c === 0) + if (c === 0 && (j > 0 || firstChar === ' ')) { result += ' '; }