555 { |
555 { |
556 QScriptItem &si = layoutData->items[item]; |
556 QScriptItem &si = layoutData->items[item]; |
557 |
557 |
558 si.glyph_data_offset = layoutData->used; |
558 si.glyph_data_offset = layoutData->used; |
559 |
559 |
560 QFontEngine *font = fontEngine(si, &si.ascent, &si.descent); |
560 QFontEngine *font = fontEngine(si, &si.ascent, &si.descent, &si.leading); |
561 if (font->type() != QFontEngine::Multi) { |
561 if (font->type() != QFontEngine::Multi) { |
562 shapeTextWithHarfbuzz(item); |
562 shapeTextWithHarfbuzz(item); |
563 return; |
563 return; |
564 } |
564 } |
565 |
565 |
592 uc[i] = str[i].toUpper().unicode(); |
592 uc[i] = str[i].toUpper().unicode(); |
593 } |
593 } |
594 str = reinterpret_cast<const QChar *>(uc); |
594 str = reinterpret_cast<const QChar *>(uc); |
595 } |
595 } |
596 |
596 |
597 while (true) { |
597 ensureSpace(num_glyphs); |
|
598 num_glyphs = layoutData->glyphLayout.numGlyphs - layoutData->used; |
|
599 |
|
600 QGlyphLayout g = availableGlyphs(&si); |
|
601 g.numGlyphs = num_glyphs; |
|
602 unsigned short *log_clusters = logClusters(&si); |
|
603 |
|
604 bool stringToCMapFailed = false; |
|
605 if (!fe->stringToCMap(str, len, &g, &num_glyphs, flags, log_clusters, attributes())) { |
598 ensureSpace(num_glyphs); |
606 ensureSpace(num_glyphs); |
599 num_glyphs = layoutData->glyphLayout.numGlyphs - layoutData->used; |
607 stringToCMapFailed = fe->stringToCMap(str, len, &g, &num_glyphs, flags, log_clusters, |
600 |
608 attributes()); |
601 QGlyphLayout g = availableGlyphs(&si); |
|
602 g.numGlyphs = num_glyphs; |
|
603 unsigned short *log_clusters = logClusters(&si); |
|
604 |
|
605 if (fe->stringToCMap(str, |
|
606 len, |
|
607 &g, |
|
608 &num_glyphs, |
|
609 flags, |
|
610 log_clusters, |
|
611 attributes())) { |
|
612 |
|
613 heuristicSetGlyphAttributes(str, len, &g, log_clusters, num_glyphs); |
|
614 break; |
|
615 } |
|
616 } |
609 } |
617 |
610 |
618 si.num_glyphs = num_glyphs; |
611 if (!stringToCMapFailed) { |
619 |
612 heuristicSetGlyphAttributes(str, len, &g, log_clusters, num_glyphs); |
620 layoutData->used += si.num_glyphs; |
613 |
621 |
614 si.num_glyphs = num_glyphs; |
622 QGlyphLayout g = shapedGlyphs(&si); |
615 |
623 |
616 layoutData->used += si.num_glyphs; |
624 if (si.analysis.script == QUnicodeTables::Arabic) { |
617 |
625 QVarLengthArray<QArabicProperties> props(len + 2); |
618 QGlyphLayout g = shapedGlyphs(&si); |
626 QArabicProperties *properties = props.data(); |
619 |
627 int f = si.position; |
620 if (si.analysis.script == QUnicodeTables::Arabic) { |
628 int l = len; |
621 QVarLengthArray<QArabicProperties> props(len + 2); |
629 if (f > 0) { |
622 QArabicProperties *properties = props.data(); |
630 --f; |
623 int f = si.position; |
631 ++l; |
624 int l = len; |
632 ++properties; |
625 if (f > 0) { |
633 } |
626 --f; |
634 if (f + l < layoutData->string.length()) { |
627 ++l; |
635 ++l; |
628 ++properties; |
636 } |
629 } |
637 qt_getArabicProperties((const unsigned short *)(layoutData->string.unicode()+f), l, props.data()); |
630 if (f + l < layoutData->string.length()) { |
638 |
631 ++l; |
639 unsigned short *log_clusters = logClusters(&si); |
632 } |
640 |
633 qt_getArabicProperties((const unsigned short *)(layoutData->string.unicode()+f), l, props.data()); |
641 for (int i = 0; i < len; ++i) { |
634 |
642 int gpos = log_clusters[i]; |
635 unsigned short *log_clusters = logClusters(&si); |
643 g.attributes[gpos].justification = properties[i].justification; |
636 |
|
637 for (int i = 0; i < len; ++i) { |
|
638 int gpos = log_clusters[i]; |
|
639 g.attributes[gpos].justification = properties[i].justification; |
|
640 } |
644 } |
641 } |
645 } |
642 } |
646 |
643 |
647 const ushort *uc = reinterpret_cast<const ushort *>(str); |
644 const ushort *uc = reinterpret_cast<const ushort *>(str); |
648 |
645 |