trello-archive / victor

Use SVGs as resources in Android
Apache License 2.0
1.01k stars 49 forks source link

Alternative dimensions specification not recognized, Batik upgrade required #20

Closed intrepidclass closed 9 years ago

intrepidclass commented 9 years ago

Using the victor sample project, and changing just the way the dimensions are specified in ic_laptop.svg from

width="24pt" height="24pt"

to

style="width:24px;height:24px" 

results in a 3 by 3 png in the generated xxhdpi folder, containing only a shadowy gradient. (same result when using pt instead of px)

That is somewhat unfortunate, since the http://materialdesignicons.com/ tool specifies the dimensions that way.

@dlew suspects the Batik rasterizer version just needs to get upgraded to solve this issue.

dlew commented 9 years ago

I've done a lot of reading on SVG's use of the style attribute. I think the core problem is that SVG doesn't support width/height in style.

Why does it seem to work? I think because browsers have learned to be permissive, but it doesn't seem to be part of the official spec for SVG, and thus Batik (which attempts to be compliant) doesn't recognize it.

Here's my evidence:

  1. This page lists out all the SVG styling properties, which does not include width nor height.
  2. This page is another view of supported attributes that does not include it. (Though it specifies that it's not normative.)

I'm going to close this for now and open an issue on https://github.com/Templarian/MaterialDesign/ since it sounds like they might not want to be using style either.

If there is evidence that can be found that width and height should be supported, then I'll consider re-opening this issue.


As an aside, the file you should be using from http://materialdesignicons.com/ is NOT the web version. You should be downloading "SVG compressed", I believe. It will give you the proper SVGs.