def build(self, bld, target, tgen, font): if not hasattr(self, 'no_make'): cmd = getattr(self, 'make_params', '') + " " ind = 0 srcs = [] if hasattr(font, 'ap'): srcs.append(bld.path.find_or_declare(font.ap)) cmd += "-a ${SRC[" + str(ind) + "].bldpath()} " ind += 1 if hasattr(self, 'master'): srcs.append(self.master) cmd += "-i ${SRC[" + str(ind) + "].bldpath()} " ind += 1 bld(rule="${MAKE_VOLT} " + cmd + "-t " + bld.path.find_or_declare(target).bldpath() + " > ${TGT}", shell=1, source=srcs + [target], target=self.source) if hasattr(font, 'typetuner') and not getattr(self, 'no_typetuner', 0): xmlparms = " -x ${TGT[0].bldpath()}" tgts = [target, font.typetuner] modify("${VOLT2TTF} " + self.params + xmlparms + " -t ${SRC} ${DEP} ${TGT}", tgts, [self.source], path=bld.srcnode.find_node('wscript').abspath(), name=font.target + "_ot") else: modify("${VOLT2TTF} " + self.params + " -t ${SRC} ${DEP} ${TGT}", target, [self.source], path=bld.srcnode.find_node('wscript').abspath(), name=font.target + "_ot")
def build(self, bld, font): if not hasattr(self, 'copyright'): self.copyright = getattr(font, 'copyright', getattr(font.package, 'copyright', '')) modify(self.insert_ofl, font.target, path=bld.srcnode.find_node('wscript').abspath(), late=1)
def doit(src, keeps): modify("${TTFTABLE} -d opentype ${DEP} ${TGT}", target) modify( "${FONTFORGE} -nosplash -quiet -lang=py -c 'f=open(\"${DEP}\",32); f.encoding=\"Original\"; list(f.removeLookup(x) for x in f.gsub_lookups+f.gpos_lookups if not len(f.getLookupInfo(x)[2]) or f.getLookupInfo(x)[2][0][0] not in [" + keeps + "]); f.mergeFeature(\"${SRC}\"); f.generate(\"${TGT}\")'", target, [src], path=bld.srcnode.find_node('wscript').abspath(), name=font.target + "_fea", deps=depends, shell=1)
def doit(src, keeps) : modify("${TTFTABLE} -d opentype ${DEP} ${TGT}", target) if hasattr(font, 'buildusingfontforge') : modify("${FONTFORGE} -nosplash -quiet -lang=py -c 'f=open(\"${DEP}\",32); f.encoding=\"Original\"; list(f.removeLookup(x) for x in f.gsub_lookups+f.gpos_lookups if not len(f.getLookupInfo(x)[2]) or f.getLookupInfo(x)[2][0][0] not in ["+keeps+"]); f.mergeFeature(\"${SRC}\"); f.generate(\"${TGT}\")'", target, [src], path = bld.srcnode.find_node('wscript').abspath(), name = font.target + "_fea", shell = 1) elif hasattr(self, 'buildusingsilfont'): modify("${PSFBUILDFEA} " + self.params + " -o '${TGT}' '${SRC}' '${DEP}'", target, [src], name = font.target + "_fea", path=bld.srcnode.find_node('wscript').abspath(), shell = 1) else : modify("${FONTTOOLS} feaLib -o '${TGT}' '${SRC}' '${DEP}'", target, [src], name = font.target + "_fea", path = bld.srcnode.find_node('wscript').abspath(), shell = 1)
def build(self, bld, target, tgen, font) : if not hasattr(self, 'no_make') : cmd = getattr(self, 'make_params', '') + " " ind = 0 srcs = [] if hasattr(font, 'ap') : srcs.append(bld.path.find_or_declare(font.ap)) cmd += "-a ${SRC[" + str(ind) + "].bldpath()} " ind += 1 if hasattr(self, 'master') : srcs.append(self.master) cmd += "-i ${SRC[" + str(ind) + "].bldpath()} " ind += 1 bld(rule = "${MAKE_VOLT} " + cmd + "-t " + bld.path.find_or_declare(target).bldpath() + " > ${TGT}", shell = 1, source = srcs + [target], target = self.source) if hasattr(font, 'typetuner') and not getattr(self, 'no_typetuner', 0) : xmlparms = " -x ${TGT[0].bldpath()}" tgts = [target, font.typetuner] modify("${VOLT2TTF} " + self.params + xmlparms + " -t ${SRC} ${DEP} ${TGT}", tgts, [self.source], path = bld.srcnode.find_node('wscript').abspath(), name = font.target + "_ot") else : modify("${VOLT2TTF} " + self.params + " -t ${SRC} ${DEP} ${TGT}", target, [self.source], path = bld.srcnode.find_node('wscript').abspath(), name = font.target + "_ot")
def build(self, bld, target, tgen, font) : srcs = [font.source] if self.master : srcs.append(self.master) modify("${TTFTABLE} -delete graphite ${DEP} ${TGT}", target, srcs, path = bld.srcnode.find_node('wscript').abspath()) prevars = "" if hasattr(self, 'gdlpp_prefs') : prevars = 'GDLPP_PREFS="' + self.gdlpp_prefs + '" ' depends = getattr(self, 'depends', []) if self.source is not None : if not hasattr(self, 'no_make') : srcs = [] cmd = getattr(self, 'make_params', '') + " " ind = 0 if hasattr(font, 'ap') : srcs.append(bld.path.find_or_declare(font.ap)) cmd += "-a '${SRC[" + str(ind) + "].bldpath()}' " ind += 1 if hasattr(font, 'classes') : srcs.append(bld.path.find_or_declare(font.classes)) cmd += "-c '${SRC[" + str(ind) + "].bldpath()}' " ind += 1 if self.master : mnode = bld.path.find_or_declare(self.master) srcs.append(mnode) snode = bld.bldnode.find_or_declare(self.source) loc = mnode.path_from(snode.parent) # cmd += '-i ${SRC[' + str(ind) + "].bldpath()} " cmd += '-i ' + loc + ' ' ind += 1 bld(rule = "${MAKE_GDL} " + cmd + bld.path.find_or_declare(target).bldpath() + " ${TGT}", shell = 1, source = srcs + [target], target = self.source) modify(prevars + "${GRCOMPILER} -q " + self.params + " ${SRC} ${DEP} ${TGT}", target, [self.source], path = bld.srcnode.find_node('wscript').abspath(), name = font.target + "_gr", deps = depends, shell = 1) elif self.master : modify(prevars + "${GRCOMPILER} -q " + self.params + " ${SRC} ${DEP} ${TGT}", target, [self.master], path = bld.srcnode.find_node('wscript').abspath(), name = font.target + "_gr", deps = depends, shell = 1)
def build(self, bld, target, tgen, font) : srcs = [font.source] if self.master : srcs.append(self.master) modify("${TTFTABLE} -delete graphite ${DEP} ${TGT}", target, srcs, path = bld.srcnode.find_node('wscript').abspath()) prevars = "" if hasattr(self, 'gdlpp_prefs') : prevars = 'GDLPP_PREFS="' + self.gdlpp_prefs + '" ' depends = getattr(self, 'depends', []) if self.source is not None : if not hasattr(self, 'no_make') : srcs = [] cmd = getattr(self, 'make_params', '') + " " ind = 0 if hasattr(font, 'ap') : srcs.append(bld.path.find_or_declare(font.ap)) cmd += "-a '${SRC[" + str(ind) + "].bldpath()}' " ind += 1 if hasattr(font, 'classes') : srcs.append(bld.path.find_or_declare(font.classes)) cmd += "-c '${SRC[" + str(ind) + "].bldpath()}' " ind += 1 if self.master : mnode = bld.path.find_or_declare(self.master) srcs.append(mnode) snode = bld.bldnode.find_or_declare(self.source) loc = mnode.path_from(snode.parent) # cmd += '-i ${SRC[' + str(ind) + "].bldpath()} " cmd += '-i ' + loc + ' ' ind += 1 bld(rule = "${MAKE_GDL} " + cmd + bld.path.find_or_declare(target).bldpath() + " ${TGT}", shell = 1, source = srcs + [target], target = self.source) modify(prevars + "${GRCOMPILER} " + self.params + " ${SRC} ${DEP} ${TGT}", target, [self.source], path = bld.srcnode.find_node('wscript').abspath(), name = font.target + "_gr", deps = depends, shell = 1) elif self.master : modify(prevars + "${GRCOMPILER} " + self.params + " ${SRC} ${DEP} ${TGT}", target, [self.master], path = bld.srcnode.find_node('wscript').abspath(), name = font.target + "_gr", deps = depends, shell = 1)
def build(self, bld, ap=None) : res = {} if self._isbuilt : return self else : self._isbuilt = True basepath = bld.srcnode.find_node('wscript').abspath() if self.source == self.target : Logs.error("Font source may not be the same as the target: '%s'" % self.target) # convert from legacy if hasattr(self, 'legacy') : self.legacy.build(bld, getattr(self, 'ap', None)) # build font targetnode = bld.path.find_or_declare(self.target) tarname = None srcnode = bld.path.find_or_declare(self.source) if self.source.endswith(".ttf") : bgen = bld(rule = "${COPY} '${SRC}' '${TGT}'", source = srcnode, target = targetnode, shell=True) elif self.source.endswith(".ufo") and not hasattr(self, 'buildusingfontforge') : bgen = bld(rule = "${PSFUFO2TTF} '${SRC}' '${TGT}'", source = srcnode, target = targetnode, shell=True) else : if getattr(self, "sfd_master", None) and self.sfd_master != self.source: tarname = self.source + "_" bld(rule = "${COPY} '${SRC}' '${TGT}'", source = srcnode, target = tarname, shell=True) modify("${SFDMELD} ${SRC} ${DEP} ${TGT}", tarname, [self.sfd_master], path = basepath, before = self.target + "_sfd") bgen = bld(rule = "${FONTFORGE} -nosplash -quiet -lang=py -c 'import sys; f=open(sys.argv[1]); f.encoding=\"Original\"; f.generate(sys.argv[2])' ${SRC} ${TGT}", source = tarname or srcnode, target = self.target, name = self.target + "_sfd") # for old fontforges # bgen = bld(rule = "${FONTFORGE} -quiet -lang=ff -c 'Open($1); Generate($2)' ${SRC} ${TGT}", source = tarname or srcnode, target = self.target, name = self.target + "_sfd") if hasattr(self, 'version') : if isinstance(self.version, (list, tuple)) : ttfsetverparms = "-d '" + self.version[1] + "' " + self.version[0] elif self.package.buildversion != '' : ttfsetverparms = "-d '{1}' {0}".format(str(self.version), self.package.buildversion) else : ttfsetverparms = str(self.version) modify("${TTFSETVER} " + ttfsetverparms + " ${DEP} ${TGT}", self.target, path = basepath, late = 1) if hasattr(self, 'copyright') : modify("${TTFNAME} -t 0 -n '%s' ${DEP} ${TGT}" % (self.copyright), self.target, path = basepath, late = 1) if hasattr(self, 'license') : if hasattr(self.license, 'reserve') : self.package.add_reservedofls(*self.license.reserve) self.license.build(bld, self) # add smarts if hasattr(self, 'ap') : if not hasattr(self, 'legacy') or hasattr(self.legacy, 'noap') : apnode = bld.path.find_or_declare(self.ap) if self.source.endswith(".sfd") and not os.path.exists(apnode.get_src().abspath()) : apopts = getattr(self, 'ap_params', "") bld(rule = "${SFD2AP} " + apopts + " '${SRC}' '${TGT}'", source = tarname or self.source, target = apnode) elif self.source.endswith(".ufo") and not os.path.exists(apnode.get_src().abspath()): apopts = getattr(self, 'ap_params', "") bld(rule = "${PSFEXPORTANCHORS} -l '${TGT[0].bld_dir()}' " + apopts + " '${SRC}' '${TGT}'", source = tarname or self.source, target = apnode) elif not hasattr(self.ap, 'isGenerated') and (hasattr(self, 'classes') or ismodified(self.ap, path = basepath)) : origap = self.ap self.ap = self.ap + ".smith" bld(rule="${COPY} '${SRC}' '${TGT}'", source = origap, target = self.ap, shell=True) # if hasattr(self, 'classes') : # modify("${ADD_CLASSES} -c ${SRC} ${DEP} > ${TGT}", self.ap, [self.classes], shell = 1, path = basepath) # add smarts for x in (getattr(self, y, None) for y in ('opentype', 'graphite', 'pdf', 'woff', 'fret')) : if x : x.build(bld, self.target, bgen, self) if hasattr(self, 'ttfautohint'): modify("${TTFAUTOHINT} " + self.ttfautohint + " ${DEP} ${TGT}", self.target) if hasattr(self, 'typetuner') : modify("${TYPETUNER} -o ${TGT} add ${SRC} ${DEP}", self.target, inputs = [self.typetuner]) return self
def build(self, bld, ap=None) : res = {} if self._isbuilt : return self else : self._isbuilt = True basepath = bld.srcnode.find_node('wscript').abspath() if self.source == self.target : Logs.error("Font source may not be the same as the target: '%s'" % self.target) # convert from legacy if hasattr(self, 'legacy') : self.legacy.build(bld, getattr(self, 'ap', None)) # build font targetnode = bld.path.find_or_declare(self.target) tarname = None if self.source.endswith(".ttf") : bgen = bld(rule = "${COPY} '${SRC}' '${TGT}'", source = [self.source], target = targetnode, shell=True) else : srcnode = bld.path.find_or_declare(self.source) if getattr(self, "sfd_master", None) and self.sfd_master != self.source: tarname = self.source + "_" bld(rule = "${COPY} '${SRC}' '${TGT}'", source = srcnode, target = tarname, shell=True) modify("${SFDMELD} ${SRC} ${DEP} ${TGT}", tarname, [self.sfd_master], path = basepath, before = self.target + "_sfd") bgen = bld(rule = "${FONTFORGE} -nosplash -quiet -lang=py -c 'import sys; f=open(sys.argv[1]); f.encoding=\"Original\"; f.generate(sys.argv[2])' ${SRC} ${TGT}", source = tarname or srcnode, target = self.target, name = self.target + "_sfd") # for old fontforges # bgen = bld(rule = "${FONTFORGE} -quiet -lang=ff -c 'Open($1); Generate($2)' ${SRC} ${TGT}", source = tarname or srcnode, target = self.target, name = self.target + "_sfd") if hasattr(self, 'version') : if isinstance(self.version, (list, tuple)) : ttfsetverparms = "-d '" + self.version[1] + "' " + self.version[0] else : gotver = package.getversion() if gotver != '' : ttfsetverparms = "-d 'dev {1}' {0}".format(str(self.version), gotver) else : ttfsetverparms = str(self.version) modify("${TTFSETVER} " + ttfsetverparms + " ${DEP} ${TGT}", self.target, path = basepath, late = 1) if hasattr(self, 'copyright') : modify("${TTFNAME} -t 0 -n '%s' ${DEP} ${TGT}" % (self.copyright), self.target, path = basepath, late = 1) if hasattr(self, 'license') : if hasattr(self.license, 'reserve') : self.package.add_reservedofls(*self.license.reserve) self.license.build(bld, self) # add smarts if hasattr(self, 'ap') : if not hasattr(self, 'legacy') or hasattr(self.legacy, 'noap') : apnode = bld.path.find_or_declare(self.ap) if self.source.endswith(".sfd") and not os.path.exists(apnode.get_src().abspath()) : apopts = getattr(self, 'ap_params', "") bld(rule = "${SFD2AP} " + apopts + " '${SRC}' '${TGT}'", source = tarname or self.source, target = apnode) elif not hasattr(self.ap, 'isGenerated') and (hasattr(self, 'classes') or ismodified(self.ap, path = basepath)) : origap = self.ap self.ap = self.ap + ".smith" bld(rule="${COPY} '${SRC}' '${TGT}'", source = origap, target = self.ap, shell=True) # if hasattr(self, 'classes') : # modify("${ADD_CLASSES} -c ${SRC} ${DEP} > ${TGT}", self.ap, [self.classes], shell = 1, path = basepath) # add smarts for x in (getattr(self, y, None) for y in ('opentype', 'graphite', 'pdf', 'woff', 'fret')) : if x : x.build(bld, self.target, bgen, self) if hasattr(self, 'typetuner') : modify("${TYPETUNER} -o ${TGT} add ${SRC} ${DEP}", self.target, [self.typetuner]) return self
def build(self, bld, font) : if not hasattr(self, 'copyright') : self.copyright = getattr(font, 'copyright', getattr(font.package, 'copyright', '')) modify(self.insert_ofl, font.target, path = bld.srcnode.find_node('wscript').abspath(), late = 1)
def doit(src, keeps) : modify("${TTFTABLE} -d opentype ${DEP} ${TGT}", target) modify("${FONTFORGE} -nosplash -quiet -lang=py -c 'f=open(\"${DEP}\",32); f.encoding=\"Original\"; list(f.removeLookup(x) for x in f.gsub_lookups+f.gpos_lookups if not len(f.getLookupInfo(x)[2]) or f.getLookupInfo(x)[2][0][0] not in ["+keeps+"]); f.mergeFeature(\"${SRC}\"); f.generate(\"${TGT}\")'", target, [src], path = bld.srcnode.find_node('wscript').abspath(), name = font.target + "_fea", deps = depends, shell = 1)