OLD | NEW |
1 /* | 1 /* |
2 * Copyright © 2011,2012 Google, Inc. | 2 * Copyright © 2011,2012 Google, Inc. |
3 * | 3 * |
4 * This is part of HarfBuzz, a text shaping library. | 4 * This is part of HarfBuzz, a text shaping library. |
5 * | 5 * |
6 * Permission is hereby granted, without written agreement and without | 6 * Permission is hereby granted, without written agreement and without |
7 * license or royalty fees, to use, copy, modify, and distribute this | 7 * license or royalty fees, to use, copy, modify, and distribute this |
8 * software and its documentation for any purpose, provided that the | 8 * software and its documentation for any purpose, provided that the |
9 * above copyright notice and the following two paragraphs appear in | 9 * above copyright notice and the following two paragraphs appear in |
10 * all copies of this software. | 10 * all copies of this software. |
(...skipping 903 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
914 break; | 914 break; |
915 } | 915 } |
916 break; | 916 break; |
917 } | 917 } |
918 | 918 |
919 /* Handle beginning Ra */ | 919 /* Handle beginning Ra */ |
920 if (has_reph) | 920 if (has_reph) |
921 info[start].indic_position() = POS_RA_TO_BECOME_REPH; | 921 info[start].indic_position() = POS_RA_TO_BECOME_REPH; |
922 | 922 |
923 /* For old-style Indic script tags, move the first post-base Halant after | 923 /* For old-style Indic script tags, move the first post-base Halant after |
924 * last consonant. Only do this if there is *not* a Halant after last | 924 * last consonant. |
925 * consonant. Otherwise it becomes messy. */ | 925 * |
926 if (indic_plan->is_old_spec) { | 926 * Reports suggest that in some scripts Uniscribe does this only if there |
| 927 * is *not* a Halant after last consonant already (eg. Kannada), while it |
| 928 * does it unconditionally in other scripts (eg. Malayalam). We don't |
| 929 * currently know about other scripts, so we single out Malayalam for now. |
| 930 * |
| 931 * Kannada test case: |
| 932 * U+0C9A,U+0CCD,U+0C9A,U+0CCD |
| 933 * With some versions of Lohit Kannada. |
| 934 * https://bugs.freedesktop.org/show_bug.cgi?id=59118 |
| 935 * |
| 936 * Malayalam test case: |
| 937 * U+0D38,U+0D4D,U+0D31,U+0D4D,U+0D31,U+0D4D |
| 938 * With lohit-ttf-20121122/Lohit-Malayalam.ttf |
| 939 */ |
| 940 if (indic_plan->is_old_spec) |
| 941 { |
| 942 bool disallow_double_halants = buffer->props.script != HB_SCRIPT_MALAYALAM; |
927 for (unsigned int i = base + 1; i < end; i++) | 943 for (unsigned int i = base + 1; i < end; i++) |
928 if (info[i].indic_category() == OT_H) { | 944 if (info[i].indic_category() == OT_H) |
| 945 { |
929 unsigned int j; | 946 unsigned int j; |
930 for (j = end - 1; j > i; j--) | 947 for (j = end - 1; j > i; j--) |
931 » if (is_consonant (info[j]) || info[j].indic_category() == OT_H) | 948 » if (is_consonant (info[j]) || |
| 949 » (disallow_double_halants && info[j].indic_category() == OT_H)) |
932 break; | 950 break; |
933 if (info[j].indic_category() != OT_H && j > i) { | 951 if (info[j].indic_category() != OT_H && j > i) { |
934 /* Move Halant to after last consonant. */ | 952 /* Move Halant to after last consonant. */ |
935 hb_glyph_info_t t = info[i]; | 953 hb_glyph_info_t t = info[i]; |
936 memmove (&info[i], &info[i + 1], (j - i) * sizeof (info[0])); | 954 memmove (&info[i], &info[i + 1], (j - i) * sizeof (info[0])); |
937 info[j] = t; | 955 info[j] = t; |
938 } | 956 } |
939 break; | 957 break; |
940 } | 958 } |
941 } | 959 } |
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1260 unsigned int syllable = buffer->cur().syllable(); | 1278 unsigned int syllable = buffer->cur().syllable(); |
1261 syllable_type_t syllable_type = (syllable_type_t) (syllable & 0x0F); | 1279 syllable_type_t syllable_type = (syllable_type_t) (syllable & 0x0F); |
1262 if (unlikely (last_syllable != syllable && syllable_type == broken_cluster)) | 1280 if (unlikely (last_syllable != syllable && syllable_type == broken_cluster)) |
1263 { | 1281 { |
1264 last_syllable = syllable; | 1282 last_syllable = syllable; |
1265 | 1283 |
1266 hb_glyph_info_t info = dottedcircle; | 1284 hb_glyph_info_t info = dottedcircle; |
1267 info.cluster = buffer->cur().cluster; | 1285 info.cluster = buffer->cur().cluster; |
1268 info.mask = buffer->cur().mask; | 1286 info.mask = buffer->cur().mask; |
1269 info.syllable() = buffer->cur().syllable(); | 1287 info.syllable() = buffer->cur().syllable(); |
| 1288 /* TODO Set glyph_props? */ |
1270 | 1289 |
1271 /* Insert dottedcircle after possible Repha. */ | 1290 /* Insert dottedcircle after possible Repha. */ |
1272 while (buffer->idx < buffer->len && | 1291 while (buffer->idx < buffer->len && |
1273 last_syllable == buffer->cur().syllable() && | 1292 last_syllable == buffer->cur().syllable() && |
1274 buffer->cur().indic_category() == OT_Repha) | 1293 buffer->cur().indic_category() == OT_Repha) |
1275 buffer->next_glyph (); | 1294 buffer->next_glyph (); |
1276 | 1295 |
1277 buffer->output_info (info); | 1296 buffer->output_info (info); |
1278 } | 1297 } |
1279 else | 1298 else |
(...skipping 576 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1856 data_create_indic, | 1875 data_create_indic, |
1857 data_destroy_indic, | 1876 data_destroy_indic, |
1858 NULL, /* preprocess_text */ | 1877 NULL, /* preprocess_text */ |
1859 HB_OT_SHAPE_NORMALIZATION_MODE_COMPOSED_DIACRITICS_NO_SHORT_CIRCUIT, | 1878 HB_OT_SHAPE_NORMALIZATION_MODE_COMPOSED_DIACRITICS_NO_SHORT_CIRCUIT, |
1860 decompose_indic, | 1879 decompose_indic, |
1861 compose_indic, | 1880 compose_indic, |
1862 setup_masks_indic, | 1881 setup_masks_indic, |
1863 HB_OT_SHAPE_ZERO_WIDTH_MARKS_NONE, | 1882 HB_OT_SHAPE_ZERO_WIDTH_MARKS_NONE, |
1864 false, /* fallback_position */ | 1883 false, /* fallback_position */ |
1865 }; | 1884 }; |
OLD | NEW |