diff options
author | Johannes Hofmann <Johannes.Hofmann@gmx.de> | 2009-10-18 17:18:22 +0200 |
---|---|---|
committer | Johannes Hofmann <Johannes.Hofmann@gmx.de> | 2009-10-18 17:18:22 +0200 |
commit | 58e8cc02ca27066eb514eae6dcbfbfe8060eaeaa (patch) | |
tree | 56ef7564bc668d7d5addc9b3ddb8ce88ca2a345a /src/styleengine.cc | |
parent | 2a77f76cbd4d6136953893437d67fe752a751361 (diff) |
limit letter-spacing values
Diffstat (limited to 'src/styleengine.cc')
-rw-r--r-- | src/styleengine.cc | 9 |
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; |