code: def main(args=None):
      """Calculate optimum defaultWidthX/nominalWidthX values"""
  
      import argparse
  
      parser = argparse.ArgumentParser(
          "fonttools cffLib.width",
          description=main.__doc__,
      )
      parser.add_argument(
          "inputs",
          metavar="FILE",
          type=str,
          nargs="+",
          help="Input TTF files",
      )
      parser.add_argument(
          "-b",
          "--brute-force",
          dest="brute",
          action="store_true",
          help="Use brute-force approach (VERY slow)",
      )
  
      args = parser.parse_args(args)
  
      for fontfile in args.inputs:
          font = TTFont(fontfile)
          hmtx = font["hmtx"]
          widths = [m[0] for m in hmtx.metrics.values()]
          if args.brute:
              default, nominal = optimizeWidthsBruteforce(widths)
          else:
              default, nominal = optimizeWidths(widths)
          print(
              "glyphs=%d default=%d nominal=%d byteCost=%d"
              % (
                  len(widths),
                  default,
                  nominal,
                  byteCost(widths, default, nominal),
              )
          )
  
file_path: catboost/contrib/python/fonttools/fontTools/cffLib/width.py
imports: from fontTools.ttLib import TTFont
  from collections import defaultdict
  from operator import add
  from functools import reduce
label_desc: Use image node_id 5 for calling a global function with example usage: main(args) without return types