Skip to content

Fix Measurement tool's convert to item's text box

Nathan Lee requested to merge nathanal/inkscape:inkscape3412 into master

Correct text bounds provided by rebuildLayout, removed in b4fa18dd (from SPText::write). Re-adding for a rebuild on every write/update seems excessive, so just added as needed.

Fix #3412 (closed)

A grep for uses of createElement("svg:text") says we use it in:

  1. pdfinput/svg-builder.cpp (doesn't appear necessary)
  2. lpe-measure-segments.cpp (doesn't appear necessary)
  3. sp-flowtext.cpp (getAsText)
  4. sp-text.cpp
  5. text-chemistry.cpp (unflow, don't notice any obvious bugs with SVG 1.2 or 2 bugs, at least not ones fixed by re-adding rebuildLayout to SPText::write)
  6. measure tool
  7. text-tool.cpp (sp_text_context_setup_text, doesn't appear necessary. Purpose of removal was to speed up editing here anyway)

Tangential note:, now handled

while testing, I found that the following crashed debug builds (on master, not just this MR):

  1. create rectangle
  2. create text (e.g. R)
  3. clone
  4. clip rectangle to clone
  5. change text (e.g. change the R to a G)
  6. crash

The launchpad issue specifically mentions "Visual bounding box doesn't update as expected with these steps:" (and then the above steps to crash)

I tried re-adding the rebuildLayout to SPText::write, but that did not help for the bbox (in 1.2.x) or crash (here). Note, this issue was brought up after the issue was marked fixed, no one was claiming it was fixed. The lp bug (for the bbox being wrong before changing the text) has not returned.

Will open as issue hopefully tomorrow. I tried on another machine and didn't experience a crash. Will need to investigate more, perhaps it was a very recent change (it doesn't happen on 1.2.x) inbox#6976 (moved) new assert introduced this crash

Edited by Nathan Lee

Merge request reports