code: def test_glyphs_subset():
      fpath = str(_get_data_path("fonts/ttf/DejaVuSerif.ttf"))
      chars = "these should be subsetted! 1234567890"
  
      # non-subsetted FT2Font
      nosubfont = FT2Font(fpath)
      nosubfont.set_text(chars)
  
      # subsetted FT2Font
      subfont = FT2Font(get_glyphs_subset(fpath, chars))
      subfont.set_text(chars)
  
      nosubcmap = nosubfont.get_charmap()
      subcmap = subfont.get_charmap()
  
      # all unique chars must be available in subsetted font
      assert {*chars} == {chr(key) for key in subcmap}
  
      # subsetted font's charmap should have less entries
      assert len(subcmap) < len(nosubcmap)
  
      # since both objects are assigned same characters
      assert subfont.get_num_glyphs() == nosubfont.get_num_glyphs()
  
imports: import datetime
  import decimal
  import io
  import os
  from pathlib import Path
  import numpy
  import pytest
  import matplotlib
  from matplotlib import pyplot, rcParams, font_manager
  from matplotlib.cbook import _get_data_path
  from matplotlib.ft2font import FT2Font
  from matplotlib.font_manager import findfont, FontProperties
  from matplotlib.backends._backend_pdf_ps import get_glyphs_subset
  from matplotlib.backends.backend_pdf import PdfPages
  from matplotlib.patches import Rectangle
  from matplotlib.testing.decorators import check_figures_equal, image_comparison
  from matplotlib.testing._markers import needs_usetex
label_desc: Use image node_id 21 for calling a global function with example usage: test_glyphs_subset() without return types