Extension bug at creating text elements

Bug #276456 reported by Karlisson
2
Affects Status Importance Assigned to Milestone
Inkscape
Invalid
Low
Unassigned

Bug Description

I have tested the following tutorial http://wiki.inkscape.org/wiki/index.php/PythonEffectTutorial on 0.46 in Ubuntu Hardy and noticed that when I create a new text element and try to edit and press ENTER to insert a newline, I can't. It just creates new tspan's with no text inside. The cursor doesn't even move. It happens only on dynamic created texts with Python extensions.

Revision history for this message
Karlisson (karlisson) wrote :
Karlisson (karlisson)
description: updated
Revision history for this message
Aaron C Spike (acspike) wrote :

There are definitely some weird behaviors here. Everytime I hit enter it duplicates the text contents horizontally (ignoring new lines). Very weird.

The tutorial is technically correct. Because it isn't doing multiple lines placing text directly in the <text/> element is sufficient. I don't know how Inkscape should properly behave when making a new line in a raw <text/> element. Perhaps we should place the current line into a tspan and add another.

Thanks for the report.

Revision history for this message
Karlisson (karlisson) wrote :

Update:

As you said at #inkscape, adding "sodipodi:role = line" solves the problem. But when the extension runs, I get the warning:

hello_world.py:
TagNameWarning: Tag names must not contain ':', lxml 2.0 will enforce well-formed tag names as required by the XML specification.
  tspan.set("sodipodi:role", "line")

Plus, the extension dialog doesn't close. (Like all the others)

What should I do?

Revision history for this message
jazzynico (jazzynico) wrote :

Still present in rev. 21789.

Changed in inkscape:
importance: Undecided → Low
status: New → Confirmed
jazzynico (jazzynico)
tags: added: extensions-plugins svg text
Revision history for this message
su_v (suv-lp) wrote :

> I don't know how Inkscape should properly behave
> when making a new line in a raw <text/> element.

Proposing to link as duplicate to:
- Bug #167904 "Incorrect handling of <text> without <tspan>”
  <https://bugs.launchpad.net/inkscape/+bug/167904>

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

Related later reports (same symptom: <tspan> representing a line without editing information (sodipodi:role="line")):
* Bug #366744 “Multi-line text object in plain SVG behaves strangely after re-opening”
* Bug #1514050 “Cannot type newline in text objects”

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

For extension authors:
adding an attribute in a custom namespace can use 'addNS()' from inkex.py, e.g.:

        mytext = inkex.etree.Element(inkex.addNS('text','svg'))
        myline = inkex.etree.SubElement(mytext, inkex.addNS('tspan', 'svg'))
        myline.set(inkex.addNS('role', 'sodipodi'), "line")

Revision history for this message
Patrick Storz (ede123) wrote :

Closing in favour of migrated bug #167904.

Closed by: https://gitlab.com/ede123
Moved to: https://gitlab.com/inkscape/inbox/issues/248

Patrick Storz (ede123)
tags: added: bug-migration
Patrick Storz (ede123)
Changed in inkscape:
status: Confirmed → 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.