Skip to content
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

Component handling: add API for checked insertion and removal? #219

Open
madig opened this issue Dec 22, 2021 · 2 comments
Open

Component handling: add API for checked insertion and removal? #219

madig opened this issue Dec 22, 2021 · 2 comments

Comments

@madig
Copy link
Collaborator

madig commented Dec 22, 2021

I had the idea of having Layer and Glyph cooperate to check that inserting, modifying and removing components ensures that we never end up with dangling components. glifparser has code for handling. Need to investigate:

  1. Does it add value?
  2. Should it be used for UFO loading or just for the programmatic API? When loading UFOs, how to handle glyphs that exist but aren't added yet?
  3. Are there situations where you'd need an unchecked way of messing with components?
@cmyr
Copy link
Member

cmyr commented Dec 24, 2021

this will actually be kind of annoying, since when you add a component you're mutating the glyph directly, unless we have a method on Layer, like,

fn add_component(&mut self, component: Component, to_glyph: GlyphName) -> Result<(), SomeError> { }

in which case the layer could check that the referenced component exists in that layer?

In any case, I don't think this is pressing enough that we should block 1.0.

@madig
Copy link
Collaborator Author

madig commented Dec 25, 2021

Hm... not a blocker, no. I was thinking of Glyph::add_component_checked(&mut self, component: Component, layer: &Layer) but then you could pass in the wrong layer. Needs more thinking (and checking what MFEK stuff is doing).

@madig madig mentioned this issue Mar 9, 2022
22 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants