Skip to content

Commit 6c85d3f

Browse files
committed
Merge pull request #16 from mdboom/more-subsetting-fixes
Restore POST table subsetting
2 parents c98a52f + 3946234 commit 6c85d3f

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

lib/freetypy/subset.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -343,11 +343,11 @@ def _subset_format2(self, glyphs):
343343
if gind < numglyphs:
344344
offset = i + 2 * gind
345345
name_index, = struct.unpack('>H', content[offset:offset+2])
346-
if name_index < n_basic_names:
346+
if name_index < N_BASIC_NAMES:
347347
new_glyph_index[gind] = name_index
348-
elif (name_index >= n_basic_names and
349-
name_index < numglyphs - n_basic_names):
350-
needed_indices[name_index - n_basic_names] = gind
348+
elif (name_index >= N_BASIC_NAMES and
349+
name_index < numglyphs - N_BASIC_NAMES):
350+
needed_indices[name_index - N_BASIC_NAMES] = gind
351351

352352
names = []
353353
name_index = 0
@@ -358,7 +358,7 @@ def _subset_format2(self, glyphs):
358358
if name_index in needed_indices:
359359
name = content[i:i+name_length]
360360
new_glyph_index[needed_indices[name_index]] = (
361-
len(names) + n_basic_names)
361+
len(names) + N_BASIC_NAMES)
362362
names.append(name)
363363
i += name_length
364364
name_index += 1
@@ -375,7 +375,7 @@ def _subset_format2(self, glyphs):
375375
return b''.join(new_content)
376376

377377
def subset(self, glyphs):
378-
if self.format == 0x20000 and False:
378+
if self.format == 0x20000:
379379
self.content = self._subset_format2(glyphs)
380380

381381

0 commit comments

Comments
 (0)