Skip to content

Gradient stops should be able to handle percent values

According to https://www.w3.org/TR/SVG11/pservers.html#StopElementOffsetAttribute, gradient offsets can be either number or a percentage. However, when extracting a stop with percentage valued offsets, I get the stack trace:

gradient_to_path.py:50: in recursive_replace_gradient 
stops = gradient.stops                                                                                                                                                                                                                 
/usr/share/inkscape/extensions/inkex/elements/_filters.py:137: in stops                                                                                                                                                                          
return sorted([child for child in gradcolor if isinstance(child, Stop)]
     , key=lambda x: float(x.offset))
E   ValueError: could not convert string to float: '0%'
/usr/share/inkscape/extensions/inkex/elements/_filters.py:138: ValueError   
Edited by Catherine Holloway

Merge request reports