def new(cls): font = cls() font.info.unitsPerEm = 1000 font.info.ascender = 750 font.info.capHeight = 700 font.info.xHeight = 500 font.info.descender = -250 defaultGlyphSet = settings.defaultGlyphSet() if defaultGlyphSet: glyphNames = None glyphSets = settings.readGlyphSets() if defaultGlyphSet in glyphSets: glyphNames = glyphSets[defaultGlyphSet] if glyphNames is not None: for name in glyphNames: font.get(name, asTemplate=True) font.dirty = False app = QApplication.instance() data = dict(font=font) app.postNotification("newFontCreated", data) return font
def readSettings(self): defaultGlyphSet = settings.defaultGlyphSet() self.defaultGlyphSetBox.setChecked(len(defaultGlyphSet)) self.glyphSets = settings.readGlyphSets() self.defaultGlyphSetDrop.clear() self.defaultGlyphSetDrop.addItems(self.glyphSets.keys()) self.glyphSetList.clear() glyphSetNames = self.glyphSets.keys() # Normally we should be enforcing this rather decently in the interface # already if glyphSetNames: for glyphSetName in glyphSetNames: item = QListWidgetItem(glyphSetName, self.glyphSetList) item.setFlags(item.flags() | Qt.ItemIsEditable) self.glyphSetList.setCurrentRow(0) self.removeGlyphSetButton.setEnabled(len(self.glyphSets) > 1) glyphListPath = settings.glyphListPath() self.glyphListBox.setChecked(bool(glyphListPath)) self.glyphListEdit.setEnabled(bool(glyphListPath)) self.glyphListEdit.setText(glyphListPath) self.glyphListButton.setEnabled(bool(glyphListPath))
def newStandardFont(cls): font = cls() font.info.unitsPerEm = 1000 font.info.ascender = 750 font.info.descender = -250 font.info.capHeight = 750 font.info.xHeight = 500 defaultGlyphSet = settings.defaultGlyphSet() if defaultGlyphSet: glyphNames = None glyphSets = settings.readGlyphSets() if defaultGlyphSet in glyphSets: glyphNames = glyphSets[defaultGlyphSet] if glyphNames is not None: for name in glyphNames: font.newStandardGlyph(name, asTemplate=True) font.dirty = False app = QApplication.instance() data = dict(font=font) app.postNotification("newFontCreated", data) return font