glifparser/guideline/
xml.rs

1use crate::glif::IntoXML;
2use crate::xml::Element;
3
4use super::{Guideline, PointData};
5
6impl<GD: PointData> IntoXML for Guideline<GD> {
7    fn xml(&self) -> Element {
8        let mut guideline_node = xmltree::Element::new("guideline");
9        guideline_node.attributes.insert("x".to_string(), self.at.x.to_string());
10        guideline_node.attributes.insert("y".to_string(), self.at.y.to_string());
11        guideline_node.attributes.insert("angle".to_string(), self.angle.to_string());
12        if let Some(c) = self.color {
13            guideline_node.attributes.insert("color".to_string(), c.to_string());
14        }
15        if let Some(n) = &self.name {
16            guideline_node.attributes.insert("name".to_string(), n.clone());
17        }
18        if let Some(i) = &self.identifier {
19            guideline_node.attributes.insert("identifier".to_string(), i.clone());
20        }
21        guideline_node
22    }
23}