summaryrefslogtreecommitdiff
path: root/utils/themeeditor/graphics/rbfont.cpp
diff options
context:
space:
mode:
authorRobert Bieber <robby@bieberphoto.com>2010-07-05 22:15:17 +0000
committerRobert Bieber <robby@bieberphoto.com>2010-07-05 22:15:17 +0000
commit6a04479d63dd4d7dfc54849e4c925d360d55fa9c (patch)
tree581a953843da7537f89dfda67e06633b19719398 /utils/themeeditor/graphics/rbfont.cpp
parent8a23b8eb1e5e9add6dcf8ab60067d9cf45aba8d0 (diff)
downloadrockbox-6a04479d63dd4d7dfc54849e4c925d360d55fa9c.tar.gz
rockbox-6a04479d63dd4d7dfc54849e4c925d360d55fa9c.zip
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
Diffstat (limited to 'utils/themeeditor/graphics/rbfont.cpp')
-rw-r--r--utils/themeeditor/graphics/rbfont.cpp68
1 files changed, 67 insertions, 1 deletions
diff --git a/utils/themeeditor/graphics/rbfont.cpp b/utils/themeeditor/graphics/rbfont.cpp
index 71c6ff3fc1..3988fbc64f 100644
--- a/utils/themeeditor/graphics/rbfont.cpp
+++ b/utils/themeeditor/graphics/rbfont.cpp
@@ -23,9 +23,75 @@
23 23
24#include <QFont> 24#include <QFont>
25#include <QBrush> 25#include <QBrush>
26#include <QFile>
26 27
27RBFont::RBFont(QString file): filename(file) 28#include <QDebug>
29
30RBFont::RBFont(QString file)
28{ 31{
32
33 /* Attempting to locate the correct file name */
34 if(!QFile::exists(file))
35 file = ":/fonts/08-Schumacher-Clean.fnt";
36 header.insert("filename", file);
37
38 /* Opening the file */
39 QFile fin(file);
40 fin.open(QFile::ReadOnly);
41
42 /* Loading the header info */
43 quint16 word;
44 quint32 dword;
45
46 QDataStream data(&fin);
47 data.setByteOrder(QDataStream::LittleEndian);
48
49 /* Grabbing the magic number and version */
50 data >> dword;
51 header.insert("version", dword);
52
53 /* Max font width */
54 data >> word;
55 header.insert("maxwidth", word);
56
57 /* Font height */
58 data >> word;
59 header.insert("height", word);
60
61 /* Ascent */
62 data >> word;
63 header.insert("ascent", word);
64
65 /* Padding */
66 data >> word;
67
68 /* First character code */
69 data >> dword;
70 header.insert("firstchar", dword);
71
72 /* Default character code */
73 data >> dword;
74 header.insert("defaultchar", dword);
75
76 /* Number of characters */
77 data >> dword;
78 header.insert("size", dword);
79
80 /* Bytes of imagebits in file */
81 data >> dword;
82 header.insert("nbits", dword);
83
84 /* Longs (dword) of offset data in file */
85 data >> dword;
86 header.insert("noffset", dword);
87
88 /* Bytes of width data in file */
89 data >> dword;
90 header.insert("nwidth", dword);
91
92 fin.close();
93
94 qDebug() << header ;
29} 95}
30 96
31RBFont::~RBFont() 97RBFont::~RBFont()