Skip to content

svglib ignores <switch> nodes #397

Open
@ilkoch008

Description

@ilkoch008

Is it possible to add support for at least default cases (without requiredFeatures)?

My case:
I use rst2pdf to compile document containing svg images.
Those svg images are exported from draw.io.
draw.io uses <switch> when exporting to svg for all text blocks.

Example:

<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="121" height="61" viewBox="-0.5 -0.5 121 61">
  <rect width="120" height="60" rx="9" ry="9" fill="#FFF" stroke="#000" pointer-events="all"/>
  <switch transform="translate(-.5 -.5)">
    <foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow:visible;text-align:left">
      <div xmlns="http://www.w3.org/1999/xhtml" style="display:flex;align-items:unsafe center;justify-content:unsafe center;width:118px;height:1px;padding-top:30px;margin-left:1px">
        <div data-drawio-colors="color: rgb(0, 0, 0);" style="box-sizing:border-box;font-size:0;text-align:center">
          <div style="display:inline-block;font-size:12px;font-family:Helvetica;color:#000;line-height:1.2;pointer-events:all;white-space:normal;overflow-wrap:normal">
            some text
          </div>
        </div>
      </div>
    </foreignObject>
    <text x="60" y="34" font-family="Helvetica" font-size="12" text-anchor="middle">some text</text>
  </switch>
</svg>

As a result, all text in the images is lost after assembly.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions