本文整理汇总了Python中FDKUtils.runShellCmdLogging方法的典型用法代码示例。如果您正苦于以下问题:Python FDKUtils.runShellCmdLogging方法的具体用法?Python FDKUtils.runShellCmdLogging怎么用?Python FDKUtils.runShellCmdLogging使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FDKUtils
的用法示例。
在下文中一共展示了FDKUtils.runShellCmdLogging方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: proofMakePDF
# 需要导入模块: import FDKUtils [as 别名]
# 或者: from FDKUtils import runShellCmdLogging [as 别名]
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:
pdfFontList = []
logMsg("")
logMsg( "Collecting font data from:")
fontCount = 0
for path in pathList:
fontFileName = os.path.basename(path)
params.rt_filePath = os.path.abspath(path)
logMsg( "\t%s." % (path))
try:
ttFont, tempPathCFF = openFile(path, txPath)
except FontError:
print traceback.format_exception_only(sys.exc_type, sys.exc_value)[-1]
return
try:
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.
glyphList = filterGlyphList(params, fontGlyphList, fontFileName)
if not 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))
break
if tempPathCFF:
pdfFont.path = tempPathCFF
pdfFontList.append([glyphList, pdfFont, tempPathCFF])
pdfFilePath = makeFontSetPDF(pdfFontList, params)
for entry in pdfFontList:
tempPathCFF = entry[2]
pdfFont = entry[1]
pdfFont.clientFont.close()
if tempPathCFF:
os.remove(tempPathCFF)
logMsg( "Wrote proof file %s. End time: %s." % (pdfFilePath, time.asctime()))
if pdfFilePath and params.openPDFWhenDone:
if curSystem == "Windows":
curdir = os.getcwdu()
basedir, pdfName = os.path.split(pdfFilePath)
os.chdir(basedir)
command = "start %s" % (pdfName)
print command
FDKUtils.runShellCmdLogging(command)
os.chdir(curdir)
elif os.name == "Linux":
command = "xdg-open \"" + pdfFilePath + "\"" + " &"
FDKUtils.runShellCmdLogging(command)
else:
command = "open \"" + pdfFilePath + "\"" + " &"
FDKUtils.runShellCmdLogging(command)
else:
tmpList = []
for path in pathList:
fontFileName = os.path.basename(path)
params.rt_filePath = os.path.abspath(path)
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
pdfFilePath = makePDF(pdfFont, params)
ttFont.close()
if tempPathCFF:
#.........这里部分代码省略.........