code: def recalc(self, ttFont):
      if "hmtx" not in ttFont:
          return
  
      hmtxTable = ttFont["hmtx"]
      self.advanceWidthMax = max(
          adv for adv, _ in hmtxTable.metrics.values()
      )
  
      boundsWidthDict = {}
      if "glyf" in ttFont:
          glyfTable = ttFont["glyf"]
          for name in ttFont.getGlyphOrder():
              g = glyfTable[name]
              if g.numberOfContours == 0:
                  continue
              if g.numberOfContours < 0 and not hasattr(g, "xMax"):
                  # Composite glyph without extents set.
                  # Calculate those.
                  g.recalcBounds(glyfTable)
              boundsWidthDict[name] = g.xMax - g.xMin
      elif "CFF " in ttFont or "CFF2" in ttFont:
          if "CFF " in ttFont:
              topDict = ttFont["CFF "].cff.topDictIndex[0]
          else:
              topDict = ttFont["CFF2"].cff.topDictIndex[0]
          charStrings = topDict.CharStrings
          for name in ttFont.getGlyphOrder():
              cs = charStrings[name]
              bounds = cs.calcBounds(charStrings)
              if bounds is not None:
                  boundsWidthDict[name] = int(
                      math.ceil(bounds[2]) - math.floor(bounds[0])
                  )
  
      if boundsWidthDict:
          minLeftSideBearing = float("inf")
          minRightSideBearing = float("inf")
          xMaxExtent = -float("inf")
          for name, boundsWidth in boundsWidthDict.items():
              advanceWidth, lsb = hmtxTable[name]
              rsb = advanceWidth - lsb - boundsWidth
              extent = lsb + boundsWidth
              minLeftSideBearing = min(minLeftSideBearing, lsb)
              minRightSideBearing = min(minRightSideBearing, rsb)
              xMaxExtent = max(xMaxExtent, extent)
          self.minLeftSideBearing = minLeftSideBearing
          self.minRightSideBearing = minRightSideBearing
          self.xMaxExtent = xMaxExtent
  
      else:  # No glyph has outlines.
          self.minLeftSideBearing = 0
          self.minRightSideBearing = 0
          self.xMaxExtent = 0
  
file_path: catboost/contrib/python/fonttools/fontTools/ttLib/tables/_h_h_e_a.py
imports: from fontTools.misc import sstruct
  from fontTools.misc.textTools import safeEval
  from fontTools.misc.fixedTools import ensureVersionIsLong, versionToFixed
  from .None import DefaultTable
  import math
label_desc: Use image node_id 7 for calling the table__h_h_e_a obj's underlying member method code with example usage: obj.recalc(ttFont) without return types