Skip to content

Instantly share code, notes, and snippets.

@connordavenport
Created February 20, 2025 19:24
Show Gist options
  • Save connordavenport/49928e333240f655ee4b8113b0ca7c44 to your computer and use it in GitHub Desktop.
Save connordavenport/49928e333240f655ee4b8113b0ca7c44 to your computer and use it in GitHub Desktop.
Custom RGlyph `bounds` property that takes anchors into account
'''
Custom RGlyph `bounds` property that takes anchors into account
'''
@property
def full_bounds(self):
bounds = list(self.bounds)
for anchor in self.anchors:
if anchor.x < bounds[0]:
bounds[0] = anchor.x
if anchor.x > bounds[2]:
bounds[2] = anchor.x
if anchor.y < bounds[1]:
bounds[1] = anchor.y
if anchor.y > bounds[3]:
bounds[3] = anchor.y
return tuple(bounds)
# ------------------------------------------------------------------------------------------
# ------------------------------------------------------------------------------------------
from mojo.roboFont import RGlyph
RGlyph.fbounds = full_bounds
# ------------------------------------------------------------------------------------------
# ------------------------------------------------------------------------------------------
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment