summaryrefslogtreecommitdiffstats
path: root/src/sp-text.cpp
diff options
context:
space:
mode:
authorTavmjong Bah <tavmjong@free.fr>2014-07-30 08:31:31 +0000
committertavmjong-free <tavmjong@free.fr>2014-07-30 08:31:31 +0000
commitb7ebc313abd7f6aa501370d58ba54e6169e4218e (patch)
tree779a7b4b4f1cce041cffd987d530e4222f930ebe /src/sp-text.cpp
parentFix a bug pointed by su_v on fillet-chamfer open paths (diff)
downloadinkscape-b7ebc313abd7f6aa501370d58ba54e6169e4218e.tar.gz
inkscape-b7ebc313abd7f6aa501370d58ba54e6169e4218e.zip
Read CSS Text 3 'white-space' property, SVG 2 <text> 'width', 'height' attributes.
(bzr r13341.1.110)
Diffstat (limited to 'src/sp-text.cpp')
-rw-r--r--src/sp-text.cpp30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/sp-text.cpp b/src/sp-text.cpp
index ccc5adf59..3bb1e16d0 100644
--- a/src/sp-text.cpp
+++ b/src/sp-text.cpp
@@ -82,6 +82,10 @@ 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
@@ -92,6 +96,8 @@ void SPText::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 {
@@ -109,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;
@@ -284,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;