Theme Editor: Began working on font loading.  Font header info is now read and spewed out onto the debug console

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27301 a1c6a512-1295-4272-9138-f99709370657
diff --git a/utils/themeeditor/graphics/rbfont.cpp b/utils/themeeditor/graphics/rbfont.cpp
index 71c6ff3..3988fbc 100644
--- a/utils/themeeditor/graphics/rbfont.cpp
+++ b/utils/themeeditor/graphics/rbfont.cpp
@@ -23,9 +23,75 @@
 
 #include <QFont>
 #include <QBrush>
+#include <QFile>
 
-RBFont::RBFont(QString file): filename(file)
+#include <QDebug>
+
+RBFont::RBFont(QString file)
 {
+
+    /* Attempting to locate the correct file name */
+    if(!QFile::exists(file))
+        file = ":/fonts/08-Schumacher-Clean.fnt";
+    header.insert("filename", file);
+
+    /* Opening the file */
+    QFile fin(file);
+    fin.open(QFile::ReadOnly);
+
+    /* Loading the header info */
+    quint16 word;
+    quint32 dword;
+
+    QDataStream data(&fin);
+    data.setByteOrder(QDataStream::LittleEndian);
+
+    /* Grabbing the magic number and version */
+    data >> dword;
+    header.insert("version", dword);
+
+    /* Max font width */
+    data >> word;
+    header.insert("maxwidth", word);
+
+    /* Font height */
+    data >> word;
+    header.insert("height", word);
+
+    /* Ascent */
+    data >> word;
+    header.insert("ascent", word);
+
+    /* Padding */
+    data >> word;
+
+    /* First character code */
+    data >> dword;
+    header.insert("firstchar", dword);
+
+    /* Default character code */
+    data >> dword;
+    header.insert("defaultchar", dword);
+
+    /* Number of characters */
+   data >> dword;
+   header.insert("size", dword);
+
+   /* Bytes of imagebits in file */
+   data >> dword;
+   header.insert("nbits", dword);
+
+   /* Longs (dword) of offset data in file */
+   data >> dword;
+   header.insert("noffset", dword);
+
+   /* Bytes of width data in file */
+   data >> dword;
+   header.insert("nwidth", dword);
+
+    fin.close();
+
+    qDebug() << header ;
 }
 
 RBFont::~RBFont()
diff --git a/utils/themeeditor/graphics/rbfont.h b/utils/themeeditor/graphics/rbfont.h
index 61a171e..2c1f8a9 100644
--- a/utils/themeeditor/graphics/rbfont.h
+++ b/utils/themeeditor/graphics/rbfont.h
@@ -25,6 +25,7 @@
 #include <QString>
 #include <QFile>
 #include <QGraphicsSimpleTextItem>
+#include <QHash>
 
 class RBFont
 {
@@ -37,7 +38,7 @@
     int lineHeight(){ return 8; }
 
 private:
-    QString filename;
+    QHash<QString, QVariant> header;
 };
 
 #endif // RBFONT_H