def main():
  default_coverage_file = '[tools]/nototools/data/noto_cmap_phase3.xml'

  parser = argparse.ArgumentParser()
  parser.add_argument(
      '-o', '--output_file', help='name of xml file to output', metavar='file')
  parser.add_argument(
      '-d', '--dirs', help='directories containing font files', metavar='dir',
      nargs='+')
  parser.add_argument(
      '-f', '--files', help='font files', metavar='file', nargs='+')
  parser.add_argument(
      '-n', '--name', help='short name of this collection, used in reports',
      metavar='name', required=True)
  parser.add_argument(
      '-c', '--cmap_data', help='cmap data file (default %s)' %
      default_coverage_file, const=default_coverage_file, nargs='?',
      metavar='file')
  args = parser.parse_args()

  cmap_path = None
  if args.dirs or args.files:
    paths = tool_utils.collect_paths(args.dirs, args.files)
    cps, paths = get_cps_from_files(paths)
  elif args.cmap_data:
    cmap_path = tool_utils.resolve_path(args.cmap_data)
    cps = get_cps_from_cmap_data_file(cmap_path)
    paths = None
  else:
    print 'Please specify font files, directories, or a cmap data file.'
    return
  coverage = create(args.name, cps, paths=paths, cmap_data=cmap_path)
  write(coverage, args.output_file)
예제 #2
0
def main():
  default_coverage_file = '[tools]/nototools/data/noto_cmap_phase3.xml'

  parser = argparse.ArgumentParser()
  parser.add_argument(
      '-o', '--output_file', help='name of xml file to output', metavar='file')
  parser.add_argument(
      '-d', '--dirs', help='directories containing font files', metavar='dir',
      nargs='+')
  parser.add_argument(
      '-f', '--files', help='font files', metavar='file', nargs='+')
  parser.add_argument(
      '-n', '--name', help='short name of this collection, used in reports',
      metavar='name', required=True)
  parser.add_argument(
      '-c', '--cmap_data', help='cmap data file (default %s)' %
      default_coverage_file, const=default_coverage_file, nargs='?',
      metavar='file')
  args = parser.parse_args()

  cmap_path = None
  if args.dirs or args.files:
    paths = tool_utils.collect_paths(args.dirs, args.files)
    cps, paths = get_cps_from_files(paths)
  elif args.cmap_data:
    cmap_path = tool_utils.resolve_path(args.cmap_data)
    cps = get_cps_from_cmap_data_file(cmap_path)
    paths = None
  else:
    print('Please specify font files, directories, or a cmap data file.')
    return
  coverage = create(args.name, cps, paths=paths, cmap_data=cmap_path)
  write(coverage, args.output_file)
예제 #3
0
def main():
    default_coverage_file = "[tools]/nototools/data/noto_cmap_phase3.xml"

    parser = argparse.ArgumentParser()
    parser.add_argument("-o",
                        "--output_file",
                        help="name of xml file to output",
                        metavar="file")
    parser.add_argument(
        "-d",
        "--dirs",
        help="directories containing font files",
        metavar="dir",
        nargs="+",
    )
    parser.add_argument("-f",
                        "--files",
                        help="font files",
                        metavar="file",
                        nargs="+")
    parser.add_argument(
        "-n",
        "--name",
        help="short name of this collection, used in reports",
        metavar="name",
        required=True,
    )
    parser.add_argument(
        "-c",
        "--cmap_data",
        help="cmap data file (default %s)" % default_coverage_file,
        const=default_coverage_file,
        nargs="?",
        metavar="file",
    )
    args = parser.parse_args()

    cmap_path = None
    if args.dirs or args.files:
        paths = tool_utils.collect_paths(args.dirs, args.files)
        cps, paths = get_cps_from_files(paths)
    elif args.cmap_data:
        cmap_path = tool_utils.resolve_path(args.cmap_data)
        cps = get_cps_from_cmap_data_file(cmap_path)
        paths = None
    else:
        print("Please specify font files, directories, or a cmap data file.")
        return
    coverage = create(args.name, cps, paths=paths, cmap_data=cmap_path)
    write(coverage, args.output_file)