Skip to content

Instantly share code, notes, and snippets.

View arrowtype's full-sized avatar

Stephen Nixon arrowtype

View GitHub Profile
@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 / LICENSE.txt
Created September 21, 2020 14:52
A RoboFont script to generate a faux-italic font
Copyright 2020 Arrow Type / 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 SOFTWARE OR
"""
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!
@arrowtype
arrowtype / DarkConnor.roboFontTheme
Last active April 24, 2023 02:01
A dark theme for the RoboFont extension Theme Editor, based on the default "Connor’s Theme," but adjusted for a dark background. Updated April 2023.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>glyphViewAlternateFillColor</key>
<array>
<real>0.0</real>
<real>0.0</real>
<real>0.0</real>
<real>0.6027</real>
@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 / add-STAT.py
Created June 25, 2021 19:17
Example STAT-adding script for a typeface with split Roman/Italic variable fonts
"""
python3 src/build-scripts/helpers/add-STAT-display_only.py <build_directory>
...where <build_directory> is a folder containing two variable fonts, e.g. Family-Variable.ttf and FamilyItalic-Variable.ttf
This file is adapted from an example originally in https://github.com/Omnibus-Type/Texturina
"""
from fontTools.otlLib.builder import buildStatTable, _addName
from fontTools.ttLib import TTFont
@arrowtype
arrowtype / check-glyphset.py
Created August 3, 2021 22:31
A simple way to compare the unicodes currently covered by a font binary to GF Glyph Sets.
"""
A simple way to compare the unicodes currently covered by a font binary to GF Glyph Sets.
Doesn’t account for glyphs that don’t have unicodes, such as most ligatures, case-specific puncutation, etc.
Glyph Sets copied and adjusted from:
https://github.com/googlefonts/gftools/tree/3aefd92ba3f9ab5355de472a4cb1e4b19c1a3b2e/Lib/gftools/encodings/GF%20Glyph%20Sets#google-fonts-2016-glyph-sets
Usage:
@arrowtype
arrowtype / find-n-fix-unintended-kerning-exceptions.py
Last active August 26, 2021 15:37
RoboFont script to find unexpected kerning exceptions in a UFO, then remove those kerns and replace them with kerns using groups.
"""
Find kerning exceptions in a UFO, then remove those kerns and replace them with kerns using groups.
Why?
Sometimes, if you add kerning to a font early, you can wind up with unexpected kerning exceptions
when you add new characters to the font. E.g. ('G', 'asterisk') makes sense until you add 'Gbreve'.
USAGE:
Configure side1_ignore & side2_ignore lists below, then run this script in RoboFont.
- It won’t autosave your UFOs, because you should probably review the results before saving.