Skip to content

Instantly share code, notes, and snippets.

View arrowtype's full-sized avatar

Stephen Nixon arrowtype

View GitHub Profile
@arrowtype
arrowtype / LICENSE.txt
Last active April 29, 2025 14:07
Starter script to set up proper code ligatures in a GlyphsApp font source
MIT License
Copyright 2025 ArrowType / Stephen Nixon
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE S
@arrowtype
arrowtype / zip.py
Created February 23, 2025 20:43
Python script to create a zip of a folder, without .DS_Store files. Suggestions/comments welcome!
"""
MIT License.
"""
import os
import sys
import zipfile
def zip_directory(dir_to_zip):
# Change to the parent directory of the directory to zip
@arrowtype
arrowtype / proof-T-kerns.drawbot.py
Created April 17, 2024 22:12
A drawbot script used to proof kerns against the letter T
"""
This script requires some edits to be useful. Originally written for proofing Name Sans.
Demoed at https://www.youtube.com/watch?v=3a9KIPi_rTU
MIT License. Go ahead and use it!
Goals:
- Test `T` and `T.ultra` against basic lowercase: `TaTbTcT` etc, across full designspace, and especially around where it swaps to `T.ultra`
- Test `T` and `T.ultra` against relatively common diacritics
@arrowtype
arrowtype / remove-overlap-selected-contours.py
Last active September 23, 2023 19:39
RoboFont script to remove overlap in selected contours, or else current glyph
# menutitle: Remove Overlap in Selected Contours
# shortcut: control+command+o
g = CurrentGlyph()
with g.undo("Remove overlap"):
d_glyph = g.asDefcon()
sel = d_glyph.selection
sel.removeOverlap()
@arrowtype
arrowtype / add-ufo2ft-filters-to-ufos_in_dir.py
Last active July 31, 2023 19:37
A Python script to set ufo2ft filters in UFOs, in order to run them on FontMake builds
"""
A script to set ufo2ft filters for all fonts in a directory.
DIRECTIONS: Set up the dict below with filters you would like to use in your UFO builds. Then, run it in the command
line like this, replacing the <content surrounded by angle brackets> with relavent paths:
python3 "<path_to_this_script>/add-ufo2ft-filters-to-ufos_in_dir.py" "<path_to_a_folder_containing_UFO_fonts>"
See https://github.com/googlefonts/fontmake/blob/a4c83a0693ae7c629db9385a9e68d8641d85718e/USAGE.md#outline-filtering
for more information.
@arrowtype
arrowtype / example-designspace.designspace
Last active June 30, 2023 14:20
A script to help sync spacing & shaping for support sources within a large designspace.
<?xml version='1.0' encoding='UTF-8'?>
<designspace format="5.0">
<axes elidedfallbackname="Regular">
<axis tag="opsz" name="Optical Size" minimum="8" maximum="72" default="8">
<labelname xml:lang="en">Optical Size</labelname>
<map input="72" output="72"/>
<map input="20" output="40"/>
<map input="8" output="8" name="Text" elidable="true"/>
</axis>
<axis tag="wght" name="Weight" minimum="1" maximum="1000" default="700">
@arrowtype
arrowtype / fonttools-recording-pen-example.py
Created June 23, 2023 22:05
Basic example of how to use the FontTools Recording Pen
"""
A basic example of how to open a UFO and print out the bezier curve values from a glyph.
Example expanded from:
https://fonttools.readthedocs.io/en/latest/pens/recordingPen.html
Requires FontTools and FontParts.
"""
from fontParts.fontshell import RFont as Font
@arrowtype
arrowtype / README.md
Last active June 27, 2023 16:48
Example script that helps keep support sources up to date between full sources of a designspace.
@arrowtype
arrowtype / zipit.sh
Created June 7, 2023 22:04
A shell function to zip folders, excluding macOS metadata files. Add to your .bash_profile (or similar) to have a "zipit" command.
function zipit {
currentDir=$(pwd) # get current dir so you can return later
cd $(dirname $1) # change to target’s dir (works better for zip)
target=$(basename $1) # get target’s name
zip -r $target.zip $target -x '*/.DS_Store' # make a zip of the target, excluding macOS metadata
echo "zip made of " $1 # announce completion
cd $currentDir # return to where you were
}
@arrowtype
arrowtype / calculate-stripe-fee.py
Last active February 28, 2023 17:36
A quick Python script to compute Stripe fees, for invoicing customers
"""
A simple Python3 script to take in a project price, and output the fee Stripe will charge on an invoice.
See also:
https://support.stripe.com/questions/passing-the-stripe-fee-on-to-customers
USAGE - Call the script with Python3 and its path, and give your project/goal price as an arg:
python3 calculate-stripe-fee.py 95.00