else: log.error("Program 'latex' isn't avaialable.") sys.exit(3) else: log.info("File %s not changed, used existing DVI file (%s)", input_txt, tmp_filename) # 5. Load DVI dvi = binfile(tmp_filename + ".dvi", 'rb') comment, (num, den, mag, u, l), page_offset, fonts = dviparser.dviinfo(dvi) unit_mm = num / (den * 10000.0) scale = unit_mm * 72.27 / 25.4 mag = mag / 1000.0 # 6. Preload fonts used in DVI & other stuff fontsel.preload() missing = [] for k in fonts: _, s, d, fontname = fonts[k] log.debug("Font %s=%s" % (k, fontname)) #print "Font %s=%s" % (k, fontname) try: fontsel.create_DVI_font(fontname, k, s, d, setup.options.enc_methods) except fontsel.FontError, e: log.error("Can't find font '%s': %s" % (fontname, str(e))) missing.append((k, fontname)) if missing: log.error( "There were some unavailable fonts; list of missing fonts: %s" %
# parse positional args args = cmdopts.parse_pos_args(args) # set logging level if setup.options.verbose: logging.basicConfig(level=logging.DEBUG) log = logging.getLogger('dvi2svg') if not args: log.info("Nothing to do.") sys.exit() # load & process information about encoding font.preload(setup.options.enc_repl) for filename, basename in args: # # 1. Open file # dvi = binfile(filename, 'rb') log.info("Processing '%s' file -> '%s'", filename, basename) # # 2. Read DVI info # comment, (num, den, mag, u, l), page_offset, fonts = DVI_info(dvi) unit_mm = num / (den * 10000.0)
# parse positional args args = cmdopts.parse_pos_args(args) # set logging level if setup.options.verbose: logging.basicConfig(level=logging.DEBUG) log = logging.getLogger('dvi2svg') if not args: log.info("Nothing to do.") sys.exit() # load & process information about encoding font.preload(setup.options.enc_repl) for filename, basename in args: # # 1. Open file # dvi = binfile(filename, 'rb') log.info("Processing '%s' file -> '%s'", filename, basename) # # 2. Read DVI info # comment, (num, den, mag, u, l), page_offset, fonts = DVI_info(dvi) unit_mm = num/(den*10000.0)
log.error("Program 'latex' isn't avaialable.") sys.exit(3) else: log.info("File %s not changed, used existing DVI file (%s)", input_txt, tmp_filename) # 5. Load DVI dvi = binfile(tmp_filename + ".dvi", 'rb') comment, (num, den, mag, u, l), page_offset, fonts = dviparser.dviinfo(dvi) unit_mm = num/(den*10000.0) scale = unit_mm * 72.27/25.4 mag = mag/1000.0 # 6. Preload fonts used in DVI & other stuff fontsel.preload() missing = [] for k in fonts: _, s, d, fontname = fonts[k] log.debug("Font %s=%s" % (k, fontname)) #print "Font %s=%s" % (k, fontname) try: fontsel.create_DVI_font(fontname, k, s, d, setup.options.enc_methods) except fontsel.FontError, e: log.error("Can't find font '%s': %s" % (fontname, str(e))) missing.append((k, fontname)) if missing: log.error("There were some unavailable fonts; list of missing fonts: %s" % (dvi.name, ", ".join("%d=%s" % kf for kf in missing))) sys.exit(1)