summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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)
135 /* Loading the offset table if necessary */ 135 /* Loading the offset table if necessary */
136 if(header.value("noffset").toInt() > 0) 136 if(header.value("noffset").toInt() > 0)
137 { 137 {
138 offsetData = new quint16[header.value("noffset").toInt()]; 138 int bytesToRead;
139 data.readRawData(reinterpret_cast<char*>(offsetData), 139 if(header.value("nbits").toInt() > maxFontSizeFor16BitOffsets)
140 header.value("noffset").toInt() * 2); 140 bytesToRead = 4 * header.value("noffset").toInt();
141 else
142 bytesToRead = 2 * header.value("noffset").toInt();
143 offsetData = new quint16[bytesToRead];
144 data.readRawData(reinterpret_cast<char*>(offsetData), bytesToRead);
141 } 145 }
142 146
143 /* Loading the width table if necessary */ 147 /* Loading the width table if necessary */
@@ -178,6 +182,9 @@ RBText* RBFont::renderText(QString text, QColor color, int viewWidth,
178 int height = header.value("height").toInt(); 182 int height = header.value("height").toInt();
179 int maxWidth = header.value("maxwidth").toInt(); 183 int maxWidth = header.value("maxwidth").toInt();
180 184
185 bool extendedSet = header.value("nbits").
186 toUInt() > maxFontSizeFor16BitOffsets;
187
181 /* First we determine the width of the combined text */ 188 /* First we determine the width of the combined text */
182 QList<int> widths; 189 QList<int> widths;
183 for(int i = 0; i < text.length(); i++) 190 for(int i = 0; i < text.length(); i++)
@@ -203,9 +210,16 @@ RBText* RBFont::renderText(QString text, QColor color, int viewWidth,
203 { 210 {
204 unsigned int offset; 211 unsigned int offset;
205 if(offsetData) 212 if(offsetData)
206 offset = offsetData[text[i].unicode() - firstChar]; 213 {
214 if(extendedSet)
215 offset = reinterpret_cast<quint32*>(offsetData)[text[i].unicode() - firstChar];
216 else
217 offset = offsetData[text[i].unicode() - firstChar];
218 }
207 else 219 else
220 {
208 offset = (text[i].unicode() - firstChar) * maxWidth; 221 offset = (text[i].unicode() - firstChar) * maxWidth;
222 }
209 223
210 int bytesHigh = height / 8; 224 int bytesHigh = height / 8;
211 if(height % 8 > 0) 225 if(height % 8 > 0)