From 8e1a538a6e849c905e0222312f67c826e3599757 Mon Sep 17 00:00:00 2001 From: Matthew Cattell Date: Wed, 23 Mar 2011 16:37:43 +0100 Subject: [PATCH] patched svghandler.cpp and svgstyle_p.h --- src/svg/qsvghandler.cpp | 50 +++++++++++++++++++++++++++++++++------------- src/svg/qsvgstyle_p.h | 38 ++++++++++++++++++++++------------- 2 files changed, 60 insertions(+), 28 deletions(-) diff --git a/src/svg/qsvghandler.cpp b/src/svg/qsvghandler.cpp index 9698860..924be96 100644 --- a/src/svg/qsvghandler.cpp +++ b/src/svg/qsvghandler.cpp @@ -1,17 +1,17 @@ /**************************************************************************** ** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** ** This file is part of the QtSvg module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -25,16 +25,16 @@ ** rights. These rights are described in the Nokia Qt LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** ** If you have questions regarding the use of this file, please contact ** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** ** $QT_END_LICENSE$ ** ****************************************************************************/ @@ -1269,6 +1269,27 @@ static void parseFont(QSvgNode *node, return; QSvgTinyDocument *doc = node->document(); + +#if 1 + //JGE PATCH BEGIN + //try to find an already existing style + QSvgFontStyle *fontStyle = static_cast(node->styleProperty(QSvgStyleProperty::FONT)); + if (!fontStyle) { + //if not, create new svgFontStyle + fontStyle = new QSvgFontStyle; + } + + if (!attributes.fontFamily.isEmpty()) { + //try to create a new svgFont + QSvgFont * svgFont = doc->svgFont(attributes.fontFamily.toString()); + if (svgFont) { + //set this SvgFont and the document + fontStyle->setSvgFontAndDoc(svgFont, doc); + } + } + //JGE PATCH END +#else + QSvgFontStyle *fontStyle = 0; if (!attributes.fontFamily.isEmpty()) { QSvgFont *svgFont = doc->svgFont(attributes.fontFamily.toString()); @@ -1277,6 +1298,7 @@ static void parseFont(QSvgNode *node, } if (!fontStyle) fontStyle = new QSvgFontStyle; +#endif if (!attributes.fontFamily.isEmpty() && attributes.fontFamily != QT_INHERIT) fontStyle->setFamily(attributes.fontFamily.toString().trimmed()); diff --git a/src/svg/qsvgstyle_p.h b/src/svg/qsvgstyle_p.h index e53ab48..0304132 100644 --- a/src/svg/qsvgstyle_p.h +++ b/src/svg/qsvgstyle_p.h @@ -1,17 +1,17 @@ /**************************************************************************** ** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** ** This file is part of the QtSvg module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -25,16 +25,16 @@ ** rights. These rights are described in the Nokia Qt LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** ** If you have questions regarding the use of this file, please contact ** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** ** $QT_END_LICENSE$ ** ****************************************************************************/ @@ -334,6 +334,16 @@ public: virtual void revert(QPainter *p, QSvgExtraStates &states); virtual Type type() const; + //JGE PATCH BEGIN + #if 1 + void setSvgFontAndDoc(QSvgFont *font, QSvgTinyDocument *doc) + { + m_svgFont=font; + m_doc=doc; + } + #endif + //JGE PATCH END + void setSize(qreal size) { // Store the _pixel_ size in the font. Since QFont::setPixelSize() only takes an int, call -- 1.7.4.msysgit.0