From b39deb401d5d34abceb5ee8caad920b70d734205 Mon Sep 17 00:00:00 2001 From: Jabiertxof Date: Wed, 4 Sep 2019 21:38:00 +0200 Subject: fixx flowbox on SVG2 mode using tspans --- src/object/sp-text.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src/object') diff --git a/src/object/sp-text.cpp b/src/object/sp-text.cpp index f42a694f0..7035d78b2 100644 --- a/src/object/sp-text.cpp +++ b/src/object/sp-text.cpp @@ -838,10 +838,13 @@ void SPText::rebuildLayout() #endif // set the x,y attributes on role:line spans + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + bool svg2text = prefs->getBool("/tools/text/use_svg2"); for (auto& child: children) { if (SP_IS_TSPAN(&child)) { SPTSpan *tspan = SP_TSPAN(&child); - if ( (tspan->role != SP_TSPAN_ROLE_UNSPECIFIED) + if (!svg2text && + (tspan->role != SP_TSPAN_ROLE_UNSPECIFIED) && tspan->attributes.singleXYCoordinates() ) { Inkscape::Text::Layout::iterator iter = layout.sourceToIterator(tspan); Geom::Point anchor_point = layout.chunkAnchorPoint(iter); @@ -1112,12 +1115,17 @@ SPItem *create_text_with_rectangle (SPDesktop *desktop, Geom::Point p0, Geom::Po sp_repr_css_set(text_repr, css, "style"); sp_repr_css_attr_unref(css); + /* Create */ + Inkscape::XML::Node *rtspan = xml_doc->createElement("svg:tspan"); + rtspan->setAttribute("sodipodi:role", "line"); // otherwise, why bother creating the tspan? Inkscape::XML::Node *text_node = xml_doc->createTextNode(""); - text_repr->appendChild(text_node); + rtspan->appendChild(text_node); + text_repr->appendChild(rtspan); SPItem *item = dynamic_cast(desktop->currentLayer()); g_assert(item != nullptr); + Inkscape::GC::release(rtspan); Inkscape::GC::release(text_repr); Inkscape::GC::release(text_node); Inkscape::GC::release(defs_repr); -- cgit v1.2.3