Skip to content

Latest commit

 

History

History
72 lines (55 loc) · 3.32 KB

test.asc

File metadata and controls

72 lines (55 loc) · 3.32 KB

DesignSpace

An alternative to the font object is the designspace object. Most of the font object attributes mentioned above apply to the designspace object, the differences are described below.

Instead of a source attribute, the designspace object uses a designspace file. Each instance described in the designspace file is treated as a source, and the designspace object iterates over all these instances and builds output from each.

Thus the minimum needed for the designspace object is a designspace file and target attribute:

designspace('source/myfont.designspace',
    target = '${DS:FILENAME_BASE}.ttf')

Except for source and sfd_master, all other attributes of the font object can be used with the designspace object. Additionally the following attribute can be used:

params

Command line arguments to psfcreateinstances. A common usage is to provide unique logfile for each instance.

Note, however, that in contrast to the simplest font object, the target attribute cannot be as simple as myfont.ttf but must be an expression that yields an appropriate filename for each instance. This will also be true for some other attributes as well, for example the attachment point information specified by the ap attribute will need to be different for each instance.

To facilitate this, the designspace object provides a number of variables whose value is based on the particular instance being processed. To prevent possible name conflicts, the designspace object uses a DS: prefix for each of the variables it provides.

For a given instance, each attribute and each location introduce one or more variables. Consider the following instance definition:

<instance
    familyname="MyFont"
    stylename="Bold"
    name="ACME MyFont Bold"
    filename="instances/myfont-bold.ufo"
    >
    <location>
        <dimension name="weight" xvalue="700" />
        <dimension name="width"  xvalue="100" />
        <dimension name="custom" xvalue="0" />
    </location>
    <info />
    <kerning />
</instance>

Based on the corresponding instance attributes, the following variables will be defined:

variable string value

${DS:FAMILYNAME}

MyFont

${DS:STYLENAME}

Bold

${DS:NAME}

ACME MyFont Bold

${DS:FILENAME}

instances/myfont-bold.ufo

Additionally, for each of the above, two additional variables are defined. Adding _DASH to the variable name results in a value where all spaces are replaced with a hyphen, while adding _BASE to the variable name results in a value which is the basename of the original value. For example:

${DS:NAME_DASH}

ACME-MyFont-Bold

${DS:FILENAME_BASE}

myfont-bold

Based on the location specified for the instance, the following variables are defined:

${DS:AXIS_WEIGHT}

700

${DS:AXIS_WIDTH}

100

${DS:AXIS_CUSTOM}

0