aboutsummaryrefslogtreecommitdiff
path: root/src/styleengine.cc
diff options
context:
space:
mode:
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;