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>
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>
Hide the justification algorithm implementation details

The justification "classes" stored in the glyph attributes
are actually a justification priorities suitable for a particular
language (script). The external API only uses the justification
metrics array calculated on top of these priorities.

Change-Id: I5b0a39e35954084c63a798b632fd6108f9ae7608
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Make QGlyphLayout consume one byte less per glyph

Change-Id: Iddcc2e1f284dcf13ae98b57ea2d5854e57c83530
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Fix QFontEngineQPA::recalcAdvances() in case of missing glyph

Modifying the glyph indexes array in recalcAdvances() could lead
to undefined behavior.

Change-Id: Ibbb6642f381a5fe01b285dc8d2001c167dc66f46
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Get rid of unused variable

Change-Id: Ie90914c2110d32e573108a355a44dd459097a755
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Unify QFontEngine*::stringToCMap() behavior

Ensure the params are valid and make QCoreTextFontEngine::stringToCMap()
handle the unsufficient buffer case exactly like the other engines does.

Change-Id: I078af37da917cf2bac709b12aa827ed4128e5f30
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Introduce QFontEngine::glyphIndex(uint)

...an optimized drop-in replacement for the code like this:
`stringToCMap(&uc, 1, &g, &numGlyphs, QFontEngine::GlyphIndicesOnly)`
(aka "get the glyph index for exactly one Unicode character").

Change-Id: I22babf49f7cf28892d27533a5ac51ad449779f75
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Introduce a generic QFontEngine::canRender() implementation

...which uses the recently introduced glyphIndex() method;
get rid of re-implementations that did almost the same.

Change-Id: I6d32d2cee6a31f57de6aee05ed8d120d4a1f4e9c
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Fix some typos

Change-Id: I7dbe938bff5ac3ab50a0197f94bdb2f6c22fbd16
Reviewed-by: Kevin Krammer <kevin.krammer@kdab.com>
Reviewed-by: Mitch Curtis <mitch.curtis@digia.com>