summaryrefslogtreecommitdiffstats
path: root/src/gui/text
diff options
context:
space:
mode:
authorKonstantin Ritt <ritt.ks@gmail.com>2014-03-02 02:04:39 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-03-02 23:26:51 +0100
commitead6cc40df7d6cede49c58bc9ce3c461a068afce (patch)
treecfdb4620144f6814b97a16550e253ff697592f74 /src/gui/text
parent4c7082162dd2192f535c1e524f966199883f53db (diff)
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>
Diffstat (limited to 'src/gui/text')
-rw-r--r--src/gui/text/qfontengine_qpa.cpp8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/gui/text/qfontengine_qpa.cpp b/src/gui/text/qfontengine_qpa.cpp
index cb40a5388a..eb6a97c5f1 100644
--- a/src/gui/text/qfontengine_qpa.cpp
+++ b/src/gui/text/qfontengine_qpa.cpp
@@ -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);
}
}