Ejemplo n.º 1
0
def vtt_merge(infile, outfile=None, **kwargs):
    ufo = infile
    if not os.path.exists(ufo) or not os.path.isdir(ufo):
        raise VTTLibArgumentError("No such directory: '%s'" % ufo)

    check_ufo_version(ufo)

    if not outfile:
        outfile = os.path.splitext(infile)[0] + ".ttf"
    if not os.path.exists(outfile):
        raise VTTLibArgumentError("'%s' not found" % outfile)

    font = TTFont(outfile)
    if font.sfntVersion not in ("\x00\x01\x00\x00", "true"):
        raise VTTLibArgumentError("Not a TrueType font (bad sfntVersion)")

    for ttx in glob.glob(os.path.join(ufo, "data", TTX_DATA_FOLDER, "*.ttx")):
        identifier = os.path.splitext(os.path.basename(ttx))[0]
        try:
            tag = identifierToTag(identifier)
        except:
            continue
        else:
            if tag not in VTT_TABLES:
                continue
        font.importXML(ttx)

    read_maxp_data(ufo, font)

    font.save(outfile)
Ejemplo n.º 2
0
def vtt_merge(infile, outfile=None, **kwargs):
    ufo = infile
    if not os.path.exists(ufo) or not os.path.isdir(ufo):
        raise VTTLibArgumentError("No such directory: '%s'" % ufo)

    check_ufo_version(ufo)

    if not outfile:
        outfile = os.path.splitext(infile)[0] + ".ttf"
    if not os.path.exists(outfile):
        raise VTTLibArgumentError("'%s' not found" % outfile)

    font = TTFont(outfile)
    if font.sfntVersion not in ("\x00\x01\x00\x00", "true"):
        raise VTTLibArgumentError("Not a TrueType font (bad sfntVersion)")

    for ttx in glob.glob(os.path.join(ufo, "data", TTX_DATA_FOLDER, "*.ttx")):
        identifier = os.path.splitext(os.path.basename(ttx))[0]
        try:
            tag = identifierToTag(identifier)
        except:
            continue
        else:
            if tag not in VTT_TABLES:
                continue
        font.importXML(ttx)

    read_maxp_data(ufo, font)

    font.save(outfile)
Ejemplo n.º 3
0
import textwrap


fontToolsDir = os.path.dirname(os.path.dirname(os.path.join(os.getcwd(), sys.argv[0])))
fontToolsDir= os.path.normpath(fontToolsDir)
tablesDir = os.path.join(fontToolsDir,
		"Lib", "fontTools", "ttLib", "tables")
docFile = os.path.join(fontToolsDir, "Doc/source/ttx.rst")

names = glob.glob1(tablesDir, "*.py")

modules = []
tables = []
for name in names:
	try:
		tag = identifierToTag(name[:-3])
	except:
		pass
	else:
		modules.append(name[:-3])
		tables.append(tag.strip())

modules.sort()
tables.sort()


with open(os.path.join(tablesDir, "__init__.py"), "w") as file:

	file.write('''
# DON'T EDIT! This file is generated by MetaTools/buildTableList.py.
def _moduleFinderHint():
Ejemplo n.º 4
0
from fontTools.ttLib import identifierToTag


fontToolsDir = os.path.dirname(os.path.dirname(os.path.join(os.getcwd(), sys.argv[0])))
fontToolsDir= os.path.normpath(fontToolsDir)
tablesDir = os.path.join(fontToolsDir,
		"Lib", "fontTools", "ttLib", "tables")
docFile = os.path.join(fontToolsDir, "Doc", "documentation.html")

names = glob.glob1(tablesDir, "*.py")

modules = []
tables = []
for name in names:
	try:
		tag = identifierToTag(name[:-3])
	except:
		pass
	else:
		modules.append(name[:-3])
		tables.append(tag.strip())

modules.sort()
tables.sort()


file = open(os.path.join(tablesDir, "__init__.py"), "w")

file.write("# DON'T EDIT! This file is generated by MetaTools/buildTableList.py.\n")
file.write("def _moduleFinderHint():\n")
file.write('\t"""Dummy function to let modulefinder know what tables may be\n')