summaryrefslogtreecommitdiffstats
path: root/src/style-internal.cpp
diff options
context:
space:
mode:
authorLiam P. White <inkscapebrony@gmail.com>2014-09-27 14:17:45 +0000
committerLiam P. White <inkscapebrony@gmail.com>2014-09-27 14:17:45 +0000
commitfa9bd6393f316dab9303569b28f6b5d179fedd61 (patch)
tree33df00632f850a6f117978c36145feeac05f1a4c /src/style-internal.cpp
parentUpdate to experimental r13527 (diff)
downloadinkscape-fa9bd6393f316dab9303569b28f6b5d179fedd61.tar.gz
inkscape-fa9bd6393f316dab9303569b28f6b5d179fedd61.zip
Update to experimental r13565
(bzr r13341.5.16)
Diffstat (limited to 'src/style-internal.cpp')
-rw-r--r--src/style-internal.cpp24
1 files changed, 24 insertions, 0 deletions
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 ) {