< prev index next >

src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape-complex-khmer.cc

Print this page




 355         last = i;
 356   }
 357 
 358   {
 359     /* Use syllable() for sort accounting temporarily. */
 360     unsigned int syllable = info[start].syllable();
 361     for (unsigned int i = start; i < end; i++)
 362       info[i].syllable() = i - start;
 363 
 364     /* Sit tight, rock 'n roll! */
 365     hb_stable_sort (info + start, end - start, compare_khmer_order);
 366     /* Find base again */
 367     base = end;
 368     for (unsigned int i = start; i < end; i++)
 369       if (info[i].khmer_position() == POS_BASE_C)
 370       {
 371         base = i;
 372         break;
 373       }
 374 



 375     /* Note!  syllable() is a one-byte field. */
 376     for (unsigned int i = base; i < end; i++)
 377       if (info[i].syllable() != 255)
 378       {
 379         unsigned int max = i;
 380         unsigned int j = start + info[i].syllable();
 381         while (j != i)
 382         {
 383           max = MAX (max, j);
 384           unsigned int next = start + info[j].syllable();
 385           info[j].syllable() = 255; /* So we don't process j later again. */
 386           j = next;
 387         }
 388         if (i != max)
 389           buffer->merge_clusters (i, max + 1);
 390       }
 391 
 392     /* Put syllable back in. */
 393     for (unsigned int i = start; i < end; i++)
 394       info[i].syllable() = syllable;




 355         last = i;
 356   }
 357 
 358   {
 359     /* Use syllable() for sort accounting temporarily. */
 360     unsigned int syllable = info[start].syllable();
 361     for (unsigned int i = start; i < end; i++)
 362       info[i].syllable() = i - start;
 363 
 364     /* Sit tight, rock 'n roll! */
 365     hb_stable_sort (info + start, end - start, compare_khmer_order);
 366     /* Find base again */
 367     base = end;
 368     for (unsigned int i = start; i < end; i++)
 369       if (info[i].khmer_position() == POS_BASE_C)
 370       {
 371         base = i;
 372         break;
 373       }
 374 
 375     if (unlikely (end - start >= 127))
 376       buffer->merge_clusters (start, end);
 377     else
 378       /* Note!  syllable() is a one-byte field. */
 379       for (unsigned int i = base; i < end; i++)
 380         if (info[i].syllable() != 255)
 381         {
 382           unsigned int max = i;
 383           unsigned int j = start + info[i].syllable();
 384           while (j != i)
 385           {
 386             max = MAX (max, j);
 387             unsigned int next = start + info[j].syllable();
 388             info[j].syllable() = 255; /* So we don't process j later again. */
 389             j = next;
 390           }
 391           if (i != max)
 392             buffer->merge_clusters (i, max + 1);
 393         }
 394 
 395     /* Put syllable back in. */
 396     for (unsigned int i = start; i < end; i++)
 397       info[i].syllable() = syllable;


< prev index next >