Skip to content

Instantly share code, notes, and snippets.

View arrowtype's full-sized avatar

Stephen Nixon arrowtype

View GitHub Profile
@justinpenner
justinpenner / clearglyphs.py
Created February 28, 2022 19:21
Remove glyph outlines from a font while preserving everything else (advance widths, OT features)
from fontTools.ttLib import TTFont
from fontTools.ttLib.tables._g_l_y_f import Glyph
f = TTFont('Font.ttf')
assert 'glyf' in f and 'gvar' not in f, 'Must be a static font with a `glyf` table.'
for name in f['glyf'].keys():
if not f['glyf'][name].isComposite():
f['glyf'][name] = Glyph()
f.save('Font-Regular-Blank.ttf')
from fontTools.ttLib import TTFont
import fontTools.ttLib.tables.otTables as ot
def coverage_for(lookup):
coverage = set()
for st in lookup.SubTable:
coverage |= coverage_for_subtable(st)
return coverage
@frankrolf
frankrolf / lemonvetica.py
Last active April 21, 2023 09:31
Example on how to show a given letter’s off-curve points in DrawBot
# 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]
@mzabriskie
mzabriskie / README.md
Last active February 5, 2024 15:10
Check git status of multiple repos

If you're like me you have a dir like ~/Workspace/Github where all your git repos live. I often find myself making a change in a repo, getting side tracked and ending up in another repo, or off doing something else all together. After a while I end up with several repos with modifications. This script helps me pick up where I left off by checking the status of all my repos, instead of having to check each one individually.

Usage:

git-status [directory]

This will run git status on each repo under the directory specified. If called with no directory provided it will default to the current directory.