class_docstr: Object representing a TrueType Collection / OpenType Collection.
  The main API is self.fonts being a list of TTFont instances.
  
  If shareTables is True, then different fonts in the collection
  might point to the same table object if the data for the table was
  the same in the font file.  Note, however, that this might result
  in suprises and incorrect behavior if the different fonts involved
  have different GlyphOrder.  Use only if you know what you are doing.
class_docstr_tok: ["Object","representing","a","TrueType","Collection","\/","OpenType","Collection",".","The","main","API","is","self.fonts","being","a","list","of","TTFont","instances",".","If","shareTables","is","True",",","then","different","fonts","in","the","collection","might","point","to","the","same","table","object","if","the","data","for","the","table","was","the","same","in","the","font","file",".","Note",",","however",",","that","this","might","result","in","suprises","and","incorrect","behavior","if","the","different","fonts","involved","have","different","GlyphOrder",".","Use","only","if","you","know","what","you","are","doing","."]
code: def __init__(self, file=None, shareTables=False, **kwargs):
      fonts = self.fonts = []
      if file is None:
          return
  
      assert "fontNumber" not in kwargs, kwargs
  
      closeStream = False
      if not hasattr(file, "read"):
          file = open(file, "rb")
          closeStream = True
  
      tableCache = {} if shareTables else None
  
      header = readTTCHeader(file)
      for i in range(header.numFonts):
          font = TTFont(
              file, fontNumber=i, _tableCache=tableCache, **kwargs
          )
          fonts.append(font)
  
      # don't close file if lazy=True, as the TTFont hold a reference to the original
      # file; the file will be closed once the TTFonts are closed in the
      # TTCollection.close(). We still want to close the file if lazy is None or
      # False, because in that case the TTFont no longer need the original file
      # and we want to avoid 'ResourceWarning: unclosed file'.
      if not kwargs.get("lazy") and closeStream:
          file.close()
  
file_path: catboost/contrib/python/fonttools/fontTools/ttLib/ttCollection.py
imports: from fontTools.ttLib.ttFont import TTFont
  from fontTools.ttLib.sfnt import readTTCHeader, writeTTCHeader
  from io import BytesIO
  import struct
  import logging
label_desc: Use image node_id 1 to create a new TTCollection object from inherited base classes: object with example: obj = TTCollection(file, shareTables)