qscriptengine.cpp

来自「QT 开发环境里面一个很重要的文件」· C++ 代码 · 共 1,915 行 · 第 1/5 页

CPP
1,915
字号
            apply[i] |= IsolProperty|MediProperty|FinaProperty;    }    if (!openType->shape(item, apply.data())) {        *ot_ok = false;        return false;    }    return openType->positionAndAdd(item, nglyphs);}#endif#ifndef Q_WS_MAC// #### stil missing: identify invalid character combinationsstatic bool arabic_shape(QShaperItem *item){    Q_ASSERT(item->script == QUnicodeTables::Arabic);#ifndef QT_NO_OPENTYPE    QOpenType *openType = item->font->openType();    if (openType && openType->supportsScript(QUnicodeTables::Arabic)) {        bool ot_ok;        if (arabicSyriacOpenTypeShape(openType, item, &ot_ok))            return true;        if (ot_ok)            return false;            // fall through to the non OT code    }#endif    QVarLengthArray<ushort> shapedChars(item->length);    int slen;    shapedString(item->string, item->from, item->length, (QChar *)shapedChars.data(), &slen,                  item->flags & QTextEngine::RightToLeft,                  item->glyphs, item->log_clusters);    if (!item->font->stringToCMap((QChar *)shapedChars.data(), slen, item->glyphs, &item->num_glyphs, QFlag(item->flags)))        return false;    for (int i = 0; i < slen; ++i)        if (item->glyphs[i].attributes.mark)            item->glyphs[i].advance = QFixedPoint();    qt_heuristicPosition(item);    return true;}#endif// ------------------------------------------------------------------------------------------------------------------//// Continuation of middle eastern languages//// ------------------------------------------------------------------------------------------------------------------#if defined(Q_WS_X11) || defined(Q_WS_QWS)// #### stil missing: identify invalid character combinationsstatic bool syriac_shape(QShaperItem *item){    Q_ASSERT(item->script == QUnicodeTables::Syriac);#ifndef QT_NO_OPENTYPE    QOpenType *openType = item->font->openType();    if (openType && openType->supportsScript(QUnicodeTables::Syriac)) {        bool ot_ok;        if (arabicSyriacOpenTypeShape(openType, item, &ot_ok))            return true;        if (ot_ok)            return false;            // fall through to the non OT code    }#endif    return basic_shape(item);}static bool thaana_shape(QShaperItem *item){    Q_ASSERT(item->script == QUnicodeTables::Thaana);#ifndef QT_NO_OPENTYPE    QOpenType *openType = item->font->openType();    if (openType && openType->supportsScript(item->script)) {        openType->selectScript(item, QUnicodeTables::Thaana);        const int availableGlyphs = item->num_glyphs;        if (!item->font->stringToCMap(item->string->unicode()+item->from, item->length, item->glyphs, &item->num_glyphs, QFlag(item->flags)))            return false;        heuristicSetGlyphAttributes(item);        openType->shape(item);        return openType->positionAndAdd(item, availableGlyphs);    }#endif    return basic_shape(item);}#endif// --------------------------------------------------------------------------------------------------------------------------------------------//// Indic languages//// --------------------------------------------------------------------------------------------------------------------------------------------enum Form {    Invalid = 0x0,    UnknownForm = Invalid,    Consonant,    Nukta,    Halant,    Matra,    VowelMark,    StressMark,    IndependentVowel,    LengthMark,    Control,    Other};static const unsigned char indicForms[0xe00-0x900] = {    // Devangari    Invalid, VowelMark, VowelMark, VowelMark,    Invalid, IndependentVowel, IndependentVowel, IndependentVowel,    IndependentVowel, IndependentVowel, IndependentVowel, IndependentVowel,    IndependentVowel, IndependentVowel, IndependentVowel, IndependentVowel,    IndependentVowel, IndependentVowel, IndependentVowel, IndependentVowel,    IndependentVowel, Consonant, Consonant, Consonant,    Consonant, Consonant, Consonant, Consonant,    Consonant, Consonant, Consonant, Consonant,    Consonant, Consonant, Consonant, Consonant,    Consonant, Consonant, Consonant, Consonant,    Consonant, Consonant, Consonant, Consonant,    Consonant, Consonant, Consonant, Consonant,    Consonant, Consonant, Consonant, Consonant,    Consonant, Consonant, Consonant, Consonant,    Consonant, Consonant, UnknownForm, UnknownForm,    Nukta, Other, Matra, Matra,    Matra, Matra, Matra, Matra,    Matra, Matra, Matra, Matra,    Matra, Matra, Matra, Matra,    Matra, Halant, UnknownForm, UnknownForm,    Other, StressMark, StressMark, StressMark,    StressMark, UnknownForm, UnknownForm, UnknownForm,    Consonant, Consonant, Consonant, Consonant,    Consonant, Consonant, Consonant, Consonant,    IndependentVowel, IndependentVowel, VowelMark, VowelMark,    Other, Other, Other, Other,    Other, Other, Other, Other,    Other, Other, Other, Other,    Other, Other, Other, Other,    Other, Other, Other, Other,    Other, Other, Other, Other,    Other, Other, Other, Other,    // Bengali    Invalid, VowelMark, VowelMark, VowelMark,    Invalid, IndependentVowel, IndependentVowel, IndependentVowel,    IndependentVowel, IndependentVowel, IndependentVowel, IndependentVowel,    IndependentVowel, Invalid, Invalid, IndependentVowel,    IndependentVowel, Invalid, Invalid, IndependentVowel,    IndependentVowel, Consonant, Consonant, Consonant,    Consonant, Consonant, Consonant, Consonant,    Consonant, Consonant, Consonant, Consonant,    Consonant, Consonant, Consonant, Consonant,    Consonant, Consonant, Consonant, Consonant,    Consonant, Invalid, Consonant, Consonant,    Consonant, Consonant, Consonant, Consonant,    Consonant, Invalid, Consonant, Invalid,    Invalid, Invalid, Consonant, Consonant,    Consonant, Consonant, UnknownForm, UnknownForm,    Nukta, Other, Matra, Matra,    Matra, Matra, Matra, Matra,    Matra, Invalid, Invalid, Matra,    Matra, Invalid, Invalid, Matra,    Matra, Halant, Consonant, UnknownForm,    Invalid, Invalid, Invalid, Invalid,    Invalid, Invalid, Invalid, VowelMark,    Invalid, Invalid, Invalid, Invalid,    Consonant, Consonant, Invalid, Consonant,    IndependentVowel, IndependentVowel, VowelMark, VowelMark,    Other, Other, Other, Other,    Other, Other, Other, Other,    Other, Other, Other, Other,    Consonant, Consonant, Other, Other,    Other, Other, Other, Other,    Other, Other, Other, Other,    Other, Other, Other, Other,    // Gurmukhi    Invalid, Invalid, VowelMark, Invalid,    Invalid, IndependentVowel, IndependentVowel, IndependentVowel,    IndependentVowel, IndependentVowel, IndependentVowel, Invalid,    Invalid, Invalid, Invalid, IndependentVowel,    IndependentVowel, Invalid, Invalid, IndependentVowel,    IndependentVowel, Consonant, Consonant, Consonant,    Consonant, Consonant, Consonant, Consonant,    Consonant, Consonant, Consonant, Consonant,    Consonant, Consonant, Consonant, Consonant,    Consonant, Consonant, Consonant, Consonant,    Consonant, Invalid, Consonant, Consonant,    Consonant, Consonant, Consonant, Consonant,    Consonant, Invalid, Consonant, Consonant,    Invalid, Consonant, Consonant, Invalid,    Consonant, Consonant, UnknownForm, UnknownForm,    Nukta, Other, Matra, Matra,    Matra, Matra, Matra, Invalid,    Invalid, Invalid, Invalid, Matra,    Matra, Invalid, Invalid, Matra,    Matra, Halant, UnknownForm, UnknownForm,    Invalid, Invalid, Invalid, Invalid,    Invalid, UnknownForm, UnknownForm, UnknownForm,    Invalid, Consonant, Consonant, Consonant,    Consonant, Invalid, Consonant, Invalid,    Other, Other, Invalid, Invalid,    Other, Other, Other, Other,    Other, Other, Other, Other,    Other, Other, Other, Other,    StressMark, StressMark, Other, Other,    Other, Other, Other, Other,    Other, Other, Other, Other,    Other, Other, Other, Other,    // Gujarati    Invalid, VowelMark, VowelMark, VowelMark,    Invalid, IndependentVowel, IndependentVowel, IndependentVowel,    IndependentVowel, IndependentVowel, IndependentVowel, IndependentVowel,    Invalid, IndependentVowel, Invalid, IndependentVowel,    IndependentVowel, IndependentVowel, Invalid, IndependentVowel,    IndependentVowel, Consonant, Consonant, Consonant,    Consonant, Consonant, Consonant, Consonant,    Consonant, Consonant, Consonant, Consonant,    Consonant, Consonant, Consonant, Consonant,    Consonant, Consonant, Consonant, Consonant,    Consonant, Invalid, Consonant, Consonant,    Consonant, Consonant, Consonant, Consonant,    Consonant, Invalid, Consonant, Consonant,    Invalid, Consonant, Consonant, Consonant,    Consonant, Consonant, UnknownForm, UnknownForm,    Nukta, Other, Matra, Matra,    Matra, Matra, Matra, Matra,    Matra, Matra, Invalid, Matra,    Matra, Matra, Invalid, Matra,    Matra, Halant, UnknownForm, UnknownForm,    Other, UnknownForm, UnknownForm, UnknownForm,    UnknownForm, UnknownForm, UnknownForm, UnknownForm,    UnknownForm, UnknownForm, UnknownForm, UnknownForm,    UnknownForm, UnknownForm, UnknownForm, UnknownForm,    Other, Other, Other, Other,    Other, Other, Other, Other,    Other, Other, Other, Other,    Other, Other, Other, Other,    Other, Other, Other, Other,    Other, Other, Other, Other,    Other, Other, Other, Other,    Other, Other, Other, Other,    // Oriya    Invalid, VowelMark, VowelMark, VowelMark,    Invalid, IndependentVowel, IndependentVowel, IndependentVowel,    IndependentVowel, IndependentVowel, IndependentVowel, IndependentVowel,    IndependentVowel, Invalid, Invalid, IndependentVowel,    IndependentVowel, Invalid, Invalid, IndependentVowel,    IndependentVowel, Consonant, Consonant, Consonant,    Consonant, Consonant, Consonant, Consonant,    Consonant, Consonant, Consonant, Consonant,    Consonant, Consonant, Consonant, Consonant,    Consonant, Consonant, Consonant, Consonant,    Consonant, Invalid, Consonant, Consonant,    Consonant, Consonant, Consonant, Consonant,    Consonant, Invalid, Consonant, Consonant,    Invalid, Invalid, Consonant, Consonant,    Consonant, Consonant, UnknownForm, UnknownForm,    Nukta, Other, Matra, Matra,    Matra, Matra, Matra, Matra,    Invalid, Invalid, Invalid, Matra,    Matra, Invalid, Invalid, Matra,    Matra, Halant, UnknownForm, UnknownForm,    Other, Invalid, Invalid, Invalid,    Invalid, UnknownForm, LengthMark, LengthMark,    Invalid, Invalid, Invalid, Invalid,    Consonant, Consonant, Invalid, Consonant,    IndependentVowel, IndependentVowel, Invalid, Invalid,    Invalid, Invalid, Other, Other,    Other, Other, Other, Other,    Other, Other, Other, Other,    Other, Other, Other, Other,    Other, Other, Other, Other,    Other, Other, Other, Other,    Other, Other, Other, Other,    //Tamil    Invalid, Invalid, VowelMark, Other,    Invalid, IndependentVowel, IndependentVowel, IndependentVowel,    IndependentVowel, IndependentVowel, IndependentVowel, Invalid,    Invalid, Invalid, IndependentVowel, IndependentVowel,    IndependentVowel, Invalid, IndependentVowel, IndependentVowel,    IndependentVowel, Consonant, Invalid, Invalid,    Invalid, Consonant, Consonant, Invalid,    Consonant, Invalid, Consonant, Consonant,    Invalid, Invalid, Invalid, Consonant,    Consonant, Invalid, Invalid, Invalid,    Consonant, Consonant, Consonant, Invalid,    Invalid, Invalid, Consonant, Consonant,    Consonant, Consonant, Consonant, Consonant,    Consonant, Consonant, Invalid, Consonant,    Consonant, Consonant, UnknownForm, UnknownForm,    Invalid, Invalid, Matra, Matra,    Matra, Matra, Matra, Invalid,    Invalid, Invalid, Matra, Matra,    Matra, Invalid, Matra, Matra,    Matra, Halant, Invalid, Invalid,    Invalid, Invalid, Invalid, Invalid,    Invalid, Invalid, Invalid, LengthMark,    Invalid, Invalid, Invalid, Invalid,    Invalid, Invalid, Invalid, Invalid,    Invalid, Invalid, Invalid, Invalid,    Invalid, Invalid, Other, Other,    Other, Other, Other, Other,    Other, Other, Other, Other,    Other, Other, Other, Other,    Other, Other, Other, Other,    Other, Other, Other, Other,    Other, Other, Other, Other,    // Telugu    Invalid, VowelMark, VowelMark, VowelMark,    Invalid, IndependentVowel, IndependentVowel, IndependentVowel,    IndependentVowel, IndependentVowel, IndependentVowel, IndependentVowel,    IndependentVowel, Invalid, IndependentVowel, IndependentVowel,    IndependentVowel, Invalid, IndependentVowel, IndependentVowel,    IndependentVowel, Consonant, Consonant, Consonant,    Consonant, Consonant, Consonant, Consonant,    Consonant, Consonant, Consonant, Consonant,    Consonant, Consonant, Consonant, Consonant,    Consonant, Consonant, Consonant, Consonant,    Consonant, Invalid, Consonant, Consonant,    Consonant, Consonant, Consonant, Consonant,    Consonant, Consonant, Consonant, Consonant,   

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?