< prev index next >

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

Print this page




 651    * Happens in Sinhala. */
 652   for (unsigned int i = base + 1; i < end; i++)
 653     if (info[i].indic_category() == OT_M) {
 654       for (unsigned int j = i + 1; j < end; j++)
 655         if (is_consonant (info[j])) {
 656          info[j].indic_position() = POS_FINAL_C;
 657          break;
 658        }
 659       break;
 660     }
 661 
 662   /* Handle beginning Ra */
 663   if (has_reph)
 664     info[start].indic_position() = POS_RA_TO_BECOME_REPH;
 665 
 666   /* For old-style Indic script tags, move the first post-base Halant after
 667    * last consonant.
 668    *
 669    * Reports suggest that in some scripts Uniscribe does this only if there
 670    * is *not* a Halant after last consonant already (eg. Kannada), while it
 671    * does it unconditionally in other scripts (eg. Malayalam).  We don't
 672    * currently know about other scripts, so we single out Malayalam for now.

 673    *
 674    * Kannada test case:
 675    * U+0C9A,U+0CCD,U+0C9A,U+0CCD
 676    * With some versions of Lohit Kannada.
 677    * https://bugs.freedesktop.org/show_bug.cgi?id=59118
 678    *
 679    * Malayalam test case:
 680    * U+0D38,U+0D4D,U+0D31,U+0D4D,U+0D31,U+0D4D
 681    * With lohit-ttf-20121122/Lohit-Malayalam.ttf





 682    */
 683   if (indic_plan->is_old_spec)
 684   {
 685     bool disallow_double_halants = buffer->props.script != HB_SCRIPT_MALAYALAM;

 686     for (unsigned int i = base + 1; i < end; i++)
 687       if (info[i].indic_category() == OT_H)
 688       {
 689         unsigned int j;
 690         for (j = end - 1; j > i; j--)
 691           if (is_consonant (info[j]) ||
 692               (disallow_double_halants && info[j].indic_category() == OT_H))
 693             break;
 694         if (info[j].indic_category() != OT_H && j > i) {
 695           /* Move Halant to after last consonant. */
 696           hb_glyph_info_t t = info[i];
 697           memmove (&info[i], &info[i + 1], (j - i) * sizeof (info[0]));
 698           info[j] = t;
 699         }
 700         break;
 701       }
 702   }
 703 
 704   /* Attach misc marks to previous char to move with them. */
 705   {




 651    * Happens in Sinhala. */
 652   for (unsigned int i = base + 1; i < end; i++)
 653     if (info[i].indic_category() == OT_M) {
 654       for (unsigned int j = i + 1; j < end; j++)
 655         if (is_consonant (info[j])) {
 656          info[j].indic_position() = POS_FINAL_C;
 657          break;
 658        }
 659       break;
 660     }
 661 
 662   /* Handle beginning Ra */
 663   if (has_reph)
 664     info[start].indic_position() = POS_RA_TO_BECOME_REPH;
 665 
 666   /* For old-style Indic script tags, move the first post-base Halant after
 667    * last consonant.
 668    *
 669    * Reports suggest that in some scripts Uniscribe does this only if there
 670    * is *not* a Halant after last consonant already (eg. Kannada), while it
 671    * does it unconditionally in other scripts (eg. Malayalam, Bengali).  We
 672    * don't currently know about other scripts, so we whitelist Malayalam and
 673    * Bengali for now.
 674    *
 675    * Kannada test case:
 676    * U+0C9A,U+0CCD,U+0C9A,U+0CCD
 677    * With some versions of Lohit Kannada.
 678    * https://bugs.freedesktop.org/show_bug.cgi?id=59118
 679    *
 680    * Malayalam test case:
 681    * U+0D38,U+0D4D,U+0D31,U+0D4D,U+0D31,U+0D4D
 682    * With lohit-ttf-20121122/Lohit-Malayalam.ttf
 683    *
 684    * Bengali test case
 685    * U+0998,U+09CD,U+09AF,U+09CD
 686    * With Windows XP vrinda.ttf
 687    * https://github.com/harfbuzz/harfbuzz/issues/1073
 688    */
 689   if (indic_plan->is_old_spec)
 690   {
 691     bool disallow_double_halants = buffer->props.script != HB_SCRIPT_MALAYALAM &&
 692                                    buffer->props.script != HB_SCRIPT_BENGALI;
 693     for (unsigned int i = base + 1; i < end; i++)
 694       if (info[i].indic_category() == OT_H)
 695       {
 696         unsigned int j;
 697         for (j = end - 1; j > i; j--)
 698           if (is_consonant (info[j]) ||
 699               (disallow_double_halants && info[j].indic_category() == OT_H))
 700             break;
 701         if (info[j].indic_category() != OT_H && j > i) {
 702           /* Move Halant to after last consonant. */
 703           hb_glyph_info_t t = info[i];
 704           memmove (&info[i], &info[i + 1], (j - i) * sizeof (info[0]));
 705           info[j] = t;
 706         }
 707         break;
 708       }
 709   }
 710 
 711   /* Attach misc marks to previous char to move with them. */
 712   {


< prev index next >