blob: 9534a5ca5640b990e33c1a2bb5f6c3d04a609a8d [file] [log] [blame]
Behdad Esfahbod54660612013-07-21 18:16:55 -04001#!/usr/bin/python
2
3# Python OpenType Layout Subsetter
Behdad Esfahbod4aa6ce32013-07-22 12:15:36 -04004# Written by: Behdad Esfahbod
Behdad Esfahbod54660612013-07-21 18:16:55 -04005
6import fontTools.ttx
Behdad Esfahbod54660612013-07-21 18:16:55 -04007
Behdad Esfahbod54660612013-07-21 18:16:55 -04008
Behdad Esfahbod02b92062013-07-21 18:40:59 -04009def add_method (*clazzes):
Behdad Esfahbod54660612013-07-21 18:16:55 -040010 def wrapper(method):
Behdad Esfahbod02b92062013-07-21 18:40:59 -040011 for clazz in clazzes:
12 setattr (clazz, method.func_name, method)
Behdad Esfahbod54660612013-07-21 18:16:55 -040013 return wrapper
14
Behdad Esfahbod54660612013-07-21 18:16:55 -040015# Subset
Behdad Esfahbod54660612013-07-21 18:16:55 -040016
17@add_method(fontTools.ttLib.tables.otTables.Coverage)
18def subset (self, glyphs):
19 indices = [i for (i,g) in enumerate (self.glyphs) if g in glyphs]
20 self.glyphs = [g for g in self.glyphs if g in glyphs]
21 return indices
Behdad Esfahbodd1d41bc2013-07-21 23:15:32 -040022
23@add_method(fontTools.ttLib.tables.otTables.Coverage)
24def __nonzero__ (self):
25 return bool (self.glyphs)
Behdad Esfahbod54660612013-07-21 18:16:55 -040026
27@add_method(fontTools.ttLib.tables.otTables.ClassDef)
28def subset (self, glyphs):
Behdad Esfahbod4aa6ce32013-07-22 12:15:36 -040029 "Returns ascending list of remaining classes."
Behdad Esfahbod54660612013-07-21 18:16:55 -040030 self.classDefs = {g:v for g,v in self.classDefs.items() if g in glyphs}
Behdad Esfahbod4aa6ce32013-07-22 12:15:36 -040031 return {v:1 for v in self.classDefs.values ()}.keys ()
32
33@add_method(fontTools.ttLib.tables.otTables.ClassDef)
34def remap (self, class_map):
35 "Remaps classes."
36 self.classDefs = {g:class_map.index (v) for g,v in self.classDefs.items()}
Behdad Esfahbodd1d41bc2013-07-21 23:15:32 -040037
38@add_method(fontTools.ttLib.tables.otTables.ClassDef)
39def __nonzero__ (self):
40 return bool (self.classDefs)
Behdad Esfahbod54660612013-07-21 18:16:55 -040041
42@add_method(fontTools.ttLib.tables.otTables.SingleSubst)
43def subset (self, glyphs):
44 if self.Format in [1, 2]:
45 self.mapping = {g:v for g,v in self.mapping.items() if g in glyphs}
Behdad Esfahbodd1d41bc2013-07-21 23:15:32 -040046 return len (self.mapping)
Behdad Esfahbod54660612013-07-21 18:16:55 -040047 else:
48 assert 0, "unknown format: %s" % self.Format
49
50@add_method(fontTools.ttLib.tables.otTables.MultipleSubst)
51def subset (self, glyphs):
52 if self.Format == 1:
53 indices = self.Coverage.subset (glyphs)
54 self.Sequence = [self.Sequence[i] for i in indices]
Behdad Esfahbodd1d41bc2013-07-21 23:15:32 -040055 self.SequenceCount = len (self.Sequence)
56 return self.SequenceCount
Behdad Esfahbod54660612013-07-21 18:16:55 -040057 else:
58 assert 0, "unknown format: %s" % self.Format
59
60@add_method(fontTools.ttLib.tables.otTables.AlternateSubst)
61def subset (self, glyphs):
62 if self.Format == 1:
63 self.alternates = {g:v for g,v in self.alternates.items() if g in glyphs}
Behdad Esfahbodd1d41bc2013-07-21 23:15:32 -040064 return len (self.alternates)
Behdad Esfahbod54660612013-07-21 18:16:55 -040065 else:
66 assert 0, "unknown format: %s" % self.Format
67
68@add_method(fontTools.ttLib.tables.otTables.LigatureSubst)
69def subset (self, glyphs):
Behdad Esfahbodd1d41bc2013-07-21 23:15:32 -040070 if self.Format == 1:
71 self.ligatures = {g:v for g,v in self.ligatures.items() if g in glyphs}
72 self.ligatures = {g:[seq for seq in seqs if all(c in glyphs for c in seq.Component)]
73 for g,seqs in self.ligatures.items()}
74 self.ligatures = {g:v for g,v in self.ligatures.items() if v}
75 return len (self.ligatures)
76 else:
77 assert 0, "unknown format: %s" % self.Format
Behdad Esfahbod54660612013-07-21 18:16:55 -040078
Behdad Esfahbod54660612013-07-21 18:16:55 -040079@add_method(fontTools.ttLib.tables.otTables.ReverseChainSingleSubst)
80def subset (self, glyphs):
81 if self.Format == 1:
82 indices = self.Coverage.subset (glyphs)
83 self.Substitute = [self.Substitute[i] for i in indices]
84 self.GlyphCount = len (self.Substitute)
Behdad Esfahbodd1d41bc2013-07-21 23:15:32 -040085 return self.GlyphCount and all (c.subset (glyphs) for c in self.LookAheadCoverage + self.BacktrackCoverage)
Behdad Esfahbod54660612013-07-21 18:16:55 -040086 else:
87 assert 0, "unknown format: %s" % self.Format
88
89@add_method(fontTools.ttLib.tables.otTables.SinglePos)
90def subset (self, glyphs):
91 if self.Format == 1:
Behdad Esfahbodd1d41bc2013-07-21 23:15:32 -040092 return len (self.Coverage.subset (glyphs))
Behdad Esfahbod54660612013-07-21 18:16:55 -040093 elif self.Format == 2:
94 indices = self.Coverage.subset (glyphs)
95 self.Value = [self.Value[i] for i in indices]
96 self.ValueCount = len (self.Value)
Behdad Esfahbodd1d41bc2013-07-21 23:15:32 -040097 return self.ValueCount
Behdad Esfahbod54660612013-07-21 18:16:55 -040098 else:
99 assert 0, "unknown format: %s" % self.Format
100
101@add_method(fontTools.ttLib.tables.otTables.PairPos)
102def subset (self, glyphs):
103 if self.Format == 1:
104 indices = self.Coverage.subset (glyphs)
105 self.PairSet = [self.PairSet[i] for i in indices]
106 for p in self.PairSet:
107 p.PairValueRecord = [r for r in p.PairValueRecord if r.SecondGlyph in glyphs]
108 p.PairValueCount = len (p.PairValueRecord)
Behdad Esfahbodd1d41bc2013-07-21 23:15:32 -0400109 self.PairSet = [p for p in self.PairSet if p.PairValueCount]
Behdad Esfahbod54660612013-07-21 18:16:55 -0400110 self.PairSetCount = len (self.PairSet)
Behdad Esfahbodd1d41bc2013-07-21 23:15:32 -0400111 return self.PairSetCount
Behdad Esfahbod54660612013-07-21 18:16:55 -0400112 elif self.Format == 2:
113 self.Coverage.subset (glyphs)
Behdad Esfahbod4aa6ce32013-07-22 12:15:36 -0400114 class1_map = self.ClassDef1.subset (glyphs)
115 class2_map = self.ClassDef2.subset (glyphs)
116 self.ClassDef1.remap (class1_map)
117 self.ClassDef2.remap (class2_map)
118 self.Class1Record = [self.Class1Record[i] for i in class1_map]
119 for c in self.Class1Record:
120 c.Class2Record = [c.Class2Record[i] for i in class2_map]
121 self.Class1Count = len (class1_map)
122 self.Class2Count = len (class2_map)
123 return self.Coverage and self.Class1Count and self.Class2Count
Behdad Esfahbod54660612013-07-21 18:16:55 -0400124 else:
125 assert 0, "unknown format: %s" % self.Format
126
127@add_method(fontTools.ttLib.tables.otTables.CursivePos)
128def subset (self, glyphs):
129 if self.Format == 1:
130 indices = self.Coverage.subset (glyphs)
131 self.EntryExitRecord = [self.EntryExitRecord[i] for i in indices]
Behdad Esfahbodd1d41bc2013-07-21 23:15:32 -0400132 self.EntryExitCount = len (self.EntryExitRecord)
133 return self.EntryExitCount
Behdad Esfahbod54660612013-07-21 18:16:55 -0400134 else:
135 assert 0, "unknown format: %s" % self.Format
136
137@add_method(fontTools.ttLib.tables.otTables.MarkBasePos)
138def subset (self, glyphs):
139 if self.Format == 1:
140 mark_indices = self.MarkCoverage.subset (glyphs)
141 self.MarkArray.MarkRecord = [self.MarkArray.MarkRecord[i] for i in mark_indices]
142 self.MarkArray.MarkCount = len (self.MarkArray.MarkRecord)
143 base_indices = self.BaseCoverage.subset (glyphs)
144 self.BaseArray.BaseRecord = [self.BaseArray.BaseRecord[i] for i in base_indices]
145 self.BaseArray.BaseCount = len (self.BaseArray.BaseRecord)
146 # TODO Prune empty classes
Behdad Esfahbodd1d41bc2013-07-21 23:15:32 -0400147 return self.MarkArray.MarkCount and self.BaseArray.BaseCount
Behdad Esfahbod54660612013-07-21 18:16:55 -0400148 else:
149 assert 0, "unknown format: %s" % self.Format
150
151@add_method(fontTools.ttLib.tables.otTables.MarkLigPos)
152def subset (self, glyphs):
153 if self.Format == 1:
154 mark_indices = self.MarkCoverage.subset (glyphs)
155 self.MarkArray.MarkRecord = [self.MarkArray.MarkRecord[i] for i in mark_indices]
156 self.MarkArray.MarkCount = len (self.MarkArray.MarkRecord)
157 ligature_indices = self.LigatureCoverage.subset (glyphs)
158 self.LigatureArray.LigatureAttach = [self.LigatureArray.LigatureAttach[i] for i in ligature_indices]
159 self.LigatureArray.LigatureCount = len (self.LigatureArray.LigatureAttach)
160 # TODO Prune empty classes
Behdad Esfahbodd1d41bc2013-07-21 23:15:32 -0400161 return self.MarkArray.MarkCount and self.LigatureArray.LigatureCount
Behdad Esfahbod54660612013-07-21 18:16:55 -0400162 else:
163 assert 0, "unknown format: %s" % self.Format
164
165@add_method(fontTools.ttLib.tables.otTables.MarkMarkPos)
166def subset (self, glyphs):
167 if self.Format == 1:
168 mark1_indices = self.Mark1Coverage.subset (glyphs)
169 self.Mark1Array.MarkRecord = [self.Mark1Array.MarkRecord[i] for i in mark1_indices]
170 self.Mark1Array.MarkCount = len (self.Mark1Array.MarkRecord)
171 mark2_indices = self.Mark2Coverage.subset (glyphs)
172 self.Mark2Array.Mark2Record = [self.Mark2Array.Mark2Record[i] for i in mark2_indices]
173 self.Mark2Array.MarkCount = len (self.Mark2Array.Mark2Record)
174 # TODO Prune empty classes
Behdad Esfahbodd1d41bc2013-07-21 23:15:32 -0400175 return self.Mark1Array.MarkCount and self.Mark2Array.MarkCount
Behdad Esfahbod54660612013-07-21 18:16:55 -0400176 else:
177 assert 0, "unknown format: %s" % self.Format
178
Behdad Esfahbod02b92062013-07-21 18:40:59 -0400179@add_method(fontTools.ttLib.tables.otTables.ContextSubst, fontTools.ttLib.tables.otTables.ContextPos)
Behdad Esfahbod54660612013-07-21 18:16:55 -0400180def subset (self, glyphs):
Behdad Esfahbod02b92062013-07-21 18:40:59 -0400181 if self.Format == 1:
Behdad Esfahbodb7fef902013-07-21 22:48:08 -0400182 indices = self.Coverage.subset (glyphs)
183 self.SubRuleSet = [self.SubRuleSet[i] for i in indices]
184 self.SubRuleSetCount = len (self.SubRuleSet)
185 for rs in self.SubRuleSet:
186 rs.SubRule = [r for r in rs.SubRule
187 if all (g in glyphs for g in r.Input)]
188 rs.SubRuleCount = len (rs.SubRule)
Behdad Esfahbodd1d41bc2013-07-21 23:15:32 -0400189 # Prune empty subrulesets
190 return self.SubRuleSetCount
Behdad Esfahbod02b92062013-07-21 18:40:59 -0400191 elif self.Format == 2:
Behdad Esfahbodd1d41bc2013-07-21 23:15:32 -0400192 return self.Coverage.subset (glyphs) and self.ClassDef.subset (glyphs)
Behdad Esfahbod02b92062013-07-21 18:40:59 -0400193 elif self.Format == 3:
Behdad Esfahbodd1d41bc2013-07-21 23:15:32 -0400194 return all (c.subset (glyphs) for c in self.Coverage)
Behdad Esfahbod02b92062013-07-21 18:40:59 -0400195 else:
196 assert 0, "unknown format: %s" % self.Format
Behdad Esfahbod54660612013-07-21 18:16:55 -0400197
Behdad Esfahbod02b92062013-07-21 18:40:59 -0400198@add_method(fontTools.ttLib.tables.otTables.ChainContextSubst, fontTools.ttLib.tables.otTables.ChainContextPos)
Behdad Esfahbod54660612013-07-21 18:16:55 -0400199def subset (self, glyphs):
Behdad Esfahbod02b92062013-07-21 18:40:59 -0400200 if self.Format == 1:
Behdad Esfahbodb7fef902013-07-21 22:48:08 -0400201 indices = self.Coverage.subset (glyphs)
202 self.ChainSubRuleSet = [self.ChainSubRuleSet[i] for i in indices]
203 self.ChainSubRuleSetCount = len (self.ChainSubRuleSet)
204 for rs in self.ChainSubRuleSet:
205 rs.ChainSubRule = [r for r in rs.ChainSubRule
206 if all (g in glyphs for g in r.Backtrack + r.Input + r.LookAhead)]
207 rs.ChainSubRuleCount = len (rs.ChainSubRule)
Behdad Esfahbodd1d41bc2013-07-21 23:15:32 -0400208 # Prune empty subrulesets
209 return self.ChainSubRuleSetCount
Behdad Esfahbod02b92062013-07-21 18:40:59 -0400210 elif self.Format == 2:
Behdad Esfahbodd1d41bc2013-07-21 23:15:32 -0400211 return self.Coverage.subset (glyphs) and \
212 self.LookAheadClassDef.subset (glyphs) and \
213 self.BacktrackClassDef.subset (glyphs) and \
214 self.InputClassDef.subset (glyphs)
Behdad Esfahbod02b92062013-07-21 18:40:59 -0400215 elif self.Format == 3:
Behdad Esfahbodd1d41bc2013-07-21 23:15:32 -0400216 return all (c.subset (glyphs) for c in self.InputCoverage + self.LookAheadCoverage + self.BacktrackCoverage)
Behdad Esfahbod02b92062013-07-21 18:40:59 -0400217 else:
218 assert 0, "unknown format: %s" % self.Format
Behdad Esfahbod54660612013-07-21 18:16:55 -0400219
Behdad Esfahbod02b92062013-07-21 18:40:59 -0400220@add_method(fontTools.ttLib.tables.otTables.ExtensionSubst, fontTools.ttLib.tables.otTables.ExtensionPos)
Behdad Esfahbod54660612013-07-21 18:16:55 -0400221def subset (self, glyphs):
222 if self.Format == 1:
Behdad Esfahbodd1d41bc2013-07-21 23:15:32 -0400223 return self.ExtSubTable.subset (glyphs)
Behdad Esfahbod54660612013-07-21 18:16:55 -0400224 else:
225 assert 0, "unknown format: %s" % self.Format
226
Behdad Esfahbod02b92062013-07-21 18:40:59 -0400227@add_method(fontTools.ttLib.tables.otTables.Lookup)
228def subset (self, glyphs):
Behdad Esfahbod1be53452013-07-21 22:52:15 -0400229 self.SubTable = [s for s in self.SubTable if s.subset (glyphs)]
Behdad Esfahbodd1d41bc2013-07-21 23:15:32 -0400230 self.SubTableCount = len (self.SubTable)
231 return self.SubTableCount
232
233@add_method(fontTools.ttLib.tables.otTables.LookupList)
234def subset (self, glyphs):
Behdad Esfahbod77cda412013-07-22 11:46:50 -0400235 "Returns the indices of nonempty lookups."
236 return [i for (i,l) in enumerate (self.Lookup) if l.subset (glyphs)]
237
238@add_method(fontTools.ttLib.tables.otTables.LookupList)
239def subset_lookups (self, lookup_indices):
240 self.Lookup = [self.Lookup[i] for i in lookup_indices]
241 self.LookupCount = len (self.Lookup)
242
243@add_method(fontTools.ttLib.tables.otTables.Feature)
244def subset_lookups (self, lookup_indices):
245 self.LookupListIndex = [l for l in self.LookupListIndex if l in lookup_indices]
246 # Now map them.
247 self.LookupListIndex = [lookup_indices.index (l) for l in self.LookupListIndex]
248 self.LookupCount = len (self.LookupListIndex)
Behdad Esfahbodd1d41bc2013-07-21 23:15:32 -0400249 return self.LookupCount
Behdad Esfahbod54660612013-07-21 18:16:55 -0400250
Behdad Esfahbod77cda412013-07-22 11:46:50 -0400251@add_method(fontTools.ttLib.tables.otTables.FeatureList)
252def subset_lookups (self, lookup_indices):
253 "Returns the indices of nonempty features."
254 feature_indices = [i for (i,f) in enumerate (self.FeatureRecord) if f.Feature.subset_lookups (lookup_indices)]
255 self.FeatureRecord = [self.FeatureRecord[i] for i in feature_indices]
256 self.FeatureCount = len (self.FeatureRecord)
257 return feature_indices
258
259@add_method(fontTools.ttLib.tables.otTables.DefaultLangSys, fontTools.ttLib.tables.otTables.LangSys)
260def subset_features (self, feature_indices):
261 if self.ReqFeatureIndex not in feature_indices:
262 self.ReqFeatureIndex = 65535
263 self.FeatureIndex = [f for f in self.FeatureIndex if f in feature_indices]
264 self.FeatureCount = len (self.FeatureIndex)
265 return self.FeatureCount
266
267@add_method(fontTools.ttLib.tables.otTables.Script)
268def subset_features (self, feature_indices):
269 if self.DefaultLangSys and not self.DefaultLangSys.subset_features (feature_indices):
270 self.DefaultLangSys = None
271 self.LangSysRecord = [l for l in self.LangSysRecord if l.LangSys.subset_features (feature_indices)]
272 self.LangSysCount = len (self.LangSysRecord)
273 return self.LangSysCount
274
275@add_method(fontTools.ttLib.tables.otTables.ScriptList)
276def subset_features (self, feature_indices):
277 self.ScriptRecord = [s for s in self.ScriptRecord if s.Script.subset_features (feature_indices)]
278 self.ScriptCount = len (self.ScriptRecord)
279 return self.ScriptCount
280
Behdad Esfahbod02b92062013-07-21 18:40:59 -0400281@add_method(fontTools.ttLib.tables.otTables.GSUB, fontTools.ttLib.tables.otTables.GPOS)
282def subset (self, glyphs):
Behdad Esfahbod77cda412013-07-22 11:46:50 -0400283 lookup_indices = self.LookupList.subset (glyphs)
284 self.subset_lookups (lookup_indices)
Behdad Esfahbodd1d41bc2013-07-21 23:15:32 -0400285 return True # Retain the possibly empty table
Behdad Esfahbod02b92062013-07-21 18:40:59 -0400286
Behdad Esfahbod77cda412013-07-22 11:46:50 -0400287@add_method(fontTools.ttLib.tables.otTables.GSUB, fontTools.ttLib.tables.otTables.GPOS)
288def subset_lookups (self, lookup_indices):
289 "Retrains specified lookups, then removes empty features, language systems, and scripts."
290 self.LookupList.subset_lookups (lookup_indices)
291 feature_indices = self.FeatureList.subset_lookups (lookup_indices)
292 self.ScriptList.subset_features (feature_indices)
293
Behdad Esfahbodefb984a2013-07-21 22:26:16 -0400294@add_method(fontTools.ttLib.tables.otTables.GDEF)
295def subset (self, glyphs):
296 if self.LigCaretList:
297 indices = self.LigCaretList.Coverage.subset (glyphs)
298 self.LigCaretList.LigGlyph = [self.LigCaretList.LigGlyph[i] for i in indices]
299 self.LigCaretList.LigGlyphCount = len (self.LigCaretList.LigGlyph)
Behdad Esfahbodd1d41bc2013-07-21 23:15:32 -0400300 if not self.LigCaretList.LigGlyphCount:
301 self.LigCaretList = None
Behdad Esfahbodefb984a2013-07-21 22:26:16 -0400302 if self.MarkAttachClassDef:
303 self.MarkAttachClassDef.classDefs = {g:v for g,v in self.MarkAttachClassDef.classDefs.items() if g in glyphs}
Behdad Esfahbodd1d41bc2013-07-21 23:15:32 -0400304 if not self.MarkAttachClassDef.classDefs:
305 self.MarkAttachClassDef = None
Behdad Esfahbodefb984a2013-07-21 22:26:16 -0400306 if self.GlyphClassDef:
307 self.GlyphClassDef.classDefs = {g:v for g,v in self.GlyphClassDef.classDefs.items() if g in glyphs}
Behdad Esfahbodd1d41bc2013-07-21 23:15:32 -0400308 if not self.GlyphClassDef.classDefs:
309 self.GlyphClassDef = None
Behdad Esfahbodefb984a2013-07-21 22:26:16 -0400310 if self.AttachList:
311 indices = self.AttachList.Coverage.subset (glyphs)
312 self.AttachList.AttachPoint = [self.AttachList.AttachPoint[i] for i in indices]
313 self.AttachList.GlyphCount = len (self.AttachList.AttachPoint)
Behdad Esfahbodd1d41bc2013-07-21 23:15:32 -0400314 if not self.AttachList.GlyphCount:
315 self.AttachList = None
316 return True # Retain the possibly empty table
Behdad Esfahbodefb984a2013-07-21 22:26:16 -0400317
318
Behdad Esfahbod02b92062013-07-21 18:40:59 -0400319if __name__ == '__main__':
320
321 import sys
322
Behdad Esfahbod4ae81712013-07-22 11:57:13 -0400323 verbose = False
324 if "--verbose" in sys.argv:
325 verbose = True
326 sys.argv.remove ("--verbose")
Behdad Esfahbod350a5272013-07-22 12:02:16 -0400327 xml = False
328 if "--xml" in sys.argv:
329 xml = True
330 sys.argv.remove ("--xml")
Behdad Esfahbod4ae81712013-07-22 11:57:13 -0400331
Behdad Esfahbod02b92062013-07-21 18:40:59 -0400332 if len (sys.argv) < 3:
333 print >>sys.stderr, "usage: pyotlss.py font-file glyph..."
334 sys.exit (1)
335
336 fontfile = sys.argv[1]
337 glyphs = sys.argv[2:]
338
339 font = fontTools.ttx.TTFont (fontfile)
340
341 names = font.getGlyphNames()
342 # Convert to glyph names
343 glyphs = [g if g in names else font.getGlyphName(int(g)) for g in glyphs]
344
Behdad Esfahbod350a5272013-07-22 12:02:16 -0400345 if xml:
Behdad Esfahbod4ae81712013-07-22 11:57:13 -0400346 import xmlWriter
347 writer = xmlWriter.XMLWriter (sys.stdout)
Behdad Esfahbod9d02c2d2013-07-22 11:08:37 -0400348 for tag in ['GDEF', 'GSUB', 'GPOS']:
349 if tag not in font:
Behdad Esfahbod02b92062013-07-21 18:40:59 -0400350 continue
Behdad Esfahbod9d02c2d2013-07-22 11:08:37 -0400351 if not font[tag].table.subset (glyphs):
352 del font[tag]
Behdad Esfahbod4ae81712013-07-22 11:57:13 -0400353 else:
Behdad Esfahbod350a5272013-07-22 12:02:16 -0400354 if xml:
Behdad Esfahbod4ae81712013-07-22 11:57:13 -0400355 writer.begintag (tag)
356 writer.newline ()
357 font[tag].toXML(writer, font)
358 writer.endtag (tag)
359 writer.newline ()
Behdad Esfahbod350a5272013-07-22 12:02:16 -0400360 if verbose:
361 print tag, "is %d bytes now." % len (font[tag].compile (font))
Behdad Esfahbodd1d41bc2013-07-21 23:15:32 -0400362
Behdad Esfahbod77cda412013-07-22 11:46:50 -0400363 font.save (fontfile + '.subset')