Skip to content

Instantly share code, notes, and snippets.

@okay-type
okay-type / randomly-transform-each.jsx
Last active March 14, 2024 20:27
An InDesign script to randomly transform each selected object
// indesign script
// apply a random transformation to each selected objects
// 2024 jackson@okaytype.com
function rotate_objects(params) {
var rotate_range = parseFloat(params[0])
var x_range = params[1]
@okay-type
okay-type / start_up_initial_script_placeholder.py
Created January 6, 2024 00:39
Open Robofont scripting windows with preset code
from mojo.subscriber import Subscriber, registerRoboFontSubscriber
# set as a startup script
# open new scripting windows with preset code
# requires Robofont beta 2401051907 (5 January 2024) or later
# ok@ytyt.pe
preset = '''# a = AllFonts()
@okay-type
okay-type / test-menu-add-update-remove.py
Last active August 29, 2023 18:13
add update remove menu items
from vanilla import *
from AppKit import NSApp, NSMenuItem, NSImage
from mojo.UI import MenuBuilder
from lib.doodleMenus import BaseMenu
import AppKit
# print(help(MenuBuilder))
class testMenu():
@okay-type
okay-type / checkbox_only_allbut.py
Created June 13, 2023 18:48
shift+click a vanilla checkbox to un/check other checkboxes
from vanilla import *
from AppKit import NSEvent, NSShiftKeyMask, NSCommandKeyMask, NSAlternateKeyMask, NSControlKeyMask
class Test_Only_CheckBox():
def __init__(self):
u = 22
self.w = Window((250, u*10), 'Test_Only_CheckBox')
self.w.check_0 = CheckBox((5, u*0, -5, u), 'Check 0', value=True, callback=self.checks)
@okay-type
okay-type / main.py
Created May 25, 2023 16:19
import with self
from sub import *
class this():
def __init__(self):
self.x = 2
y = sub_test(self)
print(y)
this()
@okay-type
okay-type / ItalicAnglessss.py
Last active April 7, 2023 13:42
A hack to see different italic angles when drawing a ufo
from mojo.subscriber import Subscriber, registerRoboFontSubscriber
'''
Italic angles are complicated.
Technically, they don't really exist.
They're constructed by font editors to make drawing slanted things more consistent.
It's very helpful.
@okay-type
okay-type / Bulk.py
Last active February 25, 2023 21:42
A UI to do something to a bunch of ufo files
from vanilla import *
import os
from AppKit import NSFilenamesPboardType, NSDragOperationCopy
import re
from mojo.roboFont import AllFonts, CurrentFont, OpenFont
class Bulk_UFOs():
@okay-type
okay-type / Copy-Anchors.py
Last active February 1, 2023 23:51
copy anchors from glyph
from vanilla import *
from mojo.subscriber import Subscriber, registerRoboFontSubscriber
'''
to do:
when only copying x values, skew to italic angle
'''
class copyanchors(Subscriber):
@okay-type
okay-type / anchorHelperXpos
Last active February 1, 2023 18:36
a window with a ui for adjusting the horizontal position of anchors
from AppKit import NSScreen
from vanilla import *
import merz
import mojo.subscriber as subs
from mojo.subscriber import Subscriber, registerRoboFontSubscriber, unregisterRoboFontSubscriber, listRegisteredSubscribers
from mojo.extensions import registerExtensionDefaults, setExtensionDefault, getExtensionDefault, removeExtensionDefault
from mojo.drawingTools import *
from math import radians, tan, pi
from AppKit import NSColor
from fontTools.pens.basePen import BasePen
@okay-type
okay-type / All-UI.py
Last active February 2, 2022 23:18
Simple Robofont interface to controlling a list of open ufos and their UI windows.
from mojo.subscriber import Subscriber, WindowController
from mojo.subscriber import registerRoboFontSubscriber
from vanilla import Window, List, CheckBoxListCell, Group, Button
from AppKit import NSDragOperationMove, NSDragOperationCopy, NSFilenamesPboardType
from mojo.UI import AskYesNoCancel, OpenSpaceCenter, OpenFontInfoSheet, OpenGlyphWindow
from os import path as ospath
from mojo.roboFont import AllFonts, OpenFont, FontsList
from defconAppKit.controls.fontInfoView import FontInfoView
from mojo.UI import OutputWindow