[Indic] Add Uniscribe bug feature for dotted circle

For dotted-circle independent clusters, Uniscribe does no Reph shaping
for the exact sequence Ra+Halant+25CC.  Which also is the only possible
sequence with 25CC at the end.
This commit is contained in:
Behdad Esfahbod 2012-05-11 20:02:14 +02:00
parent 5b16de97bc
commit 18c06e189b
3 changed files with 21 additions and 6 deletions

View File

@ -53,17 +53,19 @@ SM = 9;
VD = 10;
A = 11;
NBSP = 12;
DOTTEDCIRCLE = 13;
c = C | Ra;
n = N N?;
z = ZWJ|ZWNJ;
matra_group = M N? H?;
syllable_tail = SM? (VD VD?)?;
place_holder = NBSP | DOTTEDCIRCLE;
consonant_syllable = (c.n? (H.z?|z.H))* c.n? A? (H.z? | matra_group*)? syllable_tail;
vowel_syllable = (Ra H)? V n? (z?.H.c | ZWJ.c)* matra_group* syllable_tail;
standalone_cluster = (Ra H)? NBSP n? (z? H c)* matra_group* syllable_tail;
standalone_cluster = (Ra H)? place_holder n? (z? H c)* matra_group* syllable_tail;
other = any;
main := |*

View File

@ -57,7 +57,8 @@ enum indic_category_t {
OT_SM,
OT_VD,
OT_A,
OT_NBSP
OT_NBSP,
OT_DOTTEDCIRCLE /* Not in the spec, but special in Uniscribe. /Very very/ special! */
};
/* Visual positions in a syllable from left to right. */

View File

@ -79,10 +79,10 @@ is_consonant (const hb_glyph_info_t &info)
{
/* Note:
*
* We treat Vowels and NBSP as if they were consonants. This is safe because Vowels
* We treat Vowels and placeholders as if they were consonants. This is safe because Vowels
* cannot happen in a consonant syllable. The plus side however is, we can call the
* consonant syllable logic from the vowel syllable function and get it all right! */
return !!(FLAG (info.indic_category()) & (FLAG (OT_C) | FLAG (OT_Ra) | FLAG (OT_V) | FLAG (OT_NBSP)));
return !!(FLAG (info.indic_category()) & (FLAG (OT_C) | FLAG (OT_Ra) | FLAG (OT_V) | FLAG (OT_NBSP) | FLAG (OT_DOTTEDCIRCLE)));
}
static const struct {
@ -213,7 +213,8 @@ _hb_ot_shape_complex_setup_masks_indic (hb_ot_map_t *map, hb_buffer_t *buffer, h
info.indic_category() = OT_ZWNJ;
else if (unlikely (info.codepoint == 0x200D))
info.indic_category() = OT_ZWJ;
else if (unlikely (info.codepoint == 0x25CC))
info.indic_category() = OT_DOTTEDCIRCLE;
}
}
@ -473,7 +474,18 @@ static void
initial_reordering_standalone_cluster (const hb_ot_map_t *map, hb_buffer_t *buffer, hb_mask_t *mask_array,
unsigned int start, unsigned int end)
{
/* We made the vowels look like consonants. So let's call the consonant logic! */
/* We treat NBSP/dotted-circle as if they are consonants, so we should just chain.
* Only if not in compatibility mode that is... */
if (options.uniscribe_bug_compatible)
{
/* For dotted-circle, this is what Uniscribe does:
* If dotted-circle is the last glyph, it just does nothing.
* Ie. It doesn't form Reph. */
if (buffer->info[end - 1].indic_category() == OT_DOTTEDCIRCLE)
return;
}
initial_reordering_consonant_syllable (map, buffer, mask_array, start, end);
}