diff options
| author | su_v <suv-sf@users.sourceforge.net> | 2014-09-25 09:35:59 +0000 |
|---|---|---|
| committer | ~suv <suv-sf@users.sourceforge.net> | 2014-09-25 09:35:59 +0000 |
| commit | ea10837f7a960bb9b914df1f25798c0b3e1da60f (patch) | |
| tree | 18cf55bd22a8104c8578f1fcb1f966390599e043 /src | |
| parent | osx-build.sh: sync with osxmenu (whitespace, formatting) (diff) | |
| parent | Fix for #1334792. Correct inheritance for 'line-height' property. (diff) | |
| download | inkscape-ea10837f7a960bb9b914df1f25798c0b3e1da60f.tar.gz inkscape-ea10837f7a960bb9b914df1f25798c0b3e1da60f.zip | |
update to trunk (r13564)
(bzr r13506.1.107)
Diffstat (limited to 'src')
| -rw-r--r-- | src/desktop-style.cpp | 4 | ||||
| -rw-r--r-- | src/extension/extension.cpp | 9 | ||||
| -rw-r--r-- | src/sp-item-group.cpp | 10 | ||||
| -rw-r--r-- | src/style-internal.cpp | 24 | ||||
| -rw-r--r-- | src/style-internal.h | 2 |
5 files changed, 43 insertions, 6 deletions
diff --git a/src/desktop-style.cpp b/src/desktop-style.cpp index f6347e5c0..bfd662c9a 100644 --- a/src/desktop-style.cpp +++ b/src/desktop-style.cpp @@ -1011,8 +1011,8 @@ objects_query_fontnumbers (GSList *objects, SPStyle *style_res) } else if (style->line_height.unit == SP_CSS_UNIT_PERCENT || style->font_size.computed == 0) { linespacing_current = style->line_height.value; linespacing_normal = false; - } else { // we need % here - linespacing_current = style->line_height.computed / style->font_size.computed; + } else { + linespacing_current = style->line_height.computed; linespacing_normal = false; } linespacing += linespacing_current; diff --git a/src/extension/extension.cpp b/src/extension/extension.cpp index 06e35ff3e..6a22eb585 100644 --- a/src/extension/extension.cpp +++ b/src/extension/extension.cpp @@ -112,8 +112,13 @@ Extension::Extension (Inkscape::XML::Node * in_repr, Implementation::Implementat _deps.push_back(new Dependency(child_repr)); } /* dependency */ if (!strcmp(chname, "script")) { - _deps.push_back(new Dependency(child_repr->firstChild())); - } /* check command as a dependency (see LP #505920) */ + for (Inkscape::XML::Node *child = child_repr->firstChild(); child != NULL ; child = child->next()) { + if (child->type() == Inkscape::XML::ELEMENT_NODE) { + _deps.push_back(new Dependency(child)); + break; + } /* skip non-element nodes (see LP #1372200) */ + } + } /* check command as a dependency (see LP #505920) */ if (!strcmp(chname, "options")) { silent = !strcmp( child_repr->attribute("silent"), "true" ); } diff --git a/src/sp-item-group.cpp b/src/sp-item-group.cpp index a24056630..b65be8f22 100644 --- a/src/sp-item-group.cpp +++ b/src/sp-item-group.cpp @@ -680,7 +680,15 @@ void SPGroup::scaleChildItemsRec(Geom::Scale const &sc, Geom::Point const &p, bo SPItem *item = NULL; if (SP_ITEM(o)->clip_ref->getObject()) { item = SP_ITEM(SP_ITEM(o)->clip_ref->getObject()->firstChild()); - } else if (SP_ITEM(o)->mask_ref->getObject()) { + } + if (item != NULL) { + Geom::Affine tdoc2dt = Geom::Scale(1, -1) * Geom::Translate(p); // re-create doc2dt() + Geom::Affine ti2doc = SP_ITEM(o)->i2doc_affine(); + item->set_i2d_affine(ti2doc * sc * ti2doc.inverse() * tdoc2dt); + item->doWriteTransform(item->getRepr(), item->transform, NULL, true); + } + item = NULL; + if (SP_ITEM(o)->mask_ref->getObject()) { item = SP_ITEM(SP_ITEM(o)->mask_ref->getObject()->firstChild()); } if (item != NULL) { diff --git a/src/style-internal.cpp b/src/style-internal.cpp index 2212f8fff..a55a11403 100644 --- a/src/style-internal.cpp +++ b/src/style-internal.cpp @@ -287,6 +287,14 @@ SPILength::read( gchar const *str ) { /* Percentage */ unit = SP_CSS_UNIT_PERCENT; value = value * 0.01; + if (name.compare( "line-height" ) == 0) { + // See: http://www.w3.org/TR/CSS2/visudet.html#propdef-line-height + if( style ) { + computed = value * style->font_size.computed; + } else { + computed = value * SPIFontSize::font_size_default; + } + } } else { /* Invalid */ return; @@ -355,6 +363,7 @@ void SPILength::cascade( const SPIBase* const parent ) { if( const SPILength* p = dynamic_cast<const SPILength*>(parent) ) { if( (inherits && !set) || inherit ) { + unit = p->unit; value = p->value; computed = p->computed; } else { @@ -365,6 +374,9 @@ SPILength::cascade( const SPIBase* const parent ) { } else if (unit == SP_CSS_UNIT_EX) { // FIXME: Get x height from libnrtype or pango. computed = value * em * 0.5; + } else if (unit == SP_CSS_UNIT_PERCENT && name.compare( "line-height" ) == 0 ) { + // Special case + computed = value * em; } } } else { @@ -469,6 +481,18 @@ SPILengthOrNormal::write( guint const flags, SPIBase const *const base) const { } void +SPILengthOrNormal::cascade( const SPIBase* const parent ) { + if( const SPILengthOrNormal* p = dynamic_cast<const SPILengthOrNormal*>(parent) ) { + if( (inherits && !set) || inherit ) { + normal = p->normal; + } + SPILength::cascade( parent ); + } else { + std::cerr << "SPILengthOrNormal::cascade(): Incorrect parent type" << std::endl; + } +} + +void SPILengthOrNormal::merge( const SPIBase* const parent ) { if( const SPILengthOrNormal* p = dynamic_cast<const SPILengthOrNormal*>(parent) ) { if( inherits ) { diff --git a/src/style-internal.h b/src/style-internal.h index e76f9faaf..69784199c 100644 --- a/src/style-internal.h +++ b/src/style-internal.h @@ -315,7 +315,7 @@ class SPILengthOrNormal : public SPILength { virtual const Glib::ustring write( guint const flags = SP_STYLE_FLAG_IFSET, SPIBase const *const base = NULL ) const; virtual void clear() { SPILength::clear(); normal = true; }; - // virtual void cascade( const SPIBase* const parent ); // Use SPILength::cascade + virtual void cascade( const SPIBase* const parent ); virtual void merge( const SPIBase* const parent ); SPILengthOrNormal& operator=(const SPILengthOrNormal& rhs) { |
