Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

<image> tag with only width will not render #232

Open
RiotGoesWoof opened this issue Aug 26, 2021 · 4 comments
Open

<image> tag with only width will not render #232

RiotGoesWoof opened this issue Aug 26, 2021 · 4 comments

Comments

@RiotGoesWoof
Copy link

When rendering on the web, if I have a CSV with an image tag that only has the width set, the height will fill according to aspect ratio. When using the androidSVG library, the will simply not display at all.

example: <image id="photo" xlink:href="data:image/png;base64,someimage" width="107" y="11.5" x="12" clip-path="url(#clip)"/>

@BigBadaboom
Copy link
Owner

BigBadaboom commented Aug 27, 2021

Currently AndroidSVG only officially supports SVG 1.1. In that version of SVG, width or height will default to 0 when not specified. And, per the spec, a value of 0 disabled rendering.

In SVG 2, which the browsers support most of now, width and height default to auto. In SVG terms that equates to "100%". That's why you are seeing different behaviour in the browser, compared with AndroidSVG.

I will gradually be implementing SVG2 spec features. So I will mark this issue as a feature request for the new SVG2 geometry attribute behaviour.

Thanks for the report.

@RiotGoesWoof
Copy link
Author

Hey great, thanks for the quick response!

So would I be able to put "100%" for height and have that render properly?

@BigBadaboom
Copy link
Owner

Yes. Setting height to "100%" should have the same effect.

@RiotGoesWoof
Copy link
Author

Lovely. Thank you for the library!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants
@BigBadaboom @RiotGoesWoof and others