diff options
author | Olivier Goffart <ogoffart@trolltech.com> | 2009-11-02 13:49:33 (GMT) |
---|---|---|
committer | Olivier Goffart <ogoffart@trolltech.com> | 2009-11-02 14:08:28 (GMT) |
commit | 8d01f436451071a917c147a96a979ccdaee106f9 (patch) | |
tree | 43972bf16252189e05969ff5c6c6b97edf9f2b54 /src | |
parent | e6da35f6055d3ae7acf38d89456d3047f055a9cd (diff) | |
download | Qt-8d01f436451071a917c147a96a979ccdaee106f9.zip Qt-8d01f436451071a917c147a96a979ccdaee106f9.tar.gz Qt-8d01f436451071a917c147a96a979ccdaee106f9.tar.bz2 |
QCSSParser: Fixes the way spaces are handled in font family.
We cannot simplify spaces because a font may have several spaces in
its name.
If we only add spaces when needed when merging tokens, we don't need
to simplyfy the string later
The CSS tokenizer will already make sure that spaces are removed if
there is no quotes (btw, the CSS specification says that there must
be quotes if there is spaces, but we tollerate if there is no quotes)
Reviewed-by: Jocelyn Turcotte
Task-number: QTBUG-4344
Task-number: 258586
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/text/qcssparser.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/gui/text/qcssparser.cpp b/src/gui/text/qcssparser.cpp index 6db86bd..93b9fc6 100644 --- a/src/gui/text/qcssparser.cpp +++ b/src/gui/text/qcssparser.cpp @@ -1129,19 +1129,22 @@ static bool setFontWeightFromValue(const Value &value, QFont *font) static bool setFontFamilyFromValues(const QVector<Value> &values, QFont *font, int start = 0) { QString family; + bool shouldAddSpace = false; for (int i = start; i < values.count(); ++i) { const Value &v = values.at(i); if (v.type == Value::TermOperatorComma) { family += QLatin1Char(','); + shouldAddSpace = false; continue; } const QString str = v.variant.toString(); if (str.isEmpty()) break; + if (shouldAddSpace) + family += QLatin1Char(' '); family += str; - family += QLatin1Char(' '); + shouldAddSpace = true; } - family = family.simplified(); if (family.isEmpty()) return false; font->setFamily(family); |