#!/usr/bin/python3
# encoding: utf-8
# this is a smith configuration file - http://scripts.sil.org/smith
# please adjust this template to your needs

# identify extra folders to include in package
DOCDIR = ["documentation", "web"]

# set the package and font family names
APPNAME = 'Foo'
FAMILY = APPNAME

# get version information from Regular UFO (canonical metadata); must be first function call:
getufoinfo('source/' + FAMILY + '-Regular' + '.ufo')

# set up the FTML tests
ftmlTest('tools/lib/ftml-smith.xsl')

# set the build parameters
OMITAPS = '--omitaps="_R,R"'
generated = 'generated/'

# set up the build parameters from the designspace file(s)
for dspace in ('Roman', 'Italic'):
    designspace('source/' + FAMILY + dspace + '.designspace',
                target=process("${DS:FILENAME_BASE}.ttf",
                    cmd('psfchangettfglyphnames ${SRC} ${DEP} ${TGT}', ['source/${DS:FILENAME_BASE}.ufo']),
                ),
                opentype=fea(generated + "${DS:FILENAME_BASE}.fea",
                             master="source/opentype/master.feax",
                             make_params=OMITAPS,
                             mapfile=generated + '${DS:FILENAME_BASE}.map',
                             params='',
                             depends=['source/opentype/myfoofeatures.fea'],
                             ),
                graphite=gdl("generated/${DS:FILENAME_BASE}.gdl",
                             master='source/graphite/master.gdl',
                             make_params=OMITAPS,
                             params='-d -e ${DS:FILENAME_BASE}_gdlerr.txt ',
                             depends=['source/graphite/myfeatures.gdl'],
                             ),
                classes='source/classes.xml',
                ap=generated + '${DS:FILENAME_BASE}.xml',
                woff=woff('web/${DS:FILENAME_BASE}.woff', params='-v ' + VERSION + ' -m ../source/${DS:FAMILYNAME}-WOFF-metadata.xml'),
                typetuner=typetuner('source/typetuner/feat_all.xml'),
                script=['foo', 'DFLT'],
                pdf=fret(params='-r -oi'),
                )


# declare other local variables or utilities
def configure(ctx):
    ctx.env['FOO'] = 'foo'
