equal
deleted
inserted
replaced
883 QFont font = this->font(si); |
883 QFont font = this->font(si); |
884 bool letterSpacingIsAbsolute = font.d->letterSpacingIsAbsolute; |
884 bool letterSpacingIsAbsolute = font.d->letterSpacingIsAbsolute; |
885 QFixed letterSpacing = font.d->letterSpacing; |
885 QFixed letterSpacing = font.d->letterSpacing; |
886 QFixed wordSpacing = font.d->wordSpacing; |
886 QFixed wordSpacing = font.d->wordSpacing; |
887 |
887 |
888 if (letterSpacingIsAbsolute) |
888 if (letterSpacingIsAbsolute && letterSpacing.value()) |
889 letterSpacing *= font.d->dpi / qt_defaultDpiY(); |
889 letterSpacing *= font.d->dpi / qt_defaultDpiY(); |
890 |
890 |
891 if (letterSpacing != 0) { |
891 if (letterSpacing != 0) { |
892 for (int i = 1; i < si.num_glyphs; ++i) { |
892 for (int i = 1; i < si.num_glyphs; ++i) { |
893 if (glyphs.attributes[i].clusterStart) { |
893 if (glyphs.attributes[i].clusterStart) { |
1402 // ATSUI requires RTL flags to correctly identify the character stops. |
1402 // ATSUI requires RTL flags to correctly identify the character stops. |
1403 bool ignore = false; |
1403 bool ignore = false; |
1404 #else |
1404 #else |
1405 bool ignore = ignoreBidi; |
1405 bool ignore = ignoreBidi; |
1406 #endif |
1406 #endif |
1407 if (!ignore && option.textDirection() == Qt::LeftToRight) { |
1407 |
|
1408 bool rtl = isRightToLeft(); |
|
1409 |
|
1410 if (!ignore && !rtl) { |
1408 ignore = true; |
1411 ignore = true; |
1409 const QChar *start = layoutData->string.unicode(); |
1412 const QChar *start = layoutData->string.unicode(); |
1410 const QChar * const end = start + length; |
1413 const QChar * const end = start + length; |
1411 while (start < end) { |
1414 while (start < end) { |
1412 if (start->unicode() >= 0x590) { |
1415 if (start->unicode() >= 0x590) { |
1418 } |
1421 } |
1419 |
1422 |
1420 QVarLengthArray<QScriptAnalysis, 4096> scriptAnalysis(length); |
1423 QVarLengthArray<QScriptAnalysis, 4096> scriptAnalysis(length); |
1421 QScriptAnalysis *analysis = scriptAnalysis.data(); |
1424 QScriptAnalysis *analysis = scriptAnalysis.data(); |
1422 |
1425 |
1423 QBidiControl control(option.textDirection() == Qt::RightToLeft); |
1426 QBidiControl control(rtl); |
1424 |
1427 |
1425 if (ignore) { |
1428 if (ignore) { |
1426 memset(analysis, 0, length*sizeof(QScriptAnalysis)); |
1429 memset(analysis, 0, length*sizeof(QScriptAnalysis)); |
1427 if (option.textDirection() == Qt::RightToLeft) { |
1430 if (option.textDirection() == Qt::RightToLeft) { |
1428 for (int i = 0; i < length; ++i) |
1431 for (int i = 0; i < length; ++i) |
1512 } |
1515 } |
1513 |
1516 |
1514 addRequiredBoundaries(); |
1517 addRequiredBoundaries(); |
1515 resolveAdditionalFormats(); |
1518 resolveAdditionalFormats(); |
1516 } |
1519 } |
|
1520 |
|
1521 bool QTextEngine::isRightToLeft() const |
|
1522 { |
|
1523 switch (option.textDirection()) { |
|
1524 case Qt::LeftToRight: |
|
1525 return false; |
|
1526 case Qt::RightToLeft: |
|
1527 return true; |
|
1528 default: |
|
1529 break; |
|
1530 } |
|
1531 // this places the cursor in the right position depending on the keyboard layout |
|
1532 if (layoutData->string.isEmpty()) |
|
1533 return QApplication::keyboardInputDirection() == Qt::RightToLeft; |
|
1534 return layoutData->string.isRightToLeft(); |
|
1535 } |
|
1536 |
1517 |
1537 |
1518 int QTextEngine::findItem(int strPos) const |
1538 int QTextEngine::findItem(int strPos) const |
1519 { |
1539 { |
1520 itemize(); |
1540 itemize(); |
1521 |
1541 |
2509 dpiScale = QFixed::fromReal(fnt.d->dpi / qreal(qt_defaultDpiY())); |
2529 dpiScale = QFixed::fromReal(fnt.d->dpi / qreal(qt_defaultDpiY())); |
2510 } |
2530 } |
2511 |
2531 |
2512 QList<QTextOption::Tab> tabArray = option.tabs(); |
2532 QList<QTextOption::Tab> tabArray = option.tabs(); |
2513 if (!tabArray.isEmpty()) { |
2533 if (!tabArray.isEmpty()) { |
2514 if (option.textDirection() == Qt::RightToLeft) { // rebase the tabArray positions. |
2534 if (isRightToLeft()) { // rebase the tabArray positions. |
2515 QList<QTextOption::Tab> newTabs; |
2535 QList<QTextOption::Tab> newTabs; |
2516 QList<QTextOption::Tab>::Iterator iter = tabArray.begin(); |
2536 QList<QTextOption::Tab>::Iterator iter = tabArray.begin(); |
2517 while(iter != tabArray.end()) { |
2537 while(iter != tabArray.end()) { |
2518 QTextOption::Tab tab = *iter; |
2538 QTextOption::Tab tab = *iter; |
2519 if (tab.type == QTextOption::LeftTab) |
2539 if (tab.type == QTextOption::LeftTab) |
2646 flags |= QTextItem::Overline; |
2666 flags |= QTextItem::Overline; |
2647 if (f->d->strikeOut || format.fontStrikeOut()) |
2667 if (f->d->strikeOut || format.fontStrikeOut()) |
2648 flags |= QTextItem::StrikeOut; |
2668 flags |= QTextItem::StrikeOut; |
2649 } |
2669 } |
2650 |
2670 |
|
2671 QTextItemInt::QTextItemInt(const QGlyphLayout &g, QFont *font, const QChar *chars_, int numChars, QFontEngine *fe) |
|
2672 : flags(0), justified(false), underlineStyle(QTextCharFormat::NoUnderline), |
|
2673 num_chars(numChars), chars(chars_), logClusters(0), f(font), glyphs(g), fontEngine(fe) |
|
2674 { |
|
2675 } |
|
2676 |
2651 QTextItemInt QTextItemInt::midItem(QFontEngine *fontEngine, int firstGlyphIndex, int numGlyphs) const |
2677 QTextItemInt QTextItemInt::midItem(QFontEngine *fontEngine, int firstGlyphIndex, int numGlyphs) const |
2652 { |
2678 { |
2653 QTextItemInt ti = *this; |
2679 QTextItemInt ti = *this; |
2654 const int end = firstGlyphIndex + numGlyphs; |
2680 const int end = firstGlyphIndex + numGlyphs; |
2655 ti.glyphs = glyphs.mid(firstGlyphIndex, numGlyphs); |
2681 ti.glyphs = glyphs.mid(firstGlyphIndex, numGlyphs); |