Broken inline SVG support for Quadratic Curves

0 votes
asked Oct 27, 2022 in Bug by Michael (120 points)

Hi Plant UML Support:

I noticed a bug in the inline SVG support. If the SVG path contains any quadratic Bezier curves – rendering of the diagram using the inline SVG as a sprite will fail with the following error:

An error has occurred: java.lang.IllegalArgumentException: Q

See the sample diagram to reproduce:
 

@startuml
sprite SVG_NO_BEZIER <svg width="12cm" height="6cm" viewBox="0 0 1200 600"
     xmlns="http://www.w3.org/2000/svg" version="1.1">
  <path d="M200,300 L400,50 L600,300
           L800,550 L1000,300"
        fill="none" stroke="#888888" stroke-width="2" />
</svg>

sprite SVG_WITH_BEZIER <svg width="12cm" height="6cm" viewBox="0 0 1200 600"
     xmlns="http://www.w3.org/2000/svg" version="1.1">
  <path d="M200,300 Q400,50 600,300 T1000,300"
        fill="none" stroke="red" stroke-width="5"  />
</svg>

Alice->Bob : <$SVG_NO_BEZIER>
' Quadratic Bézier curve commands in path result in "java.lang.IllegalArgumentException: Q" or "java.lang.IllegalArgumentException: q"
Alice->Bob : <$SVG_WITH_BEZIER>

@enduml



The issue does not happen if I use the <img> tag instead – the SVG draws correctly (There is another issue with <img> tag, unfortunately, which prevents me from using it instead of inline SVG sprites - <img> tag does not seem to look for the image files inside the packaged ZIP that I “import”).

Can you please look at it? The attached diagram SVG contains the failure + the original diagram source code at the end.

Thanks,

Michael 

1 Answer

0 votes
answered May 3 by The-Lu (85,440 points)

Hello M.,

Thanks for the report.
That is now fixed since end of 2022...

Here is the corresponding result:

@startuml
sprite SVG_NO_BEZIER <svg width="12cm" height="6cm" viewBox="0 0 1200 600"
     xmlns="http://www.w3.org/2000/svg" version="1.1">
  <path d="M200,300 L400,50 L600,300
           L800,550 L1000,300"
        fill="none" stroke="#888888" stroke-width="2" />
</svg>

sprite SVG_WITH_BEZIER <svg width="12cm" height="6cm" viewBox="0 0 1200 600"
     xmlns="http://www.w3.org/2000/svg" version="1.1">
  <path d="M200,300 Q400,50 600,300 T1000,300"
        fill="none" stroke="red" stroke-width="5"  />
</svg>

card "<$SVG_NO_BEZIER>"

' Quadratic Bézier curve commands in path now works
card "<$SVG_WITH_BEZIER>"
@enduml

Regards,
Th.

commented May 3 by The-Lu (85,440 points)

In fact it's still buggy:

  • if fill is none, the stroke and stroke-width should be used to make the outline...

commented Jun 7 by The-Lu (85,440 points)

Hi all,

With last release (v1.2025.3) that is now [almost] fixed.

[Remains the stroke-width management...]

Thanks to PlantUML team.
Regards,
Th.

...