php-svg-lib icon indicating copy to clipboard operation
php-svg-lib copied to clipboard

SVG marker

Open tskaiste opened this issue 1 year ago • 1 comments

Hi!

I have encountered an issue where I want to display SVG as Base64 img. The markers that are inside the SVG do not render. Does this package support marker rendering?

The SVG code:

<svg viewBox="0 0 300 100" xmlns="http://www.w3.org/2000/svg">
  <defs>
    <!-- A marker to be used as an arrowhead -->
    <marker
      id="arrow"
      viewBox="0 0 10 10"
      refX="5"
      refY="5"
      markerWidth="6"
      markerHeight="6"
      orient="auto-start-reverse">
      <path d="M 0 0 L 10 5 L 0 10 z" />
    </marker>
  </defs>

  <!-- A line with a marker -->
  <line
    x1="10"
    y1="10"
    x2="90"
    y2="90"
    stroke="black"
    marker-end="url(#arrow)" />

  <!-- A curved path with markers -->
  <path
    d="M 110 10
       C 120 20, 130 20, 140 10
       C 150 0, 160 0, 170 10
       C 180 20, 190 20, 200 10"
    stroke="black"
    fill="none"
    marker-start="url(#arrow)"
    marker-mid="url(#arrow)"
    marker-end="url(#arrow)" />
</svg>

Expected result: image

Actual result: image

tskaiste avatar Nov 12 '24 10:11 tskaiste

Markers are not. You can see the supported elements in the tag directory.

bsweeney avatar Nov 12 '24 16:11 bsweeney