예제 #1
0
def csv_to_xml(csv_file, xml_file, scripts, exclude_scripts):
    cmapdata = cmap_data_from_csv_file(csv_file, scripts, exclude_scripts)
    if xml_file:
        print >> sys.stderr, 'writing %s' % xml_file
        cmap_data.write_cmap_data_file(cmapdata, xml_file, pretty=True)
    else:
        print cmap_data.write_cmap_data(cmapdata, pretty=True)
예제 #2
0
def csv_to_xml(csv_file, xml_file, scripts, exclude_scripts):
  cmapdata = cmap_data_from_csv_file(csv_file, scripts, exclude_scripts)
  if xml_file:
    print >> sys.stderr, 'writing %s' % xml_file
    cmap_data.write_cmap_data_file(cmapdata, xml_file, pretty=True)
  else:
    print cmap_data.write_cmap_data(cmapdata, pretty=True)
예제 #3
0
def main():
    DEFAULT_OUTFILE = 'font_cmaps_temp.xml'

    parser = argparse.ArgumentParser()
    parser.add_argument(
        '-o',
        '--outfile',
        help='output file to write ("%s" if no name provided)' %
        DEFAULT_OUTFILE,
        metavar='name',
        nargs='?',
        default=None,
        const=DEFAULT_OUTFILE)
    parser.add_argument(
        '-p',
        '--paths',
        help='list of directory paths to search for noto fonts '
        '(default is standard noto phase2 paths)',
        metavar='path',
        nargs='*',
        default=None)
    args = parser.parse_args()

    cmapdata = font_cmap_data(args.paths)
    if args.outfile:
        cmap_data.write_cmap_data_file(cmapdata, args.outfile, pretty=True)
    else:
        print cmap_data.write_cmap_data(cmapdata, pretty=True)
예제 #4
0
def main():
    DEFAULT_UNICODE_VERSION = 9.0

    parser = argparse.ArgumentParser()
    parser.add_argument('--scripts',
                        help='list of pseudo-script codes, empty for all '
                        'phase 2 scripts',
                        metavar='code',
                        nargs='*')
    parser.add_argument('--unicode_version',
                        help='version of unicode to use (default %s)' %
                        DEFAULT_UNICODE_VERSION,
                        metavar='version',
                        type=float,
                        default=DEFAULT_UNICODE_VERSION)
    parser.add_argument('--unicode_only',
                        help='only use unicode data, not noto-specific data',
                        action='store_true')
    parser.add_argument('-p',
                        '--phase',
                        help='noto phase (default 3)',
                        metavar='phase',
                        type=int,
                        default=3)
    parser.add_argument('--outfile',
                        help='write to output file, otherwise to stdout',
                        metavar='fname',
                        nargs='?',
                        const='-default-')
    parser.add_argument('--verbose',
                        help='log to stderr as each script is complete',
                        action='store_true')
    args = parser.parse_args()

    if not args.scripts:
        scripts = set(s.strip() for s in _PHASE_TWO_SCRIPTS.split(','))
    else:
        scripts = _check_scripts(args.scripts)

    cmapdata = get_cmap_data(scripts, args.unicode_version, args.phase,
                             args.unicode_only, args.verbose)
    if args.outfile:
        if args.outfile == '-default-':
            args.outfile = 'lint_cmap_%s.xml' % args.unicode_version
        print >> sys.stderr, 'writing %s' % args.outfile
        cmap_data.write_cmap_data_file(cmapdata, args.outfile, pretty=True)
    else:
        print cmap_data.write_cmap_data(cmapdata, pretty=True)
예제 #5
0
def main():
    DEFAULT_UNICODE_VERSION = 9.0

    parser = argparse.ArgumentParser()
    parser.add_argument(
        "--scripts",
        help="list of pseudo-script codes, empty for all "
        "phase 2 scripts",
        metavar="code",
        nargs="*",
    )
    parser.add_argument(
        "--unicode_version",
        help="version of unicode to use (default %s)" %
        DEFAULT_UNICODE_VERSION,
        metavar="version",
        type=float,
        default=DEFAULT_UNICODE_VERSION,
    )
    parser.add_argument(
        "--unicode_only",
        help="only use unicode data, not noto-specific data",
        action="store_true",
    )
    parser.add_argument(
        "-p",
        "--phase",
        help="noto phase (default 3)",
        metavar="phase",
        type=int,
        default=3,
    )
    parser.add_argument(
        "--outfile",
        help="write to output file, otherwise to stdout",
        metavar="fname",
        nargs="?",
        const="-default-",
    )
    parser.add_argument(
        "--verbose",
        help="log to stderr as each script is complete",
        action="store_true",
    )
    args = parser.parse_args()

    if not args.scripts:
        scripts = set(s.strip() for s in _PHASE_TWO_SCRIPTS.split(","))
    else:
        scripts = _check_scripts(args.scripts)

    cmapdata = get_cmap_data(scripts, args.unicode_version, args.phase,
                             args.unicode_only, args.verbose)
    if args.outfile:
        if args.outfile == "-default-":
            args.outfile = "lint_cmap_%s.xml" % args.unicode_version
        sys.stderr.write("writing %s\n" % args.outfile)
        cmap_data.write_cmap_data_file(cmapdata, args.outfile, pretty=True)
    else:
        print(cmap_data.write_cmap_data(cmapdata, pretty=True).decode("utf-8"))
