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>
This commit is contained in:
parent
3567d62ed3
commit
78d115f8f2
@ -1410,6 +1410,7 @@ QFontEngineBox::~QFontEngineBox()
|
||||
|
||||
bool QFontEngineBox::stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, QFontEngine::ShaperFlags flags) const
|
||||
{
|
||||
Q_ASSERT(glyphs->numGlyphs >= *nglyphs);
|
||||
if (*nglyphs < len) {
|
||||
*nglyphs = len;
|
||||
return false;
|
||||
|
@ -1528,6 +1528,7 @@ void QFontEngineFT::addGlyphsToPath(glyph_t *glyphs, QFixedPoint *positions, int
|
||||
bool QFontEngineFT::stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs,
|
||||
QFontEngine::ShaperFlags flags) const
|
||||
{
|
||||
Q_ASSERT(glyphs->numGlyphs >= *nglyphs);
|
||||
if (*nglyphs < len) {
|
||||
*nglyphs = len;
|
||||
return false;
|
||||
|
@ -342,6 +342,7 @@ bool QFontEngineQPA::getSfntTableData(uint tag, uchar *buffer, uint *length) con
|
||||
|
||||
bool QFontEngineQPA::stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, QFontEngine::ShaperFlags flags) const
|
||||
{
|
||||
Q_ASSERT(glyphs->numGlyphs >= *nglyphs);
|
||||
if (*nglyphs < len) {
|
||||
*nglyphs = len;
|
||||
return false;
|
||||
|
@ -195,6 +195,12 @@ void QCoreTextFontEngine::init()
|
||||
bool QCoreTextFontEngine::stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs,
|
||||
int *nglyphs, QFontEngine::ShaperFlags flags) const
|
||||
{
|
||||
Q_ASSERT(glyphs->numGlyphs >= *nglyphs);
|
||||
if (*nglyphs < len) {
|
||||
*nglyphs = len;
|
||||
return false;
|
||||
}
|
||||
|
||||
QVarLengthArray<CGGlyph> cgGlyphs(len);
|
||||
CTFontGetGlyphsForCharacters(ctfont, (const UniChar*)str, cgGlyphs.data(), len);
|
||||
|
||||
|
@ -351,6 +351,7 @@ HGDIOBJ QWindowsFontEngine::selectDesignFont() const
|
||||
|
||||
bool QWindowsFontEngine::stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, QFontEngine::ShaperFlags flags) const
|
||||
{
|
||||
Q_ASSERT(glyphs->numGlyphs >= *nglyphs);
|
||||
if (*nglyphs < len) {
|
||||
*nglyphs = len;
|
||||
return false;
|
||||
|
@ -318,6 +318,7 @@ inline unsigned int getChar(const QChar *str, int &i, const int len)
|
||||
bool QWindowsFontEngineDirectWrite::stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs,
|
||||
int *nglyphs, QFontEngine::ShaperFlags flags) const
|
||||
{
|
||||
Q_ASSERT(glyphs->numGlyphs >= *nglyphs);
|
||||
if (*nglyphs < len) {
|
||||
*nglyphs = len;
|
||||
return false;
|
||||
|
Loading…
Reference in New Issue
Block a user