summaryrefslogtreecommitdiffstats
path: root/src/gui/text/qfontengine_mac.mm
diff options
context:
space:
mode:
authorSarah Smith <sarah.j.smith@nokia.com>2009-10-20 11:53:30 +1000
committerSarah Smith <sarah.j.smith@nokia.com>2009-10-20 11:53:30 +1000
commit420be4ee3d98c093c71cc840192138da6b5e61d2 (patch)
tree9debab52db05f930d2c72095eae0953a320a2816 /src/gui/text/qfontengine_mac.mm
parentdfd6221d960ec8c563a687684000c3a9c4f58079 (diff)
Fix bug QTBUG-4848
Make the shapeText function return numGlyphs properly - its not always the same as length of string. Task-number: QTBUG-4848 Reviewed-by: Rhys Weatherley
Diffstat (limited to 'src/gui/text/qfontengine_mac.mm')
-rw-r--r--src/gui/text/qfontengine_mac.mm14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/gui/text/qfontengine_mac.mm b/src/gui/text/qfontengine_mac.mm
index d11083fa2e..8ce437d4df 100644
--- a/src/gui/text/qfontengine_mac.mm
+++ b/src/gui/text/qfontengine_mac.mm
@@ -830,7 +830,6 @@ static OSStatus atsuPostLayoutCallback(ATSULayoutOperationSelector selector, ATS
surrogates += (str[i].unicode() >= 0xd800 && str[i].unicode() < 0xdc00
&& str[i+1].unicode() >= 0xdc00 && str[i+1].unicode() < 0xe000);
}
- Q_ASSERT(*nfo->numGlyphs == item->length - surrogates);
#endif
for (nextCharStop = item->from; nextCharStop < item->from + item->length; ++nextCharStop)
if (item->charAttributes[nextCharStop].charStop)
@@ -856,10 +855,13 @@ static OSStatus atsuPostLayoutCallback(ATSULayoutOperationSelector selector, ATS
QFixed xAdvance = FixedToQFixed(layoutData[glyphIdx + 1].realPos - layoutData[glyphIdx].realPos);
if (glyphId != 0xffff || i == 0) {
- nfo->glyphs->glyphs[i] = (glyphId & 0x00ffffff) | (fontIdx << 24);
+ if (i < nfo->glyphs->numGlyphs)
+ {
+ nfo->glyphs->glyphs[i] = (glyphId & 0x00ffffff) | (fontIdx << 24);
- nfo->glyphs->advances_y[i] = yAdvance;
- nfo->glyphs->advances_x[i] = xAdvance;
+ nfo->glyphs->advances_y[i] = yAdvance;
+ nfo->glyphs->advances_x[i] = xAdvance;
+ }
} else {
// ATSUI gives us 0xffff as glyph id at the index in the glyph array for
// a character position that maps to a ligtature. Such a glyph id does not
@@ -1029,6 +1031,8 @@ bool QFontEngineMacMulti::stringToCMapInternal(const QChar *str, int len, QGlyph
nfo.flags = flags;
nfo.shaperItem = shaperItem;
+ int prevNumGlyphs = *nglyphs;
+
QVarLengthArray<int> mappedFonts(len);
for (int i = 0; i < len; ++i)
mappedFonts[i] = 0;
@@ -1140,6 +1144,8 @@ bool QFontEngineMacMulti::stringToCMapInternal(const QChar *str, int len, QGlyph
}
ATSUClearLayoutCache(textLayout, kATSUFromTextBeginning);
+ if (prevNumGlyphs < *nfo.numGlyphs)
+ return false;
return true;
}