? .new.libqt.map ? tools/.new.qcomlibra Index: kernel/qfontengine_p.h =================================================================== RCS file: /home/kde/qt-copy/src/kernel/qfontengine_p.h,v retrieving revision 1.1 diff -u -b -p -r1.1 qfontengine_p.h --- kernel/qfontengine_p.h 16 May 2003 13:02:40 -0000 1.1 +++ kernel/qfontengine_p.h 21 May 2003 09:52:15 -0000 @@ -444,6 +444,7 @@ public: void appendTo(QTextEngine *engine, QScriptItem *si, bool doLogClusters = TRUE); const int *mapping(int &len); + inline void setLength(int len) { str->length = len; } unsigned short *glyphs() { return str->string; } private: bool loadTables( FT_ULong script); Index: kernel/qscriptengine_x11.cpp =================================================================== RCS file: /home/kde/qt-copy/src/kernel/qscriptengine_x11.cpp,v retrieving revision 1.2 diff -u -b -p -r1.2 qscriptengine_x11.cpp --- kernel/qscriptengine_x11.cpp 20 May 2003 12:05:32 -0000 1.2 +++ kernel/qscriptengine_x11.cpp 21 May 2003 09:52:16 -0000 @@ -33,6 +33,12 @@ static void hebrew_shape(int script, con basic_shape( script, string, from, len, engine, si ); } +// ------------------------------------------------------------------------------------------------------------------ +// +// Continuation of middle eastern languages +// +// ------------------------------------------------------------------------------------------------------------------ + // #### stil missing: identify invalid character combinations static void syriac_shape( int script, const QString &string, int from, int len, QTextEngine *engine, QScriptItem *si ) @@ -91,6 +97,7 @@ enum Form { StressMark, IndependentVowel, LengthMark, + Control, Other }; @@ -935,6 +942,8 @@ static inline Form form( unsigned short if ( uc < 0x900 || uc > 0xdff ) { if ( uc == 0x25cc ) return Consonant; + if ( uc == 0x200c || uc == 0x200d ) + return Control; return Other; } return (Form)indicForms[uc-0x900]; @@ -1057,7 +1066,7 @@ static const IndicOrdering malayalam_ord static const IndicOrdering * const indic_order[] = { devanagari_order, // Devanagari bengali_order, // Bengali - // Gurmukhi + gurmukhi_order, // Gurmukhi devanagari_order, // Gujarati bengali_order, // Oriya tamil_order, // Tamil @@ -1128,7 +1137,7 @@ static inline void splitMatra(unsigned s len++; } -// #define INDIC_DEBUG +#define INDIC_DEBUG #ifdef INDIC_DEBUG #define IDEBUG qDebug #else @@ -1171,6 +1180,8 @@ static void indic_shape_syllable( int sc } else { memcpy( reordered, string.unicode() + from, len*sizeof( QChar ) ); } + if (reordered[len-1] == 0x200c) // zero width non joiner + len--; int i; int base = 0; @@ -1203,7 +1214,7 @@ static void indic_shape_syllable( int sc // // * In Kannada and Telugu, the base consonant cannot be // farther than 3 consonants from the end of the syllable. - if (form(*uc) == Consonant) { + if (form(*uc) == Consonant || (script == QFont::Bengali && form(*uc) == IndependentVowel)) { beginsWithRa = ((len > 2) && *uc == ra && *(uc+1) == halant); base = (beginsWithRa && (properties & HasReph) ? 2 : 0); IDEBUG(" length = %d, beginsWithRa = %d, base=%d", len, beginsWithRa, base ); @@ -1303,7 +1314,7 @@ static void indic_shape_syllable( int sc toPos += 2; if (script == QFont::Devanagari || script == QFont::Gujarati || script == QFont::Bengali) { if (matra_position == Post || matra_position == Split) { - toPos = matra + 1; + toPos = matra; matra -= 2; } } else if (script == QFont::Kannada) { @@ -1432,6 +1443,10 @@ static void indic_shape_syllable( int sc int firstGlyph = si->num_glyphs; + bool control = FALSE; + for (int i = 0; i < len; ++i) + control |= (form(reordered[i]) == Control); + #ifndef QT_NO_XFTFREETYPE if (openType) { int error = si->fontEngine->stringToCMap((QChar *)reordered, len, glyphs, 0, &len, @@ -1493,8 +1508,16 @@ static void indic_shape_syllable( int sc memset(where, 0, len*sizeof(bool)); for (i = 0; i < base; ++i) where[i] = TRUE; + if (control) { + for (i = 2; i < len; ++i) { + if (form(reordered[i]) == Control && reordered[i] == 0x200d) { + where[i-1] = TRUE; + where[i-2] = TRUE; + } + } + } openType->applyGSUBFeature(FT_MAKE_TAG( 'h', 'a', 'l', 'f' ), where); - openType->applyGSUBFeature(FT_MAKE_TAG( 'p', 's', 'b', 'f' )); + openType->applyGSUBFeature(FT_MAKE_TAG( 'p', 's', 't', 'f' )); openType->applyGSUBFeature(FT_MAKE_TAG( 'v', 'a', 't', 'u' )); // Conjunkts and typographical forms @@ -1536,6 +1559,21 @@ static void indic_shape_syllable( int sc for (i = 0; i < newLen; ++i) ga[i] = glyphAttributes[char_map[i]]; + if (control) { + IDEBUG("found a control char in the syllable"); + int i = 0, j = 0; + unsigned short *g = openType->glyphs(); + while (1) { + if (form(reordered[char_map[i]]) == Control) + ++i; + if (i >= newLen) + break; + g[j] = g[i]; + ++i; + ++j; + } + openType->setLength(j); + } openType->appendTo(engine, si, FALSE); @@ -1598,7 +1636,7 @@ static int indic_nextSyllableBoundary( i pos++; if ( state != Consonant && state != IndependentVowel ) { - if ( state != Other ) + if ( state != Other && state != Control ) *invalid = TRUE; goto finish; } @@ -1607,12 +1645,18 @@ static int indic_nextSyllableBoundary( i Form newState = form( uc[pos].unicode() ); // qDebug("state[%d]=%d (uc=%4x)", pos, newState, uc[pos].unicode() ); switch( newState ) { + case Control: + if (uc[pos].unicode() == 0x200d) // Zero width joiner + newState = state; + break; case Consonant: if ( state == Halant ) break; goto finish; case Halant: if ( state == Nukta || state == Consonant ) + break; + if ( script == QFont::Bengali && pos == 1 && state == IndependentVowel ) break; goto finish; case Nukta: Index: kernel/qtextengine.cpp =================================================================== RCS file: /home/kde/qt-copy/src/kernel/qtextengine.cpp,v retrieving revision 1.1 diff -u -b -p -r1.1 qtextengine.cpp --- kernel/qtextengine.cpp 16 May 2003 13:02:53 -0000 1.1 +++ kernel/qtextengine.cpp 21 May 2003 09:52:16 -0000 @@ -158,8 +158,10 @@ static void qAppendItems(QTextEngine *en unsigned short uc = text[i].unicode(); QFont::Script s = (QFont::Script)scriptForChar( uc ); + if (s == QFont::UnknownScript) + s = script; - if (s != script && (::category( uc ) != QChar::Mark_NonSpacing || script == QFont::NoScript)) { + if (s != script) { item.analysis.script = s; item.analysis.bidiLevel = level; item.position = i; @@ -172,6 +174,8 @@ static void qAppendItems(QTextEngine *en unsigned short uc = text[i].unicode(); QFont::Script s = (QFont::Script)scriptForChar( uc ); + if (s == QFont::UnknownScript) + s = script; QChar::Category category = ::category( uc ); if ( uc == 0xfffcU || uc == 0x2028U ) { @@ -789,12 +793,9 @@ void QTextEngine::splitItem( int item, i if ( pos <= 0 ) return; -#ifdef Q_WS_WIN - // if we use Uniscribe we have to ensure we get correct shaping for arabic and other + // we have to ensure we get correct shaping for arabic and other // complex languages so we have to call shape _before_ we split the item. - if (hasUsp10) shape(item); -#endif if ( items.d->size == items.d->alloc ) items.resize( items.d->size + 1 ); Index: tools/qunicodetables.cpp =================================================================== RCS file: /home/kde/qt-copy/src/tools/qunicodetables.cpp,v retrieving revision 1.1 diff -u -b -p -r1.1 qunicodetables.cpp --- tools/qunicodetables.cpp 16 May 2003 13:03:06 -0000 1.1 +++ tools/qunicodetables.cpp 21 May 2003 09:52:23 -0000 @@ -11805,12 +11805,13 @@ enum Script { KatakanaHalfWidth, // from JIS X 0201 // End - NScripts + NScripts, + UnknownScript = NScripts }; // copied form qfont.h, as we can't include it in tools. Do not modify without // changing the script enum in qfont.h aswell. -const unsigned char QUnicodeTables::otherScripts [116] = { +const unsigned char QUnicodeTables::otherScripts [120] = { #define SCRIPTS_02 0 0xaf, Latin, 0xff, SpacingModifiers, // row 0x02, index 0 #define SCRIPTS_03 4 @@ -11833,28 +11834,28 @@ const unsigned char QUnicodeTables::othe #define SCRIPTS_18 48 0xaf, Mongolian, 0xff, Unicode, // row 0x18, index 46 #define SCRIPTS_20 52 - 0x6f, Unicode, 0x9f, NumberForms, + 0x0b, Unicode, 0x0d, UnknownScript, 0x6f, Unicode, 0x9f, NumberForms, 0xab, CurrencySymbols, 0xac, Latin, 0xcf, CurrencySymbols, 0xff, CombiningMarks, // row 0x20, index 50 -#define SCRIPTS_21 64 +#define SCRIPTS_21 68 0x4f, LetterlikeSymbols, 0x8f, NumberForms, 0xff, MathematicalOperators, // row 0x21, index 62 -#define SCRIPTS_24 70 +#define SCRIPTS_24 74 0x5f, TechnicalSymbols, 0xff, EnclosedAndSquare, // row 0x24, index 68 -#define SCRIPTS_2e 74 +#define SCRIPTS_2e 78 0x7f, Unicode, 0xff, Han, // row 0x2e, index 72 -#define SCRIPTS_30 78 +#define SCRIPTS_30 82 0x3f, Han, 0x9f, Hiragana, 0xff, Katakana, // row 0x30, index 76 -#define SCRIPTS_31 84 +#define SCRIPTS_31 88 0x2f, Bopomofo, 0x8f, Hangul, 0x9f, Han, 0xff, Unicode, // row 0x31, index 82 -#define SCRIPTS_fb 92 +#define SCRIPTS_fb 96 0x06, Latin, 0x1c, Unicode, 0x4f, Hebrew, 0xff, Arabic, // row 0xfb, index 90 -#define SCRIPTS_fe 100 +#define SCRIPTS_fe 104 0x1f, Unicode, 0x2f, CombiningMarks, 0x6f, Unicode, 0xff, Arabic, // row 0xfe, index 98 -#define SCRIPTS_ff 108 +#define SCRIPTS_ff 112 0x5e, Katakana, 0x60, Unicode, // row 0xff, index 106 0x9f, KatakanaHalfWidth, 0xff, Unicode };