-
Notifications
You must be signed in to change notification settings - Fork 1
/
socho.py
executable file
·27 lines (23 loc) · 733 Bytes
/
socho.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/usr/bin/env fontforge
import fontforge, psMat
from sys import argv, stderr
from os import system
from math import radians
if len(argv) < 4:
stderr.write("Usage: "+argv[0]+" skew-flag infile outfile\n")
quit(1)
fontforge.setPrefs('CoverageFormatsAllowed', 1)
font = fontforge.open(argv[2])
for glyph in font.glyphs():
if glyph.isWorthOutputting():
width = glyph.width
glyph.transform(psMat.translate(-font.em / 2, 0))
glyph.transform(psMat.scale(0.8, 1.0))
if int(argv[1]):
glyph.transform(psMat.rotate(radians(90)))
glyph.transform(psMat.skew(radians(-4)))
glyph.transform(psMat.rotate(radians(-90)))
glyph.transform(psMat.translate(font.em / 2, 0))
glyph.width = width
font.save(argv[3])
font.close()