I have many SVGs that specify width and heght in "pt" rather than in "px", ie.
<svg><width>200pt</width>...
The method parseFloat will throw an exception right at the start, and skip
decoding the SVG.
The fix is super-easy, in SVGParser.java line 720:
---------------------------------
private static Float getFloatAttr(String name, Attributes attributes, Float defaultValue) {
String v = getStringAttr(name, attributes);
if (v == null) {
return defaultValue;
} else {
if (v.endsWith("px") || (v.endsWith("pt))) { // added by rlp@nebular.tv to handle "pt" too.
v = v.substring(0, v.length() - 2);
}
// Log.d(TAG, "Float parsing '" + name + "=" + v + "'");
return Float.parseFloat(v);
}
}
---------------------------------
I am no expert in SVG units, maybe there are a few more missing, may be worth
to strip whatever unit with a regex and parse the float?
Original issue reported on code.google.com by kowloon....@gmail.com on 30 Apr 2013 at 10:33
Original issue reported on code.google.com by
kowloon....@gmail.com
on 30 Apr 2013 at 10:33