diff options
| author | Adrien Tétar | 2015-10-10 13:15:36 +0200 |
|---|---|---|
| committer | Adrien Tétar | 2015-10-10 13:18:00 +0200 |
| commit | a37c85e39a38fe11efbd7df3c1cf4fce5a84a7c9 (patch) | |
| tree | 12da3f3df2be8477be861eac48be08a1f4f595e5 /Lib/defconQt | |
| parent | 07028c9f10b09f524ae953e55f158b3c0146c069 (diff) | |
| download | trufont-a37c85e39a38fe11efbd7df3c1cf4fce5a84a7c9.tar.bz2 | |
fontView: add ufo2fdk-based export functionality
Diffstat (limited to 'Lib/defconQt')
| -rw-r--r-- | Lib/defconQt/fontView.py | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/Lib/defconQt/fontView.py b/Lib/defconQt/fontView.py index 80aabec..38cc054 100644 --- a/Lib/defconQt/fontView.py +++ b/Lib/defconQt/fontView.py @@ -574,6 +574,7 @@ class MainWindow(QMainWindow): fileMenu.addSeparator() fileMenu.addAction("&Save", self.saveFile, QKeySequence.Save) fileMenu.addAction("Save &as…", self.saveFileAs, QKeySequence.SaveAs) + fileMenu.addAction("Export…", self.export) fileMenu.addAction("Reload from disk", self.reload) fileMenu.addAction("E&xit", self.close, QKeySequence.Quit) menuBar.addMenu(fileMenu) @@ -717,6 +718,29 @@ class MainWindow(QMainWindow): self.setWindowTitle() #return ok + def export(self): + try: + from ufo2fdk import haveFDK, OTFCompiler + except Exception as e: + errorMessage = QErrorMessage(self) + errorMessage.showMessage(e) + return + if not haveFDK(): + errorMessage = QErrorMessage(self) + errorMessage.showMessage("The Adobe FDK could not be found.") + return + + path, ok = QFileDialog.getSaveFileName(self, "Save File", None, + "PS OpenType font (*.otf)") + if ok: + compiler = OTFCompiler() + # XXX: allow choosing parameters + reports = compiler.compile(self.font, path, checkOutlines=False, + autohint=True, releaseMode=True) + + print(reports["autohint"]) + print(reports["makeotf"]) + def setCurrentFile(self, path): settings = QSettings() recentFiles = settings.value("core/recentFiles", [], type=str) |
