From 58dc1f2f665000d94b11159113207fe420487399 Mon Sep 17 00:00:00 2001 From: Sameer Puri Date: Tue, 17 Sep 2019 19:08:08 -0500 Subject: [PATCH] Exclude paths inside clipPath element --- src/main.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index edcb07d..7ef45cb 100644 --- a/src/main.rs +++ b/src/main.rs @@ -157,7 +157,16 @@ fn svg2program(doc: &svgdom::Document, opts: ProgramOptions, mach: Machine) -> P t.pop_transform(); } } - if node.is_graphic() && is_start { + + let is_clip_path = node.ancestors().any(|ancestor| { + if let svgdom::QName::Id(ancestor_id) = *ancestor.tag_name() { + ancestor_id == ElementId::ClipPath + } else { + false + } + }); + + if node.is_graphic() && is_start && !is_clip_path { match id { ElementId::Path => { if let Some(&AttributeValue::Path(ref path)) = attrs.get_value(AttributeId::D) {