So, you saw Sans Bullshit Sans (which I
previously blogged about) and thought that Sans Bullshit
Sans font is cool, but its word list doesn't really match up with my
field's bullshit
?
As mentioned in that previous post, Sans Bullshit Sans is open-source and comes with a detailed blog post explaining how it was made. Which means we can follow those instructions to modify the word list.
FontTools#
You will need have to the fontTools package installed:
$ sudo apt-get install fonttools
FontTools includes the ttx
tool which converts back and forth
between TTF or OTF fonts and its own .ttx
XML
format. Then we can use standard tools like Python's etree
module to edit the XML before converting it back.
Extracting the word list#
Step one is to download SansBullshitSans.ttf and convert it
to .ttx
:1
$ wget http://pixelambacht.nl/downloads/SansBullshitSans.ttf
$ ttx SansBullshitSans.ttf
Then I wrote a script that extracts the word list from the .ttx
file
called ligature_xml_to_list.py
:
$ wget https://gist.githubusercontent.com/dperelman/81fb4d94124178f35966/raw/feb138d8852d4125a2245bedfcf0ebb3ef55241d/ligature_xml_to_list.py
$ sed -n '/<LigatureSubst /,/<\/LigatureSubst>/p' SansBullshitSans.ttx \
| python ./ligature_xml_to_list.py \
| tee words
DNA
DRM
MVP
ROI
SEM
SEO
accelerate
accountability
action items
...
The sed
command extracts the lines inside the
<LigatureSubst>
tag and passes them to the Python script, which uses
the etree
module to parse the XML along with fontTools to
convert from glyph names to Unicode characters.
Inserting a new word list#
Now edit the word list ./words
to your liking. Once you have done so,
you can use the following to build a font with your new word list:
wget https://gist.github.com/dperelman/d78e4897743f32e88a4b/raw/6017b403fbd54ef7dc410a7d37a7d61feb9e6ffd/gistfile1.py
FONTNAME=Sans Custom Bullshit Sans
WORDLIST=./words
ttx SansBullshitSans.ttf
(
sed -n "s/Sans Bullshit Sans/$FONTNAME/;0,/<LigatureSubst /p" SansBullshitSans.ttx
./gistfile1.py $WORDLIST | sed 's/^/ /'
sed -n '/<\/LigatureSubst>/,$p' SansBullshitSans.ttx
) >newFont.ttx
ttx newFont.ttx
rm newFont.ttx
gistfile1.py
is based on the script given in the blog post
about making Sans Bullshit Sans; the original had the word list
hard-coded, I changed it to use fileinput
instead. The
sed
commands copy the rest of the .ttx
file except for
renaming the font to $FONTNAME
so it doesn't
conflict with the real Sans Bullshit Sans. The three commands are
run in a subshell by surrounding them with ()
in order
to concatenate their output together. The output font file will be
newFont.ttf
.
-
The GitHub repository has a
SansBullshitSans.ttx
, but my version ofttx
can't read it, so I just created a fresh one from the.ttf
file. ↩
Comments
Have something to add? Post a comment by sending an email to comments@aweirdimagination.net. You may use Markdown for formatting.
There are no comments yet.