Skip to content

Instantly share code, notes, and snippets.

View benkiel's full-sized avatar

Ben Kiel benkiel

View GitHub Profile
from vanilla import Window, EditText, TextBox
from defconAppKit.controls.fontInfoView import postscriptStemSnapToUFO, infoListFromUFO
from mojo.subscriber import Subscriber, WindowController, registerCurrentFontSubscriber
class Stems(Subscriber, WindowController):
def build(self):
self.w = Window((250, 70))
self.w.vStemsControl = EditText((60, 10, -10, 20), callback=self.editVCallback)
self.w.vStemsLabel = TextBox((10, 10, -10, 17), "vStems")
import AppKit
import webbrowser
import urllib
import json
import os
import ssl
import vanilla
from mojo.extensions import ExtensionBundle
@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
# 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 / 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 __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 / 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
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 / 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
@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]