MCPcopy Index your code
hub / github.com/arrowtype/recursive / buildInstances

Function buildInstances

mastering/build_static.py:383–525  ·  view source on GitHub ↗

Generates and cleans up the instances for building the static fonts. This sets a variety of font info related values (blueScale, weight class, panose, and fixed pitch) It also cleans up the standard ps stems, sets the font features to be nothing, and removes overlap. For

(designspacePath, root, name_map)

Source from the content-addressed store, hash-verified

381
382
383def buildInstances(designspacePath, root, name_map):
384 """
385 Generates and cleans up the instances for building the static fonts.
386
387 This sets a variety of font info related values (blueScale, weight class,
388 panose, and fixed pitch)
389
390 It also cleans up the standard ps stems, sets the font features to be
391 nothing, and removes overlap.
392
393 For each instance it generates the fontinfo, kern.fea, and features files
394
395 *designspace* is a designspace object
396 *root* is the root directory where the file structure has been built
397 *name_map* is the name mapping dictionary
398 """
399
400 overlapGlyphs = ["Aogonek", "Aring", "Aringacute", "Ccedilla",
401 "Ccedillaacute", "Dcroat", "Ecedillabreve", "Eng",
402 "Eogonek", "Eth", "Hbar", "Iogonek", "Lslash",
403 "Lslash.sans", "Nhookleft", "Ohorn", "Ohornacute",
404 "Ohorndot", "Ohorngrave", "Ohornhook", "Ohorntilde",
405 "Oogonek", "Oslash", "Oslashacute", "Q", "Scedilla",
406 "Tbar", "Tcedilla", "Uhorn", "Uhornacute", "Uhorndot",
407 "Uhorngrave", "Uhornhook", "Uhorntilde", "Uogonek",
408 "aogonek", "aogonek.italic", "aogonek.simple",
409 "aringacute", "aringacute.italic", "aringacute.simple",
410 "ccedilla", "ccedilla.italic", "ccedillaacute",
411 "ccedillaacute.italic", "dcroat", "ecedillabreve",
412 "ecedillabreve.italic", "eogonek", "equal_equal.code",
413 "hbar", "iogonek", "iogonek.italic", "iogonek.mono",
414 "iogonek.simple", "lslash", "lslash.italic",
415 "lslash.mono", "lslash.sans", "lslash.simple",
416 "nhookleft", "notequal", "notequal.case",
417 "numbersign_numbersign.code",
418 "numbersign_numbersign_numbersign.code",
419 "numbersign_numbersign_numbersign_numbersign.code",
420 "ohorn", "ohornacute", "ohorndot", "ohorngrave",
421 "ohornhook", "ohorntilde", "oogonek", "oslash",
422 "oslashacute", "ringacute", "ringacute.case", "scedilla",
423 "scedilla.italic", "tbar", "tcedilla", "uhorn",
424 "uhorn.italic", "uhornacute", "uhornacute.italic",
425 "uhorndot", "uhorndot.italic", "uhorngrave",
426 "uhorngrave.italic", "uhornhook", "uhornhook.italic",
427 "uhorntilde", "uhorntilde.italic", "uogonek",
428 "uogonek.italic"]
429
430 doc = DesignSpaceProcessor()
431 doc.useVarlib = True
432 doc.roundGeometry = True
433 doc.read(designspacePath)
434 for i in doc.instances:
435 fn, sn, _, _, _ = name_map[(i.familyName, i.styleName)]
436 path = os.path.join(root,
437 fn.strip().replace(" ", ""),
438 sn.strip().replace(" ", ""),
439 os.path.split(i.filename)[1].strip().replace(" ", ""))
440 i.path = path

Callers 1

buildFilesFunction · 0.90

Calls 8

getFilesFunction · 0.90
printProgressBarFunction · 0.90
getBlueScaleFunction · 0.85
fillInPanoseValuesFunction · 0.85
fixStandardStemsFunction · 0.85
buildFontInfoFunction · 0.85
writeFeatureFunction · 0.85
writeKerningFunction · 0.85

Tested by

no test coverage detected