Skip to content

Instantly share code, notes, and snippets.

@okay-type
okay-type / MetricsAdj.py
Last active December 21, 2015 23:18
Metrics Adjuster
# jackson@okaytype.com
### requires an icon file toolGoMetrics.pdf in the same folder
# download it from www.theharrietseries.com/crypt/robofont/toolGoMetrics.pdf
### updated 2013/03/10 — linked to didfontopen observers, just set as a startup script
### updated 2013/07/16 — fixed lame selection traceback and broken spacecenter adjustments
# to do: adjust by percent, uniform adjust, remember last setting
import os
from vanilla import *
from mojo.UI import CurrentFontWindow, CurrentSpaceCenter
@okay-type
okay-type / Ventriloquist.py
Last active May 5, 2018 11:48
Ventriloquist: insert a dummy dsig table (with serials)
# Ventriloquist - Build 0.1
# insert a dummy dsig table with unique numbers into .otf fonts
# the idea is to kill two birds with one stone
# this idea needs lots of testing
# to do: add SerialDump[] to a txt file for record keeping
#
# jackson@okaytype.com
from fontTools.ttLib import TTFont
from mojo.compile import *
@okay-type
okay-type / aPreviewer.py
Last active August 29, 2015 14:03
aPreviewer.py for Robofont, show the current glyph big and small as a simple alternative to looking at drawings in space center.
# jackson @ okaytype.com
# simpler big glyph preview window v3
from vanilla import Window
from defconAppKit.windows.baseWindow import BaseWindowController
from mojo import events
from mojo.events import addObserver, removeObserver
from mojo.glyphPreview import GlyphPreview
class BigGlyphPreview(BaseWindowController):
@okay-type
okay-type / box-color-test.py
Created August 7, 2014 18:54
Making a window with a color box in RoboFont with vanilla
from vanilla import Window, Box
from defconAppKit.windows.baseWindow import BaseWindowController
from AppKit import NSColor, NSView, NSRectFill
class BigBox(BaseWindowController):
def __init__(self):
@okay-type
okay-type / +version.py
Last active November 30, 2015 20:38
+version
# jackson
# okaytype.com
# v0.3 28 Nov 15
# uses Version Minor to increment font names i.e.:
# Family Name v1
from vanilla import *
import os
from robofab.interface.all.dialogs import GetFolder
@okay-type
okay-type / syncCenter.py
Last active August 31, 2018 19:52
adds toggle to synchronize the text, size, pre, post, and suffix data in all open Robofont space center windows
# set as a startup script
# jackson at okaytype.com
# issues: sometimes doesn't update one font
# issues: needs some more testing to make sure it's not slowing things down
# next: add more settings, increase efficiency
from mojo.UI import AllSpaceCenters, CurrentSpaceCenter
from mojo.events import addObserver, removeObserver
from vanilla import *
@okay-type
okay-type / show-glyphs-with-selected-as-components.py
Created February 19, 2019 00:58
space center show-glyphs-with-selected-as-components
from mojo.UI import CurrentSpaceCenter
f = CurrentFont()
sc = CurrentSpaceCenter()
s = ''
for g in f.selectedGlyphNames:
s += '/' + f[g].name
for x in f.lib['public.glyphOrder']:
if f[x].name != f[g].name:
@okay-type
okay-type / gist:2e6a87499658e9e6bc18e64ceb599f5b
Created February 27, 2019 20:20
show-one-glyph-for-each-selected-component.py
from mojo.UI import CurrentSpaceCenter
f = CurrentFont()
sc = CurrentSpaceCenter()
s = ''
for g in f.selectedGlyphNames:
n = 0
for x in f.lib['public.glyphOrder']:
if n == 0:
@okay-type
okay-type / NoLayerSpaceCenter.py
Last active April 26, 2019 16:43
# remove the layer dropdown from robofont's space center toolbar
# remove the layer dropdown from robofont's space center toolbar
from mojo.UI import CurrentSpaceCenter
from mojo.events import addObserver, removeObserver
class NoLayerSpaceCenter(object):
def __init__(self):
addObserver(self, 'NoLayerMenu', 'spaceCenterDidOpen')
@okay-type
okay-type / spacecenter-prev-line.py
Last active September 19, 2019 16:43
Go to the previous line of Input Text in Robofont's Space Center
# Go to the previous line of Input Text in Robofont's Space Center
from mojo.UI import CurrentSpaceCenter
from difflib import get_close_matches
class SpacecenterPrevious(object):
def __init__(self):
sp = CurrentSpaceCenter()
tgli = sp.top.glyphLineInput
items = tgli.getItems()