class_docstr: the OS/2 table
class_docstr_tok: ["the","OS\/2","table"]
code: def compile(self, ttFont):
      self.updateFirstAndLastCharIndex(ttFont)
      panose = self.panose
      head = ttFont["head"]
      if (self.fsSelection & 1) and not (head.macStyle & 1 << 1):
          log.warning(
              "fsSelection bit 0 (italic) and "
              "head table macStyle bit 1 (italic) should match"
          )
      if (self.fsSelection & 1 << 5) and not (head.macStyle & 1):
          log.warning(
              "fsSelection bit 5 (bold) and "
              "head table macStyle bit 0 (bold) should match"
          )
      if (self.fsSelection & 1 << 6) and (
          self.fsSelection & 1 + (1 << 5)
      ):
          log.warning(
              "fsSelection bit 6 (regular) is set, "
              "bits 0 (italic) and 5 (bold) must be clear"
          )
      if self.version < 4 and self.fsSelection & 0b1110000000:
          log.warning(
              "fsSelection bits 7, 8 and 9 are only defined in "
              "OS/2 table version 4 and up: version %s",
              self.version,
          )
      self.panose = sstruct.pack(panoseFormat, self.panose)
      if self.version == 0:
          data = sstruct.pack(OS2_format_0, self)
      elif self.version == 1:
          data = sstruct.pack(OS2_format_1, self)
      elif self.version in (2, 3, 4):
          data = sstruct.pack(OS2_format_2, self)
      elif self.version == 5:
          d = self.__dict__.copy()
          d["usLowerOpticalPointSize"] = round(
              self.usLowerOpticalPointSize * 20
          )
          d["usUpperOpticalPointSize"] = round(
              self.usUpperOpticalPointSize * 20
          )
          data = sstruct.pack(OS2_format_5, d)
      else:
          from fontTools import ttLib
  
          raise ttLib.TTLibError(
              "unknown format for OS/2 table: version %s" % self.version
          )
      self.panose = panose
      return data
  
imports: from fontTools.misc import sstruct
  from fontTools.misc.roundTools import otRound
  from fontTools.misc.textTools import safeEval, num2binary, binary2num
  from fontTools.ttLib.tables import DefaultTable
  import bisect
  import logging
label_desc: Use image node_id 2 for calling the table_O_S_2f_2 obj's underlying member method code with example usage: obj.compile(ttFont) and returns: data