summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/object/sp-text.cpp1
-rw-r--r--src/ui/tools/text-tool.cpp11
2 files changed, 12 insertions, 0 deletions
diff --git a/src/object/sp-text.cpp b/src/object/sp-text.cpp
index ee020ab54..f42a694f0 100644
--- a/src/object/sp-text.cpp
+++ b/src/object/sp-text.cpp
@@ -846,6 +846,7 @@ void SPText::rebuildLayout()
Inkscape::Text::Layout::iterator iter = layout.sourceToIterator(tspan);
Geom::Point anchor_point = layout.chunkAnchorPoint(iter);
tspan->attributes.setFirstXY(anchor_point);
+ // repr needs to be updated but if we do it here we get a loop.
}
}
}
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);