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
00037
00038 #ifndef QCOMPLEXTEXT_H
00039 #define QCOMPLEXTEXT_H
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053 #ifndef QT_H
00054 #include "qt3namespace.h"
00055 #include <qstring.h>
00056 #include <qpointarray.h>
00057 #include <qfont.h>
00058 #include <qpainter.h>
00059 #include <qlist.h>
00060 #include <qshared.h>
00061 #endif // QT_H
00062
00063 class QFontPrivate;
00064
00065 namespace Qt3 {
00066
00067
00068 struct Q_EXPORT QBidiStatus {
00069 QBidiStatus() {
00070 eor = QChar::DirON;
00071 lastStrong = QChar::DirON;
00072 last = QChar:: DirON;
00073 }
00074 QChar::Direction eor;
00075 QChar::Direction lastStrong;
00076 QChar::Direction last;
00077 };
00078
00079 struct Q_EXPORT QBidiContext : public QShared {
00080
00081 QBidiContext( uchar level, QChar::Direction embedding, QBidiContext *parent = 0, bool override = FALSE );
00082 ~QBidiContext();
00083
00084 unsigned char level;
00085 bool override : 1;
00086 QChar::Direction dir : 5;
00087
00088 QBidiContext *parent;
00089 };
00090
00091 struct Q_EXPORT QBidiControl {
00092 QBidiControl() { context = 0; }
00093 QBidiControl( QBidiContext *c, QBidiStatus s)
00094 { context = c; if( context ) context->ref(); status = s; }
00095 ~QBidiControl() { if ( context && context->deref() ) delete context; }
00096 void setContext( QBidiContext *c ) { if ( context == c ) return; if ( context && context->deref() ) delete context; context = c; context->ref(); }
00097 QBidiContext *context;
00098 QBidiStatus status;
00099 };
00100
00101 struct Q_EXPORT QTextRun {
00102 QTextRun(int _start, int _stop, QBidiContext *context, QChar::Direction dir);
00103
00104 int start;
00105 int stop;
00106
00107 uchar level;
00108 };
00109
00110 class Q_EXPORT QComplexText {
00111 public:
00112 enum Shape {
00113 XIsolated,
00114 XFinal,
00115 XInitial,
00116 XMedial
00117 };
00118 static Shape glyphVariant( const QString &str, int pos);
00119 static Shape glyphVariantLogical( const QString &str, int pos);
00120
00121 static QChar shapedCharacter(const QString &str, int pos, const QFontMetrics *fm = 0);
00122
00123
00124 static QPointArray positionMarks( QFontPrivate *f, const QString &str, int pos, QRect *boundingRect = 0 );
00125
00126 static QPtrList<QTextRun> *bidiReorderLine( QBidiControl *control, const QString &str, int start, int len,
00127 QChar::Direction basicDir = QChar::DirON );
00128 static QString bidiReorderString( const QString &str, QChar::Direction basicDir = QChar::DirON );
00129 };
00130
00131 }
00132
00133 #endif