fontParts icon indicating copy to clipboard operation
fontParts copied to clipboard

Examine setting an object's parent via obj.foo = parent property.

Open typesupply opened this issue 7 years ago • 4 comments

The glyph object uses this internally so it is available in some cases but not all. It needs to be consistent.

typesupply avatar May 10 '18 20:05 typesupply

This already works. I don't know why I thought that it didn't.

typesupply avatar May 19 '18 00:05 typesupply

This related to contour and glyphs. If you set a contour’s parent to a glyph, that contour isn’t added to the glyph. See contour tests where I had to append the contour to a glyph instead of setting the parent.

On May 18, 2018, at 7:02 PM, Tal Leming [email protected] wrote:

Closed #285.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

benkiel avatar May 19 '18 02:05 benkiel

I just reviewed the code again and I don't see a way to make fooInstance.bar = barInstance add fooInstance to barInstance unless fooInstance is an orphan object. If it isn't, things get messy. Imagine something like this:

glyph = font1["A"]
glyph.font = font2

Would that remove the glyph from font1? FontShell could handle something like that, but other environments may not be able to.

I think we should think of childInstance.parent = parentInstance as purely a way for childInstance to set any necessary internal references to parentInstance.

Does that address this issue? I should have added more notes when I opened it.

typesupply avatar May 19 '18 13:05 typesupply

I think so. Should we make the setting private, and only the get public? That seems to be safe/rational.

benkiel avatar May 21 '18 14:05 benkiel