docstr: Recalculate the font bounding box, and most other maxp values except
  for the TT instructions values. Also recalculate the value of bit 1
  of the flags field and the font bounding box of the 'head' table.
docstr_tok: ["Recalculate","the","font","bounding","box",",","and","most","other","maxp","values","except","for","the","TT","instructions","values",".","Also","recalculate","the","value","of","bit","1","of","the","flags","field","and","the","font","bounding","box","of","the","'head","'","table","."]
code: def recalc(self, ttFont):
      """Recalculate the font bounding box, and most other maxp values except
      for the TT instructions values. Also recalculate the value of bit 1
      of the flags field and the font bounding box of the 'head' table.
      """
      glyfTable = ttFont["glyf"]
      hmtxTable = ttFont["hmtx"]
      headTable = ttFont["head"]
      self.numGlyphs = len(glyfTable)
      INFINITY = 100000
      xMin = +INFINITY
      yMin = +INFINITY
      xMax = -INFINITY
      yMax = -INFINITY
      maxPoints = 0
      maxContours = 0
      maxCompositePoints = 0
      maxCompositeContours = 0
      maxComponentElements = 0
      maxComponentDepth = 0
      allXMinIsLsb = 1
      for glyphName in ttFont.getGlyphOrder():
          g = glyfTable[glyphName]
          if g.numberOfContours:
              if hmtxTable[glyphName][1] != g.xMin:
                  allXMinIsLsb = 0
              xMin = min(xMin, g.xMin)
              yMin = min(yMin, g.yMin)
              xMax = max(xMax, g.xMax)
              yMax = max(yMax, g.yMax)
              if g.numberOfContours > 0:
                  nPoints, nContours = g.getMaxpValues()
                  maxPoints = max(maxPoints, nPoints)
                  maxContours = max(maxContours, nContours)
              elif g.isComposite():
                  (
                      nPoints,
                      nContours,
                      componentDepth,
                  ) = g.getCompositeMaxpValues(glyfTable)
                  maxCompositePoints = max(maxCompositePoints, nPoints)
                  maxCompositeContours = max(
                      maxCompositeContours, nContours
                  )
                  maxComponentElements = max(
                      maxComponentElements, len(g.components)
                  )
                  maxComponentDepth = max(
                      maxComponentDepth, componentDepth
                  )
      if xMin == +INFINITY:
          headTable.xMin = 0
          headTable.yMin = 0
          headTable.xMax = 0
          headTable.yMax = 0
      else:
          headTable.xMin = xMin
          headTable.yMin = yMin
          headTable.xMax = xMax
          headTable.yMax = yMax
      self.maxPoints = maxPoints
      self.maxContours = maxContours
      self.maxCompositePoints = maxCompositePoints
      self.maxCompositeContours = maxCompositeContours
      self.maxComponentElements = maxComponentElements
      self.maxComponentDepth = maxComponentDepth
      if allXMinIsLsb:
          headTable.flags = headTable.flags | 0x2
      else:
          headTable.flags = headTable.flags & ~0x2
  
file_path: catboost/contrib/python/fonttools/fontTools/ttLib/tables/_m_a_x_p.py
imports: from fontTools.misc import sstruct
  from fontTools.misc.textTools import safeEval
  from .None import DefaultTable
label_desc: Use image node_id 3 for calling the table__m_a_x_p obj's underlying member method code with example usage: obj.recalc(ttFont) without return types