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

Define object selection API. #37

typesupply opened this issue Jun 16, 2016 · 3 comments


None yet
2 participants
Copy link

commented Jun 16, 2016

# list of selected objects
subObjects = obj.selection
obj.selection = [subObjects]

# boolean indicating if object is selected
isSelected = obj.selected
obj.selected = True

# will need more elaborate properties
selectedGuides = obj.selectionGuides

Need to look at how RoboFab handled this and build on that without breaking anything.

@jackjennings jackjennings changed the title Define object selection API. Define object selection API Jun 16, 2016

@jackjennings jackjennings changed the title Define object selection API Define object selection API. Jun 16, 2016

@typesupply typesupply self-assigned this Mar 8, 2018


This comment has been minimized.

Copy link
Member Author

commented Mar 8, 2018

This needs to be decided so that CurrentContours() CurrentPoints() etc. can be implemented.

Here's how RoboFont 3 handles it.


This comment has been minimized.

Copy link
Member Author

commented Mar 9, 2018

Here’s a proposed API. The only thing that would be required for environments to implement is the object specific selected flag attribute. Everything else can be implemented generically in the base objects.

Any thoughts? cc @benkiel @typemytype

# -------------------------------
# Object Selection Flag (boolean)
# -------------------------------

state = foo.selected
foo.selected = True

The `selected` attribute is supported by:

- font
- layer
- glyph
- contour
- segment
- bPoint
- point
- component
- anchor
- image
- guideline

# ----------------------------------
# Sub-Object Selected Objects (list)
# ----------------------------------

bars = foo.selectedBars
foo.selectedBars = bars

# Font

font.selectedLayers # list of layer objects
font.selectedLayerNames # list of strings
font.selectedGlyphs # list of glyph objects
font.selectedGlyphNames # list of strings
font.selectedGuidelines # list of guideline objects
font.selection # alias for font.selectedGlyphNames, deprecated

# Layer

layer.selectedGlyphs # list of glyph objects
layer.selectedGlyphNames # list of strings

# Glyph

glyph.selectedContours # list of contour objects
glyph.selectedComponents # list of component objects
glyph.selectedAnchors # list of anchor objects
glyph.selectedGuidelines # list of guideline objects

# Contour

contour.selectedSegments # list of segment objects
contour.selectedPoints # list of point objects
contour.selectedBPoints # list of bPoint objects

# Segment

segment.selectedPoints # list of point objects

# ---------------------
# Convenience Functions
# ---------------------


This comment has been minimized.

Copy link

commented Mar 11, 2018

@typesupply thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.