summaryrefslogtreecommitdiffstats
path: root/src/gui/text/qtexthtmlparser.cpp
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2019-06-20 13:07:04 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2019-07-03 13:21:14 +0200
commit6ff0614b61b8645ec7ca4ea40501a0b6719a92fd (patch)
tree7fb97c07398842e074329294348986745f1adb6b /src/gui/text/qtexthtmlparser.cpp
parent2021b36ebdbdd1da1595f281a694b54beb1b23a3 (diff)
Handle multiple font-families in <font> face attribute
This seems to be a common use case, and to be expected from pastes of MSWord documents. Change-Id: I5849d7f51408e76f15a0b03c2118649f118af1d6 Fixes: QTBUG-66794 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/gui/text/qtexthtmlparser.cpp')
-rw-r--r--src/gui/text/qtexthtmlparser.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/gui/text/qtexthtmlparser.cpp b/src/gui/text/qtexthtmlparser.cpp
index 895232e4c7..929db40e5d 100644
--- a/src/gui/text/qtexthtmlparser.cpp
+++ b/src/gui/text/qtexthtmlparser.cpp
@@ -1505,7 +1505,16 @@ void QTextHtmlParser::applyAttributes(const QStringList &attributes)
n -= 3;
node->charFormat.setProperty(QTextFormat::FontSizeAdjustment, n);
} else if (key == QLatin1String("face")) {
- node->charFormat.setFontFamily(value);
+ if (value.contains(QLatin1Char(','))) {
+ const QStringList values = value.split(QLatin1Char(','));
+ QStringList families;
+ for (const QString &family : values)
+ families << family.trimmed();
+ node->charFormat.setFontFamilies(families);
+ node->charFormat.setFontFamily(families.at(0));
+ } else {
+ node->charFormat.setFontFamily(value);
+ }
} else if (key == QLatin1String("color")) {
QColor c; c.setNamedColor(value);
if (!c.isValid())