Ignore:
Timestamp:
Feb 11, 2010, 11:19:06 PM (15 years ago)
Author:
Dmitry A. Kuminov
Message:

trunk: Merged in qt 4.6.1 sources.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/src/gui/text/qtextengine_mac.cpp

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the QtGui module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    5151    // ### zeroWidth and justification are missing here!!!!!
    5252
    53     Q_ASSERT(num_glyphs <= length);
    5453    Q_UNUSED(num_glyphs);
    5554
     
    559558    si.glyph_data_offset = layoutData->used;
    560559
    561     QFontEngine *font = fontEngine(si, &si.ascent, &si.descent);
     560    QFontEngine *font = fontEngine(si, &si.ascent, &si.descent, &si.leading);
    562561    if (font->type() != QFontEngine::Multi) {
    563562        shapeTextWithHarfbuzz(item);
     
    596595    }
    597596
    598     while (true) {
    599         ensureSpace(num_glyphs);
    600         num_glyphs = layoutData->glyphLayout.numGlyphs - layoutData->used;
    601 
    602         QGlyphLayout g = availableGlyphs(&si);
    603         g.numGlyphs = num_glyphs;
    604         unsigned short *log_clusters = logClusters(&si);
    605 
    606         if (fe->stringToCMap(str,
    607                              len,
    608                              &g,
    609                              &num_glyphs,
    610                              flags,
    611                              log_clusters,
    612                              attributes())) {
    613 
    614                 heuristicSetGlyphAttributes(str, len, &g, log_clusters, num_glyphs);
    615                 break;
    616         }
     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())) {
     606        ensureSpace(num_glyphs);
     607        stringToCMapFailed = fe->stringToCMap(str, len, &g, &num_glyphs, flags, log_clusters,
     608                                              attributes());
    617609    }
    618610
    619     si.num_glyphs = num_glyphs;
    620 
    621     layoutData->used += si.num_glyphs;
    622 
    623     QGlyphLayout g = shapedGlyphs(&si);
    624 
    625     if (si.analysis.script == QUnicodeTables::Arabic) {
    626         QVarLengthArray<QArabicProperties> props(len + 2);
    627         QArabicProperties *properties = props.data();
    628         int f = si.position;
    629         int l = len;
    630         if (f > 0) {
    631             --f;
    632             ++l;
    633             ++properties;
    634         }
    635         if (f + l < layoutData->string.length()) {
    636             ++l;
    637         }
    638         qt_getArabicProperties((const unsigned short *)(layoutData->string.unicode()+f), l, props.data());
    639 
    640         unsigned short *log_clusters = logClusters(&si);
    641 
    642         for (int i = 0; i < len; ++i) {
    643             int gpos = log_clusters[i];
    644             g.attributes[gpos].justification = properties[i].justification;
     611    if (!stringToCMapFailed) {
     612        heuristicSetGlyphAttributes(str, len, &g, log_clusters, num_glyphs);
     613
     614        si.num_glyphs = num_glyphs;
     615
     616        layoutData->used += si.num_glyphs;
     617
     618        QGlyphLayout g = shapedGlyphs(&si);
     619
     620        if (si.analysis.script == QUnicodeTables::Arabic) {
     621            QVarLengthArray<QArabicProperties> props(len + 2);
     622            QArabicProperties *properties = props.data();
     623            int f = si.position;
     624            int l = len;
     625            if (f > 0) {
     626                --f;
     627                ++l;
     628                ++properties;
     629            }
     630            if (f + l < layoutData->string.length()) {
     631                ++l;
     632            }
     633            qt_getArabicProperties((const unsigned short *)(layoutData->string.unicode()+f), l, props.data());
     634
     635            unsigned short *log_clusters = logClusters(&si);
     636
     637            for (int i = 0; i < len; ++i) {
     638                int gpos = log_clusters[i];
     639                g.attributes[gpos].justification = properties[i].justification;
     640            }
    645641        }
    646642    }
Note: See TracChangeset for help on using the changeset viewer.