glifparser 2.0.1

A parser and writer for UFO `.glif` files
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use crate::glif::IntoXML;
use crate::xml::Element;

use super::{Anchor, PointData};

impl<PD: PointData> IntoXML for Anchor<PD> {
    fn xml(&self) -> Element {
        let mut anchor_node = xmltree::Element::new("anchor");
        anchor_node.attributes.insert("x".to_owned(), self.x.to_string());
        anchor_node.attributes.insert("y".to_owned(), self.y.to_string());
        if let Some(class) = &self.class {
            anchor_node.attributes.insert("name".to_owned(), class.to_string());
        }
        anchor_node
    }
}