Skip to content

Instantly share code, notes, and snippets.

@typemytype
typemytype / install_liquid_c_on_Monterey
Created Jan 22, 2022
command to install liquid-c on Monterey
View install_liquid_c_on_Monterey
gem install liquid-c -- --with-cflags="-Wno-compound-token-split-by-macro"
View merzZoomSupport.py
import vanilla
import merz
class Demo:
def __init__(self):
# setup window
self.w = vanilla.Window((400, 400), minSize=(150, 150))
View extensionSurvey.py
import AppKit
import webbrowser
import urllib
import json
import os
import ssl
import vanilla
from mojo.extensions import ExtensionBundle
View funkyLineConverter.py
# get the current glyph
glyph = CurrentGlyph()
# get the point pen
pointPen = glyph.getPointPen()
# loop over all contours
# convert the glyph to a list first
# so we can remove the contour and alter the glyph
for contour in list(glyph):
# get all the points
points = contour.points
View noMagic.py
def lerp(value1, value2, factor):
return value1 + (value2 - value1) * factor
size(400, 400)
R = (sqrt(5) - 1) / 2
def F(x1, y1, r, s, t, n):
View coloredCorners.py
x, y = 0, 0
w = h = 200
circles = 3
offset = 20
thickness = 26
color1 = (0, 1, 1)
color2 = (1, .5, 0)
color3 = (1, 0, 1)
color4 = (1, 1, 0)
@typemytype
typemytype / tabCollector.py
Last active Nov 2, 2020
Collect windows by the type of window in RoboFont
View tabCollector.py
import vanilla
import AppKit
class WindowTabCollector:
windowNames = [
"GlyphWindow",
"FontWindow",
"SpaceCenter",
"ScriptingWindow",
View whispers.py
from AppKit import *
t = """Yeah! A designspace is file that contains the plans for an interpolation system for a typeface. It describes how the source fonts relate and how they should interpolate. It defines the dimensions in which the typeface developes, for instance “weight”, “width”, or other things. A designspace also stores information about the instances, specific locations in the designspace that are interesting and what they need to be called. Designspaces can be used to build variable fonts, but you can also use them to generate fixed UFOs. This text is an introduction to designspace construction. It does not go into detail how to design letterforms for interpolation, or things like family planning. That is for other chapters. To avoid getting tangled in typographic terminology, the dimensions in this text are named after colors."""
synth = NSSpeechSynthesizer.alloc().initWithVoice_("com.apple.speech.synthesis.voice.Whisper")
synth.startSpeakingString_(t)
View animationDecorator.py
from math import sqrt
class AnimationFrame(object):
def __init__(self, index, factor):
self._index = index
self._factor = factor
def index(self):
return self._index
View speechToCommand.py
import AppKit
import vanilla
from lib.tools.debugTools import ClassNameIncrementer
class SpeechRecognizerDelegate(AppKit.NSObject, metaclass=ClassNameIncrementer):
def speechRecognizer_didRecognizeCommand_(self, recognizer, command):