summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Bieber <robby@bieberphoto.com>2010-07-11 05:12:11 +0000
committerRobert Bieber <robby@bieberphoto.com>2010-07-11 05:12:11 +0000
commitf65ed0d3bc4fd116f3fa6dfb059bb38d4c1262d1 (patch)
tree607dc84ae774efdc104e49e4e9a69ccfbb07abe0
parent364af4f5748556acef8a71742fe1b17062a6bb46 (diff)
Theme Editor: Added support for larger fonts
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27379 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--utils/themeeditor/graphics/rbfont.cpp22
1 files changed, 18 insertions, 4 deletions
diff --git a/utils/themeeditor/graphics/rbfont.cpp b/utils/themeeditor/graphics/rbfont.cpp
index 3b7397283c..23791497fd 100644
--- a/utils/themeeditor/graphics/rbfont.cpp
+++ b/utils/themeeditor/graphics/rbfont.cpp
@@ -135,9 +135,13 @@ RBFont::RBFont(QString file)
/* Loading the offset table if necessary */
if(header.value("noffset").toInt() > 0)
{
- offsetData = new quint16[header.value("noffset").toInt()];
- data.readRawData(reinterpret_cast<char*>(offsetData),
- header.value("noffset").toInt() * 2);
+ int bytesToRead;
+ if(header.value("nbits").toInt() > maxFontSizeFor16BitOffsets)
+ bytesToRead = 4 * header.value("noffset").toInt();
+ else
+ bytesToRead = 2 * header.value("noffset").toInt();
+ offsetData = new quint16[bytesToRead];
+ data.readRawData(reinterpret_cast<char*>(offsetData), bytesToRead);
}
/* Loading the width table if necessary */
@@ -178,6 +182,9 @@ RBText* RBFont::renderText(QString text, QColor color, int viewWidth,
int height = header.value("height").toInt();
int maxWidth = header.value("maxwidth").toInt();
+ bool extendedSet = header.value("nbits").
+ toUInt() > maxFontSizeFor16BitOffsets;
+
/* First we determine the width of the combined text */
QList<int> widths;
for(int i = 0; i < text.length(); i++)
@@ -203,9 +210,16 @@ RBText* RBFont::renderText(QString text, QColor color, int viewWidth,
{
unsigned int offset;
if(offsetData)
- offset = offsetData[text[i].unicode() - firstChar];
+ {
+ if(extendedSet)
+ offset = reinterpret_cast<quint32*>(offsetData)[text[i].unicode() - firstChar];
+ else
+ offset = offsetData[text[i].unicode() - firstChar];
+ }
else
+ {
offset = (text[i].unicode() - firstChar) * maxWidth;
+ }
int bytesHigh = height / 8;
if(height % 8 > 0)