예제 #1
0
def buildDesignSpace(sources, instances, axes):
    # use DesignSpaceDocument because it supports axis labelNames
    doc = DesignSpaceDocument()

    for source in sources:
        s = SourceDescriptor()
        s.path = source["path"]
        s.name = source["name"]
        s.copyInfo = source["copyInfo"]
        s.location = source["location"]
        s.familyName = source["familyName"]
        s.styleName = source["styleName"]
        doc.addSource(s)

    for instance in instances:
        i = InstanceDescriptor()
        i.location = instance["location"]
        i.familyName = instance["familyName"]
        i.styleName = instance["styleName"]
        doc.addInstance(i)

    for axis in axes:
        a = AxisDescriptor()
        a.minimum = axis["minimum"]
        a.maximum = axis["maximum"]
        a.default = axis["default"]
        a.name = axis["name"]
        a.tag = axis["tag"]
        for languageCode, labelName in axis["labelNames"].items():
            a.labelNames[languageCode] = labelName
        a.map = axis["map"]
        doc.addAxis(a)

    return doc
a2.maximum = 1000
a2.minimum = 0
a2.default = 0
a2.name = "weight"
a2.tag = "wght"
doc.addAxis(a2)

#---------
# masters
#---------

s0 = SourceDescriptor()
s0.path = "MutatorSansLightCondensed.ufo"
s0.name = "master.MutatorMathTest.LightCondensed.0"
s0.familyName = familyName
s0.styleName = "LightCondensed"
s0.location = dict(weight=0, width=0)
s0.copyLib = True
s0.copyInfo = True
s0.copyGroups = True
s0.copyFeatures = True
doc.addSource(s0)

s1 = SourceDescriptor()
s1.path = "MutatorSansBoldCondensed.ufo"
s1.name = "master.MutatorMathTest.BoldCondensed.1"
s1.familyName = familyName
s1.styleName = "BoldCondensed"
s1.location = dict(weight=1000, width=0)
doc.addSource(s1)
예제 #3
0
        dict(location=source["location"],
             styleName=source["styleName"],
             familyName=source["familyName"]))

###

doc = DesignSpaceDocument()

for source in sources:
    s = SourceDescriptor()
    s.path = source["path"]
    s.name = source["name"]
    s.copyInfo = source["copyInfo"]
    s.location = source["location"]
    s.familyName = source["familyName"]
    s.styleName = source["styleName"]
    doc.addSource(s)

for instance in instances:
    i = InstanceDescriptor()
    i.location = instance["location"]
    i.familyName = instance["familyName"]
    i.styleName = instance["styleName"]
    doc.addInstance(i)

for axis in axes:
    a = AxisDescriptor()
    a.minimum = axis["minimum"]
    a.maximum = axis["maximum"]
    a.default = axis["default"]
    a.name = axis["name"]