diff options
author | Armin Le Grand <alg@apache.org> | 2013-06-18 09:44:12 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2013-06-18 13:21:20 +0100 |
commit | b4219ea230a9635ca2422421324af5c407216e03 (patch) | |
tree | 97e4b1e70d224ee92f41821d05c7f82ebf8287f1 /svgio/source/svgreader/svgstyleattributes.cxx | |
parent | 3b3a0ae27906e534ad7b80b6eeb76cdda71a33ac (diff) |
Resolves: #i122524# fixed some text import aspects for super/sub-baseline
(cherry picked from commit def95cfb69619071811fb8e564eb4187f59f4b99)
Conflicts:
svgio/source/svgreader/svgtoken.cxx
Change-Id: I1208229a86807ce271a823415e9b8f0baf955e01
Diffstat (limited to 'svgio/source/svgreader/svgstyleattributes.cxx')
-rw-r--r-- | svgio/source/svgreader/svgstyleattributes.cxx | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/svgio/source/svgreader/svgstyleattributes.cxx b/svgio/source/svgreader/svgstyleattributes.cxx index 8d9c406ab744..b7a128bf9a48 100644 --- a/svgio/source/svgreader/svgstyleattributes.cxx +++ b/svgio/source/svgreader/svgstyleattributes.cxx @@ -1160,6 +1160,8 @@ namespace svgio mpMarkerEndXLink(0), maFillRule(FillRule_notset), maClipRule(FillRule_nonzero), + maBaselineShift(BaselineShift_Baseline), + maBaselineShiftNumber(0), mbIsClipPathContent(SVGTokenClipPathNode == mrOwner.getType()), mbStrokeDasharraySet(false) { @@ -1794,6 +1796,43 @@ namespace svgio } break; } + case SVGTokenBaselineShift: + { + if(aContent.getLength()) + { + static rtl::OUString aStrSub(rtl::OUString::createFromAscii("sub")); + static rtl::OUString aStrSuper(rtl::OUString::createFromAscii("super")); + SvgNumber aNum; + + if(aContent.match(aStrSub)) + { + setBaselineShift(BaselineShift_Sub); + } + else if(aContent.match(aStrSuper)) + { + setBaselineShift(BaselineShift_Super); + } + else if(readSingleNumber(aContent, aNum)) + { + setBaselineShiftNumber(aNum); + + if(Unit_percent == aNum.getUnit()) + { + setBaselineShift(BaselineShift_Percentage); + } + else + { + setBaselineShift(BaselineShift_Length); + } + } + else + { + // no BaselineShift or inherit (which is automatically) + setBaselineShift(BaselineShift_Baseline); + } + } + break; + } default: { break; @@ -2175,6 +2214,24 @@ namespace svgio { if(maFontSize.isSet()) { + // #122524# Handle Unit_percent realtive to parent FontSize (see SVG1.1 + // spec 10.10 Font selection properties font-size, lastline (klick 'normative + // definition of the property') + if(Unit_percent == maFontSize.getUnit()) + { + const SvgStyleAttributes* pSvgStyleAttributes = getParentStyle(); + + if(pSvgStyleAttributes) + { + const SvgNumber aParentNumber = pSvgStyleAttributes->getFontSize(); + + return SvgNumber( + aParentNumber.getNumber() * maFontSize.getNumber() * 0.01, + aParentNumber.getUnit(), + true); + } + } + return maFontSize; } @@ -2463,6 +2520,26 @@ namespace svgio return mpMarkerEndXLink; } + SvgNumber SvgStyleAttributes::getBaselineShiftNumber() const + { + // #122524# Handle Unit_percent realtive to parent BaselineShift + if(Unit_percent == maBaselineShiftNumber.getUnit()) + { + const SvgStyleAttributes* pSvgStyleAttributes = getParentStyle(); + + if(pSvgStyleAttributes) + { + const SvgNumber aParentNumber = pSvgStyleAttributes->getBaselineShiftNumber(); + + return SvgNumber( + aParentNumber.getNumber() * maBaselineShiftNumber.getNumber() * 0.01, + aParentNumber.getUnit(), + true); + } + } + + return maBaselineShiftNumber; + } } // end of namespace svgreader } // end of namespace svgio |