diff options
Diffstat (limited to 'src/gui/text')
-rw-r--r-- | src/gui/text/qfontengine.cpp | 7 | ||||
-rw-r--r-- | src/gui/text/qsyntaxhighlighter.cpp | 29 | ||||
-rw-r--r-- | src/gui/text/qtextlayout.cpp | 4 |
3 files changed, 10 insertions, 30 deletions
diff --git a/src/gui/text/qfontengine.cpp b/src/gui/text/qfontengine.cpp index bdcf166243..fa4e7a75bc 100644 --- a/src/gui/text/qfontengine.cpp +++ b/src/gui/text/qfontengine.cpp @@ -1370,7 +1370,9 @@ bool QFontEngineMulti::stringToCMap(const QChar *str, int len, bool surrogate = (str[i].isHighSurrogate() && i < len-1 && str[i+1].isLowSurrogate()); uint ucs4 = surrogate ? QChar::surrogateToUcs4(str[i], str[i+1]) : str[i].unicode(); if (glyphs->glyphs[glyph_pos] == 0 && str[i].category() != QChar::Separator_Line) { - QGlyphLayoutInstance tmp = glyphs->instance(glyph_pos); + QGlyphLayoutInstance tmp; + if (!(flags & GlyphIndicesOnly)) + tmp = glyphs->instance(glyph_pos); for (int x=1; x < engines.size(); ++x) { if (engines.at(x) == 0 && !shouldLoadFontEngineForCharacter(x, ucs4)) continue; @@ -1400,9 +1402,8 @@ bool QFontEngineMulti::stringToCMap(const QChar *str, int len, } // ensure we use metrics from the 1st font when we use the fallback image. - if (!glyphs->glyphs[glyph_pos]) { + if (!(flags & GlyphIndicesOnly) && !glyphs->glyphs[glyph_pos]) glyphs->setInstance(glyph_pos, tmp); - } } if (surrogate) diff --git a/src/gui/text/qsyntaxhighlighter.cpp b/src/gui/text/qsyntaxhighlighter.cpp index 7baf55caea..f183e1eb20 100644 --- a/src/gui/text/qsyntaxhighlighter.cpp +++ b/src/gui/text/qsyntaxhighlighter.cpp @@ -119,18 +119,14 @@ void QSyntaxHighlighterPrivate::applyFormatChanges() formatsChanged = true; } - QTextCharFormat emptyFormat; - - QTextLayout::FormatRange r; - r.start = -1; - int i = 0; while (i < formatChanges.count()) { + QTextLayout::FormatRange r; - while (i < formatChanges.count() && formatChanges.at(i) == emptyFormat) + while (i < formatChanges.count() && formatChanges.at(i) == r.format) ++i; - if (i >= formatChanges.count()) + if (i == formatChanges.count()) break; r.start = i; @@ -139,9 +135,7 @@ void QSyntaxHighlighterPrivate::applyFormatChanges() while (i < formatChanges.count() && formatChanges.at(i) == r.format) ++i; - if (i >= formatChanges.count()) - break; - + Q_ASSERT(i <= formatChanges.count()); r.length = i - r.start; if (preeditAreaLength != 0) { @@ -153,21 +147,6 @@ void QSyntaxHighlighterPrivate::applyFormatChanges() ranges << r; formatsChanged = true; - r.start = -1; - } - - if (r.start != -1) { - r.length = formatChanges.count() - r.start; - - if (preeditAreaLength != 0) { - if (r.start >= preeditAreaStart) - r.start += preeditAreaLength; - else if (r.start + r.length >= preeditAreaStart) - r.length += preeditAreaLength; - } - - ranges << r; - formatsChanged = true; } if (formatsChanged) { diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp index a0a92897c5..0ca8e8d9a6 100644 --- a/src/gui/text/qtextlayout.cpp +++ b/src/gui/text/qtextlayout.cpp @@ -916,7 +916,7 @@ QRectF QTextLayout::boundingRect() const QFixed lineWidth = si.width < QFIXED_MAX ? qMax(si.width, si.textWidth) : si.textWidth; xmax = qMax(xmax, si.x+lineWidth); // ### shouldn't the ascent be used in ymin??? - ymax = qMax(ymax, si.y+si.height()); + ymax = qMax(ymax, si.y+si.height().ceil()); } return QRectF(xmin.toReal(), ymin.toReal(), (xmax-xmin).toReal(), (ymax-ymin).toReal()); } @@ -1466,7 +1466,7 @@ qreal QTextLine::descent() const */ qreal QTextLine::height() const { - return eng->lines[index].height().toReal(); + return eng->lines[index].height().ceil().toReal(); } /*! |