Extension : Split text - fails with "words" option

Bug #1576761 reported by Alex Farlie
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Inkscape
Invalid
Undecided
Unassigned

Bug Description

The error data:-

Traceback (most recent call last):
  File "split.py", line 218, in <module>
    b.affect()

  File "C:\Program Files\Inkscape\share\extensions\inkex.py", line 268, in affect
    self.effect()

  File "split.py", line 205, in effect
    nodes = self.split_words(node)

  File "split.py", line 118, in split_words
    x = float(line.get("x"))
ValueError: invalid literal for float(): 0 5.2558823 7.8840184 39.74427 45.000153 47.628288

Revision history for this message
Alex Farlie (afarlie) wrote :
Revision history for this message
Alex Farlie (afarlie) wrote :

The example file is converted from an EPS supplied to me ( Seemingly under the terms of the UK Open Government license).

Alex Farlie (afarlie)
tags: added: extensions-plugins text
Revision history for this message
Alex Farlie (afarlie) wrote :

Having done a quick test it seems that the script becomes confused by manual kerning arrangements!

Revision history for this message
Alex Farlie (afarlie) wrote :

Looking at the error, the "fix" may be to process an array of character values rather than a single one?

Revision history for this message
Alex Farlie (afarlie) wrote :

I've been asked to provide some additional context.

Open the attached file in Inkscape...

Click down through the group hierarchy to select the text consisting of "2.5" below the first diagram.

Ungroup it and the ungrouped object should select as 'text'

Select Extensions->Split Text and click Apply.

At this point the error noted at the start of this thread will occur.

What seems to be happening (from the error generated) is that the script is expecting a single float value ( being the initial text baseline.) and is becoming confused when it gets a number of space separated values, causing the script to fail.

Revision history for this message
Alex Farlie (afarlie) wrote :
Download full text (4.1 KiB)

Closing (as original filer) , on the basis that following a disscussion in #inkscape it was felt by another contributor that the original file might be the cause of the problem.

Attaching disscusion-
ShakespeareFan00 Apparently the extennsions script is confused by 'manual kern data'
 ShakespeareFan00 If I remove the manual kerning it works
 ShakespeareFan00
 Mc- can you edit the description to add a few words of context ? ^^
 ShakespeareFan00 Mc: Read the bug
 ShakespeareFan00 but noted
 Mc- I have read
 ShakespeareFan00 Ah.
 Mc- And my reaction was "WTF is this about"
 Mc- then I inferred "probably some extension" fron the fact it's python
 Mc- and now it's "we probably have a "split word" extension which is probably supposed to split text"
 ShakespeareFan00 Mc: Added some additional context
 Mc- thx
 Mc- was the file generated with inkscape ?
 ShakespeareFan00 Nope
 ShakespeareFan00 Imported EPS
 ShakespeareFan00 And I've not been able to reproduce the same issue with manuallly kerned text I've generated directly in Inkscape
 Mc- because inkscape never generates several values for x and y
 Mc- it uses dx and dy
 ShakespeareFan00 That's what I thought was why the script was filing to process the split properly
 ShakespeareFan00 (and may be an issue with the original EPS in any event, as i suspect the original is from something like Adobe)
 Mc- what do you want to do, ultimately ?
 Mc- (ie: why split?)
 ShakespeareFan00 Mc: The text is dimensional data
 ShakespeareFan00 There should ideally be one text item per dimensional value
 ShakespeareFan00 At present in the test file atttached to the bug that's not the case
 Mc- I don't think the extension could possibly work anyway
 ShakespeareFan00 Also ,( In looking at the file low level) I've found that it's doing something weird in that soething that should be two items (Like the "2.5" dimensions under the first diagram comes up as a text string of "2.52.5"
 Mc- because the text data is "2.52.5"
 ShakespeareFan00 Yeah
 Mc- and the files gives an offset for every letter individually
 Mc- there is no way the extension will "guess" that there are two words
 ShakespeareFan00 Mc: which isn't good, because that's potentially going to break when the file renders elsewhere
 Mc- if fixed, it will treat that as 6 words
 Mc- ('2','.','5','2','.','5')
 Mc- which might not be ideal
 ShakespeareFan00 Mc: I've filed a seperate bug asking for a 'enhanced” text split where I can specify the point in the string to split...
 ShakespeareFan00 ina dialog
 ShakespeareFan00 Do you think the "2.52.5" issue is a problem in the original EPS?
 Mc- definitely
 ShakespeareFan00 Or is it going to be a problem with the import process?
 Mc- there is no way the import process will take separate text elements and just put them together with offetting individual letters
 ShakespeareFan00 Mc: So you are saying that the tool the UK Government ( which was the source of the original EPS) is nominally broken for the use case I am trying to apply
 ShakespeareFan00 (I.E It does something Inkscape doesn't, and which is making it harder to re-use the file:)
 ShakespeareFan00 You are welcome to close the bug on the basis of the "This...

Read more...

Changed in inkscape:
status: New → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

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