Closed ctrlcctrlv closed 2 years ago
I think it's best to implement this outside of the plist library; it's really just a weird UFO thing. There's code here that you can borrow :)
https://github.com/linebender/norad/blob/master/src/glyph/serialize.rs#L148
At the moment, the xml declaration and \
I wouldn't object to having an option to omit the root \
Although I am now aware that the plist format has a long and storied history in the realm of Apple's proprietary software, I only came across them because they form an integral part of the UFO font format standard.
You will notice that the great majority of UFO uses of plist see the plist sit at the root of the file, so no problem is had.
However, in UFO, there is an even more obscure format, .glif, the individual glyph standard, around which I based MFEKglif and its glifparser.
This format is prescribed as XML, not plist, unusual for the spec. But it has a plist—an internal plist called
<lib>
. Your library thankfully lets us write these internal plist's due to @cmyr's work. Colin undoubtedly had the same problem I'm having, but probably wisely chose not to bother you about it. Nevertheless, I lack his wisdom, and here I am. Could the XML root element itself, or else its name and attributes, find themselves added toXmlWriteOptions
?https://github.com/ebarnard/rust-plist/blob/4643d95b2ec21257214976edd7655edda19acd55/src/stream/xml_writer.rs#L16-L19