-
Notifications
You must be signed in to change notification settings - Fork 44
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
Proposal: BPointPen #726
Comments
Opinionated opinions:
|
This is an entirely optional way to look at the data and it is only for fontParts. I wouldn't propose this for fontTools or anywhere else because, among many reasons, it's very specific to the designer oriented API of fontParts. I agree that it's not always the best way to look at contour data. The same goes for points and segments. For example, in Glyph Nanny the various tests use points, segments or bPoints depending on the needs of the test. If the points model was best the Pen protocol wouldn't be needed. If the segments model was best the PointPen protocol wouldn't be needed. Soometimes neither of those is best. 😉
The MathGlyph comparison isn't relevant. MathGlyph predates the modern implementation of variable fonts and the point count requirements by over a decade. When I wrote MathGlyph there were a significant number of outlines that purposely did not have off curve compatibility. These incompatibilities caused significant work delays for designers when interpolating. MathGlyph was written for the time it was written in. Besides, it now has a strict flag that turns off the curve compatibility mode and new tools are turning that on by default.
Correct. This is only for cubics, just like the bPoint objects in RoboFab/fontParts have been.
Do you have any suggestions? There is a lot of data to be transferred. I considered something like this: addBPoint(
bcpIn={},
anchor={},
bcpOut={},
**kwargs
} where each of the dicts would have this structure: {
point : (x, y)
name : None | string (optional, None by default)
identifier : None | string (optional, None by default)
} I ditched this idea because it would require every implementation of |
Agee that 10 is a lot, but the usual case will be the first 4; the defaults work well for 90% (completely made up percentage) of the use cases, so can be ignored by scripters. We could note this in the docs. I think this would be a good addition to fontParts, +1 |
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?
The text was updated successfully, but these errors were encountered: