@@ -1196,15 +1196,21 @@ def embedTTFType42(font, characters, descriptor):
1196
1196
wObject = self .reserveObject ('Type 0 widths' )
1197
1197
toUnicodeMapObject = self .reserveObject ('ToUnicode map' )
1198
1198
1199
- print (f"SUBSET { filename } characters: { '' .join (chr (c ) for c in characters )} " )
1200
- fontdata = self .getSubset (filename , '' .join (chr (c ) for c in characters ))
1201
- print (f'SUBSET { filename } { os .stat (filename ).st_size } -> { len (fontdata )} ' )
1199
+ print (f"SUBSET { filename } characters: "
1200
+ f"{ '' .join (chr (c ) for c in characters )} " )
1201
+ fontdata = self .getSubset (
1202
+ filename ,
1203
+ '' .join (chr (c ) for c in characters )
1204
+ )
1205
+ print (f'SUBSET { filename } { os .stat (filename ).st_size } '
1206
+ f' ↦ { len (fontdata )} ' )
1202
1207
1203
1208
# reload the font object from the subset
1204
- # (all the necessary data could probably be obtained directly using fontLib.ttLib)
1209
+ # (all the necessary data could probably be obtained directly
1210
+ # using fontLib.ttLib)
1205
1211
with tempfile .NamedTemporaryFile (suffix = '.ttf' ) as tmp :
1206
1212
tmp .write (fontdata )
1207
- tmp .seek (0 ,0 )
1213
+ tmp .seek (0 , 0 )
1208
1214
font = FT2Font (tmp .name )
1209
1215
1210
1216
cidFontDict = {
@@ -1352,9 +1358,11 @@ def embedTTFType42(font, characters, descriptor):
1352
1358
1353
1359
@classmethod
1354
1360
def getSubset (self , fontfile , characters ):
1355
- """Read TTF font from the given file and subset it for the given characters.
1361
+ """
1362
+ Read TTF font from the given file and subset it for the given characters.
1356
1363
1357
- Returns a serialization of the subset font as bytes."""
1364
+ Returns a serialization of the subset font as bytes.
1365
+ """
1358
1366
1359
1367
options = subset .Options (glyph_names = True , recommended_glyphs = True )
1360
1368
options .drop_tables += ['FFTM' ]
0 commit comments