code: def pruningUnusedNames(varfont):
      from . import log
  
      origNameIDs = getVariationNameIDs(varfont)
  
      yield
  
      log.info("Pruning name table")
      exclude = origNameIDs - getVariationNameIDs(varfont)
      varfont["name"].names[:] = [
          record
          for record in varfont["name"].names
          if record.nameID not in exclude
      ]
      if "ltag" in varfont:
          # Drop the whole 'ltag' table if all the language-dependent Unicode name
          # records that reference it have been dropped.
          # TODO: Only prune unused ltag tags, renumerating langIDs accordingly.
          # Note ltag can also be used by feat or morx tables, so check those too.
          if not any(
              record
              for record in varfont["name"].names
              if record.platformID == 0 and record.langID != 0xFFFF
          ):
              del varfont["ltag"]
  
file_path: catboost/contrib/python/fonttools/fontTools/varLib/instancer/names.py
imports: from contextlib import contextmanager
  from copy import deepcopy
  from enum import IntEnum
  import re
label_desc: Use image node_id 2 for calling a global function with example usage: pruningUnusedNames(varfont) without return types