summaryrefslogtreecommitdiffstats
path: root/src/gui/text
diff options
context:
space:
mode:
authorOlivier Goffart <ogoffart@trolltech.com>2009-11-04 08:45:54 (GMT)
committerOlivier Goffart <ogoffart@trolltech.com>2009-11-04 08:45:54 (GMT)
commite22581675866cbf88e948eae2e83eb13a43a2d44 (patch)
tree782b173b702a48fca5f68d9622cad67d65d01d88 /src/gui/text
parent950cd9b3c1ae6a1b462d596a62aea92f9c231afb (diff)
parentdb997a02c1d306260d8bbfe4f13e8312efb6fa7c (diff)
downloadQt-e22581675866cbf88e948eae2e83eb13a43a2d44.zip
Qt-e22581675866cbf88e948eae2e83eb13a43a2d44.tar.gz
Qt-e22581675866cbf88e948eae2e83eb13a43a2d44.tar.bz2
Merge commit 'origin/4.6' into 4.6
Diffstat (limited to 'src/gui/text')
-rw-r--r--src/gui/text/qfontengine_qpf.cpp2
-rw-r--r--src/gui/text/qtextcontrol.cpp2
-rw-r--r--src/gui/text/qtextdocument.cpp27
-rw-r--r--src/gui/text/qtextdocument.h3
-rw-r--r--src/gui/text/qtextdocument_p.h3
-rw-r--r--src/gui/text/qtextengine_mac.cpp73
6 files changed, 71 insertions, 39 deletions
diff --git a/src/gui/text/qfontengine_qpf.cpp b/src/gui/text/qfontengine_qpf.cpp
index 6ff0fbd..94974fc 100644
--- a/src/gui/text/qfontengine_qpf.cpp
+++ b/src/gui/text/qfontengine_qpf.cpp
@@ -819,7 +819,7 @@ FT_Face QFontEngineQPF::lockFace() const
FT_Face face = freetype->face;
// ### not perfect
- const int ysize = int(fontDef.pixelSize) << 6;
+ const int ysize = qRound(fontDef.pixelSize * qreal(64));
const int xsize = ysize;
if (freetype->xsize != xsize || freetype->ysize != ysize) {
diff --git a/src/gui/text/qtextcontrol.cpp b/src/gui/text/qtextcontrol.cpp
index ee8b751..3f6545c 100644
--- a/src/gui/text/qtextcontrol.cpp
+++ b/src/gui/text/qtextcontrol.cpp
@@ -1619,9 +1619,11 @@ void QTextControlPrivate::mouseMoveEvent(Qt::MouseButtons buttons, const QPointF
if (cursor.position() != oldCursorPos)
emit q->cursorPositionChanged();
_q_updateCurrentCharFormatAndSelection();
+#ifndef QT_NO_IM
if (QInputContext *ic = inputContext()) {
ic->update();
}
+#endif //QT_NO_IM
} else {
//emit q->visibilityRequest(QRectF(mousePos, QSizeF(1, 1)));
if (cursor.position() != oldCursorPos)
diff --git a/src/gui/text/qtextdocument.cpp b/src/gui/text/qtextdocument.cpp
index 6978b6c..1aad385 100644
--- a/src/gui/text/qtextdocument.cpp
+++ b/src/gui/text/qtextdocument.cpp
@@ -958,6 +958,8 @@ QString QTextDocument::defaultStyleSheet() const
/*!
Returns true if undo is available; otherwise returns false.
+
+ \sa isRedoAvailable(), availableUndoSteps()
*/
bool QTextDocument::isUndoAvailable() const
{
@@ -967,6 +969,8 @@ bool QTextDocument::isUndoAvailable() const
/*!
Returns true if redo is available; otherwise returns false.
+
+ \sa isUndoAvailable(), availableRedoSteps()
*/
bool QTextDocument::isRedoAvailable() const
{
@@ -974,6 +978,29 @@ bool QTextDocument::isRedoAvailable() const
return d->isRedoAvailable();
}
+/*! \since 4.6
+
+ Returns the number of available undo steps.
+
+ \sa isUndoAvailable()
+*/
+int QTextDocument::availableUndoSteps() const
+{
+ Q_D(const QTextDocument);
+ return d->availableUndoSteps();
+}
+
+/*! \since 4.6
+
+ Returns the number of available redo steps.
+
+ \sa isRedoAvailable()
+*/
+int QTextDocument::availableRedoSteps() const
+{
+ Q_D(const QTextDocument);
+ return d->availableRedoSteps();
+}
/*! \since 4.4
diff --git a/src/gui/text/qtextdocument.h b/src/gui/text/qtextdocument.h
index e52716a..d217a4d 100644
--- a/src/gui/text/qtextdocument.h
+++ b/src/gui/text/qtextdocument.h
@@ -142,6 +142,9 @@ public:
bool isUndoAvailable() const;
bool isRedoAvailable() const;
+ int availableUndoSteps() const;
+ int availableRedoSteps() const;
+
int revision() const;
void setDocumentLayout(QAbstractTextDocumentLayout *layout);
diff --git a/src/gui/text/qtextdocument_p.h b/src/gui/text/qtextdocument_p.h
index ce25c57..c10855b 100644
--- a/src/gui/text/qtextdocument_p.h
+++ b/src/gui/text/qtextdocument_p.h
@@ -212,6 +212,9 @@ public:
inline bool isUndoAvailable() const { return undoEnabled && undoState > 0; }
inline bool isRedoAvailable() const { return undoEnabled && undoState < undoStack.size(); }
+ inline int availableUndoSteps() const { return undoEnabled ? undoState : 0; }
+ inline int availableRedoSteps() const { return undoEnabled ? qMax(undoStack.size() - undoState - 1, 0) : 0; }
+
inline QString buffer() const { return text; }
QString plainText() const;
inline int length() const { return fragments.length(); }
diff --git a/src/gui/text/qtextengine_mac.cpp b/src/gui/text/qtextengine_mac.cpp
index eeccc72..54be53b 100644
--- a/src/gui/text/qtextengine_mac.cpp
+++ b/src/gui/text/qtextengine_mac.cpp
@@ -594,53 +594,50 @@ void QTextEngine::shapeTextMac(int item) const
str = reinterpret_cast<const QChar *>(uc);
}
- while (true) {
- ensureSpace(num_glyphs);
- num_glyphs = layoutData->glyphLayout.numGlyphs - layoutData->used;
-
- QGlyphLayout g = availableGlyphs(&si);
- g.numGlyphs = num_glyphs;
- unsigned short *log_clusters = logClusters(&si);
+ ensureSpace(num_glyphs);
+ num_glyphs = layoutData->glyphLayout.numGlyphs - layoutData->used;
- if (fe->stringToCMap(str,
- len,
- &g,
- &num_glyphs,
- flags,
- log_clusters,
- attributes())) {
+ QGlyphLayout g = availableGlyphs(&si);
+ g.numGlyphs = num_glyphs;
+ unsigned short *log_clusters = logClusters(&si);
- heuristicSetGlyphAttributes(str, len, &g, log_clusters, num_glyphs);
- break;
- }
+ bool stringToCMapFailed = false;
+ if (!fe->stringToCMap(str, len, &g, &num_glyphs, flags, log_clusters, attributes())) {
+ ensureSpace(num_glyphs);
+ stringToCMapFailed = fe->stringToCMap(str, len, &g, &num_glyphs, flags, log_clusters,
+ attributes());
}
- si.num_glyphs = num_glyphs;
+ if (!stringToCMapFailed) {
+ heuristicSetGlyphAttributes(str, len, &g, log_clusters, num_glyphs);
- layoutData->used += si.num_glyphs;
+ si.num_glyphs = num_glyphs;
- QGlyphLayout g = shapedGlyphs(&si);
+ layoutData->used += si.num_glyphs;
- if (si.analysis.script == QUnicodeTables::Arabic) {
- QVarLengthArray<QArabicProperties> props(len + 2);
- QArabicProperties *properties = props.data();
- int f = si.position;
- int l = len;
- if (f > 0) {
- --f;
- ++l;
- ++properties;
- }
- if (f + l < layoutData->string.length()) {
- ++l;
- }
- qt_getArabicProperties((const unsigned short *)(layoutData->string.unicode()+f), l, props.data());
+ QGlyphLayout g = shapedGlyphs(&si);
- unsigned short *log_clusters = logClusters(&si);
+ if (si.analysis.script == QUnicodeTables::Arabic) {
+ QVarLengthArray<QArabicProperties> props(len + 2);
+ QArabicProperties *properties = props.data();
+ int f = si.position;
+ int l = len;
+ if (f > 0) {
+ --f;
+ ++l;
+ ++properties;
+ }
+ if (f + l < layoutData->string.length()) {
+ ++l;
+ }
+ qt_getArabicProperties((const unsigned short *)(layoutData->string.unicode()+f), l, props.data());
- for (int i = 0; i < len; ++i) {
- int gpos = log_clusters[i];
- g.attributes[gpos].justification = properties[i].justification;
+ unsigned short *log_clusters = logClusters(&si);
+
+ for (int i = 0; i < len; ++i) {
+ int gpos = log_clusters[i];
+ g.attributes[gpos].justification = properties[i].justification;
+ }
}
}