def apply_callback(self, sender): self.font = CurrentFont() if self.font is not None: gNames = getGlyphs(self.font) if len(gNames) > 0: # print info if self._verbose: print 'rounding glyphs to grid...\n' print '\tgrid size: %s' % self._gridsize print '\tpoints: %s' % self._points print '\tanchors: %s' % self._anchors print '\tside-bearings: %s' % self._sidebearings print '\tmark: %s' % self._mark print print '\t', # batch process glyphs for gName in gNames: print gName, if self._points: roundPointsToGrid(self.font[gName], (self._gridsize, self._gridsize)) if self._anchors: roundAnchorsToGrid(self.font[gName], (self._gridsize, self._gridsize)) if self._sidebearings: roundMargins(self.font[gName], self._gridsize, left=True, right=True) if self._mark: self.font[gName].mark = self._mark_color self.font[gName].update() # done print self.font.update() if self._verbose: print '\n...done.\n' # no glyphs selected else: print 'no glyph to process, please select one or more glyphs and try again.\n' # no font open else: print 'please open a font and try again.\n'
#FLM: [h] get glyphs test from robofab.world import CurrentFont import hTools2.modules.fontutils reload(hTools2.modules.fontutils) from hTools2.modules.fontutils import getGlyphs f = CurrentFont() gNames = getGlyphs(f) print gNames