From 565e7ce41556baea14e7b2349afdd099ebdda420 Mon Sep 17 00:00:00 2001 From: buliabyak Date: Sun, 29 Jul 2007 05:27:33 +0000 Subject: [PATCH] now this is the correct way to avoid nested updates, instead of the hack i recently removed from sptspan set method --- src/sp-text.cpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/sp-text.cpp b/src/sp-text.cpp index d1105ac20..cc575d99f 100644 --- a/src/sp-text.cpp +++ b/src/sp-text.cpp @@ -587,8 +587,7 @@ void SPText::rebuildLayout() if (!tspan->attributes.singleXYCoordinates()) continue; Inkscape::Text::Layout::iterator iter = layout.sourceToIterator(tspan); NR::Point anchor_point = layout.chunkAnchorPoint(iter); - sp_repr_set_svg_double(SP_OBJECT_REPR(tspan), "x", anchor_point[NR::X]); - sp_repr_set_svg_double(SP_OBJECT_REPR(tspan), "y", anchor_point[NR::Y]); + tspan->attributes.setFirstXY(anchor_point); } } @@ -725,6 +724,19 @@ NR::Point TextTagAttributes::firstXY() const return point; } +void TextTagAttributes::setFirstXY(NR::Point &point) +{ + SVGLength zero_length; + zero_length = 0.0; + + if (attributes.x.empty()) + attributes.x.resize(1, zero_length); + if (attributes.y.empty()) + attributes.y.resize(1, zero_length); + attributes.x[0].computed = point[NR::X]; + attributes.y[0].computed = point[NR::Y]; +} + void TextTagAttributes::mergeInto(Inkscape::Text::Layout::OptionalTextTagAttrs *output, Inkscape::Text::Layout::OptionalTextTagAttrs const &parent_attrs, unsigned parent_attrs_offset, bool copy_xy, bool copy_dxdyrotate) const { mergeSingleAttribute(&output->x, parent_attrs.x, parent_attrs_offset, copy_xy ? &attributes.x : NULL); -- 2.30.2