summaryrefslogtreecommitdiff
path: root/src/svg/qsvgstyle.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/svg/qsvgstyle.cpp')
-rw-r--r--src/svg/qsvgstyle.cpp42
1 files changed, 11 insertions, 31 deletions
diff --git a/src/svg/qsvgstyle.cpp b/src/svg/qsvgstyle.cpp
index f36dda8..d425923 100644
--- a/src/svg/qsvgstyle.cpp
+++ b/src/svg/qsvgstyle.cpp
@@ -54,14 +54,14 @@
QT_BEGIN_NAMESPACE
QSvgExtraStates::QSvgExtraStates()
- : fillOpacity(1.0)
- , strokeOpacity(1.0)
- , svgFont(0)
- , textAnchor(Qt::AlignLeft)
- , fontWeight(400)
- , fillRule(Qt::WindingFill)
- , strokeDashOffset(0)
- , vectorEffect(false)
+ : fillOpacity(1.0),
+ strokeOpacity(1.0),
+ svgFont(0),
+ textAnchor(Qt::AlignLeft),
+ fontWeight(QFont::Normal),
+ fillRule(Qt::WindingFill),
+ strokeDashOffset(0),
+ vectorEffect(false)
{
}
@@ -199,26 +199,6 @@ QSvgFontStyle::QSvgFontStyle()
{
}
-int QSvgFontStyle::SVGToQtWeight(int weight) {
- switch (weight) {
- case 100:
- case 200:
- return QFont::Light;
- case 300:
- case 400:
- return QFont::Normal;
- case 500:
- case 600:
- return QFont::DemiBold;
- case 700:
- case 800:
- return QFont::Bold;
- case 900:
- return QFont::Black;
- }
- return QFont::Normal;
-}
-
void QSvgFontStyle::apply(QPainter *p, const QSvgNode *, QSvgExtraStates &states)
{
m_oldQFont = p->font();
@@ -246,13 +226,13 @@ void QSvgFontStyle::apply(QPainter *p, const QSvgNode *, QSvgExtraStates &states
if (m_weightSet) {
if (m_weight == BOLDER) {
- states.fontWeight = qMin(states.fontWeight + 100, 900);
+ states.fontWeight = qMin(states.fontWeight + 100, static_cast<int>(QFont::Black));
} else if (m_weight == LIGHTER) {
- states.fontWeight = qMax(states.fontWeight - 100, 100);
+ states.fontWeight = qMax(states.fontWeight - 100, static_cast<int>(QFont::Thin));
} else {
states.fontWeight = m_weight;
}
- font.setWeight(SVGToQtWeight(states.fontWeight));
+ font.setWeight(QFont::Weight(states.fontWeight));
}
p->setFont(font);