This suite is large enough so that avoiding the
declaration/registration/definition of each test manually saves a lot of
space.
Change-Id: I08359c52cfbbd2ff17ec61722479cda26f308590
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143800
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
<tspan fill-opacity="..."> from SVG was ignored so far, only taking RGB
colors from the 'fill' attribute, but ignoring transparency.
The problem is that an SVG file is imported by mapping it to
drawinglayer primitives, but TextSimplePortionPrimitive2D takes a
basegfx::BColor as the font color, which doesn't handle transparency.
Fix the problem by rendering SVG similar to how commit
81b0d5393c (svx: add rendering for
semi-transparent shape text, 2019-11-20) did it for shape text: wrap the
text primitive in a UnifiedTransparencePrimitive2D when opacity is not
1.
Note that the drawinglayer primitive works with transparency and SVG
works with opacity, which is the opposite of each other, but both are
0..1 ranges.
Change-Id: If5c48613b70eac662b54b8c9da835cd0a966ba89
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143429
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
This commit reintroduces fb33451a27
"tdf#97539: SVGIO: iterate over parent's clippaths" which I
reverted it in 82c0a363ab
"tdf#97539; if parent is css style, look one level up" because
I thought it was no longer necessary, but I was wrong.
Also add a unittest
Change-Id: Ib66ca0afd63e8e52be6677b6965179e092a61aa8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137195
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
if the style attributes are set like
<rect x="10" y="10" width="100" height="100" fill="#00D000"
clip-path="url(#myClip)"/>
it works, however, if it uses a css style like
<rect x="10" y="10" width="100" height="100" style="fill:#00D000"
clip-path="url(#myClip)"/>
it fails to get the clipPath from the parent, because the css style
is the direct parent, thus, check one level up
Change-Id: Iff6df95c9fa9da4c2f1a986cca0ad82ab1494353
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137094
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
The meaning of the name got obsolete after
cded65d05a
< tdf#149893: Color names are ASCII case-insensitive >
Also add a unittest for 9b0069c283
"SVG: Using the marker property from a style sheet is equivalent
to using all three (start, mid, end).·" when this code was added
Change-Id: I87e0866cbd56bbc770920b0778ce681ac9d255b0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136910
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
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>
Tests what happens when a CSS class is redefined with new attributes
and with already defined attributes
Change-Id: I5996fa4dce6c98c1792001a11387bf570d159a8f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136151
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
With previous implementation, the EMF+ import is calculating
gradient positions wrongly. It is causing warning:
SvgGradientHelper got invalid SvgGradientEntries outside [0.0 .. 1.0]
and the gradient was not displayed at all.
This patch fixes that and gradient is displayed correctly
Change-Id: I6229c516165436d0c7ae187d9eb69b5494da396f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135607
Tested-by: Jenkins
Reviewed-by: Bartosz Kosiorek <gang65@poczta.onet.pl>
Unfortuately the build and merge of
commit 4e2e57b530
("tdf#97663 SVGIO: Fix line spacing for <tspan>")
overlapped with the merge of
commit e3bd776e02
("Split BasePrimitive2D UNO interface into separate object")
Change-Id: Iaa7c4ffda7d863a2571c7f8320889b668f82a844
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127394
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
tdf#97663 is a regression caused by the commit
701324a1e1. The previous patch caused
LO to forget the size of the font which was needed to calculate line
height based on em units.
em, px, pt, cm, in...
https://www.w3.org/Style/Examples/007/units.en.html
Accompanied with this fix is a unit test provided to avoid this
issue in the future.
The fix can be tested with:
make CPPUNIT_TEST_NAME="testTdf97663" -sr \
CppunitTest_svgio
The em_units.svg is opened with Firefox, Chrome and Inkscape and the
rendering in LibreOffice is compatible with the rendering in these
applications.
Change-Id: Idaecd9fb18101f7925fe2a917f7fc3fe7257ebc5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127130
Tested-by: Jenkins
Reviewed-by: Thorsten Behrens <thorsten.behrens@allotropia.de>
Rather than make all the BasePrimitive2D classes bear the cost of being an UNO
object, we just wrap the top level BasePrimitive2D in this class when we need
to pass them over UNO.
This reduces the locking overhead when doing normal drawinglayer operations,
and reduces the size of drawinglayer objects and the cost of initialising
them, which shaves 5% off the load/display time of a large barchart.
Add new drawinglayer::convertPrimitive2DContainerToBitmapEx utility
method to avoid needing to convert to Sequence<XPrimitive2D>
Change-Id: I553eaa4c16ba016b098cb21f6c55f5008f0d9b53
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126487
Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
drawinglayer::tools causes conflicts with ::tools namespace, so
better to move Primitive2dXmlDump out from this namespace as for
inspecting purposes it ccan be injected into existing code which
could break make it conflict and break compilation.
Change-Id: I5f9e594b2b8b1dd24067fa5f5ca3cfc4eefb85cd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98627
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
This extracts Primitive2DContainer class to its own file, common
typedefs for PrimitiveReference, Primitive2DSequence to own file
CommonTypes.hxx, some commonly used and independent functions to
Tools.hxx.
But for not BufferedDecompositionPrimitive2D class is left as
it is.
Change-Id: Ia55bafd32fb95eba945d091e2c2ae89b160140d3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86086
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Found with bin/find-unneeded-includes
Only removal proposals are dealt with here.
Change-Id: I66cde1ea02569cd8244b23be16a5550cac8adf12
Reviewed-on: https://gerrit.libreoffice.org/85237
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
... the element is a clippath and fill=none
fill="none" is created as SvgPaint(aColor, true, false, false)
in svgtools.cxx meaning bSet = true, bCurrent = False and
bOn = False, so it never checks its parent if it's a clippath
Change-Id: Ia8c556674809b2b86280219e4084550e366bbff8
Reviewed-on: https://gerrit.libreoffice.org/79201
Tested-by: Jenkins
Reviewed-by: Xisco Faulí <xiscofauli@libreoffice.org>
... is completely parsed
it might happen the element's id the url points to hasn't been parsed yet
Change-Id: Ia92c9188de5d23f2f992846aa91f3f936aeefacb
Reviewed-on: https://gerrit.libreoffice.org/79118
Tested-by: Jenkins
Reviewed-by: Xisco Faulí <xiscofauli@libreoffice.org>
This opacity influences the whole shape (stroke and fill).
Change-Id: I82e10e07dbf2f321805b55a5f4831a513e52dab8
Reviewed-on: https://gerrit.libreoffice.org/70292
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Adds a visitor for svgio for visiting svg nodes and create something
useful from them.
Basic draw commands - a tree of draw commands (with sub-pixel
precision support) just to store a simple definition for drawing.
Adds a svg draw visitor and create draw commands from the svg
structure and expose the commands through UNO API.
Change-Id: I073e891a2cffdd76d4e3b838590e3a19c998e9bf
Reviewed-on: https://gerrit.libreoffice.org/68770
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Also needs extending the XmlWriter to output double numbers as
the attribute content.
Change-Id: Ie749ea990d856c8c90092ed8153c24efda99c444
Reviewed-on: https://gerrit.libreoffice.org/67573
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
While we are drawing DrawString record, in most cases optional
StringFormat information is available.
If StringFromat information is available then we should use default
values.
For LeadingMargin for String the default value is 1/6 inch.
Change-Id: I4a0a68df5ebe74e810f8b5864232b477b3aac255
Reviewed-on: https://gerrit.libreoffice.org/62927
Tested-by: Jenkins
Reviewed-by: Bartosz Kosiorek <gang65@poczta.onet.pl>