code: def save_font(request, tmp_path, encoding):
      with open(fontname, "rb") as test_file:
          font = PcfFontFile.PcfFontFile(test_file, encoding)
      assert isinstance(font, FontFile.FontFile)
      # check the number of characters in the font
      assert (
          len([_f for _f in font.glyph if _f])
          == charsets[encoding]["glyph_count"]
      )
  
      tempname = str(tmp_path / "temp.pil")
  
      def delete_tempfile():
          try:
              os.remove(tempname[:-4] + ".pbm")
          except OSError:
              pass  # report?
  
      request.addfinalizer(delete_tempfile)
      font.save(tempname)
  
      with Image.open(tempname.replace(".pil", ".pbm")) as loaded:
          assert_image_equal_tofile(
              loaded, f"Tests/fonts/ter-x20b-{encoding}.pbm"
          )
  
      with open(tempname, "rb") as f_loaded:
          with open(
              f"Tests/fonts/ter-x20b-{encoding}.pil", "rb"
          ) as f_target:
              assert f_loaded.read() == f_target.read()
      return tempname
  
file_path: pillow/Tests/test_font_pcf_charsets.py
imports: from __future__ import annotations
  import os
  import pytest
  from PIL import FontFile, Image, ImageDraw, ImageFont, PcfFontFile
  from .helper import assert_image_equal_tofile, assert_image_similar_tofile, skip_unless_feature
label_desc: Use image node_id 1 for calling a global function with example usage: save_font(request, tmp_path, encoding) and returns: tempname