Bug 396408

Summary: Resets SVG source manual correction [UI]
Product: [Applications] krita Reporter: valkiria_dan
Component: Tool/TextAssignee: Krita Bugs <krita-bugs-null>
Status: CONFIRMED ---    
Severity: normal CC: eoinoneill1991, freebox64, halla, tamtamy.tymona
Priority: NOR Keywords: investigated, triaged
Version: 4.1.0   
Target Milestone: ---   
Platform: Microsoft Windows   
OS: Microsoft Windows   
Latest Commit: Version Fixed In:
Attachments: (Video example)

Description valkiria_dan 2018-07-11 14:17:09 UTC
I've edit svg by pasting some extra elements like stroke and it worked well untill i've decided to edit text once again. Everything in this field was reset to defaults
Comment 1 Halla Rempt 2018-07-12 09:09:06 UTC
Could you please paste your svg in a comment on this bug?
Comment 2 valkiria_dan 2018-07-25 09:10:33 UTC
(In reply to Boudewijn Rempt from comment #1)
> Could you please paste your svg in a comment on this bug?

<text style="font-family:Spectral; font-size:72pt; font-size-adjust:0.166667; font-weight:600; fill:none; stroke:#e7cb8f; stroke-width:4">
    <tspan x="0">МЕРТВЫЕ</tspan>
</text>
Comment 3 Eoin O'Neill 2018-09-15 23:08:20 UTC
CONFIRMED
Application Version: Master
System Info: Ubuntu 18.04 bionic (Linux)

Procedure:
In edit SVG text, paste the following SVG code:
<text style="font-family:Spectral; font-size:72pt; font-size-adjust:0.166667; font-weight:600; fill:none; stroke:#e7cb8f; stroke-width:4">
    <tspan x="0">МЕРТВЫЕ</tspan>
</text>

Click save and the text should update. Either close the window and edit text again or switch between Rich Text and SVG Source. After doing so, the following code will instead exist:

<text style="font-family:Spectral; font-size:72pt; font-size-adjust:0.473684; font-weight:600; fill:#000000">
    <tspan x="0">МЕРТВЫЕ</tspan>
</text>

Changing the order of the parameters (fill last, for instance) will not change the behavior.

Thoughts: 
This bug is likely caused by missing keys or values within the SVG Source serialization.
Comment 4 Dmitry Kazakov 2018-09-27 13:58:07 UTC
Git commit be8023f4545b910a978a51aa456046f501f54bf7 by Dmitry Kazakov.
Committed on 27/09/2018 at 13:57.
Pushed by dkazakov into branch 'master'.

Save the preferred text editing mode (richtext/svg) in .kra file

Now text shapes can save the mode they were created in. Therefore one
will not lose information because of auto-richtext-conversion when
editing the text next time

M  +7    -1    libs/flake/svg/SvgParser.cpp
M  +17   -1    libs/flake/text/KoSvgTextChunkShape.cpp
M  +14   -0    libs/flake/text/KoSvgTextChunkShape.h
M  +1    -0    libs/flake/text/KoSvgTextChunkShape_p.h
M  +8    -2    plugins/tools/svgtexttool/SvgTextChangeCommand.cpp
M  +3    -1    plugins/tools/svgtexttool/SvgTextChangeCommand.h
M  +16   -6    plugins/tools/svgtexttool/SvgTextEditor.cpp
M  +2    -2    plugins/tools/svgtexttool/SvgTextEditor.h
M  +3    -3    plugins/tools/svgtexttool/SvgTextTool.cpp
M  +1    -1    plugins/tools/svgtexttool/SvgTextTool.h

https://commits.kde.org/krita/be8023f4545b910a978a51aa456046f501f54bf7
Comment 5 mvowada 2018-10-15 09:07:10 UTC
Created attachment 115653 [details]
(Video example)

(Reopening (see video). SVG source code resets after switching to Rich Text)
Comment 6 Tiar 2020-09-09 14:17:17 UTC
Note: I can fix unneeded conversions (especially SVG -> rich text, which is lossy) when there was no change from the user on "the other side", but in case when the user makes a change on the rich editor side, it cannot really keep original svg.
Comment 7 Halla Rempt 2020-09-09 14:19:24 UTC
Yes, that's simply not possible. Maybe we should show a warning.