Created
February 20, 2025 19:24
-
-
Save connordavenport/49928e333240f655ee4b8113b0ca7c44 to your computer and use it in GitHub Desktop.
Custom RGlyph `bounds` property that takes anchors into account
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
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