svgo icon indicating copy to clipboard operation
svgo copied to clipboard

any reason to not merge <text> and <textspans> when possible?

Open olets opened this issue 9 years ago • 1 comments

This is probably right on the line of what's appropriate to bring up here rather than on some svg forum, but on the off chance that it is a place svgo could be improved:

I was surprised when svgo (well, svgomg - if this is something specific to that implementation, I apologize, you can just ignore me) gave me this output

<svg viewBox="0 0 241 33" xmlns="http://www.w3.org/2000/svg">
  <title>
    my sample text
  </title>
  <text transform="translate(-132 -29)" fill="#FFF" fill-rule="evenodd" font-weight="500" font-family="ProximaNova-Semibold, Proxima Nova" font-size="36">
    <tspan x="130" y="54">my sample text</tspan>
  </text>
</svg>

Is there a reason the text and textspan weren't merged into this?

<text x="-2" y="25" fill="#FFF" fill-rule="evenodd" font-weight="500" font-family="ProximaNova-Semibold, Proxima Nova" font-size="36">

olets avatar Jun 16 '16 14:06 olets

Not bad idea for a plugin! However, the case is somewhat rare and some details like positioning (x, y attributes and so on) should be considered.

GreLI avatar Jun 17 '16 11:06 GreLI