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

Contour Segment representation ? #15

Open
BlackFoundry opened this issue Feb 15, 2019 · 6 comments
Open

Contour Segment representation ? #15

BlackFoundry opened this issue Feb 15, 2019 · 6 comments

Comments

@BlackFoundry
Copy link

Wouldn't it be nice / meaningful to have Segment object too for glyphs' contours ?

@madig
Copy link
Collaborator

madig commented Mar 13, 2019

Where would you use it? One could start with a Contour.segments property that simply partitions points into a list based on the type == None or not.

@anthrotype
Copy link
Member

i'm ok with adding a property like the one suggested to make it easier to iterate over points grouped by segment, but I'd advise against wrapping the list of Point objects into a Segment wrapper class that does nothing except slowing things down

@madig
Copy link
Collaborator

madig commented Mar 13, 2019

One possible use-case for a Segment would actually be attaching a bounds method for it, although that may be (better?) solved in a different way.

Also, each segment should contain the last point of the previous segment to make it easier to call fontTools' bezierTools functions on a segment.

@anthrotype
Copy link
Member

a method or property of contour would be better, i think.
for the bounds of an array of points, you just use calcBounds function from fontTools.misc.arrayTools directly

@anthrotype
Copy link
Member

anthrotype commented Apr 30, 2020

defcon Contour has getter for segments which returns a list of lists of Points, and a removeSegment method as well (which looks quite complicated).
I don't know if we really need this. One can always use a segment-oriented pen(e.g. RecordingPen) with the contour.draw() method to obtain something very similar to this. Or Glyph.getPen() can be used to create contours as sequence of segments (as opposed to the getPointPen() which works in points).

@madig
Copy link
Collaborator

madig commented Apr 30, 2020

Let's rely on pens if they are available. We already do for bounds.

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

3 participants