-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathremove_lookups.py
More file actions
36 lines (25 loc) · 861 Bytes
/
remove_lookups.py
File metadata and controls
36 lines (25 loc) · 861 Bytes
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
28
29
30
31
32
33
34
35
36
#!/usr/bin/env python3
# coding=utf8
import sys
import os.path
def count_lookups(f):
"""Count lookups in font and return the lookup keys"""
lookups = list(f.gsub_lookups) + list(f.gpos_lookups)
print('The font has {} lookups'.format(len(lookups)))
return lookups
if len(sys.argv) != 2:
sys.exit("Usage: Give one font file name as argument")
font = fontforge.open(sys.argv[1])
lookups = count_lookups(font)
print('Removing lookup')
#for l in lookups:
font.removeLookup(lookups[10])
count_lookups(font)
print('Generating \'output.ttf\'...')
font.generate('output.ttf')
font.close()
print('Opening generated font file to output2.ttf ...')
font2 = fontforge.open('output.ttf')
count_lookups(font2)
font2.generate('output2.ttf')
font2.close()