Skip to content

Proposal: BPointPen #726

Open
Open
@typesupply

Description

Pens are great. They have been a part of our standard toolkit since before RoboFab existed and they shaped the contour structures inside of the original RoboFab objects. We can look at our contours as points, corresponding to the PointPen protocol, and segments, corresponding to the Pen protocol.

However, there has always been a third way to look at contours: bPoints. bPoints have an API that is very similar to the RoboFog API. I added bPoints to the RoboFab objects because, well, the API mirrors the visual representation of Bezier points in font editors so it just fits better with how I see a problem than points or segments when writing a quick script. I thought they were kind of hacky and have always been a bit embarrassed by my clinging to them, but they have stuck around. Recently I’ve noticed other people using them and that was delightful. Also, I recently added a feature to Glyph Nanny that uses the bPoint model to make the code easier to read. While I was writing that, I started to wish that there was a common abstraction for bPoints. Something like the way Pen abstracts segments and PointPen abstracts points. So...

I propose a new pen protocol for fontParts: BPointPen. Here’s my implementation. This includes functions that would be added to BaseGlyph and BaseContour, an abstract BPointPen, adapters that convert between the BPointPen and PointPen protocols, and some base pens for recording, filtering and printing.

Any thoughts?

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions