Skip to main content

extract_variant

Function extract_variant 

Source
pub fn extract_variant(
    xml: &str,
    weight: &str,
    scale: &str,
) -> Result<String, String>
Expand description

Cut one Weight-Scale variant out of an SF Symbol template as a standalone glyph SVG.

Preference order: the exact weight-scale requested, then the same weight at any scale, then any variant at all — a sparse third-party template still yields a glyph. The output viewBox is the variant’s measured bounding box, padded ~6 % and squared (icon slots are square; centering the short axis keeps optical alignment).