Forum Bugs

SVG nuances (marker, pattern and external urls)

oodavid
Hello,

Decided to test out the SVG capabilities of Prince, came across a few inconsistencies that I thought I'd let you know about.

My observations:

  • Cannot use external definitions, I get a warning: svg: use: @xlink:href with value of a local id required. - the external definitions are the orange markers on the dashed line and the orange square (top right)
  • Path markers aren't quite right - note the TWO black markers on the prince rendering, one floats above the viewBox, and the other appears over one of the "doors", maybe the transform from the <path> isn't being applied?
  • Patterns are OK, but appear to "stutter". #hatch005 only has vertical lines (the fifth pattern)

Otherwise, this is superb! Really looking forward to having a play with this :-)
  1. Screenshot - SVG Expected.png74.8 kB
    Expected SVG Rendering
  2. Screenshot - SVG PrinceXML.png88.7 kB
    After running through PrinceXML - I've added extra space around the SVG so we can see the marker shooting off the viewBox
  3. test.zip13.2 kB
    Original test files (html, 2 svg files and an image)
mikeday
Thanks for the praise and test document! Currently we don't support external references from SVG, but some of the other issues look more suspicious and could be bugs, we'll take a look. :)
oodavid
No worries good sir!
oodavid
Mike,

If you want to highlight the marker problem alone, I'd recommend using this svg file in lieu of the example.svg in the original zip.

Note that I've figured out a workaround for translating the markers, wrap the <path> in a group <g> and apply the transform to that element instead.

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="100%" height="100%" viewBox="0 0 800 600" preserveAspectRatio="xMidYMid meet">
	
	<!-- Asset Definitions -->
	<defs>
		<!-- Arrowhead -->
		<marker id="arrowhead001" viewBox="0 0 10 10" refX="0" refY="5" markerUnits="strokeWidth" markerWidth="8" markerHeight="6" orient="auto">
			<path d="M0,0 L10,5 L 0,10 z" fill="#333333" />
		</marker>
	</defs>

	<!-- The sketch -->
	<g id="sketch">

		<!-- The Background (to match the viewPort) -->
		<rect x="0" y="0" width="800" height="600" fill="white" />

		<!-- Layer: Assets -->
		<g id="assets" transform="translate(440,20)">
			<!-- Marker (path transform not applied) -->
			<path transform="translate(0,100)" d="M0,0 l100,0 l50,-50" stroke-width="2" stroke-dasharray="4 4" stroke="#333333" fill="none" style="marker-start:url(#arrowhead001); marker-end:url(#arrowhead001)" />
			<!-- Marker (group transform IS applied) -->
			<g transform="translate(0,150)">
				<path d="M0,0 l100,0 l50,-50" stroke-width="2" stroke-dasharray="4 4" stroke="#333333" fill="none" style="marker-start:url(#arrowhead001); marker-end:url(#arrowhead001)" />
			</g>
		</g>

	</g>

</svg>
mikeday
Thanks, looks like we're juggling transforms wrong somewhere, shouldn't be too hard to track down.
mikeday
Today we have released Prince 8.1 rev 5, which includes a fix for the marker transform issue. Thanks again for letting us know. :)
oodavid
mikeday wrote:
Today we have released Prince 8.1 rev 5, which includes a fix for the marker transform issue. Thanks again for letting us know. :)


Cheers Mike, I'll be testing that soon I hope!