Bug 420471

Summary: SVG Text tool loses whitespace when the run of similarly-formatted text is only whitespace
Product: [Applications] krita Reporter: Chris Morgan <me>
Component: Tool/TextAssignee: Krita Bugs <krita-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: ahab.greybeard, alvin, hellozee
Priority: NOR    
Version: 4.2.9   
Target Milestone: ---   
Platform: Microsoft Windows   
OS: Microsoft Windows   
Latest Commit: Version Fixed In:

Description Chris Morgan 2020-04-23 17:06:21 UTC
SUMMARY
SVG Text tool loses whitespace when the run of similarly-formatted text is only whitespace

STEPS TO REPRODUCE
1. Open the SVG Text tool and end up in the Edit Text window.
2. Enter two words, separated by a space.
3. Make the first word bold.
4. Make the second word bold.
5. Switch to the SVG Source tab.
6. Switch back to the Rich text tab.

Alternatively for steps 2–5, go to the SVG Source tab and paste one of these sets of markup:

    <text><tspan x="0"><tspan style="font-weight:600">one</tspan> <tspan style="font-weight:600">two</tspan></text>

    <text>one<tspan style="fill:red"> </tspan>two</text>

OBSERVED RESULT
The space is lost.

EXPECTED RESULT
The space should be preserved.

SOFTWARE/OS VERSIONS
Windows 10.0.19041, 64-bit

ADDITIONAL INFORMATION
I tried to work around this by using a non-breaking space, adding xml:space="preserve", wrapping the text node in <tspan>, with or without formatting. None of these worked; all that works is putting the space in with another run of formatted text.
Comment 1 Ahab Greybeard 2020-04-24 11:17:53 UTC
I've noticed that multiple spaces, entered in the text editor or the SVG editor are converted to single spaces after saving and reopening.
Comment 2 Alvin Wong 2023-08-08 19:13:33 UTC
Fixed by https://invent.kde.org/graphics/krita/-/merge_requests/1885