summaryrefslogtreecommitdiffstats
path: root/src/platformsupport
diff options
context:
space:
mode:
authorKonstantin Ritt <ritt.ks@gmail.com>2014-03-02 01:52:52 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-03-02 23:26:49 +0100
commit4c7082162dd2192f535c1e524f966199883f53db (patch)
tree5896f151f91bf91e292af7fe560d72a3c4587b2a /src/platformsupport
parent5cd7390ba91702efb2a978a438896d713f5a3abc (diff)
Unify QFontEngine::getSfntTableData() behavior on all platforms
Being a most significant method in the font API, getSfntTableData() must behave in exactly the same way on all platforms. Briefly, it must return true if the table exists in the font, despite the other params, and always stores the table data length in 'length' param, thus reporting the amount of bytes actually needed to store the table data in a buffer. Change-Id: I7a15465020c1ea818ea46a05ea3b9b7e1cd60d14 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src/platformsupport')
-rw-r--r--src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm11
1 files changed, 4 insertions, 7 deletions
diff --git a/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm b/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm
index 4fe78cb568..7ec59f552f 100644
--- a/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm
+++ b/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm
@@ -659,16 +659,13 @@ bool QCoreTextFontEngine::canRender(const QChar *string, int len)
bool QCoreTextFontEngine::getSfntTableData(uint tag, uchar *buffer, uint *length) const
{
QCFType<CFDataRef> table = CTFontCopyTable(ctfont, tag, 0);
- if (!table || !length)
+ if (!table)
return false;
CFIndex tableLength = CFDataGetLength(table);
- int availableLength = *length;
- *length = tableLength;
- if (buffer) {
- if (tableLength > availableLength)
- return false;
+ if (buffer && int(*length) >= tableLength)
CFDataGetBytes(table, CFRangeMake(0, tableLength), buffer);
- }
+ *length = tableLength;
+ Q_ASSERT(int(*length) > 0);
return true;
}