Skip to content

Instantly share code, notes, and snippets.

View benkiel's full-sized avatar

Ben Kiel benkiel

View GitHub Profile
@benkiel
benkiel / compare_glyph_structure.py
Created November 30, 2011 16:12
Small RoboFab script to mark glyphs that share the same structure between two fonts
from robofab.world import AllFonts
from robofab.pens.digestPen import DigestPointPen
fonts = AllFonts()
def getDigest(glyph):
pen = DigestPointPen()
glyph.drawPoints(pen)
return pen.getDigest()
@benkiel
benkiel / find_if_font_uses_component.py
Created December 7, 2011 16:47
Goes through all open fonts to find out if the font uses a component. Useful to run if you're thinking of changing the spacing of a accent and you don't want everything to go all wonky.
from robofab.world import AllFonts
fonts = AllFonts()
for font in fonts:
print font.info.postscriptFullName
for glyph in font:
if len(glyph.components) != 0:
for c in glyph.components:
if c.baseGlyph == 'uni0361':
@benkiel
benkiel / set_sidebearings.py
Created July 15, 2013 12:45
Set side bearings based on a base glyph
from mojo.tools import IntersectGlyphWithLine
font = CurrentFont()
glyphs = { 'e':['eacute', 'egrave', 'ediresis'],
'i':['iacute', 'igrave']
}
for base, accented in glyphs.items():
if base in font.keys():
base = font[base]
@benkiel
benkiel / gist:10167173
Last active August 29, 2015 13:58
Typographic Greatest Hits in Washington University in Saint Louis Special Collections ('Greatest' is clearly biased, incomplete, and subjective)
Cicero / De oratore / Spec PA6296 .D6 1569
http://catalog.wustl.edu:80/record=b1913504~S2
Cicero. De oratore. Manuscripts: Meissner Collection. #80
[Book of Hours] / Horae beatae Mariae virginis / France, late 15th century / Spec BX2080 .C25 1450
http://catalog.wustl.edu:80/record=b2783064~S2
[Printed Book of Hours] / Hore in laude gloriosissime virginis Maries / Spec BX2080 .R59 1532
http://catalog.wustl.edu:80/record=b1944669~S2
fonts = AllFonts()
for font in fonts:
keys = font.keys()
for f in fonts:
compare_keys = f.keys()
for v in compare_keys:
if v not in keys:
print v
@benkiel
benkiel / simplify_components.py
Created June 11, 2015 22:04
Walks all open fonts and looks for a component that is a reference of another component. Is dumb and assumes that there is only one component the reference. Good for quickly cleaning up UFOs before importing into FontLab, where this sort of thing isn't allowed.
fonts = AllFonts()
for font in fonts:
for g in font:
if len(g.components) != 0:
for c in g.components:
b = font[c.baseGlyph]
if len(b.components) != 0:
e = b.components[0]
eb = e.baseGlyph
from __future__ import division
morseAlphabet ={
"A" : [1,2,],
"B" : [2,1,1,1,],
"C" : [2,1,2,1,],
"D" : [2,1,1,],
"E" : [1,],
"F" : [1,1,2,1,],
"G" : [2,2,1,],
@benkiel
benkiel / bulk-list.py
Created September 19, 2019 18:59 — forked from okay-type/bulk-list.py
dropfile-ui
# jackson # ok@yty.pe
# version 0.3 - conditional status icons
import os
from AppKit import NSFilenamesPboardType, NSDragOperationCopy
from vanilla import Window, List, Button
action = 'Do Thing'
class doThing():
# from https://tylerxhobbs.com/essays/2020/flow-fields
import math
import random
# You need to pip install this in Drawbot
# (i.e., go to Python > Install Python Packages and copy in perlin_noise and select install)
from perlin_noise import PerlinNoise
@benkiel
benkiel / gist:ec4ca6378deb85c464eabf1234954047
Created May 3, 2021 16:59
Links from A Typographic Commons: UFO and roboTools, ATypI Tech Talks, May 3, 2021
https://unifiedfontobject.org
https://github.com/unified-font-object
https://graphics.pixar.com/usd/
https://www.midi.org
https://instagram.com/noahjodice
https://www.noahjodice.com
https://github.com/fonttools/fonttools