Repository: googlefonts/picosvg

Issue:
Possible to ignore vendor style?
Sometimes SVG generated by Inkscape contains [vendor-specific extensions](https://www.w3.org/TR/CSS2/syndata.html#vendor-keywords) starting with `-`, such as Inkscape's `-inkscape-font-specification` and `-inkscape-stroke`.

Discussion:

Patch:
diff --git a/src/picosvg/svg_meta.py b/src/picosvg/svg_meta.py
index fa2c98d..e9be598 100644
--- a/src/picosvg/svg_meta.py
+++ b/src/picosvg/svg_meta.py
@@ -143,6 +143,7 @@ def parse_css_declarations(
     property_names: Optional[Container[str]] = None,
 ) -> str:
     """Parse CSS declaration list into {property: value} dict.
+    Vendor styles are ignored even if in property_names as lxml does not support attribute names starting with dash.
 
     Args:
         style: CSS declaration list without the enclosing braces,
@@ -160,13 +161,16 @@ def parse_css_declarations(
     References:
     https://www.w3.org/TR/SVG/styling.html#ElementSpecificStyling
     https://www.w3.org/TR/2013/REC-css-style-attr-20131107/#syntax
+    https://www.w3.org/TR/CSS2/syndata.html#vendor-keywords
     """
     unparsed = []
     for declaration in style.split(";"):
         if declaration.count(":") == 1:
             property_name, value = declaration.split(":")
             property_name = property_name.strip()
-            if property_names is None or property_name in property_names:
+            if (
+                property_names is None or property_name in property_names
+            ) and not property_name.startswith("-"):
                 output[property_name] = value.strip()
             else:
                 unparsed.append(declaration.strip())


Test patch:
diff --git a/tests/svg_test.py b/tests/svg_test.py
index 898cc52..67ced9f 100644
--- a/tests/svg_test.py
+++ b/tests/svg_test.py
@@ -415,6 +415,13 @@ def test_tolerance(svg_string, expected_result):
             {"enable-background": "new 0 0 128 128"},
             "foo:abc; bar:123;",
         ),
+        (
+            # does not support vendor style attributes due to lxml module, see #293
+            "stroke:#FF0000;stroke-width:0.5;fill:none;-inkscape-font-specification:'Roboto';",
+            None,
+            {"stroke": "#FF0000", "stroke-width": "0.5", "fill": "none"},
+            "-inkscape-font-specification:'Roboto';",
+        ),
     ],
 )
 def test_parse_css_declarations(