code: def find_font(font_name):
      
      if font_name in STANDARD_FONT_NAMES:
          return font_name, True
      elif font_name in _registered_fonts:
          return font_name, _registered_fonts[font_name]
  
      NOT_FOUND = (None, False)
      try:
          # Try first to register the font if it exists as ttf,
          # based on ReportLab font search.
          registerFont(TTFont(font_name, '%s.ttf' % font_name))
          _registered_fonts[font_name] = True
          return font_name, True
      except TTFError:
          # Try searching with Fontconfig
          try:
              pipe = subprocess.Popen(
                  ['fc-match', '-s', '--format=%{file}\\n', font_name],
                  stdout=subprocess.PIPE,
                  stderr=subprocess.PIPE,
              )
              output = pipe.communicate()[0].decode(sys.getfilesystemencoding())
              font_path = output.split('\n')[0]
          except OSError:
              return NOT_FOUND
          try:
              registerFont(TTFont(font_name, font_path))
          except TTFError:
              return NOT_FOUND
          # Fontconfig may return a default font totally unrelated with font_name
          exact = font_name.lower() in os.path.basename(font_path).lower()
          _registered_fonts[font_name] = exact
          return font_name, exact
docs: Return the font and a Boolean indicating if the match is exact.