Пример #1
0
void tst_QScriptEngine::greek()
{
    FT_Face face = loadFace("DejaVuSans.ttf");
    if (face) {
        for (int uc = 0x1f00; uc <= 0x1fff; ++uc) {
            QString str;
            str.append(uc);
            if (str.normalized(QString::NormalizationForm_D).normalized(QString::NormalizationForm_C) != str) {
                //qDebug() << "skipping" << hex << uc;
                continue;
            }
            if (uc == 0x1fc1 || uc == 0x1fed)
                continue;
            QVERIFY( decomposedShaping(face, HB_Script_Greek, QChar(uc)) );
        }
        FT_Done_Face(face);
    } else {
        QSKIP("couln't find DejaVu Sans");
    }


    face = loadFace("SBL_grk.ttf");
    if (face) {
        for (int uc = 0x1f00; uc <= 0x1fff; ++uc) {
            QString str;
            str.append(uc);
            if (str.normalized(QString::NormalizationForm_D).normalized(QString::NormalizationForm_C) != str) {
                //qDebug() << "skipping" << hex << uc;
                continue;
            }
            if (uc == 0x1fc1 || uc == 0x1fed)
                continue;
            QVERIFY( decomposedShaping(face, HB_Script_Greek, QChar(uc)) );

        }

        const ShapeTable shape_table [] = {
            { { 0x3b1, 0x300, 0x313, 0x0 },
              { 0xb8, 0x3d3, 0x3c7, 0x0 } },
            { { 0x3b1, 0x313, 0x300, 0x0 },
              { 0xd4, 0x0 } },

            { {0}, {0} }
        };


        const ShapeTable *s = shape_table;
        while (s->unicode[0]) {
            QVERIFY( shaping(face, s, HB_Script_Greek) );
            ++s;
        }

        FT_Done_Face(face);
    } else {
        QSKIP("couln't find DejaVu Sans");
    }
}
Пример #2
0
void tst_QTextScriptEngine::greek()
{
#if defined(Q_WS_X11)
    {
        if (QFontDatabase().families(QFontDatabase::Any).contains("DejaVu Sans")) {
            QFont f("DejaVu Sans");
            for (int uc = 0x1f00; uc <= 0x1fff; ++uc) {
                QString str;
                str.append(uc);
                if (str.normalized(QString::NormalizationForm_D).normalized(QString::NormalizationForm_C) != str) {
                    //qDebug() << "skipping" << hex << uc;
                    continue;
                }
                if (uc == 0x1fc1 || uc == 0x1fed)
                    continue;
                QVERIFY( decomposedShaping(f, QChar(uc)) );
            }
        } else {
            QSKIP("couln't find DejaVu Sans", SkipAll);
        }
    }

    {
        if (QFontDatabase().families(QFontDatabase::Any).contains("SBL Greek")) {
            QFont f("SBL Greek");
            for (int uc = 0x1f00; uc <= 0x1fff; ++uc) {
                QString str;
                str.append(uc);
                if (str.normalized(QString::NormalizationForm_D).normalized(QString::NormalizationForm_C) != str) {
                    //qDebug() << "skipping" << hex << uc;
                    continue;
                }
                if (uc == 0x1fc1 || uc == 0x1fed)
                    continue;
                QVERIFY( decomposedShaping(f, QChar(uc) ) );

            }

            const ShapeTable shape_table [] = {
                { { 0x3b1, 0x300, 0x313, 0x0 },
                  { 0xb8, 0x3d3, 0x3c7, 0x0 } },
                { { 0x3b1, 0x313, 0x300, 0x0 },
                  { 0xd4, 0x0 } },

                { {0}, {0} }
            };


            const ShapeTable *s = shape_table;
            while (s->unicode[0]) {
                QVERIFY( shaping(f, s) );
                ++s;
            }
        } else {
            QSKIP("couln't find SBL_grk", SkipAll);
        }
    }
#else
    QSKIP("X11 specific test", SkipAll);
#endif
}