Fix retreiving the 'head' table in QPAGenerator

The 'head' table is usually of 54 bytes length. Passing the buffer of
4 bytes capacity for the 'head' table is expected to return false,
thus skipping the FontRevision tag in QPAGenerator::writeHeader().

Change-Id: I02c0b13f3cbf13579a845fe78fcbc8a437ae22bf
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
bb10
Konstantin Ritt 2014-03-02 02:04:39 +02:00 committed by The Qt Project
parent 4c7082162d
commit ead6cc40df
1 changed files with 3 additions and 5 deletions

View File

@ -563,11 +563,9 @@ void QPAGenerator::writeHeader()
writeTaggedUInt32(QFontEngineQPA::Tag_FileIndex, face.index);
{
uchar data[4];
uint len = 4;
bool ok = fe->getSfntTableData(MAKE_TAG('h', 'e', 'a', 'd'), data, &len);
if (ok) {
const quint32 revision = qFromBigEndian<quint32>(data);
const QByteArray head = fe->getSfntTable(MAKE_TAG('h', 'e', 'a', 'd'));
if (head.size() >= 4) {
const quint32 revision = qFromBigEndian<quint32>(reinterpret_cast<const uchar *>(head.constData()));
writeTaggedUInt32(QFontEngineQPA::Tag_FontRevision, revision);
}
}