This file contains 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
# it’s easy to access a letter’s contours through a BezierPath object: | |
bp = BezierPath() | |
bp.text( | |
's', | |
font='SFProDisplay-Heavy', | |
fontSize=1200) | |
# Fill the letter, and offset the whole canvas so it sits in the middle. | |
fill(1, 1, 0) | |
letter_width = bp.bounds()[-2] - bp.bounds()[0] |