Skip to content

Instantly share code, notes, and snippets.

View arrowtype's full-sized avatar

Stephen Nixon arrowtype

View GitHub Profile
@arrowtype
arrowtype / github-details-bash-alias.sh
Created November 11, 2019 15:46
Get a handy summary+details dropdown to copy into HTML, markdown, and GitHub Issues/PRs/readme files
# add the line below to your ~/.bash_profile or ~/.profile
alias deets="printf \"<details>\n<summary><b><!-------->Dropdown title<!--------></b> (Click to expand)</summary>\n\n<!-------->\nDropdown details\n<!-------->\n\n</details>\" | pbcopy && echo \"github-ready <details> element copied to clipboard\""
@arrowtype
arrowtype / MM2SpaceCenter_v4.9.py
Created March 16, 2020 10:55 — forked from cjdunn/MM2SpaceCenter_v4.9.py
MM2SpaceCenter_v4.9.py
# MM2SpaceCenter by CJ Dunn, 2019, and licensed under the MIT license. Thanks to Tal Leming, Andy Clymer, David Jonathan Ross, Jackson Cavanaugh, Nina Stössinger for help and inspiration with this script
# #when pair changes: get pair and set to space center
#you must have a UFO open and have MetricsMachine open
import sys, os
import random
from mojo.UI import CurrentSpaceCenter, OpenSpaceCenter
@arrowtype
arrowtype / set-new-mark-opacity.robofont.py
Created May 3, 2020 17:57
RoboFont script to help set new mark opacity for a selected mark
"""
Get the mark color of currently-selected glyphs and change the
opacity of it in the current font.
Useful for changing the Font View to a "dark theme," where
the wrong mark opacity can suddenly disrupt a system of colors.
"""
f = CurrentFont()
@arrowtype
arrowtype / copy-kerning-in-pair_list-from-ufo-to-ufos.py
Last active June 26, 2020 13:29
A script to run on UFO files from a command line. Goes through a pair list and copy kerns from one UFO to others, if those kern pairs are in the pair list.
"""
A script to run on UFO files from a command line. Goes through a pair list and
copy kerns from one UFO to others, if those kern pairs are in the pair list.
What happens:
- copy groups from ufoToCopyFrom to each other UFOs
- for each pair in the pair list, copy kern from ufoToCopyFrom to each other UFOs
---
@arrowtype
arrowtype / minecraft-cubes-and-towers.py
Last active March 5, 2021 15:23
Python experiments for Minecraft API (mcpi) to make ridiculous cubes & towers.
"""
Make cubes and towers in Minecraft, with Python.
Really fun way to introduce a kid to Python (or yourself to Minecraft, as I've learned).
Setup instructions for Minecraft + macOS + Python: https://gist.github.com/noahcoad/fc9d3984a5d4d61648269c0a9477c622
Additional setup:
- Activate correct Java version: `export JAVA_HOME=`/usr/libexec/java_home -v 11.0.5``
- Activate spigot `cd spigot; java -jar spigot.jar`
@arrowtype
arrowtype / abc-grid-flipped.drawbot.py
Created March 26, 2021 02:10
Make a cool reflected alphabet pattern in Drawbot.
"""
Make a cool reflected alphabet pattern.
Inspired by Klaus Burkhardt and Reinhard Döhl, Rot 40:
Poem Structures In the Looking Glass, Edition Rot, Stuttgart, 1969.
https://twitter.com/Lett_Arc/status/1375252819620466688
"""
s = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
@arrowtype
arrowtype / README.md
Last active April 7, 2021 17:34
An example script that adds a starter set of anchors to one or more UFOs. This must be run in RoboFont, but could be easily adapted to run via the command line only.

Add (starter) anchors to UFO(s)

An example script that adds a starter set of anchors to one or more UFOs.

This is intended to save time clicking around and typing to add anchors to glyphs across one or multiple sources of a font project. You will still need to go through the glyphs to refine the positioning of anchors after running this script, as positions are only rough guesses.

You can remix/extend the script to add anchors to more glyphs, add special anchors to certain glyphs at certain positions, and more.

This script is intended to be run in RoboFont, but it could be easily adapted to run via the command line only, using the FontParts API.

@arrowtype
arrowtype / print-character-set.robofont.py
Created April 11, 2021 21:41
A RoboFont script to print all characters in a font that have a unicode value.
"""
A RoboFont script to print all characters in a font that have a unicode value.
"""
f = CurrentFont()
unicodes = []
for name in f.keys():
if f[name].unicodes != () and f[name].width != 0:
@arrowtype
arrowtype / lemonvetica.py
Created December 11, 2019 16:16 — forked from frankrolf/lemonvetica.py
Example on how to show a given letter’s off-curve points in DrawBot
# it’s easy to access a letter’s contours through a BezierPath object:
bp = BezierPath()
bp.text(
's',
font='.SFNSDisplayCondensed-Black',
fontSize=1200)
# Fill the letter, and offset the whole canvas so it sits in the middle.
fill(1, 1, 0)
letter_width = bp.bounds()[-2] - bp.bounds()[0]
"""
A RoboFont script to check if "dark mode" is currently active and apply dark preferences in RoboFont if so.
Works best if set up as a "Start Up Script." Here’s how to make it one:
1. Open RoboFont > Preferences
2. Go to Extensions > Start Up Scripts
3. Click the "+" icon, then add this script
4. Click "Apply" to save setting changes
5. Restart RoboFont!