summaryrefslogtreecommitdiffstats
path: root/src/ui/tools/text-tool.cpp
diff options
context:
space:
mode:
authorTavmjong Bah <tavmjong@free.fr>2019-09-07 14:28:20 +0000
committerTavmjong Bah <tavmjong@free.fr>2019-09-07 14:28:20 +0000
commit5a1239565aeab46c53b36099c7d79c3b9a8b77bd (patch)
treea4fa4d9c69ff929916adf804a29377873bab9e27 /src/ui/tools/text-tool.cpp
parentUpdate 2geom (diff)
downloadinkscape-5a1239565aeab46c53b36099c7d79c3b9a8b77bd.tar.gz
inkscape-5a1239565aeab46c53b36099c7d79c3b9a8b77bd.zip
Write out 'x' and 'y' attribute values to repr when some text property value changes.
Changes to property values may cause text to be relayed out, changing 'x' and 'y' attributes on tspans with sodipodi:role="line". Fix for issue 234.
Diffstat (limited to 'src/ui/tools/text-tool.cpp')
-rw-r--r--src/ui/tools/text-tool.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/ui/tools/text-tool.cpp b/src/ui/tools/text-tool.cpp
index b8d66817b..f4a1be76a 100644
--- a/src/ui/tools/text-tool.cpp
+++ b/src/ui/tools/text-tool.cpp
@@ -1530,6 +1530,17 @@ bool TextTool::_styleSet(SPCSSAttr const *css)
return false; // will get picked up by the parent and applied to the whole text object
sp_te_apply_style(this->text, this->text_sel_start, this->text_sel_end, css);
+
+ // This is a bandaid fix... whenever a style is changed it might cause the text layout to
+ // change which requires rewriting the 'x' and 'y' attributes of the tpsans for Inkscape
+ // multi-line text (with sodipodi:role="line"). We need to rewrite the repr after this is
+ // done. rebuldLayout() will be called a second time unnecessarily.
+ SPText* sptext = dynamic_cast<SPText*>(text);
+ if (sptext) {
+ sptext->rebuildLayout();
+ sptext->updateRepr();
+ }
+
DocumentUndo::done(this->desktop->getDocument(), SP_VERB_CONTEXT_TEXT,
_("Set text style"));
sp_text_context_update_cursor(this);