aboutsummaryrefslogtreecommitdiff
path: root/src/styleengine.cc
diff options
context:
space:
mode:
authorJohannes Hofmann <Johannes.Hofmann@gmx.de>2009-10-18 17:18:22 +0200
committerJohannes Hofmann <Johannes.Hofmann@gmx.de>2009-10-18 17:18:22 +0200
commit58e8cc02ca27066eb514eae6dcbfbfe8060eaeaa (patch)
tree56ef7564bc668d7d5addc9b3ddb8ce88ca2a345a /src/styleengine.cc
parent2a77f76cbd4d6136953893437d67fe752a751361 (diff)
limit letter-spacing values
Diffstat (limited to 'src/styleengine.cc')
-rw-r--r--src/styleengine.cc9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/styleengine.cc b/src/styleengine.cc
index e266b0d1..8636a8a0 100644
--- a/src/styleengine.cc
+++ b/src/styleengine.cc
@@ -316,7 +316,14 @@ void StyleEngine::apply (StyleAttrs *attrs, CssPropertyList *props) {
computeValue (&fontAttrs.letterSpacing, p->value.intVal,
parentFont, parentFont->size);
}
- // TODO
+
+ /* Limit letterSpacing to reasonable values to avoid overflows e.g,
+ * when measuring word width.
+ */
+ if (fontAttrs.letterSpacing > 1000)
+ fontAttrs.letterSpacing = 1000;
+ else if (fontAttrs.letterSpacing < -1000)
+ fontAttrs.letterSpacing = -1000;
break;
default:
break;