summaryrefslogtreecommitdiff
path: root/qmake/include/private/qcomplextext_p.h
Unidiff
Diffstat (limited to 'qmake/include/private/qcomplextext_p.h') (more/less context) (ignore whitespace changes)
-rw-r--r--qmake/include/private/qcomplextext_p.h123
1 files changed, 123 insertions, 0 deletions
diff --git a/qmake/include/private/qcomplextext_p.h b/qmake/include/private/qcomplextext_p.h
new file mode 100644
index 0000000..2132522
--- a/dev/null
+++ b/qmake/include/private/qcomplextext_p.h
@@ -0,0 +1,123 @@
1/****************************************************************************
2** $Id$
3**
4** Internal header file.
5**
6** Created :
7**
8** Copyright (C) 2001 Trolltech AS. All rights reserved.
9**
10** This file is part of the kernel module of the Qt GUI Toolkit.
11**
12** This file may be distributed under the terms of the Q Public License
13** as defined by Trolltech AS of Norway and appearing in the file
14** LICENSE.QPL included in the packaging of this file.
15**
16** This file may be distributed and/or modified under the terms of the
17** GNU General Public License version 2 as published by the Free Software
18** Foundation and appearing in the file LICENSE.GPL included in the
19** packaging of this file.
20**
21** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
22** licenses may use this file in accordance with the Qt Commercial License
23** Agreement provided with the Software.
24**
25** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
26** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
27**
28** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
29** information about Qt Commercial License Agreements.
30** See http://www.trolltech.com/qpl/ for QPL licensing information.
31** See http://www.trolltech.com/gpl/ for GPL licensing information.
32**
33** Contact info@trolltech.com if any conditions of this licensing are
34** not clear to you.
35**
36**********************************************************************/
37
38#ifndef QCOMPLEXTEXT_H
39#define QCOMPLEXTEXT_H
40
41//
42// W A R N I N G
43// -------------
44//
45// This file is not part of the Qt API. It exists for the convenience
46// of Qt Remote Control. This header file may change from version to
47// version without notice, or even be removed.
48//
49// We mean it.
50//
51//
52
53#ifndef QT_H
54#include <qstring.h>
55#include <qpointarray.h>
56#include <qfont.h>
57#include <qpainter.h>
58#include <qptrlist.h>
59#include <qshared.h>
60#endif // QT_H
61
62#ifndef QT_NO_COMPLEXTEXT
63
64// bidi helper classes. Internal to Qt
65struct Q_EXPORT QBidiStatus {
66 QBidiStatus() {
67 eor = QChar::DirON;
68 lastStrong = QChar::DirON;
69 last = QChar:: DirON;
70 }
71 QChar::Direction eor;
72 QChar::Direction lastStrong;
73 QChar::Direction last;
74};
75
76struct Q_EXPORT QBidiContext : public QShared {
77 // ### ref and deref parent?
78 QBidiContext( uchar level, QChar::Direction embedding, QBidiContext *parent = 0, bool override = FALSE );
79 ~QBidiContext();
80
81 unsigned char level;
82 bool override : 1;
83 QChar::Direction dir : 5;
84
85 QBidiContext *parent;
86};
87
88struct Q_EXPORT QBidiControl {
89 QBidiControl() { context = 0; }
90 QBidiControl( QBidiContext *c, QBidiStatus s)
91 { context = c; if( context ) context->ref(); status = s; }
92 ~QBidiControl() { if ( context && context->deref() ) delete context; }
93 void setContext( QBidiContext *c ) { if ( context == c ) return; if ( context && context->deref() ) delete context; context = c; context->ref(); }
94 QBidiContext *context;
95 QBidiStatus status;
96};
97
98struct Q_EXPORT QTextRun {
99 QTextRun(int _start, int _stop, QBidiContext *context, QChar::Direction dir);
100
101 int start;
102 int stop;
103 // explicit + implicit levels here
104 uchar level;
105};
106
107class Q_EXPORT QComplexText {
108public:
109 static QString shapedString( const QString &str, int from = 0, int len = -1, QPainter::TextDirection dir = QPainter::Auto, const QFontMetrics *fm = 0);
110 static QChar shapedCharacter(const QString &str, int pos, const QFontMetrics *fm = 0);
111
112 // positions non spacing marks relative to the base character at position pos.
113 static QPointArray positionMarks( QFontPrivate *f, const QString &str, int pos, QRect *boundingRect = 0 );
114
115 static QPtrList<QTextRun> *bidiReorderLine( QBidiControl *control, const QString &str, int start, int len,
116 QChar::Direction basicDir = QChar::DirON );
117 static QString bidiReorderString( const QString &str, QChar::Direction basicDir = QChar::DirON );
118};
119
120
121#endif //QT_NO_COMPLEXTEXT
122
123#endif