Ignore:
Timestamp:
Aug 2, 2010, 9:27:30 PM (15 years ago)
Author:
Dmitry A. Kuminov
Message:

trunk: Merged in qt 4.6.3 sources from branches/vendor/nokia/qt.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/src/3rdparty/harfbuzz/tests/shaping/main.cpp

    r561 r769  
    137137}
    138138
    139 void hb_getGlyphMetrics(HB_Font font, HB_Glyph glyph, HB_GlyphMetrics *metrics)
     139void hb_getGlyphMetrics(HB_Fontlyph, HB_GlyphMetrics *metrics)
    140140{
    141141    // ###
     
    143143}
    144144
    145 HB_Fixed hb_getFontMetric(HB_Font font, HB_FontMetric metric)
     145HB_Fixed hb_getFontMetric(HB_Font)
    146146{
    147147    return 0; // ####
     
    170170    void cleanupTestCase();
    171171private slots:
     172
     173
    172174    void devanagari();
    173175    void bengali();
     
    204206}
    205207
    206 struct ShapeTable {
    207     unsigned short unicode[16];
    208     unsigned short glyphs[16];
     208class Shaper
     209{
     210public:
     211    Shaper(FT_Face face, HB_Script script, const QString &str);
     212
     213    HB_FontRec hbFont;
     214    HB_ShaperItem shaper_item;
     215    QVarLengthArray<HB_Glyph> hb_glyphs;
     216    QVarLengthArray<HB_GlyphAttributes> hb_attributes;
     217    QVarLengthArray<HB_Fixed> hb_advances;
     218    QVarLengthArray<HB_FixedPoint> hb_offsets;
     219    QVarLengthArray<unsigned short> hb_logClusters;
     220
    209221};
    210222
    211 static bool shaping(FT_Face face, const ShapeTable *s, HB_Script script)
    212 {
    213     QString str = QString::fromUtf16( s->unicode );
    214 
     223Shaper::Shaper(FT_Face face, HB_Script script, const QString &str)
     224{
    215225    HB_Face hbFace = HB_NewFace(face, hb_getSFntTable);
    216226
    217     HB_FontRec hbFont;
    218227    hbFont.klass = &hb_fontClass;
    219228    hbFont.userData = face;
     
    223232    hbFont.y_scale = face->size->metrics.y_scale;
    224233
    225     HB_ShaperItem shaper_item;
    226234    shaper_item.kerning_applied = false;
    227235    shaper_item.string = reinterpret_cast<const HB_UChar16 *>(str.constData());
     
    238246    shaper_item.initialGlyphCount = 0;
    239247
    240     QVarLengthArray<HB_Glyph> hb_glyphs(shaper_item.num_glyphs);
    241     QVarLengthArray<HB_GlyphAttributes> hb_attributes(shaper_item.num_glyphs);
    242     QVarLengthArray<HB_Fixed> hb_advances(shaper_item.num_glyphs);
    243     QVarLengthArray<HB_FixedPoint> hb_offsets(shaper_item.num_glyphs);
    244     QVarLengthArray<unsigned short> hb_logClusters(shaper_item.num_glyphs);
    245248
    246249    while (1) {
     
    264267        if (HB_ShapeItem(&shaper_item))
    265268            break;
    266 
    267269    }
    268270
    269271    HB_FreeFace(hbFace);
     272
     273
     274
     275
     276
     277
     278
     279
     280
     281
     282
     283
     284
     285
     286
     287
     288
     289
     290
     291
     292
     293
     294
     295
     296
     297
     298
     299
     300
     301
     302
     303
     304
     305
     306
     307
     308
     309
     310
     311
     312
     313
     314
     315
     316
     317
     318
     319
     320
     321
     322
     323
     324
     325
     326
     327
     328
    270329
    271330    hb_uint32 nglyphs = 0;
     
    276335    }
    277336
    278     if( nglyphs != shaper_item.num_glyphs )
     337    if( nglyphs != shaper_item.num_glyphs )
    279338        goto error;
    280339
    281340    for (hb_uint32 i = 0; i < nglyphs; ++i) {
    282         if ((shaper_item.glyphs[i]&0xffffff) != s->glyphs[i])
     341shaper_item.glyphs[i]&0xffffff) != s->glyphs[i])
    283342            goto error;
    284343    }
    285344    return true;
    286345 error:
    287     str = "";
     346    str = "";
    288347    const unsigned short *uc = s->unicode;
    289348    while (*uc) {
     
    294353           face->family_name,
    295354           str.toLatin1().constData(),
    296            shaper_item.num_glyphs, nglyphs);
     355           shaper_item.num_glyphs, nglyphs);
    297356
    298357    str = "";
    299358    hb_uint32 i = 0;
    300     while (i < shaper_item.num_glyphs) {
    301         str += QString("%1 ").arg(shaper_item.glyphs[i], 4, 16);
     359    while (i < shaper_item.num_glyphs) {
     360shaper_item.glyphs[i], 4, 16);
    302361        ++i;
    303362    }
     
    305364    return false;
    306365}
     366
     367
     368
     369
     370
     371
     372
     373
     374
     375
     376
     377
     378
     379
     380
     381
     382
     383
     384
     385
     386
     387
     388
     389
     390
     391
     392
     393
     394
     395
     396
     397
     398
     399
     400
     401
     402
     403
     404
     405
     406
     407
     408
     409
     410
     411
     412
     413
     414
     415
     416
     417
     418
     419
     420
     421
     422
     423
     424
     425
    307426
    308427void tst_QScriptEngine::devanagari()
     
    10121131                { { 0xd2f, 0xd4d, 0xd15, 0xd4d, 0xd15, 0xd41, 0x0 },
    10131132                  { 0x2ff, 0x0 } },
     1133
     1134
    10141135
    10151136                { {0}, {0} }
Note: See TracChangeset for help on using the changeset viewer.