<s> from random import choice <EOL> from compositor . classDefinitionTables import ClassDef <EOL> from compositor . glyphRecord import glyphNamesToGlyphRecords <EOL> from compositor . subTablesBase import BaseSubTable , BaseLookupRecord , Coverage , BaseContextFormat1SubTable , BaseContextFormat2SubTable , BaseContextFormat3SubTable , BaseChainingContextFormat1SubTable , BaseChainingContextFormat2SubTable , BaseChainingContextFormat3SubTable <EOL> __all__ = [ <EOL> "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" , "<STR_LIT>" <EOL> ] <EOL> globalSubstitutionSubTableSlots = [ "<STR_LIT>" ] <EOL> class GSUBLookupType1Format2 ( BaseSubTable ) : <EOL> """<STR_LIT>""" <EOL> __slots__ = [ "<STR_LIT>" , "<STR_LIT>" ] + globalSubstitutionSubTableSlots <EOL> def __init__ ( self ) : <EOL> super ( GSUBLookupType1Format2 , self ) . __init__ ( ) <EOL> self . SubstFormat = <NUM_LIT:2> <EOL> self . Substitute = [ ] <EOL> self . Coverage = None <EOL> def loadFromFontTools ( self , subtable , lookup ) : <EOL> super ( GSUBLookupType1Format2 , self ) . loadFromFontTools ( subtable , lookup ) <EOL> coverage = [ ] <EOL> self . Substitute = [ ] <EOL> for glyphName , alternate in sorted ( subtable . mapping . items ( ) ) : <EOL> coverage . append ( glyphName ) <EOL> self . Substitute . append ( alternate ) <EOL> self . Coverage = Coverage ( ) . loadFromFontTools ( coverage ) <EOL> return self <EOL> def process ( self , processed , glyphRecords , featureTag ) : <EOL> performedSub = False <EOL> currentRecord = glyphRecords [ <NUM_LIT:0> ] <EOL> currentGlyph = currentRecord . glyphName <EOL> if currentGlyph in self . Coverage : <EOL> if not self . _lookupFlagCoversGlyph ( currentGlyph ) : <EOL> performedSub = True <EOL> index = self . Coverage . index ( currentGlyph ) <EOL> substitute = self . Substitute [ index ] <EOL> if featureTag == "<STR_LIT>" : <EOL> if currentRecord . _alternatesReference != currentGlyph : <EOL> currentRecord . _alternatesReference = currentGlyph <EOL> currentRecord . alternates = [ ] <EOL> currentRecord . alternates . append ( substitute ) <EOL> else : <EOL> currentRecord . saveState ( currentRecord . glyphName ) <EOL> currentRecord . glyphName = substitute <EOL> processed . append ( currentRecord ) <EOL> glyphRecords = glyphRecords [ <NUM_LIT:1> : ] <EOL> return processed , glyphRecords , performedSub <EOL> class GSUBLookupType2 ( BaseSubTable ) : <EOL> """<STR_LIT>""" <EOL> __slots__ = [ "<STR_LIT>" , "<STR_LIT>" ] + globalSubstitutionSubTableSlots <EOL> def __init__ ( self ) : <EOL> super ( GSUBLookupType2 , self ) . __init__ ( ) <EOL> self . SubstFormat = <NUM_LIT:1> <EOL> self . Coverage = None <EOL> self . Sequence = [ ] <EOL> def loadFromFontTools ( self , subtable , lookup ) : <EOL> super ( GSUBLookupType2 , self ) . loadFromFontTools ( subtable , lookup ) <EOL> self . Coverage = Coverage ( ) . loadFromFontTools ( subtable . Coverage ) <EOL> self . Sequence = [ Sequence ( ) . loadFromFontTools ( sequence ) for sequence in subtable . Sequence ] <EOL> return self <EOL> def process ( self , processed , glyphRecords , featureTag ) : <EOL> performedSub = False <EOL> currentRecord = glyphRecords [ <NUM_LIT:0> ] <EOL> currentGlyph = currentRecord . glyphName <EOL> if currentGlyph in self . Coverage : <EOL> if not self . _lookupFlagCoversGlyph ( currentGlyph ) : <EOL> performedSub = True <EOL> index = self . Coverage . index ( currentGlyph ) <EOL> sequence = self . Sequence [ index ] <EOL> substitute = sequence . Substitute <EOL> substitute = glyphNamesToGlyphRecords ( substitute ) <EOL> processed . extend ( substitute ) <EOL> glyphRecords = glyphRecords [ <NUM_LIT:1> : ] <EOL> return processed , glyphRecords , performedSub <EOL> class Sequence ( object ) : <EOL> """<STR_LIT>""" <EOL> __slots__ = [ "<STR_LIT>" ] <EOL> def __init__ ( self ) : <EOL> self . Substitute = [ ] <EOL> def loadFromFontTools ( self , sequence ) : <EOL> self . Substitute = list ( sequence . Substitute ) <EOL> return self <EOL> class GSUBLookupType3 ( BaseSubTable ) : <EOL> """<STR_LIT>""" <EOL> __slots__ = [ "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ] + globalSubstitutionSubTableSlots <EOL> def __init__ ( self ) : <EOL> super ( GSUBLookupType3 , self ) . __init__ ( ) <EOL> self . SubstFormat = <NUM_LIT:1> <EOL> self . AlternateSet = [ ] <EOL> self . Coverage = None <EOL> self . AlternateSetCount = <NUM_LIT:0> <EOL> def loadFromFontTools ( self , subtable , lookup ) : <EOL> super ( GSUBLookupType3 , self ) . loadFromFontTools ( subtable , lookup ) <EOL> coverage = [ ] <EOL> self . AlternateSet = [ ] <EOL> for glyphName , alternates in subtable . alternates . items ( ) : <EOL> coverage . append ( glyphName ) <EOL> alternateSet = AlternateSet ( ) . loadFromFontTools ( alternates ) <EOL> self . AlternateSet . append ( alternateSet ) <EOL> self . Coverage = Coverage ( ) . loadFromFontTools ( coverage ) <EOL> self . AlternateSetCount = len ( self . AlternateSet ) <EOL> return self <EOL> def process ( self , processed , glyphRecords , featureTag ) : <EOL> performedSub = False <EOL> currentRecord = glyphRecords [ <NUM_LIT:0> ] <EOL> currentGlyph = currentRecord . glyphName <EOL> if currentGlyph in self . Coverage : <EOL> if not self . _lookupFlagCoversGlyph ( currentGlyph ) : <EOL> performedSub = True <EOL> index = self . Coverage . index ( currentGlyph ) <EOL> alternateSet = self . AlternateSet [ index ] <EOL> alternates = alternateSet . Alternate <EOL> if featureTag == "<STR_LIT>" : <EOL> currentRecord . saveState ( currentRecord . glyphName ) <EOL> currentRecord . glyphName = choice ( alternates ) <EOL> else : <EOL> if currentRecord . _alternatesReference != currentGlyph : <EOL> currentRecord . _alternatesReference = currentGlyph <EOL> currentRecord . alternates = [ ] <EOL> currentRecord . alternates . extend ( alternates ) <EOL> processed . append ( currentRecord ) <EOL> glyphRecords = glyphRecords [ <NUM_LIT:1> : ] <EOL> return processed , glyphRecords , performedSub <EOL> class AlternateSet ( object ) : <EOL> """<STR_LIT>""" <EOL> __slots__ = [ "<STR_LIT>" ] <EOL> def __init__ ( self ) : <EOL> self . Alternate = [ ] <EOL> def loadFromFontTools ( self , alternates ) : <EOL> self . Alternate = list ( alternates ) <EOL> return self <EOL> class GSUBLookupType4 ( BaseSubTable ) : <EOL> """<STR_LIT>""" <EOL> __slots__ = [ "<STR_LIT>" , "<STR_LIT>" ] + globalSubstitutionSubTableSlots <EOL> def __init__ ( self ) : <EOL> super ( GSUBLookupType4 , self ) . __init__ ( ) <EOL> self . SubstFormat = <NUM_LIT:1> <EOL> self . LigatureSet = [ ] <EOL> self . Coverage = None <EOL> def loadFromFontTools ( self , subtable , lookup ) : <EOL> super ( GSUBLookupType4 , self ) . loadFromFontTools ( subtable , lookup ) <EOL> coverage = [ ] <EOL> self . LigatureSet = [ ] <EOL> for glyphName , ligature in subtable . ligatures . items ( ) : <EOL> ligatureSet = LigatureSet ( ) . loadFromFontTools ( ligature ) <EOL> self . LigatureSet . append ( ligatureSet ) <EOL> coverage . append ( glyphName ) <EOL> self . Coverage = Coverage ( ) . loadFromFontTools ( coverage ) <EOL> return self <EOL> def process ( self , processed , glyphRecords , featureTag ) : <EOL> performedSub = False <EOL> currentRecord = glyphRecords [ <NUM_LIT:0> ] <EOL> currentGlyph = currentRecord . glyphName <EOL> lookupFlag = self . _lookup ( ) . LookupFlag <EOL> if currentGlyph in self . Coverage : <EOL> if not lookupFlag . coversGlyph ( currentGlyph ) : <EOL> while not performedSub : <EOL> coverageIndex = self . Coverage . index ( currentGlyph ) <EOL> ligatureSet = self . LigatureSet [ coverageIndex ] <EOL> for ligature in ligatureSet . Ligature : <EOL> component = ligature . Component <EOL> componentCount = ligature . CompCount <EOL> currentComponentIndex = <NUM_LIT:0> <EOL> matchedRecordIndexes = set ( ) <EOL> lastWasMatch = False <EOL> for index , glyphRecord in enumerate ( glyphRecords [ <NUM_LIT:1> : ] ) : <EOL> glyphName = glyphRecord . glyphName <EOL> if not lookupFlag . coversGlyph ( glyphName ) : <EOL> if not glyphName == component [ currentComponentIndex ] : <EOL> lastWasMatch = False <EOL> break <EOL> else : <EOL> lastWasMatch = True <EOL> matchedRecordIndexes . add ( index ) <EOL> currentComponentIndex += <NUM_LIT:1> <EOL> if currentComponentIndex == componentCount - <NUM_LIT:1> : <EOL> break <EOL> if lastWasMatch and currentComponentIndex == componentCount - <NUM_LIT:1> : <EOL> performedSub = True <EOL> currentRecord . saveState ( [ currentGlyph ] + ligature . Component ) <EOL> currentRecord . glyphName = ligature . LigGlyph <EOL> currentRecord . ligatureComponents = [ currentGlyph ] + ligature . Component <EOL> processed . append ( currentRecord ) <EOL> glyphRecords = [ record for index , record in enumerate ( glyphRecords [ <NUM_LIT:1> : ] ) if index not in matchedRecordIndexes ] <EOL> break <EOL> break <EOL> return processed , glyphRecords , performedSub <EOL> class LigatureSet ( object ) : <EOL> """<STR_LIT>""" <EOL> __slots__ = [ "<STR_LIT>" , "<STR_LIT>" ] <EOL> def __init__ ( self ) : <EOL> self . Ligature = [ ] <EOL> self . LigatureCount = <NUM_LIT:0> <EOL> def loadFromFontTools ( self , ligatures ) : <EOL> self . Ligature = [ Ligature ( ) . loadFromFontTools ( ligature ) for ligature in ligatures ] <EOL> self . LigatureCount = len ( self . Ligature ) <EOL> return self <EOL> class Ligature ( object ) : <EOL> """<STR_LIT>""" <EOL> __slots__ = [ "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ] <EOL> def __init__ ( self ) : <EOL> self . CompCount = None <EOL> self . LigGlyph = None <EOL> self . Component = [ ] <EOL> def loadFromFontTools ( self , ligature ) : <EOL> self . CompCount = ligature . CompCount <EOL> self . LigGlyph = ligature . LigGlyph <EOL> self . Component = list ( ligature . Component ) <EOL> return self <EOL> class GSUBLookupType5Format1 ( BaseContextFormat1SubTable ) : <EOL> """<STR_LIT>""" <EOL> __slots__ = [ "<STR_LIT>" , "<STR_LIT>" ] + globalSubstitutionSubTableSlots <EOL> def __init__ ( self ) : <EOL> super ( GSUBLookupType5Format1 , self ) . __init__ ( ) <EOL> self . SubstFormat = <NUM_LIT:1> <EOL> self . Coverage = None <EOL> self . SubRuleSet = [ ] <EOL> def loadFromFontTools ( self , subtable , lookup ) : <EOL> super ( GSUBLookupType5Format1 , self ) . loadFromFontTools ( subtable , lookup ) <EOL> self . Coverage = Coverage ( ) . loadFromFontTools ( subtable . Coverage ) <EOL> self . SubRuleSet = [ SubRuleSet ( ) . loadFromFontTools ( subRuleSet ) for subRuleSet in subtable . SubRuleSet ] <EOL> return self <EOL> def _get_RuleSet ( self ) : <EOL> return self . SubRuleSet <EOL> _RuleSet = property ( _get_RuleSet ) <EOL> class SubRuleSet ( object ) : <EOL> """<STR_LIT>""" <EOL> __slots__ = [ "<STR_LIT>" ] <EOL> def __init__ ( self ) : <EOL> self . SubRule = [ ] <EOL> def loadFromFontTools ( self , subRuleSet ) : <EOL> self . SubRule = [ SubRule ( ) . loadFromFontTools ( subRule ) for subRule in subRuleSet . SubRule ] <EOL> return self <EOL> def _get_Rule ( self ) : <EOL> return self . SubRule <EOL> _Rule = property ( _get_Rule ) <EOL> class SubRule ( object ) : <EOL> """<STR_LIT>""" <EOL> __slots__ = [ "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ] <EOL> def __init__ ( self ) : <EOL> self . Input = [ ] <EOL> self . GlyphCount = <NUM_LIT:0> <EOL> self . SubstCount = <NUM_LIT:0> <EOL> self . SubstLookupRecord = [ ] <EOL> def loadFromFontTools ( self , subRule ) : <EOL> self . Input = list ( subRule . Input ) <EOL> self . GlyphCount = subRule . GlyphCount <EOL> self . SubstCount = subRule . SubstCount <EOL> self . SubstLookupRecord = [ SubstLookupRecord ( ) . loadFromFontTools ( record ) for record in subRule . SubstLookupRecord ] <EOL> return self <EOL> def _get_ActionCount ( self ) : <EOL> return self . SubstCount <EOL> _ActionCount = property ( _get_ActionCount ) <EOL> def _get_ActionLookupRecord ( self ) : <EOL> return self . SubstLookupRecord <EOL> _ActionLookupRecord = property ( _get_ActionLookupRecord ) <EOL> class GSUBLookupType5Format2 ( BaseContextFormat2SubTable ) : <EOL> """<STR_LIT>""" <EOL> __slots__ = [ "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ] + globalSubstitutionSubTableSlots <EOL> def __init__ ( self ) : <EOL> super ( GSUBLookupType5Format2 , self ) . __init__ ( ) <EOL> self . SubstFormat = <NUM_LIT:2> <EOL> self . Coverage = None <EOL> self . ClassDef = None <EOL> self . SubClassSet = [ ] <EOL> def loadFromFontTools ( self , subtable , lookup ) : <EOL> super ( GSUBLookupType5Format2 , self ) . loadFromFontTools ( subtable , lookup ) <EOL> self . Coverage = Coverage ( ) . loadFromFontTools ( subtable . Coverage ) <EOL> self . ClassDef = ClassDef ( ) . loadFromFontTools ( subtable . ClassDef ) <EOL> self . SubClassSet = [ ] <EOL> for subClassSet in subtable . SubClassSet : <EOL> if subClassSet is None : <EOL> self . SubClassSet . append ( None ) <EOL> else : <EOL> self . SubClassSet . append ( SubClassSet ( ) . loadFromFontTools ( subClassSet ) ) <EOL> return self <EOL> def _get_ClassSet ( self ) : <EOL> return self . SubClassSet <EOL> _ClassSet = property ( _get_ClassSet ) <EOL> class SubClassSet ( object ) : <EOL> """<STR_LIT>""" <EOL> __slots__ = [ "<STR_LIT>" ] <EOL> def __init__ ( self ) : <EOL> self . SubClassRule = [ ] <EOL> def loadFromFontTools ( self , subClassSet ) : <EOL> self . SubClassRule = [ SubClassRule ( ) . loadFromFontTools ( subClassRule ) for subClassRule in subClassSet . SubClassRule ] <EOL> return self <EOL> def _get_ClassRule ( self ) : <EOL> return self . SubClassRule <EOL> _ClassRule = property ( _get_ClassRule ) <EOL> class SubClassRule ( object ) : <EOL> """<STR_LIT>""" <EOL> __slots__ = [ "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ] <EOL> def __init__ ( self ) : <EOL> self . Class = [ ] <EOL> self . GlyphCount = <NUM_LIT:0> <EOL> self . SubstCount = <NUM_LIT:0> <EOL> self . SubstLookupRecord = [ ] <EOL> def loadFromFontTools ( self , subClassRule ) : <EOL> self . Class = list ( subClassRule . Class ) <EOL> self . GlyphCount = subClassRule . GlyphCount <EOL> self . SubstCount = subClassRule . SubstCount <EOL> self . SubstLookupRecord = [ SubstLookupRecord ( ) . loadFromFontTools ( record ) for record in subClassRule . SubstLookupRecord ] <EOL> return self <EOL> def _get_ActionCount ( self ) : <EOL> return self . SubstCount <EOL> _ActionCount = property ( _get_ActionCount ) <EOL> def _get_ActionLookupRecord ( self ) : <EOL> return self . SubstLookupRecord <EOL> _ActionLookupRecord = property ( _get_ActionLookupRecord ) <EOL> class GSUBLookupType5Format3 ( BaseContextFormat3SubTable ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self ) : <EOL> super ( GSUBLookupType5Format3 , self ) . __init__ ( ) <EOL> self . SubstFormat = <NUM_LIT:3> <EOL> self . Coverage = [ ] <EOL> self . GlyphCount = <NUM_LIT:0> <EOL> self . SubstCount = <NUM_LIT:0> <EOL> self . SubstLookupRecord = [ ] <EOL> def loadFromFontTools ( self , subtable , lookup ) : <EOL> super ( GSUBLookupType5Format3 , self ) . loadFromFontTools ( subtable , lookup ) <EOL> self . Coverage = [ Coverage ( ) . loadFromFontTools ( coverage ) for coverage in subtable . Coverage ] <EOL> self . GlyphCount = subtable . GlyphCount <EOL> self . SubstCount = subtable . SubstCount <EOL> self . SubstLookupRecord = [ SubstLookupRecord ( ) . loadFromFontTools ( record ) for record in subtable . SubstLookupRecord ] <EOL> return self <EOL> def _get_ActionCount ( self ) : <EOL> return self . SubstCount <EOL> _ActionCount = property ( _get_ActionCount ) <EOL> def _get_ActionLookupRecord ( self ) : <EOL> return self . SubstLookupRecord <EOL> _ActionLookupRecord = property ( _get_ActionLookupRecord ) <EOL> class GSUBLookupType6Format1 ( BaseChainingContextFormat1SubTable ) : <EOL> """<STR_LIT>""" <EOL> __slots__ = [ "<STR_LIT>" , "<STR_LIT>" ] + globalSubstitutionSubTableSlots <EOL> def __init__ ( self ) : <EOL> super ( GSUBLookupType6Format1 , self ) . __init__ ( ) <EOL> self . SubstFormat = <NUM_LIT:1> <EOL> self . Coverage = None <EOL> self . ChainSubRuleSet = [ ] <EOL> def loadFromFontTools ( self , subtable , lookup ) : <EOL> super ( GSUBLookupType6Format1 , self ) . loadFromFontTools ( subtable , lookup ) <EOL> self . Coverage = Coverage ( ) . loadFromFontTools ( subtable . Coverage ) <EOL> self . ChainSubRuleSet = [ ChainSubRuleSet ( ) . loadFromFontTools ( chainSubRuleSet ) for chainSubRuleSet in subtable . ChainSubRuleSet ] <EOL> return self <EOL> def _get_ChainRuleSet ( self ) : <EOL> return self . ChainSubRuleSet <EOL> _ChainRuleSet = property ( _get_ChainRuleSet ) <EOL> class ChainSubRuleSet ( object ) : <EOL> """<STR_LIT>""" <EOL> __slots__ = [ "<STR_LIT>" ] <EOL> def __init__ ( self ) : <EOL> self . ChainSubRule = [ ] <EOL> def loadFromFontTools ( self , chainSubRuleSet ) : <EOL> self . ChainSubRule = [ ChainSubRule ( ) . loadFromFontTools ( chainSubRule ) for chainSubRule in chainSubRuleSet . ChainSubRule ] <EOL> return self <EOL> def _get_ChainRule ( self ) : <EOL> return self . ChainSubRule <EOL> _ChainRule = property ( _get_ChainRule ) <EOL> class ChainSubRule ( object ) : <EOL> """<STR_LIT>""" <EOL> __slots__ = [ "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" , "<STR_LIT>" , ] <EOL> def __init__ ( self ) : <EOL> self . BacktrackGlyphCount = <NUM_LIT:0> <EOL> self . Backtrack = [ ] <EOL> self . InputGlyphCount = <NUM_LIT:0> <EOL> self . Input = [ ] <EOL> self . LookAheadGlyphCount = <NUM_LIT:0> <EOL> self . LookAhead = [ ] <EOL> self . SubstCount = <NUM_LIT:0> <EOL> self . SubstLookupRecord = [ ] <EOL> def loadFromFontTools ( self , chainSubRule ) : <EOL> self . BacktrackGlyphCount = chainSubRule . BacktrackGlyphCount <EOL> self . Backtrack = list ( chainSubRule . Backtrack ) <EOL> self . InputGlyphCount = chainSubRule . InputGlyphCount <EOL> self . Input = list ( chainSubRule . Input ) <EOL> self . LookAheadGlyphCount = chainSubRule . LookAheadGlyphCount <EOL> self . LookAhead = list ( chainSubRule . LookAhead ) <EOL> self . SubstCount = chainSubRule . SubstCount <EOL> self . SubstLookupRecord = [ SubstLookupRecord ( ) . loadFromFontTools ( record ) for record in chainSubRule . SubstLookupRecord ] <EOL> return self <EOL> def _get_ActionCount ( self ) : <EOL> return self . SubstCount <EOL> _ActionCount = property ( _get_ActionCount ) <EOL> def _get_ActionLookupRecord ( self ) : <EOL> return self . SubstLookupRecord <EOL> _ActionLookupRecord = property ( _get_ActionLookupRecord ) <EOL> class GSUBLookupType6Format2 ( BaseChainingContextFormat2SubTable ) : <EOL> """<STR_LIT>""" <EOL> __slots__ = [ "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" , "<STR_LIT>" ] + globalSubstitutionSubTableSlots <EOL> def __init__ ( self ) : <EOL> super ( GSUBLookupType6Format2 , self ) . __init__ ( ) <EOL> self . SubstFormat = <NUM_LIT:2> <EOL> self . Coverage = None <EOL> self . BacktrackClassDef = None <EOL> self . InputClassDef = None <EOL> self . LookAheadClassDef = None <EOL> self . ChainSubClassSet = [ ] <EOL> def loadFromFontTools ( self , subtable , lookup ) : <EOL> super ( GSUBLookupType6Format2 , self ) . loadFromFontTools ( subtable , lookup ) <EOL> self . Coverage = Coverage ( ) . loadFromFontTools ( subtable . Coverage ) <EOL> self . BacktrackClassDef = ClassDef ( ) . loadFromFontTools ( subtable . BacktrackClassDef ) <EOL> self . InputClassDef = ClassDef ( ) . loadFromFontTools ( subtable . InputClassDef ) <EOL> self . LookAheadClassDef = ClassDef ( ) . loadFromFontTools ( subtable . LookAheadClassDef ) <EOL> self . ChainSubClassSet = [ ] <EOL> for chainSubClassSet in subtable . ChainSubClassSet : <EOL> if chainSubClassSet is None : <EOL> self . ChainSubClassSet . append ( None ) <EOL> else : <EOL> self . ChainSubClassSet . append ( ChainSubClassSet ( ) . loadFromFontTools ( chainSubClassSet ) ) <EOL> return self <EOL> def _get_ChainClassSet ( self ) : <EOL> return self . ChainSubClassSet <EOL> _ChainClassSet = property ( _get_ChainClassSet ) <EOL> class ChainSubClassSet ( object ) : <EOL> """<STR_LIT>""" <EOL> __slots__ = [ "<STR_LIT>" ] <EOL> def __init__ ( self ) : <EOL> self . ChainSubClassRule = None <EOL> def loadFromFontTools ( self , chainSubClassSet ) : <EOL> self . ChainSubClassRule = [ ChainSubClassRule ( ) . loadFromFontTools ( chainSubClassRule ) for chainSubClassRule in chainSubClassSet . ChainSubClassRule ] <EOL> return self <EOL> def _get_ChainClassRule ( self ) : <EOL> return self . ChainSubClassRule <EOL> _ChainClassRule = property ( _get_ChainClassRule ) <EOL> class ChainSubClassRule ( object ) : <EOL> """<STR_LIT>""" <EOL> __slots__ = [ "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" , "<STR_LIT>" ] <EOL> def __init__ ( self ) : <EOL> self . BacktrackGlyphCount = <NUM_LIT:0> <EOL> self . Backtrack = [ ] <EOL> self . InputGlyphCount = <NUM_LIT:0> <EOL> self . Input = [ ] <EOL> self . LookAheadGlyphCount = <NUM_LIT:0> <EOL> self . LookAhead = [ ] <EOL> self . SubstCount = <NUM_LIT:0> <EOL> self . SubstLookupRecord = [ ] <EOL> def loadFromFontTools ( self , chainSubClassRule ) : <EOL> self . BacktrackGlyphCount = chainSubClassRule . BacktrackGlyphCount <EOL> self . Backtrack = list ( chainSubClassRule . Backtrack ) <EOL> self . InputGlyphCount = chainSubClassRule . InputGlyphCount <EOL> self . Input = list ( chainSubClassRule . Input ) <EOL> self . LookAheadGlyphCount = chainSubClassRule . LookAheadGlyphCount <EOL> self . LookAhead = list ( chainSubClassRule . LookAhead ) <EOL> self . SubstCount = chainSubClassRule . SubstCount <EOL> self . SubstLookupRecord = [ SubstLookupRecord ( ) . loadFromFontTools ( record ) for record in chainSubClassRule . SubstLookupRecord ] <EOL> return self <EOL> def _get_ActionCount ( self ) : <EOL> return self . SubstCount <EOL> _ActionCount = property ( _get_ActionCount ) <EOL> def _get_ActionLookupRecord ( self ) : <EOL> return self . SubstLookupRecord <EOL> _ActionLookupRecord = property ( _get_ActionLookupRecord ) <EOL> class GSUBLookupType6Format3 ( BaseChainingContextFormat3SubTable ) : <EOL> """<STR_LIT>""" <EOL> __slots__ = [ "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" <EOL> "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" , "<STR_LIT>" ] + globalSubstitutionSubTableSlots <EOL> def __init__ ( self ) : <EOL> super ( GSUBLookupType6Format3 , self ) . __init__ ( ) <EOL> self . SubstFormat = <NUM_LIT:3> <EOL> self . SubstCount = <NUM_LIT:0> <EOL> self . SubstLookupRecord = [ ] <EOL> def loadFromFontTools ( self , subtable , lookup ) : <EOL> super ( GSUBLookupType6Format3 , self ) . loadFromFontTools ( subtable , lookup ) <EOL> self . SubstCount = subtable . SubstCount <EOL> self . SubstLookupRecord = [ SubstLookupRecord ( ) . loadFromFontTools ( record ) for record in subtable . SubstLookupRecord ] <EOL> return self <EOL> def _get_ActionCount ( self ) : <EOL> return self . SubstCount <EOL> _ActionCount = property ( _get_ActionCount ) <EOL> def _get_ActionLookupRecord ( self ) : <EOL> return self . SubstLookupRecord <EOL> _ActionLookupRecord = property ( _get_ActionLookupRecord ) <EOL> class SubstLookupRecord ( BaseLookupRecord ) : pass <EOL> class GSUBLookupType7 ( BaseSubTable ) : <EOL> """<STR_LIT>""" <EOL> __slots__ = [ "<STR_LIT>" , "<STR_LIT>" ] + globalSubstitutionSubTableSlots <EOL> def __init__ ( self ) : <EOL> self . SubstFormat = <NUM_LIT:1> <EOL> self . ExtSubTable = None <EOL> def loadFromFontTools ( self , subtable , lookup ) : <EOL> super ( GSUBLookupType7 , self ) . loadFromFontTools ( subtable , lookup ) <EOL> self . ExtensionLookupType = subtable . ExtensionLookupType <EOL> lookupType = self . ExtensionLookupType <EOL> if lookupType == <NUM_LIT:1> : <EOL> cls = GSUBLookupType1Format2 <EOL> elif lookupType == <NUM_LIT:2> : <EOL> cls = GSUBLookupType2 <EOL> elif lookupType == <NUM_LIT:3> : <EOL> cls = GSUBLookupType3 <EOL> elif lookupType == <NUM_LIT:4> : <EOL> cls = GSUBLookupType4 <EOL> elif lookupType == <NUM_LIT:5> : <EOL> cls = ( GSUBLookupType5Format1 , GSUBLookupType5Format2 , GSUBLookupType5Format3 ) [ subtable . ExtSubTable . Format - <NUM_LIT:1> ] <EOL> elif lookupType == <NUM_LIT:6> : <EOL> cls = ( GSUBLookupType6Format1 , GSUBLookupType6Format2 , GSUBLookupType6Format3 ) [ subtable . ExtSubTable . Format - <NUM_LIT:1> ] <EOL> elif lookupType == <NUM_LIT:7> : <EOL> cls = GSUBLookupType7 <EOL> elif lookupType == <NUM_LIT:8> : <EOL> cls = GSUBLookupType8 <EOL> self . ExtSubTable = cls ( ) . loadFromFontTools ( subtable . ExtSubTable , lookup ) <EOL> return self <EOL> def process ( self , processed , glyphRecords , featureTag ) : <EOL> return self . ExtSubTable . process ( processed , glyphRecords , featureTag ) <EOL> class GSUBLookupType8 ( BaseSubTable ) : pass </s>
