summaryrefslogtreecommitdiffstats
path: root/src/svg/qsvghandler.cpp
diff options
context:
space:
mode:
authorMorten Engvoldsen <morten.engvoldsen@nokia.com>2010-10-06 11:12:30 (GMT)
committerMorten Engvoldsen <morten.engvoldsen@nokia.com>2010-10-06 11:12:30 (GMT)
commiteaef6f8b4a7ad637a59b4fe2ec623d26a7cae96f (patch)
tree4868b097a6e1d5814ae557c464f70c879ffd8e9d /src/svg/qsvghandler.cpp
parentfe0319a84082cb97a2007ca82af153a785a0938e (diff)
parent24c89f6d1c090ab670d4f883d06cd0413c2ecc65 (diff)
downloadQt-eaef6f8b4a7ad637a59b4fe2ec623d26a7cae96f.zip
Qt-eaef6f8b4a7ad637a59b4fe2ec623d26a7cae96f.tar.gz
Qt-eaef6f8b4a7ad637a59b4fe2ec623d26a7cae96f.tar.bz2
Merge branch '4.7' of git@scm.dev.nokia.troll.no:qt/qt-doc-team into 4.7
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) {