forked from len0rd/rockbox
Theme Editor: Added support for larger fonts
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27379 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
364af4f574
commit
f65ed0d3bc
1 changed files with 18 additions and 4 deletions
|
@ -135,9 +135,13 @@ RBFont::RBFont(QString file)
|
||||||
/* Loading the offset table if necessary */
|
/* Loading the offset table if necessary */
|
||||||
if(header.value("noffset").toInt() > 0)
|
if(header.value("noffset").toInt() > 0)
|
||||||
{
|
{
|
||||||
offsetData = new quint16[header.value("noffset").toInt()];
|
int bytesToRead;
|
||||||
data.readRawData(reinterpret_cast<char*>(offsetData),
|
if(header.value("nbits").toInt() > maxFontSizeFor16BitOffsets)
|
||||||
header.value("noffset").toInt() * 2);
|
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 */
|
/* 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 height = header.value("height").toInt();
|
||||||
int maxWidth = header.value("maxwidth").toInt();
|
int maxWidth = header.value("maxwidth").toInt();
|
||||||
|
|
||||||
|
bool extendedSet = header.value("nbits").
|
||||||
|
toUInt() > maxFontSizeFor16BitOffsets;
|
||||||
|
|
||||||
/* First we determine the width of the combined text */
|
/* First we determine the width of the combined text */
|
||||||
QList<int> widths;
|
QList<int> widths;
|
||||||
for(int i = 0; i < text.length(); i++)
|
for(int i = 0; i < text.length(); i++)
|
||||||
|
@ -203,9 +210,16 @@ RBText* RBFont::renderText(QString text, QColor color, int viewWidth,
|
||||||
{
|
{
|
||||||
unsigned int offset;
|
unsigned int offset;
|
||||||
if(offsetData)
|
if(offsetData)
|
||||||
offset = offsetData[text[i].unicode() - firstChar];
|
{
|
||||||
|
if(extendedSet)
|
||||||
|
offset = reinterpret_cast<quint32*>(offsetData)[text[i].unicode() - firstChar];
|
||||||
else
|
else
|
||||||
|
offset = offsetData[text[i].unicode() - firstChar];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
offset = (text[i].unicode() - firstChar) * maxWidth;
|
offset = (text[i].unicode() - firstChar) * maxWidth;
|
||||||
|
}
|
||||||
|
|
||||||
int bytesHigh = height / 8;
|
int bytesHigh = height / 8;
|
||||||
if(height % 8 > 0)
|
if(height % 8 > 0)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue