diff options
| author | Jabiertxof <jabier.arraiza@marker.es> | 2019-09-04 19:38:00 +0000 |
|---|---|---|
| committer | Jabier Arraiza <jabier.arraiza@marker.es> | 2019-09-07 21:48:33 +0000 |
| commit | b39deb401d5d34abceb5ee8caad920b70d734205 (patch) | |
| tree | bd3134ff6873e1ed7e684e026d9f748ce3b23617 /src/object/sp-text.cpp | |
| parent | Add Text direction icons (diff) | |
| download | inkscape-b39deb401d5d34abceb5ee8caad920b70d734205.tar.gz inkscape-b39deb401d5d34abceb5ee8caad920b70d734205.zip | |
fixx flowbox on SVG2 mode using tspans
Diffstat (limited to 'src/object/sp-text.cpp')
| -rw-r--r-- | src/object/sp-text.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
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 <tspan> */ + 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<SPItem *>(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); |
