#NEWLINE# def defaultTestData( header = False , directory = False , tableData = False , metadata = False , privateData = False ) : #NEWLINE# #INDENT# parts = [ ] #NEWLINE# if header : #NEWLINE# #INDENT# header = deepcopy ( testDataHeaderDict ) #NEWLINE# header [ 'length' ] = headerSize #NEWLINE# parts . append ( header ) #NEWLINE# #UNINDENT# if directory : #NEWLINE# #INDENT# directory = deepcopy ( testDataDirectoryList ) #NEWLINE# if header : #NEWLINE# #INDENT# header [ 'numTables' ] = len ( directory ) #NEWLINE# neededSize = sfntHeaderSize #NEWLINE# for table in directory : #NEWLINE# #INDENT# neededSize += sfntDirectoryEntrySize #NEWLINE# neededSize += table [ 'origLength' ] #NEWLINE# #UNINDENT# header [ 'totalSfntSize' ] = neededSize #NEWLINE# header [ 'length' ] += ( header [ 'numTables' ] * directorySize ) #NEWLINE# dataOffset = header [ 'length' ] #NEWLINE# #UNINDENT# parts . append ( directory ) #NEWLINE# #UNINDENT# if tableData : #NEWLINE# #INDENT# tableData = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# parts . append ( tableData ) #NEWLINE# for entry in deepcopy ( testDataDirectoryList ) : #NEWLINE# #INDENT# tableData [ entry [ 'tag' ] ] = ( testDataTableData , testDataTableData ) #NEWLINE# #UNINDENT# if header : #NEWLINE# #INDENT# header [ 'length' ] += ( len ( tableData ) * len ( testDataTableData ) ) #NEWLINE# #UNINDENT# if directory : #NEWLINE# #INDENT# updateDirectoryEntries ( directory = directory , tableData = tableData ) #NEWLINE# #UNINDENT# #UNINDENT# if metadata : #NEWLINE# #INDENT# metadata = ( '\x00' * 1000 ) #NEWLINE# compMetadata = zlib . compress ( metadata ) #NEWLINE# if header : #NEWLINE# #INDENT# header [ 'metaOrigLength' ] = len ( metadata ) #NEWLINE# header [ 'metaLength' ] = len ( compMetadata ) #NEWLINE# header [ 'metaOffset' ] = header [ 'length' ] #NEWLINE# header [ 'length' ] = ( len ( compMetadata ) + calcPaddingLength ( len ( compMetadata ) ) ) #NEWLINE# #UNINDENT# compMetadata += ( '\x00' * calcPaddingLength ( len ( compMetadata ) ) ) #NEWLINE# parts . append ( compMetadata ) #NEWLINE# #UNINDENT# if ( len ( parts ) == 1 ) : #NEWLINE# #INDENT# return parts [ 0 ] #NEWLINE# #UNINDENT# return parts