Skip to content

Instantly share code, notes, and snippets.

View LettError's full-sized avatar

Erik van Blokland LettError

View GitHub Profile
@LettError
LettError / copyNamesToClipboard.py
Created March 29, 2021 16:23
RoboFont Script that offers a small UI for copying the selected glyphs in different ways.
# coding: utf-8
# menuTitle : Copy Names To Clipboard
# shortCut : command+shift+C
import vanilla
from defconAppKit.windows.baseWindow import BaseWindowController
from mojo.roboFont import CurrentFont, CurrentGlyph, AllFonts, OpenWindow
from AppKit import NSPasteboardTypeString, NSPasteboard
"""
@LettError
LettError / drawbot_generate_teams_background.py
Created May 8, 2020 14:39
Generate a background for Teams with drawbot
import os
from os.path import expanduser
home = expanduser("~")
backgroundFolder = os.path.join(home, "Library/Application Support/Microsoft/Teams/Backgrounds/Uploads")
size(1920, 1080)
s = 10
sw = int(width()/s)
@LettError
LettError / icons.txt
Created December 17, 2019 19:19
DeRez output of the ICON resources from RoboFog 1.6.3
data 'ICON' (20265) {
$"0000 0000 0000 0000 0000 0000 0000 0000" /* ................ */
$"0000 0000 0000 0000 0000 0000 0000 0000" /* ................ */
$"0000 0000 0000 0000 0000 0000 00FE 0000" /* .............˛.. */
$"0101 0000 0210 8000 0438 4000 0854 2000" /* ......Ä..8@..T . */
$"1082 1000 2101 0800 4210 8400 8428 4200" /* .Ç..!...B.Ñ.Ñ(B. */
$"0844 2000 1082 1000 0101 0000 0200 8000" /* .D ..Ç........Ä. */
$"0400 4000 0000 0000 0000 0000 0000 0000" /* ..@............. */
$"0000 0000 0000 0000 0000 0000 0000 0000" /* ................ */
};
@LettError
LettError / prrrrrr.py
Created September 6, 2019 19:45
RoboFont: temporary designspace + designspaceChecker to report on glyph compatibility issues.
"""
test all open fonts on compatibility
create temp designspace file
align all fonts on a temp axis
order does not matter
run designspaceProblems
present the data somehow
@LettError
LettError / export_drawings.py
Created May 22, 2019 11:55
Export Robofont glyph image to iCloud, then reimport it again. After editing it on an ipad for instance.
import drawBot as ctx
import os
from os.path import expanduser
home = expanduser("~")
imagesDir = "Library/Mobile Documents/com~apple~CloudDocs/RoboFont/"
path = os.path.join(home, imagesDir)
if not os.path.exists(path):
os.makedirs(path)
@LettError
LettError / unicodeStyleWriter.py
Created February 28, 2019 14:24
A small converter from normal latin AZ,az to the Unicode math alphabets.
import vanilla
""" Unicode Stylewriter: Use the unicode styles to impress friends and families on the internet. """
class StyleWriter(object):
styles = [
dict(title="𝔸", upper=0x1D538, lower=0x1D552, name='mathdoublestruck'),
dict(title="𝖠", upper=0x1D5A0, lower=0x1D5BA, name='mathsans'),
dict(title="𝗔", upper=0x1D5D4, lower=0x1D5EE, name='mathsansbold'),
dict(title="𝐴", upper=0x1D434, lower=0x1D44E, name='mathitalic'),
dict(title="𝐀", upper=0x1D400, lower=0x1D41A, name='mathbold'),
@LettError
LettError / angleRatioTool.py
Created February 28, 2019 09:57
EditTool script for RoboFont 3. Show the ratio between the length of incoming and outgoing sections of bcps and tangents.
import AppKit
from mojo.events import installTool, EditingTool, BaseEventTool, setActiveEventTool
from mojo.drawingTools import *
from mojo.UI import UpdateCurrentGlyphView
from defconAppKit.windows.baseWindow import BaseWindowController
import math
#
#
# A visualisation for RoboFont
# encoding: utf-8
"""
This is an exploration of some of the calculations we can do
based on the size of a typographic detail in a shape, the distance
of the shape to the eye, the average amount of light that shines
on the shape, the amount of that reflected light that will be captured by the eye,
the aperture of the pupil and some other factors.
@LettError
LettError / comments.py
Created May 24, 2018 08:35
Drawbot sketch for drawing scribbles.
size(1000,400)
def scribble(pos, width, amplitude):
save()
x, y = pos
start = x
strokeWidth(1)
fill(None)
stroke(1-random()*0.2,0,0)
@LettError
LettError / blinkenDraw.py
Last active March 14, 2018 16:38
Toy script for RF3: draw animated pixels in a tiny window, save to gif.
# coding: utf-8
import os
import vanilla
import mojo.canvas
from mojo.UI import PutFile
from random import random
from mojo.drawingTools import *
import drawBot
from AppKit import NSTimer