summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndy Shaw <andy.shaw@qt.io>2020-02-18 21:43:41 +0100
committerAndy Shaw <andy.shaw@qt.io>2020-03-10 08:08:08 +0100
commit92ae8746c412fbc87a97364eb4d86e470009f80d (patch)
tree1bb4a721b0e811001392620813ee420043c0426c /src
parent45530ad4c5c6d3e90fe6d5a63f3bb551f37ad917 (diff)
downloadqtsvg-92ae8746c412fbc87a97364eb4d86e470009f80d.tar.gz
Strip the quotes around the font family
Due to changes in how QFont handles a family it should be given the whole string without quotes so it can find the family name correctly. Additionally, this changes it to use setFamilies instead of setFamily to make this more future-proof. Fixes: QTBUG-81926 Change-Id: I659950cf244c1f7a1a5dae6e7b0e136cfe274d47 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/svg/qsvghandler.cpp9
-rw-r--r--src/svg/qsvgstyle.cpp2
-rw-r--r--src/svg/qsvgstyle_p.h2
3 files changed, 8 insertions, 5 deletions
diff --git a/src/svg/qsvghandler.cpp b/src/svg/qsvghandler.cpp
index 86ca77e..afdecdc 100644
--- a/src/svg/qsvghandler.cpp
+++ b/src/svg/qsvghandler.cpp
@@ -1361,9 +1361,12 @@ static void parseFont(QSvgNode *node,
}
if (!fontStyle)
fontStyle = new QSvgFontStyle;
-
- if (!attributes.fontFamily.isEmpty() && attributes.fontFamily != QT_INHERIT)
- fontStyle->setFamily(attributes.fontFamily.toString().trimmed());
+ if (!attributes.fontFamily.isEmpty() && attributes.fontFamily != QT_INHERIT) {
+ QString family = attributes.fontFamily.toString().trimmed();
+ if (family.at(0) == QLatin1Char('\'') || family.at(0) == QLatin1Char('\"'))
+ family = family.mid(1, family.length() - 2);
+ fontStyle->setFamily(family);
+ }
if (!attributes.fontSize.isEmpty() && attributes.fontSize != QT_INHERIT) {
// TODO: Support relative sizes 'larger' and 'smaller'.
diff --git a/src/svg/qsvgstyle.cpp b/src/svg/qsvgstyle.cpp
index c4edd25..6abedf3 100644
--- a/src/svg/qsvgstyle.cpp
+++ b/src/svg/qsvgstyle.cpp
@@ -232,7 +232,7 @@ void QSvgFontStyle::apply(QPainter *p, const QSvgNode *, QSvgExtraStates &states
QFont font = m_oldQFont;
if (m_familySet) {
states.svgFont = m_svgFont;
- font.setFamily(m_qfont.family());
+ font.setFamilies(m_qfont.families());
}
if (m_sizeSet)
diff --git a/src/svg/qsvgstyle_p.h b/src/svg/qsvgstyle_p.h
index 9d616d4..a8fb5ee 100644
--- a/src/svg/qsvgstyle_p.h
+++ b/src/svg/qsvgstyle_p.h
@@ -348,7 +348,7 @@ public:
void setFamily(const QString &family)
{
- m_qfont.setFamily(family);
+ m_qfont.setFamilies({family});
m_familySet = 1;
}