office-gobmx/svgio
Stephan Bergmann 9e83d35c4a Make CppunitTest_svgio CPPUNIT_TEST_NAME=Test::testCssClassRedefinition robust
That recently introduced test systematically failed on my Fedora 36 machine with

> /home/sbergman/lo2/core/test/source/xmltesttools.cxx:89:(anonymous namespace)::Test::testCssClassRedefinition
> equality assertion failed
> - Expected: 1
> - Actual  : 0
> - In <>, XPath '/primitive2D/transform/textsimpleportion[1]' number of nodes is incorrect

because the dumped data was

> <?xml version="1.0" encoding="UTF-8"?>
> <primitive2D>
>  <transform xy11="26" xy12="0" xy13="0" xy21="0" xy22="26" xy23="0" xy31="0" xy32="0" xy33="1">
>   <mask>
>    <polypolygon height="100" width="50" minx="0" miny="0" maxx="50" maxy="100" path="m0 0h50v100h-50z">
>     <polygon>
>      <point x="0" y="0"/>
>      <point x="50" y="0"/>
>      <point x="50" y="100"/>
>      <point x="0" y="100"/>
>     </polygon>
>    </polypolygon>
>    <textsimpleportion width="16" height="16" x="20" y="20" text="test" fontcolor="#ff0000" familyname="Sans"/>
>   </mask>
>  </transform>
> </primitive2D>

rather than the expected

> <?xml version="1.0" encoding="UTF-8"?>
> <primitive2D>
>  <transform xy11="26" xy12="0" xy13="0" xy21="0" xy22="26" xy23="0" xy31="0" xy32="0" xy33="1">
>   <textsimpleportion width="16" height="16" x="20" y="20" text="test" fontcolor="#ff0000" familyname="Sans"/>
>   <hiddengeometry>
>    <polygonhairline color="#000000">
>     <polygon>0,0 50,0 50,100 0,100</polygon>
>    </polygonhairline>
>   </hiddengeometry>
>  </transform>
> </primitive2D>

because in SvgSvgNode::decomposeSvgNode (svgio/source/svgreader/svgsvgnode.cxx)
aSvgCanvasRange = 50x100@(0,0) vs. aContentRange = 31x11@(20,9) did not match
the

>                         if(aSvgCanvasRange.isInside(aContentRange))

branch ("no clip needed, but an invisible HiddenGeometryPrimitive2D...") but
rather the

>                         else if(aSvgCanvasRange.overlaps(aContentRange))

branch ("Clip is necessary") introducing the additional <mask> element.  The
size of aContentRange (and thus whether it is contained in or merely overlaps
aSvgCanvasRange) is apparently affected by what actual font gets substituted for
"Sans" in any given environment.

The only font that is guaranteed to always be available and is not subject to
--with-fonts (which isn't already demanded via gb_CppunitTest_use_more_fonts in
svgio/CppunitTest_svgio.mk) appears to be "Open Symbol" (cf.
extras/Package_fonts.mk), so use that (even if it doesn't have glyphs for the
given text, but which should be irrelevant for this test).

Change-Id: If6f6fdc481b313aa08803b4b3f406e01ff0be1ac
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136350
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-06-23 23:03:21 +02:00
..
inc tdf#149449 Don't ignore CSS class redefinition inside SVGs 2022-06-22 14:14:27 +02:00
qa/cppunit Make CppunitTest_svgio CPPUNIT_TEST_NAME=Test::testCssClassRedefinition robust 2022-06-23 23:03:21 +02:00
source tdf#149449 Don't ignore CSS class redefinition inside SVGs 2022-06-22 14:14:27 +02:00
CppunitTest_svgio.mk Split BasePrimitive2D UNO interface into separate object 2021-12-23 11:45:33 +01:00
CppunitTest_svgio_read.mk Separate core drawinglayer func. into drawinglayercore library 2021-12-22 12:10:10 +01:00
CppunitTest_svgio_tools.mk Split BasePrimitive2D UNO interface into separate object 2021-12-23 11:45:33 +01:00
IwyuFilter_svgio.yaml tdf#42949 Fix IWYU warnings in svgio/ 2019-12-20 10:31:39 +01:00
Library_svgio.mk Split BasePrimitive2D UNO interface into separate object 2021-12-23 11:45:33 +01:00
Makefile
Module_svgio.mk svgio: add test for svgtools starting with SvgNumber 2021-05-01 09:29:18 +02:00
README.md Add documentation for the 'svgio' module 2021-10-26 15:08:07 +02:00
svgio.component svgio: create instances with uno constructors 2020-07-08 20:26:01 +02:00

SVG Reader

Introduction

The svgio module is used to read SVG (Scalable Vector Graphics[1]) files. It is an XML based format for vector graphics.

This module contains svgio/source/svgreader which is used for embedding an SVG file with "Insert -> Picture -> From File".

SVG is an open standard provided by the World Wide Web Consortium (W3C).

[1] Scalable Vector Graphics

How does it work?

svgio module uses sax for reading xml and turns it into drawinglayer primitives. The rendering is done via drawinglayer primitives. For more information, you should refer to drawinglayer documentation.

Known Bugs

Known remaining bugs for this module are gathered here:

Dependencies

Direct dependencies for emfio are drawinglayer and sax.

References

Documentation for the SVG format is available on the W3C website: