Lone spaces removed when pasting text

Bug #1423522 reported by ken sands
26
This bug affects 4 people
Affects Status Importance Assigned to Milestone
Inkscape
Confirmed
Low
Unassigned

Bug Description

I occasionally use a lazy line space method, I add a blank line. if I add a space to that line I can select the space and change the font size to alter the line space to my liking.

I'd done this in one document, I wanted to copy the text, so I copy and paste. the text pastes ok but the spaces all reset to the overall font size, when I clicked in the text the "empty" lines had lost the space character. adding a space returned the spacing to how I'd set it. It seemed the font size had been remembered but the space itself had been removed.

To repeat:
Write three lines of text the middle line to contain just a single space.
select the space character and set the font size to 2. (the middle line will shrink down).
select the text object, copy and paste.
behold the object looks different! the middle line no longer contains a space.

Note: The whole font sizing thing is not necessary to show the bug however it shows a case where this behaviour is undesirable, without it the removal of spaces could almost be considered a feature.

Tags: clipboard text
Revision history for this message
su_v (suv-lp) wrote :

Please always include information about OS/platform and Inkscape version (see Inkscape menu 'Help > About Inkscape') in the bug description when filing new reports, thx.

Reproduced as described with Inkscape 0.48.5 r10040 and Inkscape 0.91 r13725 on OS X 10.7.5.

tags: added: clipboard
removed: copy paste spaces
Changed in inkscape:
status: New → Confirmed
Revision history for this message
su_v (suv-lp) wrote :

Possibly related earlier reports:
- Bug #254686 “formatting a space inside a text won't format but move the space”
- Bug #272100 “Space character gets deleted on font-size or font-style change”
- Bug #995819 “leading space characters in a text object are not font-sizeable indepentently”

Revision history for this message
ken sands (kensands) wrote :

My bad sorry, Windows 7 pro (64 bit), Inkscape 0.91pre3 r13670

I think you're right it's very likely the same issue in the code causing the #272100 bug, I had a search but didn't find that one, probably because I was searching on copy and paste terms. Either way this is repeatable and easy to test.

Revision history for this message
su_v (suv-lp) wrote :

Unlinked as duplicate from bug #272100 - the issue as originally reported in bug #272100 does actually not reproduce with Inkscape 0.91 (the space character is not deleted on font style change anymore), whereas the copy&paste problem as reported here still persists.

su_v (suv-lp)
Changed in inkscape:
importance: Undecided → Low
Revision history for this message
ken sands (kensands) wrote :

I've noticed the problem also occurs opening a previous svg, add spaces so the line spacing is correct, save the svg, open it in inkscape 0.91 and the spaces have been removed altering the appearance of the document. (I'm not sure if the change happens during the save of the svg or when it is loaded. The fact that this can substantially alter the appearance of a document should make it more important?

Revision history for this message
ken sands (kensands) wrote :

Examples attached, the eps is saved from inkscape with the spacing set correctly. saved it as eps and svg.

Opening the svg in Inkscape 0.91pre3 r13670 the spacing is broken resulting in text running off the page.

Revision history for this message
ken sands (kensands) wrote :

I've looked into the svg, it saves it fine, it's when it's loaded that the incorrect trimming is applied. Simple fix is don't automatically remove spaces when loading a file!

Revision history for this message
Mc (mc...) wrote :

Hi,
why testing with a prerelease version ?
(.91 r13725: opening the eps file and saving as svg gives a correct file that can be opened correctly (here) )

Revision history for this message
ken sands (kensands) wrote :

Tested with Inkscape 0.91 r13725, still the same.

Revision history for this message
ken sands (kensands) wrote :

Yes if you open the eps it's correct because when saving the eps each line is given it's position specifically.

in the svg its a block of text with different font sizes, when inkscape reads the svg it removes the space characters in turn removing the effect the font size has on the line height.

the svg in that zip should render the same as the eps. but in inkscape it doesn't.

Revision history for this message
ken sands (kensands) wrote :

If someone can give me a hint as to where I should look in the source code for the bit where it reads in the textflows from an svg I'll track this bug down however I've never worked on the inkscape code so right now I have no idea where to start looking.

Revision history for this message
Mc (mc...) wrote :

"the svg in that zip should render the same as the eps. "
-> what makes you say that ?
From the file, the file height is 1052px and the flowregion rect height is 1168 with two line breaks between each line, which does not seem to be the same as the eps file. Which steps did you take to obtain that file from the eps file ?

Revision history for this message
Mc (mc...) wrote :

> If someone can give me a hint as to where I should look in the source code for the bit where it reads in the textflows from an svg I'll track this bug down however I've never worked on the inkscape code so right now I have no idea where to start looking.

pasting and opening documents are handled by some code in src/file.cpp ; but the first place where i'd look for the cause of this bug is in src/text-editing.cpp which has a lot of tidy_operator_*** functions that may not preserve document appearance (i removed one a while ago)

Revision history for this message
ken sands (kensands) wrote :

I see your confusion. I didn't obtain the svg from the eps, I created the eps from inkscape from that svg.

when you open that svg in inkscape it removes the space characters from lines containing only space characters, when it does that it also messes up the formatting of the lines.

Try this.

Open the svg.
double click to edit the text.
go to each blank line and add a space character (at this point you will find some lines are set to a font size of 10 and the line spacing will jump around fitting everthing exactly as you see in the eps).
You document looks good. Now save the svg.
Open your saved svg...

Revision history for this message
Nick Viera (electromechanick) wrote :

*Workaround: Instead of using a "normal" space character, insert a Unicode space character, such as U+2003 which is the "EM SPACE (mutton)" character. Inkscape will not strip/remove these.

I'm also still experiencing this issue with multiline, flowed text in Inkscape 0.92.1 r15371 on Debian Stretch (Linux). Flowed textbox lines which contain a single blank space appear fine in the editor *until* the file is saved and re-opened in Inkscape. After re-opening, all lines that previously had a blank space no longer appear in the text box (they were stripped).

Each line of a flowed text box is represented in SVG by a node like <svg:flowPara id="flowPara7293">. The value of the line (in this case, the single space character) is added as content to this node. After re-loading the file, Inkscape strips out the lone space character, making the content of the node blank... which of course alters the presentation of the document without the author's consent.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.