def _convert_slot(self): """ Start converting slot """ chars_sets = str(self.txtBrowser_chars.toPlainText()) if chars_sets: gtime = time.time() # converting to ngl font name = self.lineEdit_fontName.text() self.NGL_Font = NFontConverter.convertQFont( chars_sets, name, self.font) ch_list = self.NGL_Font.get_chars_list() gtime = time.time() - gtime self.lbl_gen_time.setText( 'converted at: %.2f sec | estimate code size: ~%0.3fk' % (gtime, self.NGL_Font.code_size_calc() / 1000)) self.lbl_gen_time.update() else: QMessageBox.critical( self, 'ERROR', """ Nothing to convert! Add singles char or characters set to textbox first""")
def _convertFont(self, font, verbose): """ Convert parsed QFont to NGL_Font object """ # charters set to converting char_range = range(ord(" "), ord("~")) chars_sets = "".join([chr(x) for x in char_range]) if verbose: inform("converting font %s, %spt, bold %s" % (font.family(), font.pointSize(), font.bold())) name = NGL_Font.formatName(font.family(), font.pointSize(), font.bold()) # convert and return return NFontConverter.convertQFont(chars_sets, name, font)
def _convertFont(self, font, verbose): """ Convert parsed QFont to NGL_Font object """ # charters set to converting char_range = range(ord(' '), ord('~')) chars_sets = ''.join([chr(x) for x in char_range]) if verbose: inform( 'converting font %s, %spt, bold %s' % (font.family(), font.pointSize(), font.bold())) name = NGL_Font.formatName(font.family(), font.pointSize(), font.bold()) # convert and return return NFontConverter.convertQFont(chars_sets, name, font)