diff options
| author | Liam P. White <inkscapebrony@gmail.com> | 2014-07-30 15:53:05 +0000 |
|---|---|---|
| committer | Liam P. White <inkscapebrony@gmail.com> | 2014-07-30 15:53:05 +0000 |
| commit | 5281d66b1a85e8f203c71798305f838fa3089dc2 (patch) | |
| tree | cc3c8c61428eaa7308db24ee6c5b1c9c2fa5c2d3 /src/sp-text.cpp | |
| parent | Refactoring of linejoin code (diff) | |
| parent | Update to trunk r13482 (diff) | |
| download | inkscape-5281d66b1a85e8f203c71798305f838fa3089dc2.tar.gz inkscape-5281d66b1a85e8f203c71798305f838fa3089dc2.zip | |
Update to experimental r13452
(bzr r13090.1.95)
Diffstat (limited to 'src/sp-text.cpp')
| -rw-r--r-- | src/sp-text.cpp | 36 |
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; |
