[fondue-commits] [SCM] Fondue Font Editor branch, master, updated. 8421a8499180144f1980fbff2a44fee85e0887ba

Eugeniy Meshcheryakov eugen at debian.org
Tue Sep 30 13:59:39 UTC 2008


The following commit has been merged in the master branch:
commit 53e08c4ebb9f6574513410c2146d06b7ae6e95c7
Author: Eugeniy Meshcheryakov <eugen at debian.org>
Date:   Tue Sep 16 14:29:19 2008 +0200

    add glyphedit program to simplify development

diff --git a/.gitignore b/.gitignore
index a4e8e1a..acedb5b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,6 +1,6 @@
 # programs
 src/fondue
-src/ufondue
+src/glyphedit
 
 # objects and libraries
 *.[oa]
diff --git a/src/glyphedit.cxx b/src/glyphedit.cxx
new file mode 100644
index 0000000..8963969
--- /dev/null
+++ b/src/glyphedit.cxx
@@ -0,0 +1,97 @@
+/* Copyright © 2008 Євгеній Мещеряков <eugen at debian.org>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+#include <QApplication>
+#include <QTranslator>
+#include <QLocale>
+#include <QLibraryInfo>
+#include <QDebug>
+#include <cstdio>
+#include <QFile>
+#include "fontdocument.h"
+#include "fontdocumentreader.h"
+#include "glyphsmodel.h"
+#include "glypheditwidget.h"
+
+static FontDocument *readDocument(const char *fileName)
+{
+	QFile fontFile(fileName);
+	if (!fontFile.open(QFile::ReadOnly)) {
+		qDebug() << "Cannot open file" << fileName << ":" << fontFile.errorString();
+		return 0;
+	}
+
+	FontDocument *doc = new FontDocument; // TODO it should be deleted
+	FontDocumentReader reader(doc);
+	reader.read(&fontFile);
+	fontFile.close();
+
+	if (reader.hasError()) {
+		qDebug() << "Error while reading font document:" << reader.errorString();
+		delete doc;
+		return 0;
+	}
+	return doc;
+}
+
+int main(int argc, char **argv)
+{
+	QApplication app(argc, argv);
+	QTranslator qtTranslator;
+	qtTranslator.load("qt_" + QLocale::system().name(), QLibraryInfo::location(QLibraryInfo::TranslationsPath));
+	app.installTranslator(&qtTranslator);
+
+	QCoreApplication::setOrganizationName("Fondue");
+	QCoreApplication::setOrganizationDomain("fondue.alioth.debian.org");
+	QCoreApplication::setApplicationName("Fondue");
+
+	if (argc != 3) {
+		fprintf(stderr, "Usage: %s FONT-FILE GLYPH-NAME\n", argv[0]);
+		return 1;
+	}
+
+	QFile fontFile(argv[1]);
+	if (!fontFile.open(QFile::ReadOnly)) {
+		qDebug() << "Cannot open file" << argv[1] << ":" << fontFile.errorString();
+		return 1;
+	}
+
+	qDebug() << "Reading document...";
+	FontDocument *doc = readDocument(argv[1]); // TODO it should be deleted
+	if (!doc)
+		return 1;
+
+	qDebug() << "Creating model...";
+	GlyphsModel *model = new GlyphsModel(); // TODO it should be deleted
+	model->setDocument(doc);
+
+	qDebug() << "Locating the glyph...";
+	Glyph *g = doc->getGlyph(argv[2]);
+	if (!g) {
+		qDebug() << "Cannot find glyph:" << argv[2];
+		return 1;
+	}
+
+	/* XXX HACK */
+	int idx = doc->glyphIndex(g);
+	QModelIndex glyphIdx = model->index(idx, GlyphsModel::GlyphColumn);
+
+	qDebug() << "Creating editor...";
+	GlyphEditWidget *editor = new GlyphEditWidget(0, model, glyphIdx);
+	editor->show();
+
+	qDebug() << "All done.";
+	return app.exec();
+}
diff --git a/src/src.rules b/src/src.rules
index 4bb140e..ff6b0de 100644
--- a/src/src.rules
+++ b/src/src.rules
@@ -1,7 +1,11 @@
-bin_PROGRAMS += src/fondue
+bin_PROGRAMS += src/fondue src/glyphedit
 
 src_fondue_SOURCES = src/main.cxx
 src_fondue_CPPFLAGS = $(QtCore_CFLAGS) $(QtGui_CFLAGS) $(QtScript_CFLAGS)
 src_fondue_LDADD = libfonduegui.a libfonduefilters.a libfonduenongui.a libfondueqscript.a $(QtCore_LIBS) $(QtGui_LIBS) $(QtScript_LIBS)
 
+src_glyphedit_SOURCES = src/glyphedit.cxx
+src_glyphedit_CPPFLAGS = $(QtCore_CFLAGS) $(QtGui_CFLAGS)
+src_glyphedit_LDADD = libfonduegui.a libfonduenongui.a $(QtCore_LIBS) $(QtGui_LIBS)
+
 ## vim:ft=automake

-- 
Fondue Font Editor



More information about the fondue-commits mailing list