QFontEngineBox: Fix assertion for code points beyond BMP

...due to a typo introduced in d8225fab8f and stricter checks
introduced in 4e319ca4c4.
This uses recently added QStringIterator to decrease the code duplication.

Change-Id: Ib1c2519db1c4d65f3ac14e6f9ae3fa272860b1dd
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
This commit is contained in:
Konstantin Ritt 2014-02-08 23:49:32 +02:00 committed by The Qt Project
parent daf4e1e140
commit 535086e9e5

View File

@ -48,6 +48,7 @@
#include "qvarlengtharray.h"
#include <qmath.h>
#include <qendian.h>
#include <private/qstringiterator_p.h>
#ifdef QT_ENABLE_HARFBUZZ_NG
# include "qharfbuzzng_p.h"
@ -1364,14 +1365,12 @@ bool QFontEngineBox::stringToCMap(const QChar *str, int len, QGlyphLayout *glyph
}
int ucs4Length = 0;
for (int i = 0; i < len; ++i) {
if (str[i].isHighSurrogate() && i + 1 < len && str[i + 1].isLowSurrogate())
++ucs4Length;
++ucs4Length;
QStringIterator it(str, str + len);
while (it.hasNext()) {
it.advance();
glyphs->glyphs[ucs4Length++] = 0;
}
memset(glyphs->glyphs, 0, ucs4Length * sizeof(glyph_t));
*nglyphs = ucs4Length;
glyphs->numGlyphs = ucs4Length;