X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=src%2Fsp-text.cpp;h=1c677edb2d7c014a0b689e557e7be8bf1ef38c5a;hb=84e5676034b77e63dbc43746cec0a8b48fd06f7c;hp=5c2c5412c3bd8e606876b70d6c8e6d3cd2dab666;hpb=3caca4f8381f7ae35678d16074c2414c02a0c0ff;p=inkscape.git diff --git a/src/sp-text.cpp b/src/sp-text.cpp index 5c2c5412c..1c677edb2 100644 --- a/src/sp-text.cpp +++ b/src/sp-text.cpp @@ -46,6 +46,7 @@ #include "mod360.h" #include "sp-textpath.h" +#include "sp-tref.h" #include "sp-tspan.h" #include "text-editing.h" @@ -355,7 +356,7 @@ sp_text_bbox(SPItem const *item, NRRect *bbox, NR::Matrix const &transform, unsi // Add stroke width SPStyle* style=SP_OBJECT_STYLE (item); - if (style->stroke.type != SP_PAINT_TYPE_NONE) { + if (!style->stroke.isNone()) { double const scale = expansion(transform); if ( fabs(style->stroke_width.computed * scale) > 0.01 ) { // sinon c'est 0=oon veut pas de bord double const width = MAX(0.125, style->stroke_width.computed * scale); @@ -516,6 +517,9 @@ unsigned SPText::_buildLayoutInput(SPObject *root, Inkscape::Text::Layout::Optio bool use_xy = !in_textpath && (tspan->role == SP_TSPAN_ROLE_UNSPECIFIED || !tspan->attributes.singleXYCoordinates()); tspan->attributes.mergeInto(&optional_attrs, parent_optional_attrs, parent_attrs_offset, use_xy, true); } + else if (SP_IS_TREF(root)) { + SP_TREF(root)->attributes.mergeInto(&optional_attrs, parent_optional_attrs, parent_attrs_offset, true, true); + } else if (SP_IS_TEXTPATH(root)) { in_textpath = true; SP_TEXTPATH(root)->attributes.mergeInto(&optional_attrs, parent_optional_attrs, parent_attrs_offset, false, true); @@ -583,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); } } @@ -619,6 +622,9 @@ void SPText::_adjustCoordsRecursive(SPItem *item, NR::Matrix const &m, double ex SP_TEXT(item)->attributes.transform(m, ex, ex, is_root); else if (SP_IS_TEXTPATH(item)) SP_TEXTPATH(item)->attributes.transform(m, ex, ex, is_root); + else if (SP_IS_TREF(item)) { + SP_TREF(item)->attributes.transform(m, ex, ex, is_root); + } for (SPObject *o = item->children; o != NULL; o = o->next) { if (SP_IS_ITEM(o)) @@ -718,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);