Skip to content

Instantly share code, notes, and snippets.

Avatar

arrowtype

View GitHub Profile
@arrowtype
arrowtype / DarkConnor.roboFontTheme
Last active Feb 20, 2021
A dark theme for the RoboFont extension Theme Editor, based on the default "Connor’s Theme," but adjusted for a dark background.
View DarkConnor.roboFontTheme
<?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>
View dark-robofont.py
"""
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." Heres 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 / LICENSE.txt
Created Sep 21, 2020
A RoboFont script to generate a faux-italic font
View LICENSE.txt
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
@arrowtype
arrowtype / copy-kerning-in-pair_list-from-ufo-to-ufos.py
Last active Jun 26, 2020
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.
View copy-kerning-in-pair_list-from-ufo-to-ufos.py
"""
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 / getting-started-in-type-design.md
Last active Dec 17, 2020
Some tips for getting started in type design, plus a few favorite extensions and tools
View getting-started-in-type-design.md

Getting started in Type Design (and possible next steps)

So, you’re interested in type design, but you are still figuring out how & where to start or get to the next step. This post is a non-exhaustive attempt to share an overview of how you might learn some basics, how you can get started with font editing software, and where you might consider growing your skills after that. It reflects my bias and (some of) my personal experience, and it completely skips important topics like formal education, calligraphy and sketching, bezier drawing tips, and more.

This started as an email listing my favorite RoboFont extensions, and then I thought that it would be worth sharing publicly, and then I added more and it turned into a bigger post. In the future, I hope to bring it onto a proper blog as a collection of separate, more-focused topics.

General learning

Useful Internet resources

@arrowtype
arrowtype / 00-toggle-darkmode.robofont.py
Last active May 5, 2020
A script to toggle darkmode in RoboFont, for app UI and Font View. Also includes a dark theme for the RoboFont Theme Editor.
View 00-toggle-darkmode.robofont.py
"""
Toggle a dark mode in RoboFont.
For a dark mode in the Glyph Edit view, install Theme Editor:
https://github.com/connordavenport/Theme-Manager
...and import the "Dark Connor" theme from this Gist
(https://gist.github.com/arrowtype/ce0cee426f47c2fe7e82aa07d1e0a450).
Also offers to edit the markColor of glyphs with a high opacity in their markColor,
which will disrupt the visual effect of a dark mode on the Font View. However,
@arrowtype
arrowtype / set-new-mark-opacity.robofont.py
Created May 3, 2020
RoboFont script to help set new mark opacity for a selected mark
View set-new-mark-opacity.robofont.py
"""
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 / make-trial-font.py
Last active Dec 9, 2020
A command-line tool to produce a "trial font" for input OTF or TTF font files, using Python 3 & FontTools
View make-trial-font.py
"""
A script to create a trial font from an OpenType font file (OTF or TTF), keeping characters for specified unicodes, while hiding the rest with a "replacer" glyph.
This allows trial-font users to see how a given font looks to type words, but makes it simple to restrict it from full use in documents.
Hiding the extended character set under a "replacer" glyph prevents fallback fonts from easily being subbed in for unintended use.
This script is licensed under Apache 2.0: you are free to use and modify this script for commercial work.
USAGE:
@arrowtype
arrowtype / README.md
Last active Jun 11, 2020
The basics of working with unicode values in Python
View README.md

Unicode values in Python

Unicodes can either be integers (“A” is 65, “B” is 66, etc) or hex (“A” is 0x41, “B” is 0x42, etc).

When scripting with RoboFont or FontTools, a hard thing at first is that different styles come up in different contexts. For example, integers will often be used in scripts, but hex values are shown in UIs and in the TTX output of cmap (the table that maps unicode values to glyphs). So, it's helpful to know how to go between them to do different types of work.

To go from a string to an unicode integer, you can use ord(), like:

>>> ord("A")
View 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