diff --git a/src/sp-text.cpp b/src/sp-text.cpp
index 3bbb3b89263d55e0fcc91c14c4d3eccda0bb7c39..d1105ac2065987e817fa3a709e2c3e17558ac516 100644 (file)
--- a/src/sp-text.cpp
+++ b/src/sp-text.cpp
#include "mod360.h"
#include "sp-textpath.h"
+#include "sp-tref.h"
#include "sp-tspan.h"
#include "text-editing.h"
sp_item_invoke_bbox(text, &paintbox, NR::identity(), TRUE);
for (SPItemView* v = text->display; v != NULL; v = v->next) {
text->_clearFlow(NR_ARENA_GROUP(v->arenaitem));
+ nr_arena_group_set_style(NR_ARENA_GROUP(v->arenaitem), SP_OBJECT_STYLE(object));
// pass the bbox of the text object as paintbox (used for paintserver fills)
text->layout.show(NR_ARENA_GROUP(v->arenaitem), &paintbox);
}
guint cflags = (flags & SP_OBJECT_MODIFIED_CASCADE);
if (flags & SP_OBJECT_MODIFIED_FLAG) cflags |= SP_OBJECT_PARENT_MODIFIED_FLAG;
+ // FIXME: all that we need to do here is nr_arena_glyphs_[group_]set_style, to set the changed
+ // style, but there's no easy way to access the arena glyphs or glyph groups corresponding to a
+ // text object. Therefore we do here the same as in _update, that is, destroy all arena items
+ // and create new ones. This is probably quite wasteful.
+ if (flags & ( SP_OBJECT_STYLE_MODIFIED_FLAG )) {
+ SPText *text = SP_TEXT (object);
+ NRRect paintbox;
+ sp_item_invoke_bbox(text, &paintbox, NR::identity(), TRUE);
+ for (SPItemView* v = text->display; v != NULL; v = v->next) {
+ text->_clearFlow(NR_ARENA_GROUP(v->arenaitem));
+ nr_arena_group_set_style(NR_ARENA_GROUP(v->arenaitem), SP_OBJECT_STYLE(object));
+ text->layout.show(NR_ARENA_GROUP(v->arenaitem), &paintbox);
+ }
+ }
+
/* Create temporary list of children */
GSList *l = NULL;
SPObject *child;
SPText *text = SP_TEXT (object);
if (flags & SP_OBJECT_WRITE_BUILD) {
+ Inkscape::XML::Document *xml_doc = sp_document_repr_doc(SP_OBJECT_DOCUMENT(object));
if (!repr)
- repr = sp_repr_new ("svg:text");
+ repr = xml_doc->createElement("svg:text");
GSList *l = NULL;
for (SPObject *child = sp_object_first_child(object) ; child != NULL ; child = SP_OBJECT_NEXT(child) ) {
Inkscape::XML::Node *crepr = NULL;
if (SP_IS_STRING(child)) {
- crepr = sp_repr_new_text(SP_STRING(child)->string.c_str());
+ crepr = xml_doc->createTextNode(SP_STRING(child)->string.c_str());
} else {
crepr = child->updateRepr(NULL, flags);
}
@@ -361,6 +379,8 @@ sp_text_show(SPItem *item, NRArena *arena, unsigned /* key*/, unsigned /*flags*/
NRArenaGroup *flowed = NRArenaGroup::create(arena);
nr_arena_group_set_transparent (flowed, FALSE);
+ nr_arena_group_set_style(flowed, group->style);
+
// pass the bbox of the text object as paintbox (used for paintserver fills)
NRRect paintbox;
sp_item_invoke_bbox(item, &paintbox, NR::identity(), TRUE);
n = g_strdup(_("<no name found>"));
}
- GString *xs = SP_PX_TO_METRIC_STRING(style->font_size.computed, SP_DT_NAMEDVIEW(SP_ACTIVE_DESKTOP)->getDefaultMetric());
+ GString *xs = SP_PX_TO_METRIC_STRING(style->font_size.computed, sp_desktop_namedview(SP_ACTIVE_DESKTOP)->getDefaultMetric());
char *ret = ( SP_IS_TEXT_TEXTPATH(item)
? g_strdup_printf(_("<b>Text on path</b> (%s, %s)"), n, xs->str)
@@ -497,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);
@@ -600,6 +623,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))