Ejemplo n.º 1
0
def get_encoding_from_MAPfiles(fontname):
	global tex_map_file_list

	log.debug("... checking map files")
	if tex_map_file_list != None:
		log.debug("... ... list of map files is present.")
	else:
		log.debug("... ... list of map files dosn't exists - getting one (it may take a while...)")

		def mappred(path, filename):
			return filename.endswith('.map')

		tex_map_file_list = findfile.find_all_files(setup.tex_paths, mappred)

	for filename in tex_map_file_list:
		log.debug("... ... ... scanning %s" % filename)
		enc = read_MAP(filename, fontname)
		if enc:
			log.debug("... ... ... encoding %s" % enc)
			return enc
Ejemplo n.º 2
0
def guess_encoding(font_names):
    global enc_file_list

    log.debug("... checking enc files")
    if enc_file_list != None:
        log.debug("... enc files already loaded")
    else:
        log.debug("... searching for enc files")
        dirs = [setup.encoding_path] + setup.tex_paths

        def encpred(path, filename):
            return filename.endswith('.enc')

        enc_file_list = []
        enc_files = findfile.find_all_files(dirs, encpred)

        for file_path in enc_files:
            try:
                name_list = set(encoding.read_ENC(open(file_path, 'r'))[1])
                enc_file_list.append((file_path, name_list))
            except encoding.ENCFileError, e:
                log.debug("ENCFileError: %s" % str(e))
Ejemplo n.º 3
0
def get_encoding_from_MAPfiles(fontname):
    global tex_map_file_list

    log.debug("... checking map files")
    if tex_map_file_list != None:
        log.debug("... ... list of map files is present.")
    else:
        log.debug(
            "... ... list of map files dosn't exists - getting one (it may take a while...)"
        )

        def mappred(path, filename):
            return filename.endswith('.map')

        tex_map_file_list = findfile.find_all_files(setup.tex_paths, mappred)

    for filename in tex_map_file_list:
        log.debug("... ... ... scanning %s" % filename)
        enc = read_MAP(filename, fontname)
        if enc:
            log.debug("... ... ... encoding %s" % enc)
            return enc
Ejemplo n.º 4
0
def guess_encoding(font_names):
	global enc_file_list

	log.debug("... checking enc files")
	if enc_file_list != None:
		log.debug("... enc files already loaded")
	else:
		log.debug("... searching for enc files")
		dirs      = [setup.encoding_path] + setup.tex_paths

		def encpred(path, filename):
			return filename.endswith('.enc')

		enc_file_list = []
		enc_files     = findfile.find_all_files(dirs, encpred)

		for file_path in enc_files:
			try:
				name_list = set(encoding.read_ENC(open(file_path, 'r'))[1])
				enc_file_list.append( (file_path, name_list) )
			except encoding.ENCFileError, e:
				log.debug("ENCFileError: %s" % str(e))
Ejemplo n.º 5
0
# utility to produce/update unicode.py 

import findfile
import xml.dom.minidom as dom

d = {}
for filename in findfile.find_all_files('fonts', lambda p,f: f.endswith('.svg')):
	print "Processing", filename

	doc = dom.parse(filename)
	for glyph in doc.getElementsByTagName('glyph'):
		name = glyph.getAttribute('glyph-name')
		if not name:
			continue

		unic = glyph.getAttribute('unicode')
		if name not in d:
			d[name] = [unic]
		else:
			if unic not in d[name]:
				d[name].append(unicode)
				print "duplicated '%s'" % name
	#rof
#rof

f = open('tmp', 'w');
for name, unic in d.iterkeys():
	f.write(" '%s'\t: %s\n" % (name, repr(unic[0])))
f.close