androidsvg icon indicating copy to clipboard operation
androidsvg copied to clipboard

This svg file, there is a problem

Open chengang151 opened this issue 2 years ago • 3 comments

This svg cannot be scaled up;Some elements are displayed incorrectly。

/

chengang151 avatar Jun 17 '23 02:06 chengang151

Hi @chengang151

The reason this does not work is because it uses the CSS property baseline-shift. This CSS property is not yet supported by AndroidSVG. Even Firefox does not support it yet.

There is a workaround however. You can do your superscripts another way, that will work on all browsers and should work on AndroidSVG also. Change the <text> element from:

<text xmlns="http://www.w3.org/2000/svg" font-size="36" fill="#464646" transform="translate(286 344)">4d<tspan
style="baseline-shift: super; font-size: 0.67em;">7</tspan>5s<tspan 
style="baseline-shift: super; font-size: 0.67em;">1</tspan></text>

to

<text xmlns="http://www.w3.org/2000/svg" font-size="36" fill="#464646" transform="translate(286 344)">4d<tspan
y="-0.33em" style="font-size: 0.67em;">7</tspan><tspan y="0">5s</tspan><tspan y="-0.33em" 
style="font-size: 0.67em;">1</tspan></text>

Hopefully they are your files, and you are able to change them yourself.

Paul

BigBadaboom avatar Jun 17 '23 13:06 BigBadaboom

Thanks for your reply, problem solved;But why can't this svg picture be enlarged? After changing the width and height, the picture is not enlarged.

chengang151 avatar Jun 19 '23 02:06 chengang151

For an SVG to scale, it needs to have a viewBox. See these FAQ answers for an explanation, and some solutions.

BigBadaboom avatar Jun 19 '23 06:06 BigBadaboom