windows版のfontplotでエラー
C:\Users\m_fujii\Desktop\04_Fonts\work >fontplot -o aaa.pdf ComingSoon-Regular.ttf Proofing font ComingSoon-Regular.ttf. Start time: Fri Oct 13 14:01:10 2017. Traceback (most recent call last): File "C:\FDK\Tools\SharedData\FDKScripts\ 1 "ProofPDF.py",line 987, in <module> main() 2 "ProofPDF.py",line 979, in main proofMakePDF(params.rt_fileList, params, txPath) 3 "ProofPDF.py",line 929, in proofMakePDF pdfFilePath = makePDF(pdfFont, params) 4 "fontPDF.py", line 1648,in makePDF makeProofPDF(pdfFont, params, progressBarInstance) 5 "fontPDF.py", line 2264,in makeProofPDF pdfGlyph = pdfFont.getGlyph(params.rt_glyphList[gi]) 6 "fontPDF.py", line 462, in getGlyph return self.clientGetGlyph(glyphName) 7 "ttfPDF.py", line 106, in clientGetGlyph return txPDFGlyph(self, glyphName) 8 "fontPDF.py", line 588, in __init__ self.clientInitData() 9 "ttfPDF.py", line 159, in clientInitData clientGlyph.draw(pen) File "C:\FDK\Tools\win\Python\AFDKOPython27\lib\site-packages\fonttools-3.9.1-py2.7.egg\ 10 "fontTools\ttLib\__init__.py", line 758, in draw 11 "fontTools\ttLib\tables\_g_l_y_f.py", line 947, in draw 12 "fontTools\pens\basePen.py", line 195, in addComponent TypeError: 'NoneType' object has no attribute '__getitem__'
afdko/ProofPDF.py at master · adobe-type-tools/afdko · GitHub
1 "ProofPDF.py",line 987, in <module> main()
def main(): try: txPath, fdkSharedDataDir = CheckEnvironment() except FDKEnvironmentError,e: print e return try: params = FontPDFParams() params.rt_fdkSharedDataDir = fdkSharedDataDir params = getOptions(params) except OptionParseError,e: print e print __usage__ return # verify that all files exist. haveFiles = 1 for path in params.rt_fileList: if not os.path.exists(path): print "File does not exist: <%s>." % path haveFiles = 0 if not haveFiles: return try: proofMakePDF(params.rt_fileList, params, txPath) <======================== except (FontError, NotImplementedError),e: print "\t exception %s" % e traceback.print_exc() return
2 "ProofPDF.py",line 979, in main proofMakePDF(params.rt_fileList, params, txPath)
def proofMakePDF(pathList, params, txPath): # use fontTools library to open font and extract CFF table. # If error, skip font and report error. if params.rt_doFontSet: else: tmpList = [] for path in pathList: fontFileName = os.path.basename(path) params.rt_filePath = os.path.abspath(path) if not params.quietMode: logMsg("") logMsg( "Proofing font %s. Start time: %s." % (path, time.asctime())) try: ttFont, tempPathCFF = openFile(path, txPath) fontGlyphList = ttFont.getGlyphOrder() except FontError: print traceback.format_exception_only(sys.exc_type, sys.exc_value)[-1] return # filter specified list, if any, with font list. params.rt_glyphList = filterGlyphList(params, fontGlyphList, fontFileName) if not params.rt_glyphList: raise FontError("Error: selected glyph list is empty for font <%s>." % fontFileName) params.rt_reporter = logMsg if ttFont.has_key("CFF "): pdfFont = otfPDF.txPDFFont(ttFont, params) elif ttFont.has_key("glyf"): pdfFont = ttfPDF.txPDFFont(ttFont, params) else: logMsg( "Quitting. Font type is not recognized. %s.." % (path)) return if tempPathCFF: pdfFont.path = tempPathCFF doProgressBar = not params.quietMode pdfFilePath = makePDF(pdfFont, params, doProgressBar) <================= ttFont.close() if tempPathCFF: os.remove(tempPathCFF)
afdko/fontPDF.py at master · adobe-type-tools/afdko · GitHub
3 File "fontPDF.py", line 1648, in makePDF makeProofPDF(pdfFont, params, progressBarInstance)
def makePDF(pdfFont, params, doProgressBar=True): if not params.rt_filePath: params.rt_reporter( "Skipping font. Calling program must set params.rt_filePath.") return fontPath = params.rt_filePath if params.rt_pdfFileName: pdfPath = params.rt_pdfFileName else: pdfPath = os.path.splitext(fontPath)[0] + ".pdf" params.rt_canvas = rt_canvas = pdfgen.Canvas(pdfPath, pagesize=params.pageSize, bottomup = 1) if params.waterfallRange: makeWaterfallPDF(params, pdfFont, doProgressBar) else: makeProofPDF(pdfFont, params, doProgressBar) <============================= return pdfPath
3 "ProofPDF.py",line 929, in proofMakePDF pdfFilePath = makePDF(pdfFont, params)
def makeProofPDF(pdfFont, params, doProgressBar=True): # Collect log file text, if any. if params.errorLogFilePath: if not os.path.isfile(params.errorLogFilePath): print "Error: log file %s does not exist or is not a file." % (repr(params.errorLogFilePath)) else: lf = file(params.errorLogFilePath, "rU") errorLines = lf.readlines() lf.close() params.rt_errorLogDict = parseErrorLog(errorLines, params.errorLogFilePath) keys = params.rt_errorLogDict.keys() keys.sort() # Determine layout # If the em-box is not 1000, we handle that by scaling the glyph outline # down. However, this means that all the text and tick sizes used with the # main outline must be scaled up by that amount. emBoxScale = params.rt_emBoxScale = kGlyphSquare/float( pdfFont.getEmSquare()) params.pointLabelSize = params.pointLabelSize/params.rt_emBoxScale params.pointMarkDiameter = params.pointMarkDiameter/params.rt_emBoxScale params.pointLabel_BCP_CrossSize = params.pointLabel_BCP_CrossSize/params.rt_emBoxScale params.pointLabel_LineLength = params.pointLabel_LineLength/params.rt_emBoxScale params.pointClosingArrowLength = params.pointClosingArrowLength/params.rt_emBoxScale params.hhintXOffset = params.hhintXOffset/params.rt_emBoxScale params.vhintYOffset = params.vhintYOffset/params.rt_emBoxScale rt_canvas = params.rt_canvas numGlyphs = len(params.rt_glyphList) yTop = getTitleHeight(params) if params.descenderSpace == None: params.rt_yMin = fontYMin = pdfFont.descent else: params.rt_yMin = fontYMin = params.descenderSpace if fontYMin > 0: fontYMin = 0 # we want to add extra Y to the glyph tile when the descender is below the embox, but not subtract it when it is above. params.rt_yMin = 0 setDefaultHPadding(params) setDefaultVPadding(params) getMetaDataHeight(params, fontYMin) # how high the meta data block will be for each glyph, unscaled. yMetaHeight = params.rt_metaDataYOffset extraY = yMetaHeight if (params.metaDataAboveGlyph == 0): extraY -= fontYMin # The total excursion of the glyph tile below the origin = (abs(font min) + yMetaHeight extraY += (params.pointLabel_LineLength + params.pointLabelSize)*2 # Need some margin for the labels that stick out below the outlne. numAcross, numDown, scale, xAdvance, yAdvance, leftPadding, topPadding = getLayout(params, extraY, yTop) params.rt_scale = scale if params.userPtSize: numOnPage = numAcross * numDown else: numOnPage = params.glyphsPerPage cur_x = params.pageLeftMargin + leftPadding cur_y = yTop - (topPadding + yAdvance) giRange = range(numGlyphs) if params.doAlphabeticOrder: params.rt_glyphList.sort() elif params.rt_optionLayoutDict and pdfFont.isCID: # enforce layout dict order. dictList = [] for gi in giRange: name = params.rt_glyphList[gi] try: entry = params.rt_optionLayoutDict[name] dictList.append([entry[0], entry[1], name]) except KeyError: dictList.append(["zUndefined", "zUndefined", name]) dictList.sort() params.rt_glyphList = map(lambda entry: entry[-1], dictList) doTitle(rt_canvas, pdfFont, params, numGlyphs) if doProgressBar: progressBarInstance = ProgressBar(numGlyphs, "Proofing font...", ) progressBarInstance.StartProgress() rowIndex = 0 colIndex = 0 for gi in giRange: if doProgressBar: progressBarInstance.DoProgress(gi) if rowIndex >= numAcross: if doProgressBar: progressBarInstance.DoProgress(gi) if rowIndex >= numAcross: rowIndex = 0 colIndex += 1 cur_y -= yAdvance cur_x = params.pageLeftMargin + leftPadding if (colIndex >= numDown) or (gi and ((gi % numOnPage) == 0) ): rowIndex = 0 colIndex = 0 rt_canvas.showPage() yTop = doTitle(rt_canvas, pdfFont, params, numGlyphs) cur_x = params.pageLeftMargin + leftPadding cur_y = yTop - (topPadding + yAdvance) rowIndex += 1 pdfGlyph = pdfFont.getGlyph(params.rt_glyphList[gi]) <================ pdfGlyph.extraY = extraY if not params.rt_repeatParamList: params.rt_repeatParamList = [params]*params.rt_repeats for ri in range(params.rt_repeats): curParams = params.rt_repeatParamList[ri] if ri > 0: fieldNames = dir(params) fieldNames = filter(lambda name: name[:3] == "rt_", fieldNames) for name in fieldNames: exec("curParams.%s = params.%s" % (name,name)) rt_canvas.saveState() rt_canvas.translate(cur_x, cur_y) rt_canvas.scale(scale, scale) pdfGlyph.draw(curParams, ri) rt_canvas.restoreState() cur_x += xAdvance if doProgressBar: progressBarInstance.EndProgress() rt_canvas.showPage() rt_canvas.save() return
4 "fontPDF.py", line 1648,in makePDF makeProofPDF(pdfFont, params, progressBarInstance)
def makePDF(pdfFont, params, doProgressBar=True): if not params.rt_filePath: params.rt_reporter( "Skipping font. Calling program must set params.rt_filePath.") return fontPath = params.rt_filePath if params.rt_pdfFileName: pdfPath = params.rt_pdfFileName else: pdfPath = os.path.splitext(fontPath)[0] + ".pdf" params.rt_canvas = rt_canvas = pdfgen.Canvas(pdfPath, pagesize=params.pageSize, bottomup = 1) if params.waterfallRange: makeWaterfallPDF(params, pdfFont, doProgressBar) else: makeProofPDF(pdfFont, params, doProgressBar) <==================================== return pdfPath
5 "fontPDF.py", line 2264,in makeProofPDF pdfGlyph = pdfFont.getGlyph(params.rt_glyphList[gi])
pdfGlyph = pdfFont.getGlyph(params.rt_glyphList[gi]) <======================================= pdfGlyph.extraY = extraY if not params.rt_repeatParamList: params.rt_repeatParamList = [params]*params.rt_repeats for ri in range(params.rt_repeats): curParams = params.rt_repeatParamList[ri] if ri > 0: fieldNames = dir(params) fieldNames = filter(lambda name: name[:3] == "rt_", fieldNames) for name in fieldNames: exec("curParams.%s = params.%s" % (name,name)) rt_canvas.saveState() rt_canvas.translate(cur_x, cur_y) rt_canvas.scale(scale, scale) pdfGlyph.draw(curParams, ri) rt_canvas.restoreState() cur_x += xAdvance if doProgressBar: progressBarInstance.EndProgress() rt_canvas.showPage() rt_canvas.save() return
6 "fontPDF.py", line 462, in getGlyph return self.clientGetGlyph(glyphName)
def getGlyph(self, glyphName): return self.clientGetGlyph(glyphName) <=============================
afdko/ttfPDF.py at master · adobe-type-tools/afdko · GitHub
7 "ttfPDF.py", line 106, in clientGetGlyph return txPDFGlyph(self, glyphName)
def clientGetGlyph(self, glyphName): return txPDFGlyph(self, glyphName)
8 "fontPDF.py", line 588, in __init__ self.clientInitData()
class FontPDFGlyph: def __init__(self, parentFont, glyphName): self.name = glyphName self.parentFont = parentFont self.numMT = self.numLT = self.numCT = self.numPaths = 0 # These all get set when the outline is drawn. self.pathList = [[]] self.hintTable = [] self.vhints = [] self.hhints = [] self.BBox = [0,0,0,0] # [left, bottom, right, top], aka (xMin,rt_yMin, (xMax, yMax) self.xAdvance = 0 self.yAdvance = 0 self.yOrigin = 0 self.isTT = 0 # used to determine path direction self.isCID = 0 # used to determine if the font is CID-keyed self.clientInitData() <==================== self.extraY = None # height needed to accomodate the meta data block.
9 "ttfPDF.py", line 159, in clientInitData clientGlyph.draw(pen)
class txPDFGlyph(FontPDFGlyph): def clientInitData(self): self.isTT = 1 self.isCID = 0 txFont = self.parentFont.clientFont glyphSet = txFont.getGlyphSet(preferCFF=1) clientGlyph = glyphSet[self.name] # Get the list of points pen = FontPDFPen(None) clientGlyph.draw(pen) <============================= if not hasattr(txFont, 'vmetrics'): try: txFont.vmetrics = txFont['vmtx'].metrics except KeyError: txFont.vmetrics = None try: txFont.vorg = txFont['VORG'] except KeyError: txFont.vorg = None
fonttools/__init__.py at master · fonttools/fonttools · GitHub
File "C:\FDK\Tools\win\Python\AFDKOPython27\lib\site-packages\fonttools-3.9.1-py2.7.egg\ 10 "fontTools\ttLib\__init__.py", line 758, in draw
class _TTGlyph(object): """Wrapper for a TrueType glyph that supports the Pen protocol, meaning that it has a .draw() method that takes a pen object as its only argument. Additionally there are 'width' and 'lsb' attributes, read from the 'hmtx' table. If the font contains a 'vmtx' table, there will also be 'height' and 'tsb' attributes. """ def __init__(self, glyphset, glyph, horizontalMetrics, verticalMetrics=None): self._glyphset = glyphset self._glyph = glyph self.width, self.lsb = horizontalMetrics if verticalMetrics: self.height, self.tsb = verticalMetrics else: self.height, self.tsb = None, None def draw(self, pen): """Draw the glyph onto Pen. See fontTools.pens.basePen for details how that works. """ self._glyph.draw(pen) <==============================
fonttools/_g_l_y_f.py at master · fonttools/fonttools · GitHub
11 "fontTools\ttLib\tables\_g_l_y_f.py", line 947, in draw
class Glyph(object): def draw(self, pen, glyfTable, offset=0): if self.isComposite(): for component in self.components: glyphName, transform = component.getComponentInfo() pen.addComponent(glyphName, transform) <============================ return coordinates, endPts, flags = self.getCoordinates(glyfTable) if offset: coordinates = coordinates.copy() coordinates.translate((offset, 0)) start = 0 for end in endPts: end = end + 1 contour = coordinates[start:end] cFlags = flags[start:end] start = end if 1 not in cFlags: # There is not a single on-curve point on the curve, # use pen.qCurveTo's special case by specifying None # as the on-curve point. contour.append(None) pen.qCurveTo(*contour) else: # Shuffle the points so that contour the is guaranteed # to *end* in an on-curve point, which we'll use for # the moveTo. firstOnCurve = cFlags.index(1) + 1 contour = contour[firstOnCurve:] + contour[:firstOnCurve] cFlags = cFlags[firstOnCurve:] + cFlags[:firstOnCurve] pen.moveTo(contour[-1]) while contour: nextOnCurve = cFlags.index(1) + 1 if nextOnCurve == 1: pen.lineTo(contour[0]) else: pen.qCurveTo(*contour[:nextOnCurve]) contour = contour[nextOnCurve:] cFlags = cFlags[nextOnCurve:] pen.closePath()
fonttools/basePen.py at master · fonttools/fonttools · GitHub
12 "fontTools\pens\basePen.py", line 195, in addComponent TypeError: 'NoneType' object has no attribute '__getitem__'
class BasePen(DecomposingPen): ここに__getitem__がないからなのかな???
|