1 /**************************************************************************** |
1 /**************************************************************************** |
2 ** |
2 ** |
3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). |
3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). |
4 ** All rights reserved. |
4 ** All rights reserved. |
5 ** Contact: Nokia Corporation (qt-info@nokia.com) |
5 ** Contact: Nokia Corporation (qt-info@nokia.com) |
6 ** |
6 ** |
7 ** This file is part of the QtGui module of the Qt Toolkit. |
7 ** This file is part of the QtGui module of the Qt Toolkit. |
8 ** |
8 ** |
79 /// generate the script items |
79 /// generate the script items |
80 /// The caps parameter is used to choose the algoritm of splitting text and assiging roles to the textitems |
80 /// The caps parameter is used to choose the algoritm of splitting text and assiging roles to the textitems |
81 void generate(int start, int length, QFont::Capitalization caps) |
81 void generate(int start, int length, QFont::Capitalization caps) |
82 { |
82 { |
83 if ((int)caps == (int)QFont::SmallCaps) |
83 if ((int)caps == (int)QFont::SmallCaps) |
84 generateScriptItemsSmallCaps(m_string.utf16(), start, length); |
84 generateScriptItemsSmallCaps(reinterpret_cast<const ushort *>(m_string.unicode()), start, length); |
85 else if(caps == QFont::Capitalize) |
85 else if(caps == QFont::Capitalize) |
86 generateScriptItemsCapitalize(start, length); |
86 generateScriptItemsCapitalize(start, length); |
87 else if(caps != QFont::MixedCase) { |
87 else if(caps != QFont::MixedCase) { |
88 generateScriptItemsAndChangeCase(start, length, |
88 generateScriptItemsAndChangeCase(start, length, |
89 caps == QFont::AllLowercase ? QScriptAnalysis::Lowercase : QScriptAnalysis::Uppercase); |
89 caps == QFont::AllLowercase ? QScriptAnalysis::Lowercase : QScriptAnalysis::Uppercase); |
1432 } |
1432 } |
1433 } else { |
1433 } else { |
1434 layoutData->hasBidi = bidiItemize(const_cast<QTextEngine *>(this), analysis, control); |
1434 layoutData->hasBidi = bidiItemize(const_cast<QTextEngine *>(this), analysis, control); |
1435 } |
1435 } |
1436 |
1436 |
1437 const ushort *unicode = layoutData->string.utf16(); |
1437 const ushort *uc = reinterpret_cast<const ushort *>(layoutData->string.unicode()); |
1438 // correctly assign script, isTab and isObject to the script analysis |
|
1439 const ushort *uc = unicode; |
|
1440 const ushort *e = uc + length; |
1438 const ushort *e = uc + length; |
1441 int lastScript = QUnicodeTables::Common; |
1439 int lastScript = QUnicodeTables::Common; |
1442 while (uc < e) { |
1440 while (uc < e) { |
1443 int script = QUnicodeTables::script(*uc); |
1441 int script = QUnicodeTables::script(*uc); |
1444 if (script == QUnicodeTables::Inherited) |
1442 if (script == QUnicodeTables::Inherited) |