summaryrefslogtreecommitdiffstats
path: root/src/svg/qsvghandler.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/svg/qsvghandler.cpp')
-rw-r--r--src/svg/qsvghandler.cpp33
1 files changed, 32 insertions, 1 deletions
diff --git a/src/svg/qsvghandler.cpp b/src/svg/qsvghandler.cpp
index bf19a88..c17ca7a 100644
--- a/src/svg/qsvghandler.cpp
+++ b/src/svg/qsvghandler.cpp
@@ -1282,8 +1282,39 @@ static void parseFont(QSvgNode *node,
fontStyle->setFamily(attributes.fontFamily.toString().trimmed());
if (!attributes.fontSize.isEmpty() && attributes.fontSize != QT_INHERIT) {
+ // TODO: Support relative sizes 'larger' and 'smaller'.
QSvgHandler::LengthType dummy; // should always be pixel size
- fontStyle->setSize(parseLength(attributes.fontSize.toString(), dummy, handler));
+ qreal size = 0;
+ static const qreal sizeTable[] = { qreal(6.9), qreal(8.3), qreal(10.0), qreal(12.0), qreal(14.4), qreal(17.3), qreal(20.7) };
+ enum AbsFontSize { XXSmall, XSmall, Small, Medium, Large, XLarge, XXLarge };
+ switch (attributes.fontSize.at(0).unicode()) {
+ case 'x':
+ if (attributes.fontSize == QLatin1String("xx-small"))
+ size = sizeTable[XXSmall];
+ else if (attributes.fontSize == QLatin1String("x-small"))
+ size = sizeTable[XSmall];
+ else if (attributes.fontSize == QLatin1String("x-large"))
+ size = sizeTable[XLarge];
+ else if (attributes.fontSize == QLatin1String("xx-large"))
+ size = sizeTable[XXLarge];
+ break;
+ case 's':
+ if (attributes.fontSize == QLatin1String("small"))
+ size = sizeTable[Small];
+ break;
+ case 'm':
+ if (attributes.fontSize == QLatin1String("medium"))
+ size = sizeTable[Medium];
+ break;
+ case 'l':
+ if (attributes.fontSize == QLatin1String("large"))
+ size = sizeTable[Large];
+ break;
+ default:
+ size = parseLength(attributes.fontSize.toString(), dummy, handler);
+ break;
+ }
+ fontStyle->setSize(size);
}
if (!attributes.fontStyle.isEmpty() && attributes.fontStyle != QT_INHERIT) {