Skip to main content

path_from_d

Function path_from_d 

Source
pub fn path_from_d(d: &str) -> Path
Expand description

Translates an SVG path d string into a Path.

Supports the moveto/lineto/curveto/closepath commands in both absolute and relative forms: M/m, L/l, H/h, V/v, C/c, S/s, Q/q, T/t, Z/z. Arc segments (A/a) are approximated with cubic Bézier segments via the SVG endpoint→center parametrization (radii are scaled up when they are too small for the chord, and arcs larger than a quarter turn are split). Repeated coordinate sets after a command repeat that command (per the SVG grammar M m x y ... implicit lineto included). Malformed data is skipped defensively.