Skip to content

Commit

Permalink
Version 0.2
Browse files Browse the repository at this point in the history
Close #8
Close #11
  • Loading branch information
ctrlcctrlv committed Nov 22, 2020
1 parent 648ac86 commit 167c357
Show file tree
Hide file tree
Showing 14 changed files with 33 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# TT2020

(Version 0.2: 21 November 2020)

## [Download the font](https://ctrlcctrlv.github.io/TT2020/docs/download.html)

### [Why another typewriter font?](https://ctrlcctrlv.github.io/TT2020/docs/moreinfo.html) ♦ [How does it work?](https://ctrlcctrlv.github.io/TT2020/docs/moreinfo2.html) ♦ [Animated specimen](https://ctrlcctrlv.github.io/TT2020/docs/) ♦ [BoingBoing article](https://boingboing.net/2020/01/03/tt2020-an-old-timey-typewrite.html)
Expand Down
31 changes: 31 additions & 0 deletions build/version_0.2_patch.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/usr/bin/env python3
# I was in the middle of moving when this release was made and some vital build files were on another computer.
# Therefore, let's patch the binaries and call it a release. Users will never know as long as I don't fuck up.
# (Famous last words.)

import fontTools.ttLib
import sys

assert len(sys.argv) == 2, "No filename given"

ttf=fontTools.ttLib.TTFont(file=sys.argv[1])

# SFNT revision
ttf["head"].fontRevision = 0.2

# `name` font version
padZeroes = lambda bs: b'\x00'.join([b.encode('ascii') for b in bs])
names=ttf["name"].names
for n in names:
if n.nameID != 5: continue
n.string = n.string.replace(b'001', b'0.2').replace(padZeroes('001'), padZeroes('0.2')) \
.replace(b'0.1', b'0.2').replace(padZeroes('0.1'), padZeroes('0.2'))
ttf["name"].names=names

# `liga` ⇒ `dlig` (Closes #8)
if "GSUB" in ttf:
for fr in ttf["GSUB"].table.FeatureList.FeatureRecord:
fr.FeatureTag = 'dlig' if fr.FeatureTag == 'liga' else fr.FeatureTag

ttf.save(sys.argv[1])
print("Patched {}".format(sys.argv[1]), file=sys.stderr)
Loading

0 comments on commit 167c357

Please sign in to comment.