def com_google_fonts_check_gasp(ttFont):
  """Is 'gasp' table set to optimize rendering?"""

  if "gasp" not in ttFont.keys():
    yield FAIL, ("Font is missing the 'gasp' table."
                 " Try exporting the font with autohinting enabled.")
  else:
    if not isinstance(ttFont["gasp"].gaspRange, dict):
      yield FAIL, "'gasp' table has no values."
    else:
      failed = False
      if 0xFFFF not in ttFont["gasp"].gaspRange:
        yield WARN, ("'gasp' table does not have an entry for all"
                     " font sizes (gaspRange 0xFFFF).")
      else:
        gasp_meaning = {
          0x01: "- Use gridfitting",
          0x02: "- Use grayscale rendering",
          0x04: "- Use gridfitting with ClearType symmetric smoothing",
          0x08: "- Use smoothing along multiple axes with ClearType®"
        }
        table = []
        for key in ttFont["gasp"].gaspRange.keys():
          value = ttFont["gasp"].gaspRange[key]
          meaning = []
          for flag, info in gasp_meaning.items():
            if value & flag:
              meaning.append(info)

          meaning = "\n\t".join(meaning)
          table.append(f"PPM <= {key}:\n\tflag = 0x{value:02X}\n\t{meaning}")

        table = "\n".join(table)
        yield INFO, ("These are the ppm ranges declared on the"
                    f" gasp table:\n\n{table}\n")

        for key in ttFont["gasp"].gaspRange.keys():
          if key != 0xFFFF:
            yield WARN, ("'gasp' table has a gaspRange of {} that"
                         " may be unneccessary.").format(key)
            failed = True
          else:
            value = ttFont["gasp"].gaspRange[0xFFFF]
            if value != 0x0F:
              failed = True
              yield WARN, (f"gaspRange 0xFFFF value 0x{value:02X}"
                            " should be set to 0x0F.")
        if not failed:
          yield PASS, ("'gasp' table is correctly set, with one "
                       "gaspRange:value of 0xFFFF:0x0F.")
Is 'gasp' table set to optimize rendering?