-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a basic designspace parser #272
Conversation
(Will have a look later. Did you take inspiration from https://github.com/simoncozens/rust-font-tools/blob/main/designspace/src/lib.rs?) |
Ah, you may want to rebase this on #274 because it got a newer quick-xml. |
Co-authored-by: Cosimo Lupo <cosimo@anthrotype.com>
7cb22a9
to
ea91aef
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall looks good, fairly straight-forward. I do think the API would be improved by removing the wrapper types. One possible pattern I see to handle something like this, while still leveraging derive, is to have a private MyTypeSerdeRepr
type that is designed to work with serde, and then you deserialize that and then convert it into your actual type? Not sure if this would make sense here but it's one idea. Otherwise there are various other ways to do custom deserialize.
/// The maximum value for a continuous axis, in user space coordinates. | ||
pub maximum: Option<f32>, | ||
/// The possible values for a discrete axis, in user space coordinates. | ||
pub values: Option<Vec<f32>>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we want to distinguish between a None
and an empty vec?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wish there was a way to write Option<NonEmptyVec>
.
Intended for use by Rust compiler so it can use norad to read designspace+ufo(s) to produce IR.
Serde xml seems slightly limited in ability to do things like flatten pointless container elements. If we want more control we might need to parse w/o using it.