Skip to content

Instantly share code, notes, and snippets.

@connordavenport
Created July 27, 2026 23:18
Show Gist options
  • Select an option

  • Save connordavenport/4f20097e5db9421e265d5790f1a884cc to your computer and use it in GitHub Desktop.

Select an option

Save connordavenport/4f20097e5db9421e265d5790f1a884cc to your computer and use it in GitHub Desktop.
import metricsMachine as mm
import datetime
import time
import os
ts = time.time()
d = datetime.datetime.fromtimestamp(ts).strftime('%Y-%m%d-%H%M%S')
f = mm.CurrentFont()
path = f.path.replace(os.path.splitext(f.path)[-1], f"-kern_{d}.fea")
subs = False
skip = f.lib.get("public.skipExportGlyphs", ())
pl = mm.GetPairList(f)
s = set()
for l,r in pl:
s.add(l)
s.add(r)
s = list(s)
ig = [g.name for g in f if g.name not in s or g.name in skip]
f.lib["public.skipExportGlyphs"] = ig
text = f.kerning.exportFeatureText(path,subs)
f.lib["public.skipExportGlyphs"] = skip
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment