This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
''' | |
A command-line script to update a version number inside a SFNT. | |
python Versioner.py -v 1.420 -i *.otf | |
''' | |
import os | |
from re import findall as extract | |
from fontTools.ttLib import TTFont |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from scipy.io import wavfile | |
fs, data = wavfile.read("Untitled2.wav") | |
# for this case I only needed the left waveform | |
left = [a[0] for a in data.tolist()] | |
seconds = data.shape[0]/fs | |
fps = fs | |
duration = 1 / fps | |
totalFrames = round(seconds * fps) | |
# I was too lazy to scale anything so I made a massive image file:) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from AppKit import * | |
from mojo.events import addObserver | |
class frontAndCenter(): | |
def __init__(self): | |
addObserver(self,"bringFront", "applicationDidBecomeActive") | |
def bringFront(self,sender): | |
windows = [w for w in NSApp().orderedWindows() if w.isVisible()] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from fontTools.ttLib.tables._f_v_a_r import table__f_v_a_r, Axis, NamedInstance | |
from fontTools.ttLib.tables._n_a_m_e import table__n_a_m_e, NameRecord | |
from fontTools.ttLib import TTFont | |
def AddName(font, name): | |
nameTable = font.get("name") | |
if nameTable is None: | |
nameTable = font["name"] = table__n_a_m_e() | |
nameTable.names = [] | |
namerec = NameRecord() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from ufoProcessor import DesignSpaceProcessor | |
from mojo.UI import GetFile | |
# change this to True if you want to | |
# use VarLib instead of MutatorMath ↓ | |
D = DesignSpaceProcessor(ufoVersion=3, useVarlib=False) | |
designspacePaths = GetFile("select a designspace file:", allowsMultipleSelection=True, fileTypes=['designspace']) | |
if designspacePaths: | |
for designspacePath in designspacePaths: | |
D.read(designspacePath) | |
D.generateUFO() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
Toggle the pair list of an open MetricsMachine (extension) window | |
from all kerning pairs (sorted by glyph order) to exceptions and back. | |
''' | |
import metricsMachine | |
from mm4.interface.documentWindow import MMDocumentWindowController | |
from mm4.mmScripting import _getMainWindowControllerForFont, MetricsMachineScriptingError | |
import mm4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# menuTitle : front & center | |
# shortCut : command+alt+0 | |
from mojo.UI import SelectFont, AllFontWindows | |
from fontParts.world import RFont | |
class frontAndCenter: | |
def __init__(self): | |
self.fontWindows = [(w.document.font,w) for w in AllFontWindows() if hasattr(w, "document")] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import metricsMachine | |
from mm4.mmScripting import MetricsMachineScriptingError | |
from vanilla import FloatingWindow, List, CheckBox, PopUpButton | |
from mojo.events import addObserver, removeObserver | |
from AppKit import * | |
from mojo.UI import Message | |
class SyncMM: | |
def __init__(self): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from mojo.subscriber import Subscriber, registerGlyphEditorSubscriber, disableSubscriberEvents | |
''' | |
A startup script to help keep anchors in-sync across glyphs | |
The script will not append anchors, only move existing anchors | |
To set a linked glyph, add 'LinkedGlyphs:' in your main glyph's .note | |
On that same line add a comma separated list of glyph names (no spaces) | |
Adding a ! after a glyph name with a semicolon separated list will add | |
an exception and only those anchors will be moved | |
e.g. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import os | |
import sys | |
import fontTools.t1Lib | |
''' | |
usage: | |
cd into directory you want to look through |
OlderNewer