예제 #6
0
def csv_to_xml(csv_file, xml_file, scripts, exclude_scripts):
    cmapdata = cmap_data_from_csv_file(csv_file, scripts, exclude_scripts)
    if xml_file:
        sys.stderr.write("writing %s\n" % xml_file)
        cmap_data.write_cmap_data_file(cmapdata, xml_file, pretty=True)
    else:
        print(cmap_data.write_cmap_data(cmapdata, pretty=True))
예제 #7
0
def main():
    DEFAULT_OUTFILE = "font_cmaps_temp.xml"

    parser = argparse.ArgumentParser()
    parser.add_argument(
        "-o",
        "--outfile",
        help='output file to write ("%s" if no name provided)' % DEFAULT_OUTFILE,
        metavar="name",
        nargs="?",
        default=None,
        const=DEFAULT_OUTFILE,
    )
    parser.add_argument(
        "-p",
        "--paths",
        help="list of directory paths to search for noto fonts "
        "(default is standard noto phase2 paths)",
        metavar="path",
        nargs="*",
        default=None,
    )
    args = parser.parse_args()

    cmapdata = font_cmap_data(args.paths)
    if args.outfile:
        cmap_data.write_cmap_data_file(cmapdata, args.outfile, pretty=True)
    else:
        print(cmap_data.write_cmap_data(cmapdata, pretty=True).decode("utf-8"))
예제 #8
0
def main():
  parser = argparse.ArgumentParser()
  parser.add_argument(
      '--infile', help='input file name', metavar='fname')
  parser.add_argument(
      '--outfile', help='write to output file, otherwise to stdout, '
      'provide file name or will default to one based on infile',
      metavar='fname', nargs='?', const='-default-')
  args = parser.parse_args()

  cmapdata = cmap_data_from_csv_file(args.infile)
  if args.outfile:
    if args.outfile == '-default-':
      args.outfile = path.splitext(path.basename(args.infile))[0] + '.xml'
    print >> sys.stderr, 'writing %s' % args.outfile
    cmap_data.write_cmap_data_file(cmapdata, args.outfile, pretty=True)
  else:
    print cmap_data.write_cmap_data(cmapdata, pretty=True)
예제 #9
0
def main():
  DEFAULT_OUTFILE = 'font_cmaps_temp.xml'

  parser = argparse.ArgumentParser()
  parser.add_argument(
      '-o', '--outfile', help='output file to write ("%s" if no name provided)'
      % DEFAULT_OUTFILE, metavar='name', nargs='?', default=None,
      const=DEFAULT_OUTFILE)
  parser.add_argument(
      '-p', '--paths', help='list of directory paths to search for noto fonts '
      '(default is standard noto phase2 paths)', metavar='path',
      nargs='*', default=None)
  args = parser.parse_args()

  cmapdata = font_cmap_data(args.paths)
  if args.outfile:
    cmap_data.write_cmap_data_file(cmapdata, args.outfile, pretty=True)
  else:
    print cmap_data.write_cmap_data(cmapdata, pretty=True)
예제 #10
0
def main():
    parser = argparse.ArgumentParser()
    parser.add_argument('--infile', help='input file name', metavar='fname')
    parser.add_argument(
        '--outfile',
        help='write to output file, otherwise to stdout, '
        'provide file name or will default to one based on infile',
        metavar='fname',
        nargs='?',
        const='-default-')
    args = parser.parse_args()

    cmapdata = cmap_data_from_csv_file(args.infile)
    if args.outfile:
        if args.outfile == '-default-':
            args.outfile = path.splitext(path.basename(
                args.infile))[0] + '.xml'
        print >> sys.stderr, 'writing %s' % args.outfile
        cmap_data.write_cmap_data_file(cmapdata, args.outfile, pretty=True)
    else:
        print cmap_data.write_cmap_data(cmapdata, pretty=True)
예제 #11
0
def main():
  DEFAULT_UNICODE_VERSION = 9.0

  parser = argparse.ArgumentParser()
  parser.add_argument(
      '--scripts', help='list of pseudo-script codes, empty for all '
      'phase 2 scripts', metavar='code', nargs='*')
  parser.add_argument(
      '--unicode_version', help='version of unicode to use (default %s)' %
      DEFAULT_UNICODE_VERSION, metavar='version', type=float,
      default=DEFAULT_UNICODE_VERSION)
  parser.add_argument(
      '--unicode_only', help='only use unicode data, not noto-specific data',
      action='store_true')
  parser.add_argument(
      '-p', '--phase', help='noto phase (default 3)',
      metavar='phase', type=int, default=3)
  parser.add_argument(
      '--outfile', help='write to output file, otherwise to stdout',
      metavar='fname', nargs='?', const='-default-')
  parser.add_argument(
      '--verbose', help='log to stderr as each script is complete',
      action='store_true')
  args = parser.parse_args()

  if not args.scripts:
    scripts = set(s.strip() for s in _PHASE_TWO_SCRIPTS.split(','))
  else:
    scripts = _check_scripts(args.scripts)

  cmapdata = get_cmap_data(
      scripts, args.unicode_version, args.phase, args.unicode_only,
      args.verbose)
  if args.outfile:
    if args.outfile == '-default-':
      args.outfile = 'lint_cmap_%s.xml' % args.unicode_version
    print >> sys.stderr, 'writing %s' % args.outfile
    cmap_data.write_cmap_data_file(cmapdata, args.outfile, pretty=True)
  else:
    print cmap_data.write_cmap_data(cmapdata, pretty=True)