Help needed in fixing line positioning bug.

Hi,
I've found a problem with line positioning in text objects after a line is deleted. When I first saw this bug I though I might have introduced it with my recent work on text but it turns out that it predates the work. In any case I've investigated the bug and have narrowed down the problem but I don't know how to fix it.
Here is how to reproduce the bug:
1. Create some multiline text. 2. Remove one of the middle lines including the new line character. 3. Save the file then look at it in a web browser or with the XML Editor. The lines will be shifted down one unit of line-height.
Here is what I have found:
When you delete a new-line:
sp_te_delete calls delete_line_break and then te_update_layout_now. The latter calls SPText::rebuildLayout() which loops over the tspans, calling tspan->attributes.setFirstXY(anchor_point). The values of anchor_point are correct and Inkscape displays the tpans correctly but the x and y attributes as shown by the XML Editor are not updated. It is as if the x and y attributes are being updated in a copy of the tspans. What needs to be done to get the tspans in the tree update correctly?
Tav

When you delete a new-line:
sp_te_delete calls delete_line_break and then te_update_layout_now. The latter calls SPText::rebuildLayout() which loops over the tspans, calling tspan->attributes.setFirstXY(anchor_point). The values of anchor_point are correct and Inkscape displays the tpans correctly but the x and y attributes as shown by the XML Editor are not updated. It is as if the x and y attributes are being updated in a copy of the tspans. What needs to be done to get the tspans in the tree update correctly?
Fixed in r9840. Any other editing operation after the deletion would have fixed up the repr, which is why we never noticed the problem before.
R.

On Thu, 2010-10-21 at 19:09 +0100, Richard Hughes wrote:
When you delete a new-line:
sp_te_delete calls delete_line_break and then te_update_layout_now. The latter calls SPText::rebuildLayout() which loops over the tspans, calling tspan->attributes.setFirstXY(anchor_point). The values of anchor_point are correct and Inkscape displays the tpans correctly but the x and y attributes as shown by the XML Editor are not updated. It is as if the x and y attributes are being updated in a copy of the tspans. What needs to be done to get the tspans in the tree update correctly?
Fixed in r9840. Any other editing operation after the deletion would have fixed up the repr, which is why we never noticed the problem before.
Thanks!! I've backported it to 0.48.
Tav
participants (2)
-
Richard Hughes
-
Tavmjong Bah