summaryrefslogtreecommitdiffstats
path: root/src/gui/text/qtextlayout.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/text/qtextlayout.cpp')
-rw-r--r--src/gui/text/qtextlayout.cpp40
1 files changed, 27 insertions, 13 deletions
diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp
index 988ae93..c1bc846 100644
--- a/src/gui/text/qtextlayout.cpp
+++ b/src/gui/text/qtextlayout.cpp
@@ -584,7 +584,7 @@ bool QTextLayout::cacheEnabled() const
this option is for widgets like QLineEdit or custom widgets without
a QTextDocument. Default value is Qt::LogicalMoveStyle.
- \sa setCursorMoveStyle()
+ \sa cursorMoveStyle()
*/
void QTextLayout::setCursorMoveStyle(Qt::CursorMoveStyle style)
{
@@ -2233,10 +2233,20 @@ QList<QGlyphRun> QTextLine::glyphs(int from, int length) const
glyphIndexes.setRawFont(font);
QPair<QFontEngine *, int> key(fontEngine, int(flags));
- if (!glyphsHash.contains(key))
+ if (!glyphsHash.contains(key)) {
glyphsHash.insert(key, glyphIndexes);
- else
- glyphsHash[key] += glyphIndexes;
+ } else {
+ QGlyphRun &glyphRun = glyphsHash[key];
+
+ QVector<quint32> indexes = glyphRun.glyphIndexes();
+ QVector<QPointF> positions = glyphRun.positions();
+
+ indexes += glyphIndexes.glyphIndexes();
+ positions += glyphIndexes.positions();
+
+ glyphRun.setGlyphIndexes(indexes);
+ glyphRun.setPositions(positions);
+ }
}
}
@@ -2559,8 +2569,8 @@ qreal QTextLine::cursorToX(int *cursorPos, Edge edge) const
} else {
bool rtl = eng->isRightToLeft();
bool visual = eng->visualCursorMovement();
+ int end = qMin(lineEnd, si->position + l) - si->position;
if (reverse) {
- int end = qMin(lineEnd, si->position + l) - si->position;
int glyph_end = end == l ? si->num_glyphs : logClusters[end];
int glyph_start = glyph_pos;
if (visual && !rtl && !(lastLine && itm == (visualOrder[nItems - 1] + firstItem)))
@@ -2576,7 +2586,7 @@ qreal QTextLine::cursorToX(int *cursorPos, Edge edge) const
for (int i = glyph_start; i <= glyph_end; i++)
x += glyphs.effectiveAdvance(i);
}
- x += eng->offsetInLigature(si, pos, line.length, glyph_pos);
+ x += eng->offsetInLigature(si, pos, end, glyph_pos);
}
*cursorPos = pos + si->position;
@@ -2691,6 +2701,7 @@ int QTextLine::xToCursor(qreal _x, CursorPosition cpos) const
}
int glyph_pos = -1;
+ QFixed edge;
// has to be inside run
if (cpos == QTextLine::CursorOnCharacter) {
if (si.analysis.bidiLevel % 2) {
@@ -2701,6 +2712,7 @@ int QTextLine::xToCursor(qreal _x, CursorPosition cpos) const
if (pos < x)
break;
glyph_pos = gs;
+ edge = pos;
break;
}
pos -= glyphs.effectiveAdvance(gs);
@@ -2713,6 +2725,7 @@ int QTextLine::xToCursor(qreal _x, CursorPosition cpos) const
if (pos > x)
break;
glyph_pos = gs;
+ edge = pos;
}
pos += glyphs.effectiveAdvance(gs);
++gs;
@@ -2726,6 +2739,7 @@ int QTextLine::xToCursor(qreal _x, CursorPosition cpos) const
while (gs <= ge) {
if (glyphs.attributes[gs].clusterStart && qAbs(x-pos) < dist) {
glyph_pos = gs;
+ edge = pos;
dist = qAbs(x-pos);
}
pos -= glyphs.effectiveAdvance(gs);
@@ -2735,6 +2749,7 @@ int QTextLine::xToCursor(qreal _x, CursorPosition cpos) const
while (ge >= gs) {
if (glyphs.attributes[ge].clusterStart && qAbs(x-pos) < dist) {
glyph_pos = ge;
+ edge = pos;
dist = qAbs(x-pos);
}
pos += glyphs.effectiveAdvance(ge);
@@ -2746,6 +2761,7 @@ int QTextLine::xToCursor(qreal _x, CursorPosition cpos) const
while (gs <= ge) {
if (glyphs.attributes[gs].clusterStart && qAbs(x-pos) < dist) {
glyph_pos = gs;
+ edge = pos;
dist = qAbs(x-pos);
}
pos += glyphs.effectiveAdvance(gs);
@@ -2757,6 +2773,7 @@ int QTextLine::xToCursor(qreal _x, CursorPosition cpos) const
pos += glyphs.effectiveAdvance(gs);
if (glyphs.attributes[gs].clusterStart && qAbs(x-pos) < dist) {
glyph_pos = gs;
+ edge = pos;
dist = qAbs(x-pos);
}
++gs;
@@ -2773,16 +2790,13 @@ int QTextLine::xToCursor(qreal _x, CursorPosition cpos) const
if (rtl && nchars > 0)
return insertionPoints[lastLine ? nchars : nchars - 1];
}
- return si.position + end;
+ return eng->positionInLigature(&si, end, x, pos, -1,
+ cpos == QTextLine::CursorOnCharacter);
}
}
Q_ASSERT(glyph_pos != -1);
- int j;
- for (j = 0; j < eng->length(item); ++j)
- if (logClusters[j] == glyph_pos)
- break;
-// qDebug("at pos %d (in run: %d)", si.position + j, j);
- return si.position + j;
+ return eng->positionInLigature(&si, end, x, edge, glyph_pos,
+ cpos == QTextLine::CursorOnCharacter);
}
}
// right of last item
_6_rc Tcl is a high-level, general-purpose, interpreted, dynamic programming language. It was designed with the goal of being very simple but powerful.
summaryrefslogtreecommitdiffstats
path: root/tests/cmdIL.test
Commit message (Expand)AuthorAgeFilesLines
* Now that we're no longer using SCM based on RCS, the RCS Keyword lines causedgp2011-03-021-2/+0
|\
| * Now that we're no longer using SCM based on RCS, the RCS Keyword lines causedgp2011-03-011-2/+0
| * Fix [Bug 1675116] in a way suitable for 8.4.dkf2007-03-101-1/+6
| * Fixed confusing error message. [Bug 771539]dkf2003-07-151-2/+2
* | eliminate duplicate test namesdgp2008-02-131-2/+2
* | * generic/tclCmdIl.c (Tcl_LreverseObjCmd):Miguel Sofer2008-01-221-1/+4
* | * generic/tclCmdIL.c: speed patch for lsort [Patch 1856994].Miguel Sofer2007-12-231-1/+4
* | merge stable branch onto HEADdgp2007-12-131-1/+1
* | * generic/tclIOCmd.c: Revise [open] so that it interprets leadingdgp2007-10-151-5/+5
* | Added test for [Bug 1675044].dgp2007-03-131-1/+18
* | Fix [Bug 1675116]dkf2007-03-091-1/+5
* | * generic/tclCmdIL.c (Tcl_LreverseObjCmd): Added missingdgp2007-03-021-1/+4
* | Optimize for the unshared case.dkf2006-11-091-3/+7
* | Implemented [lreverse] from TIP#272dkf2006-11-091-1/+14
* | * tests/*.test: updated all tests to refer explicitly to thetip_278_20061009Miguel Sofer2006-10-091-2/+2
* | Error message consistency improvements. [Bug 1534628]dkf2006-08-091-5/+5
* | Implementation of TIP#241 from Joe Mistachkindkf2005-06-011-2/+8
* | Merged kennykb-numerics-branch back to the head; TIPs 132 and 232Kevin B Kenny2005-05-101-1/+1
* | TIP#176 IMPLEMENTATION [Patch 1165695]dgp2005-04-291-2/+2
* | TIP#217 implementationdkf2004-10-141-2/+8
* | Full bytecode compilation for [lassign]dkf2004-01-181-49/+262
* | Fix a shimmering bugdkf2004-01-171-1/+5
* | Minor fixes and update of UNIX documentation installerdkf2004-01-171-4/+4
* | Basic implementation of TIP#57 - TclX's [lassign] command into Tcl coredkf2004-01-171-1/+83
* | Make cmdIL.test more self-contained [Bug 838384]dkf2003-11-101-29/+50
* | Test to detect a sharing problem with TIP#127 exposed in tclbenchdkf2003-10-141-1/+10
* | TIP#127 Implementation. Thanks to Michael Schlenker for his implementation workdkf2003-10-141-1/+32
* | Fixed error message to be less confusing [Bug 771539]dkf2003-07-151-2/+2
|/
* Fixed Bug #465674 reported by me. [lsort -index end-1] now behaves sensibly...dkf2001-09-28