Introduce usvg::Tree as a Data variant of svg handle. This allows user to customize svg parsing procedure, and use parsed result in svg handle.
The most significant benefit of this change is user can now inject css in svg, because usvg provides an option to specify a style sheet like following.
let tree = usvg::Tree::from_str(
&data,
&usvg::Options {
style_sheet: Some(css),
..Default::default()
},
)
This can be rather useful when loading gtk symbolic icons.
Such css-injection is impossible by merely adding a style option to svg widget, because css-injection is done while parsing, and style only affects rendering.
Although this introduces a new dependency (usvg) to iced-core, wgpu and tiny-skia renderer all depend on the functionality that usvg provides to parsing svg string data.
I’ve done a little demo for this change, and I’m willing to make a pr if this is needed.