本文整理汇总了Python中mojo.roboFont.CurrentFont.keys方法的典型用法代码示例。如果您正苦于以下问题:Python CurrentFont.keys方法的具体用法?Python CurrentFont.keys怎么用?Python CurrentFont.keys使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mojo.roboFont.CurrentFont
的用法示例。
在下文中一共展示了CurrentFont.keys方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: apply_callback
# 需要导入模块: from mojo.roboFont import CurrentFont [as 别名]
# 或者: from mojo.roboFont.CurrentFont import keys [as 别名]
def apply_callback(self, sender):
f = CurrentFont()
if f is not None:
# get layer name
layer_name_option = self.w.layer_name.get()
# mask layer
if not layer_name_option:
layer_name = 'background'
# font name
else:
layer_name = os.path.split(self.ufo_path)[1]
# import layer
print 'importing .ufo...\n'
print '\ttarget layer: %s\n' % layer_name
ufo = RFont(self.ufo_path, showUI=False)
for glyph_name in f.keys():
if ufo.has_key(glyph_name):
layer_glyph = f[glyph_name].getLayer(layer_name)
pen = layer_glyph.getPointPen()
ufo[glyph_name].drawPoints(pen)
f[glyph_name].update()
f.update()
print '...done.\n'
# no font open
else:
print no_font_open
示例2: apply_callback
# 需要导入模块: from mojo.roboFont import CurrentFont [as 别名]
# 或者: from mojo.roboFont.CurrentFont import keys [as 别名]
def apply_callback(self, sender):
f = CurrentFont()
if f is not None:
print 'importing .ufo into layer...'
ufo = RFont(self.ufo_path, showUI=False)
layer_name = os.path.split(self.ufo_path)[1]
for glyph_name in f.keys():
if ufo.has_key(glyph_name):
layer_glyph = f[glyph_name].getLayer(layer_name)
pen = layer_glyph.getPointPen()
ufo[glyph_name].drawPoints(pen)
f[glyph_name].update()
f.update()
print '...done.\n'
else:
print 'please open a font first.\n'
示例3: checkFont
# 需要导入模块: from mojo.roboFont import CurrentFont [as 别名]
# 或者: from mojo.roboFont.CurrentFont import keys [as 别名]
def checkFont(self, useSelection=False, excludeZeroWidth=True):
f = CurrentFont()
if f is not None:
# initialize things
self.w.options.progress.start()
time0 = time.time()
self.excludeZeroWidth = excludeZeroWidth
self.f = f
glyphNames = f.selection if useSelection else f.keys()
glyphList = [f[x] for x in glyphNames]
glyphList = self._trimGlyphList(glyphList)
self.touchingPairs = Touche(f).findTouchingPairs(glyphList)
# display output
self.w.results.stats.set("%d glyphs checked" % len(glyphList))
self.w.results.result.set("%d touching pairs found" % len(self.touchingPairs))
self.w.results.show(True)
outputList = [{"left glyph": g1, "right glyph": g2} for (g1, g2) in self.touchingPairs]
self.w.outputList.set(outputList)
if len(self.touchingPairs) > 0:
self.w.outputList.setSelection([0])
else:
self.w.preview.set("")
outputButtons = [self.w.results.spaceView, self.w.results.exportTxt]
for b in outputButtons:
b.enable(False) if len(self.touchingPairs) == 0 else b.enable(True)
self.w.preview.setFont(f)
self.w.options.progress.stop()
self._resizeWindow(enlarge=True)
time1 = time.time()
print u"Touché: finished checking %d glyphs in %.2f seconds" % (len(glyphList), time1 - time0)
else:
Message(u"Touché: Can’t find a font to check")