def _rasterize_callback(self, sender):
        font = CurrentFont()
        if font is not None:
            glyph_names = get_glyphs(font)
            if len(glyph_names) > 0:
                gridsize = int(self.w.spinner.value.get())
                res = (gridsize, gridsize)
                self.w.bar.start()
                print "rasterizing glyphs...\n"
                for glyph_name in glyph_names:
                    glyph = font[glyph_name]
                    print '\tscanning %s...' % glyph_name
                    glyph.prepareUndo('rasterize glyph')
                    R = RasterGlyph(glyph)
                    R.rasterize(res=res)
                    glyph.update()
                    glyph.performUndo()
                # done
                font.update()
                self.w.bar.stop()
                print "\n...done.\n"
            # no glyph selected
            else:
                print no_glyph_selected
        # no font open
        else:
            print no_font_open
dataset/ETHPy150Open gferreira/hTools2/Lib/hTools2/dialogs/glyphs/elements_rasterize.py/rasterizeGlyphDialog._rasterize_callback/original