code: def compile(self, ttFont):
      self.version = 0
      numGlyphs = ttFont["maxp"].numGlyphs
      glyphOrder = ttFont.getGlyphOrder()
      self.recordSize = 4 * ((2 + numGlyphs + 3) // 4)
      pad = (self.recordSize - 2 - numGlyphs) * b"\0"
      self.numRecords = len(self.hdmx)
      data = sstruct.pack(hdmxHeaderFormat, self)
      items = sorted(self.hdmx.items())
      for ppem, widths in items:
          data = data + bytechr(ppem) + bytechr(max(widths.values()))
          for glyphID in range(len(glyphOrder)):
              width = widths[glyphOrder[glyphID]]
              data = data + bytechr(width)
          data = data + pad
      return data
  
file_path: catboost/contrib/python/fonttools/fontTools/ttLib/tables/_h_d_m_x.py
imports: from fontTools.misc import sstruct
  from fontTools.misc.textTools import bytechr, byteord, strjoin
  from .None import DefaultTable
  import array
  from collections.abc import Mapping
label_desc: Use image node_id 2 for calling the table__h_d_m_x obj's underlying member method code with example usage: obj.compile(ttFont) and returns: data