@@ -184,15 +184,32 @@ class UFOOperator(object):
184184 # RF italic slant offset lib key
185185 italicSlantOffsetLibKey = "com.typemytype.robofont.italicSlantOffset"
186186
187- # Public key for list of glyphs we want to skip on export / generate. Stored in font.lib
188- skipExportGlyphKey = 'public.skipExportGlyphs'
189-
190- # Private key for list of glyphs we want to skip when calculating instances
191- excludeGlyphFromInstanceKey = 'com.letterror.ufoProcessor.excludeFromInstance'
192-
193- # UFOOperator temp lib muted design locations key
187+ # Public key for list of glyph names need to be skipped on generate. Stored in font.lib
188+ # "Export" is understood to mean "generating binaries". A mechanism to remove glyphs
189+ # that are not needed in the binary, it needs to be recorded in the UFO instance,
190+ # but it has no bearing on its glyphset.
191+ # font.lib, saved with the generated UFO.
192+ skipExportGlyphLibKey = 'public.skipExportGlyphs'
193+
194+ # Private key for list of glyph names we want to exclude when calculating instances
195+ # "Exclude" is understood to mean "do not attempt to instantiate". It is a
196+ # mechanism to make instances while some of the glyph data is not ready.
197+ # Note: this mechanism does not let us exclude specific glyphs in specific layers.
198+ # Quick answer: this would add a lot of plumbing and there is no indication
199+ # that this is a real problem at this time.
200+ # UFOOperator.lib, saved with the designspace.
201+ excludeGlyphFromInstanceLibKey = 'com.letterror.ufoProcessor.excludeFromInstance'
202+
203+ # UFOOperator key for temporarily muting specific design locations.
204+ # Any source at this location will be ignored when building a new mutator.
205+ # Usecase: when making partial sources, we need to be able to calculate a preview
206+ # of the glyph *without* that specific glyph.
207+ # Does this need to be public key?
208+ # UFOOperator.tempLib, not saved with the designspace.
194209 mutedDesignLocationsLibKey = 'mutedDesignLocations'
195210
211+ # In summary, these are separate mechanisms to mute glyphs, mute location, exclude glyphs and skip glyphs.
212+
196213 def __init__ (self , pathOrObject = None , ufoVersion = 3 , useVarlib = True , extrapolate = False , strict = False , debug = False ):
197214 self .ufoVersion = ufoVersion
198215 self .useVarlib = useVarlib
@@ -1244,7 +1261,7 @@ def collectSourcesForGlyph(self, glyphName, decomposeComponents=False, discreteL
12441261 if glyphName not in sourceLayer :
12451262 # start looking for a glyph
12461263 # this might be a support in a sparse layer
1247- # so we're skipping !
1264+ # so we're ignoring this glyph !
12481265 continue
12491266 # still have to check if the sourcelayer glyph is empty
12501267 if glyphName not in sourceLayer :
@@ -1347,45 +1364,46 @@ def getLocationType(self, location):
13471364 return anisotropic , continuousLocation , discreteLocation , locHorizontal , locVertical
13481365
13491366 def excludeGlyph (self , glyphNameOrList ):
1350- # add the glyphnames to the list of glyphs we do not want to make instances for
1367+ # Add the glyphnames to the list of glyphs we do not want to make instances for.
13511368 if isinstance (glyphNameOrList , str ):
13521369 glyphNameOrList = [glyphNameOrList ]
1353- excluding = self .lib .get (self .excludeGlyphFromInstanceKey , [])
1370+ excluding = self .lib .get (self .excludeGlyphFromInstanceLibKey , [])
13541371 for name in glyphNameOrList :
13551372 if name not in excluding :
13561373 excluding .append (name )
13571374 excluding .sort ()
1358- self .lib [self .excludeGlyphFromInstanceKey ] = excluding
1375+ self .lib [self .excludeGlyphFromInstanceLibKey ] = excluding
13591376 if self .debug :
1360- self .logger .info (f"excludeGlyph(): excluded glyphs: { self .lib [self .excludeGlyphFromInstanceKey ]} " )
1377+ self .logger .info (f"excludeGlyph(): excluded glyphs: { self .lib [self .excludeGlyphFromInstanceLibKey ]} " )
13611378
13621379 def includeGlyph (self , glyphNameOrList ):
1363- # remove the glyphnames to the list of glyphs we do not want to make instances for
1380+ # Remove the glyphnames from the list of glyphs we do not want to make instances for.
1381+ # In other words: start making instances for these glyphs again.
13641382 if isinstance (glyphNameOrList , str ):
13651383 glyphNameOrList = [glyphNameOrList ]
1366- excluding = self .lib .get (self .excludeGlyphFromInstanceKey , [])
1384+ excluding = self .lib .get (self .excludeGlyphFromInstanceLibKey , [])
13671385 for name in glyphNameOrList :
13681386 if name in excluding :
13691387 excluding .remove (name )
13701388 excluding .sort ()
13711389 if excluding :
1372- self .lib [self .excludeGlyphFromInstanceKey ] = excluding
1373- if self .excludeGlyphFromInstanceKey in self .lib :
1374- if self .lib [self .excludeGlyphFromInstanceKey ] == []:
1375- del self .lib [self .excludeGlyphFromInstanceKey ]
1390+ self .lib [self .excludeGlyphFromInstanceLibKey ] = excluding
1391+ if self .excludeGlyphFromInstanceLibKey in self .lib :
1392+ if self .lib [self .excludeGlyphFromInstanceLibKey ] == []:
1393+ del self .lib [self .excludeGlyphFromInstanceLibKey ]
13761394 if self .debug :
1377- self .logger .info (f"includeGlyph(): excluded glyphs: { self .lib .get (self .excludeGlyphFromInstanceKey , [])} " )
1395+ self .logger .info (f"includeGlyph(): excluded glyphs: { self .lib .get (self .excludeGlyphFromInstanceLibKey , [])} " )
13781396
13791397 def reportExcludedGlyphs (self ):
1380- # print overview of glyphs that are ignored and muted
1398+ # Print an overview of glyphs that are ignored and muted
13811399 report = []
1382- excluding = self .lib .get (self .excludeGlyphFromInstanceKey )
1400+ excluding = self .lib .get (self .excludeGlyphFromInstanceLibKey )
13831401 if excluding :
1384- report .append (f"\t Designspace excluded glyphs: { self .excludeGlyphFromInstanceKey } " )
1402+ report .append (f"\t Designspace excluded glyphs: { self .excludeGlyphFromInstanceLibKey } " )
13851403 for name in excluding :
13861404 report .append (f"\t { name } " )
13871405 else :
1388- report .append (f"\n No glyphs excluded in { self .excludeGlyphFromInstanceKey } " )
1406+ report .append (f"\n No glyphs excluded in { self .excludeGlyphFromInstanceLibKey } " )
13891407 for sd in self .sources :
13901408 if sd .mutedGlyphNames :
13911409 report .append (f"\t \t { sd .name } " )
@@ -1394,8 +1412,8 @@ def reportExcludedGlyphs(self):
13941412 return "\n " .join (report )
13951413
13961414 def collectExcludedGlyphs (self ):
1397- # return a list of all the glyphnames listed in self.excludeGlyphFromInstanceKey
1398- excluding = self .lib .get (self .excludeGlyphFromInstanceKey )
1415+ # return a list of all the glyphnames listed in self.excludeGlyphFromInstanceLibKey
1416+ excluding = self .lib .get (self .excludeGlyphFromInstanceLibKey )
13991417 if excluding is None :
14001418 excluding = []
14011419 if self .debug :
0 commit comments