summaryrefslogtreecommitdiffstats
path: root/src/sp-text.cpp
diff options
context:
space:
mode:
authorLiam P. White <inkscapebrony@gmail.com>2014-08-08 15:04:56 +0000
committerLiam P. White <inkscapebrony@gmail.com>2014-08-08 15:04:56 +0000
commitca8023872ae0d9f7b99688502b9bdba232ec5627 (patch)
tree73092b0aa6ea3e697da66d1d6316d3a2d78a4f3e /src/sp-text.cpp
parentUpdate to experimental r13440 (diff)
parentSmall tweak to bbox calculation (diff)
downloadinkscape-ca8023872ae0d9f7b99688502b9bdba232ec5627.tar.gz
inkscape-ca8023872ae0d9f7b99688502b9bdba232ec5627.zip
Update to experimental r13464
(bzr r13341.5.14)
Diffstat (limited to 'src/sp-text.cpp')
-rw-r--r--src/sp-text.cpp36
1 files changed, 31 insertions, 5 deletions
diff --git a/src/sp-text.cpp b/src/sp-text.cpp
index bbc7ec43d..3bb1e16d0 100644
--- a/src/sp-text.cpp
+++ b/src/sp-text.cpp
@@ -70,8 +70,6 @@ namespace {
# SPTEXT
#####################################################*/
SPText::SPText() : SPItem() {
- //new (&this->layout) Inkscape::Text::Layout;
- //new (&this->attributes) TextTagAttributes;
}
SPText::~SPText() {
@@ -84,19 +82,22 @@ void SPText::build(SPDocument *doc, Inkscape::XML::Node *repr) {
this->readAttr( "dy" );
this->readAttr( "rotate" );
+ // SVG 2 Auto wrapped text
+ this->readAttr( "width" );
+ this->readAttr( "height" );
+
SPItem::build(doc, repr);
this->readAttr( "sodipodi:linespacing" ); // has to happen after the styles are read
}
void SPText::release() {
- //this->attributes.~TextTagAttributes();
- //this->layout.~Layout();
-
SPItem::release();
}
void SPText::set(unsigned int key, const gchar* value) {
+ //std::cout << "SPText::set: " << sp_attribute_name( key ) << ": " << (value?value:"Null") << std::endl;
+
if (this->attributes.readSingleAttribute(key, value)) {
this->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG);
} else {
@@ -114,6 +115,22 @@ void SPText::set(unsigned int key, const gchar* value) {
this->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG | SP_TEXT_LAYOUT_MODIFIED_FLAG);
break;
+ case SP_ATTR_WIDTH:
+ if (!this->width.read(value) || this->width.value < 0.0) {
+ this->width.unset();
+ }
+
+ this->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG);
+ break;
+
+ case SP_ATTR_HEIGHT:
+ if (!this->height.read(value) || this->height.value < 0.0) {
+ this->height.unset();
+ }
+
+ this->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG);
+ break;
+
default:
SPItem::set(key, value);
break;
@@ -278,6 +295,7 @@ Inkscape::XML::Node *SPText::write(Inkscape::XML::Document *xml_doc, Inkscape::X
}
this->attributes.writeTo(repr);
+ this->rebuildLayout(); // copied from update(), see LP Bug 1339305
// deprecated attribute, but keep it around for backwards compatibility
if (this->style->line_height.set && !this->style->line_height.inherit && !this->style->line_height.normal && this->style->line_height.unit == SP_CSS_UNIT_PERCENT) {
@@ -288,6 +306,14 @@ Inkscape::XML::Node *SPText::write(Inkscape::XML::Document *xml_doc, Inkscape::X
this->getRepr()->setAttribute("sodipodi:linespacing", NULL);
}
+ // SVG 2 Auto-wrapped text
+ if( this->width.computed > 0.0 ) {
+ sp_repr_set_svg_double(repr, "width", this->width.computed);
+ }
+ if( this->height.computed > 0.0 ) {
+ sp_repr_set_svg_double(repr, "height", this->height.computed);
+ }
+
SPItem::write(xml_doc, repr, flags);
return repr;