00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036 #ifndef QCOMPLEXTEXT_P_H
00037 #define QCOMPLEXTEXT_P_H
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051 #ifndef QT_H
00052 #include <qstring.h>
00053 #include <qpointarray.h>
00054 #include <qfont.h>
00055 #include <qpainter.h>
00056 #include <qptrlist.h>
00057 #include <qshared.h>
00058 #endif // QT_H
00059
00060 #ifndef QT_NO_COMPLEXTEXT
00061
00062
00063 struct Q_EXPORT QBidiStatus {
00064 QBidiStatus() {
00065 eor = QChar::DirON;
00066 lastStrong = QChar::DirON;
00067 last = QChar:: DirON;
00068 }
00069 QChar::Direction eor;
00070 QChar::Direction lastStrong;
00071 QChar::Direction last;
00072 };
00073
00074 struct Q_EXPORT QBidiContext : public QShared {
00075
00076 QBidiContext( uchar level, QChar::Direction embedding, QBidiContext *parent = 0, bool override = FALSE );
00077 ~QBidiContext();
00078
00079 unsigned char level;
00080 bool override : 1;
00081 QChar::Direction dir : 5;
00082
00083 QBidiContext *parent;
00084 };
00085
00086 struct Q_EXPORT QBidiControl {
00087 QBidiControl() { context = 0; }
00088 QBidiControl( QBidiContext *c, QBidiStatus s)
00089 { context = c; if( context ) context->ref(); status = s; }
00090 ~QBidiControl() { if ( context && context->deref() ) delete context; }
00091 void setContext( QBidiContext *c ) { if ( context == c ) return; if ( context && context->deref() ) delete context; context = c; context->ref(); }
00092 QBidiContext *context;
00093 QBidiStatus status;
00094 };
00095
00096 struct Q_EXPORT QTextRun {
00097 QTextRun(int _start, int _stop, QBidiContext *context, QChar::Direction dir);
00098
00099 int start;
00100 int stop;
00101
00102 uchar level;
00103 };
00104
00105 class Q_EXPORT QComplexText {
00106 public:
00107 static QString shapedString( const QString &str, int from = 0, int len = -1, QPainter::TextDirection dir = QPainter::Auto, const QFontMetrics *fm = 0);
00108 static QChar shapedCharacter(const QString &str, int pos, const QFontMetrics *fm = 0);
00109
00110
00111 static QPointArray positionMarks( QFontPrivate *f, const QString &str, int pos, QRect *boundingRect = 0 );
00112
00113 static QPtrList<QTextRun> *bidiReorderLine( QBidiControl *control, const QString &str, int start, int len,
00114 QChar::Direction basicDir = QChar::DirON );
00115 static QString bidiReorderString( const QString &str, QChar::Direction basicDir = QChar::DirON );
00116 };
00117
00118
00119 #endif //QT_NO_COMPLEXTEXT
00120
00121 #endif