Skip to content

Rendering issue with <tspan> and <style> #343

Open
@jspobst

Description

A plotly figure I made isn't rendering correctly. The part that's failing involves a <tspan>, so I went and grabbed the simplest tspan example I could find from here to test further.

<svg viewBox="0 0 240 40" xmlns="http://www.w3.org/2000/svg">
  <style>
    text  { font: italic 12px serif; }
    tspan { font: bold 10px sans-serif; fill: red; }
  </style>

  <text x="10" y="30" class="small">
    You are
    <tspan>not</tspan>
    a banana!
  </text>
</svg>

That should produce
image

But when putting it through

drawing = svglib.svg2rlg(io.StringIO(textwrap.dedent(svg_string)))
renderPDF.draw(drawing, c, 50, 50)

I get this in the produced pdf
image

svglib: 1.3.0
reportlab: 3.6.9
python: 3.97
MacOS: 12.3.1

Thank you.

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions