Skip to content

Instantly share code, notes, and snippets.

View LettError's full-sized avatar

Erik van Blokland LettError

View GitHub Profile
@LettError
LettError / mathColors_example.py
Created March 3, 2015 14:18
Example for MutatorMath in Drawbot. It shows how to make math objects for a color and a shape and how to process them with MutatorMath.
from __future__ import division
from mutatorMath.objects.location import Location
from mutatorMath.objects.mutator import buildMutator
"""
Simple demo that can be run in Drawbot
http://www.drawbot.com
@LettError
LettError / spirals.py
Created October 30, 2015 15:25
Draw a spiral in Drawbot.
import math
def segment(x, y, a, d, lw):
save()
fill(None)
stroke(1,1,1)
strokeWidth(lw)
newPath()
moveTo((x,y))
a = math.radians(a)
@LettError
LettError / copyCurrentGitVersionToPrevLayer.py
Last active July 4, 2019 08:25
RoboFont: copy glif from git repo to layer in current glyph.
"""
Assuming you have
a UFO open in RoboFont
a current glyph selected
and furthermore that
this glyph is part of a git repository
and that you have done some work on it
and would like to compare the current state in robofont
@LettError
LettError / findGreeks.py
Created March 17, 2016 08:23
Find unicode names with "GREEK" and "SYMBOL"
from glyphNameFormatter import GlyphName
from glyphNameFormatter.unicodeRangeNames import *
greekSymbols = []
for name in getAllRangeNames():
if name in ['Ancient Greek Musical Notation', 'Mathematical Alphanumeric Symbols']: continue
a, b = getRangeByName(name)
for uniNumber in range(a,b):
@LettError
LettError / GlyphConstruction.txt
Created June 4, 2016 14:54
Deprecated list of glyph constructions.
#
# RoboFab Glyph Construction Database
#
# format:
# Glyphname: BaseGlyph Accent.RelativePosition* Accent.RelativePosition*
# *RelativePosition can be top, bottom, left, right
#
# NOTE: this is not a comprehensive, or even accurate, glyph list.
# It was built by Python robots and, in many cases, by tired human hands.
# Please report any omissions, errors or praise to the local RoboFab authorities.
@LettError
LettError / editThatOtherMaster.py
Last active June 7, 2017 10:17
RoboFont: switch edit windows: edit window for the current glyph, but the from the next master.
"""
If you're editing masters or whatever
and you want to switch to the same glyph in the other master
and you spend a lot of time moving glyph windows around
Add this script to RF and wire it to a key command
and then woosh woosh woosh cycle between the masters.
Possible features, not included
- some control over the direction, previous / next
size(1000, 1000)
thisFontSize = 242
s = FormattedString(
txt="fe AV,",
font="EamesCenturyModern-Regular",
fontSize=312,
)
textBox(s , (50, 50, width()-50, height()-1.5*50))
size(1000, 1000)
thisFontSize = 242
s = FormattedString(
txt="fe AV,",
font="EamesCenturyModern-Regular",
fontSize=312,
)
textBox(s , (50, 50, width()-50, height()-1.5*50))
@LettError
LettError / fontMathMathKerningExtrapolation.py
Created October 25, 2017 14:33
A comparison between the way MathKerning and Batch interpolate kerning
# an exploration of the issue described in
# https://github.com/typemytype/batchRoboFontExtension/issues/25
# [email protected]
# October 25 2017
from pprint import pprint
from fontMath.mathKerning import MathKerning
from mutatorMath.objects.mutator import buildMutator, Location
@LettError
LettError / spaceFolder.py
Created November 10, 2017 09:41
Example of how to use a mutatorMath designspace to transform n-dimensional Location objects from one point in space to another. AFAICT this is how the XVAR transformations would work.
from mutatorMath.objects.mutator import buildMutator, Location
# "That is, travel to any part of the Universe without moving."
# This is a demo of how to warp locations in a n-dimensional space.
# The mutatorMath Location object is a more or less a basoc python dictionary.
# But it can also behave as a math object, and that makes it possible
# to calculate xvar like transformations. In this example Location objects
# are both used to place an object in a designspace, as well as the objects themselves.