[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    branches/work/koffice-essen/libs/kotext/styles
From:       Sebastian Sauer <mail () dipe ! org>
Date:       2010-11-29 22:13:03
Message-ID: 20101129221303.4D004AC8A3 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1202166 by sebsauer:

be more rubust against invalid fixed values too

 M  +10 -6     KoParagraphStyle.cpp  


--- branches/work/koffice-essen/libs/kotext/styles/KoParagraphStyle.cpp #1202165:1202166
@@ -1111,16 +1111,20 @@
     QString lineHeight(styleStack.property(KoXmlNS::fo, "line-height"));
     if (!lineHeight.isEmpty()) {
         if (lineHeight != "normal") {
-            if (lineHeight.indexOf('%') > -1) { // percent value
+            if (lineHeight.indexOf('%') > -1) { // percent value is between 50% and 200%
                 bool ok;
-                int v = lineHeight.remove('%').toInt(&ok);
-                if (ok && v > 0)
-                    setLineHeightPercent(v);
+                const int percent = lineHeight.remove('%').toInt(&ok);
+                if (ok && percent >= 0) {
+                    setLineHeightPercent(percent);
             }
-            else  { // fixed value
-                setLineHeightAbsolute(KoUnit::parseValue(lineHeight));
             }
+            else  { // fixed value is between 0.0201in and 3.9402in
+                const qreal value = KoUnit::parseValue(lineHeight, -1.0);
+                if (value >= 0.0) {
+                    setLineHeightAbsolute(value);
         }
+            }
+        }
         else
             normalLineHeight = true;
     }
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic