Date: prev next · Thread: first prev next last
2012 Archives by date, by thread · List index


...because the text style gets some properties added after style id lookup. That leads to a stroke="none" and fill="none" style for a rectangle following a text element with identical style.

With this patch the rectangle gets its own styleid and is rendered correctly :-)

This is another step towards rendering coords-trans-03-t.svg as expected...next step: text placement.

Christina
From b4a26d95edee5591fcf3f434628d29d8b52f6923 Mon Sep 17 00:00:00 2001
From: "Chr. Rossmanith" <Chr.Rossmanith@gmx.de>
Date: Sun, 29 Apr 2012 22:12:29 +0200
Subject: [PATCH] SVG: text elements and graphic elements should not share
 style ids

---
 filter/source/svg/gfxtypes.hxx  |    8 ++++++--
 filter/source/svg/svgreader.cxx |    7 +++++++
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/filter/source/svg/gfxtypes.hxx b/filter/source/svg/gfxtypes.hxx
index 24c4cbd..daca2be 100644
--- a/filter/source/svg/gfxtypes.hxx
+++ b/filter/source/svg/gfxtypes.hxx
@@ -173,10 +173,11 @@ struct State
         maTransform(),
         maViewport(),
         maViewBox(),
+        mbIsText(false),
         maFontFamily(), // app-default
         mnFontSize(0),
-        maFontStyle(RTL_CONSTASCII_USTRINGPARAM("normal")),
-        maFontVariant(RTL_CONSTASCII_USTRINGPARAM("normal")),
+        maFontStyle("normal"),
+        maFontVariant("normal"),
         mnFontWeight(400.0),
         meTextAnchor(BEFORE),
         meTextDisplayAlign(BEFORE),
@@ -211,6 +212,7 @@ struct State
     basegfx::B2DRange           maViewport;
     basegfx::B2DRange           maViewBox;
 
+    bool                        mbIsText;
     rtl::OUString               maFontFamily;
     /** Absolute: xx-small=6.94 | x-small=8.33 | small=10 | medium=12 | large=14.4 | x-large=17.28 
| xx-large=20.736
 
@@ -263,6 +265,7 @@ inline bool operator==(const State& rLHS, const State& rRHS )
         rLHS.maTransform==rRHS.maTransform &&
         rLHS.maViewport==rRHS.maViewport &&
         rLHS.maViewBox==rRHS.maViewBox &&
+        rLHS.mbIsText==rRHS.mbIsText &&
         rLHS.maFontFamily==rRHS.maFontFamily &&
         rLHS.mnFontSize==rRHS.mnFontSize &&
         rLHS.maFontStyle==rRHS.maFontStyle &&
@@ -309,6 +312,7 @@ struct StateHash
             ^  size_t(rState.maViewport.getHeight())
             ^  size_t(rState.maViewBox.getWidth())
             ^  size_t(rState.maViewBox.getHeight())
+            ^  size_t(rState.mbIsText)
             ^  size_t(rState.maFontFamily.hashCode())
             ^  size_t(rState.mnFontSize)
             ^  size_t(rState.maFontStyle.hashCode())
diff --git a/filter/source/svg/svgreader.cxx b/filter/source/svg/svgreader.cxx
index dfb33c8..2c0c09b 100644
--- a/filter/source/svg/svgreader.cxx
+++ b/filter/source/svg/svgreader.cxx
@@ -521,8 +521,12 @@ struct AnnotatingVisitor
         rtl::Reference<SvXMLAttributeList> xAttrs( new SvXMLAttributeList() );
         uno::Reference<xml::sax::XAttributeList> xUnoAttrs( xAttrs.get() );
 
+        if (XML_TEXT == nTagId)
+            rState.mbIsText = true;
         std::pair<StatePool::iterator,
                   bool> aRes = mrStates.insert(rState);
+        SAL_INFO ("svg", "size " << mrStates.size() << "   id " <<  
const_cast<State&>(*aRes.first).mnStyleId);
+
         if( !aRes.second )
             return false; // not written
 
@@ -530,6 +534,8 @@ struct AnnotatingVisitor
 
         // mnStyleId does not take part in hashing/comparison
         const_cast<State&>(*aRes.first).mnStyleId = mnCurrStateId;
+        SAL_INFO ("svg", " --> " <<  const_cast<State&>(*aRes.first).mnStyleId);
+
         mrStateMap.insert(std::make_pair(
                               mnCurrStateId,
                               rState));
@@ -750,6 +756,7 @@ struct AnnotatingVisitor
 
     void writeStyle(const uno::Reference<xml::dom::XElement>& xElem, const sal_Int32 nTagId)
     {
+        SAL_INFO ("svg", "writeStyle xElem " << xElem->getTagName());
         sal_Int32 nEmulatedStyleId=0;
         if( maCurrState.maDashArray.size() &&
             maCurrState.meStrokeType != NONE )
-- 
1.7.9.5


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.