[Indic] exclude ligatures when matching on Indic category
If, say, a H,ZWJ,C ligature was formed, we don't want the code to detec that as a Halant. So, ignore ligatures when matching category in final_reordering. Sinhala failures down from 514 to 455 (0.167374%).
This commit is contained in:
parent
d1af9e82e5
commit
771a8f5028
|
@ -26,6 +26,7 @@
|
||||||
|
|
||||||
#include "hb-ot-shape-complex-indic-private.hh"
|
#include "hb-ot-shape-complex-indic-private.hh"
|
||||||
#include "hb-ot-shape-private.hh"
|
#include "hb-ot-shape-private.hh"
|
||||||
|
#include "hb-ot-layout-gsubgpos-private.hh"
|
||||||
|
|
||||||
#define OLD_INDIC_TAG(script) (((hb_tag_t) script) | 0x20000000)
|
#define OLD_INDIC_TAG(script) (((hb_tag_t) script) | 0x20000000)
|
||||||
#define IS_OLD_INDIC_TAG(tag) ( \
|
#define IS_OLD_INDIC_TAG(tag) ( \
|
||||||
|
@ -187,7 +188,7 @@ matra_position (hb_codepoint_t u, indic_position_t side)
|
||||||
abort ();
|
abort ();
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static inline bool
|
||||||
is_ra (hb_codepoint_t u)
|
is_ra (hb_codepoint_t u)
|
||||||
{
|
{
|
||||||
return !!bsearch (&u, ra_chars,
|
return !!bsearch (&u, ra_chars,
|
||||||
|
@ -196,36 +197,38 @@ is_ra (hb_codepoint_t u)
|
||||||
compare_codepoint);
|
compare_codepoint);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define JOINER_FLAGS (FLAG (OT_ZWJ) | FLAG (OT_ZWNJ))
|
static inline bool
|
||||||
static bool
|
is_one_of (const hb_glyph_info_t &info, unsigned int flags)
|
||||||
is_joiner (const hb_glyph_info_t &info)
|
|
||||||
{
|
{
|
||||||
return !!(FLAG (info.indic_category()) & JOINER_FLAGS);
|
/* If it ligated, all bets are off. */
|
||||||
|
if (unlikely (get_lig_id (info))) return false;
|
||||||
|
return !!(FLAG (info.indic_category()) & flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define CONSONANT_FLAGS (FLAG (OT_C) | FLAG (OT_Ra) | FLAG (OT_V) | FLAG (OT_NBSP) | FLAG (OT_DOTTEDCIRCLE))
|
#define JOINER_FLAGS (FLAG (OT_ZWJ) | FLAG (OT_ZWNJ))
|
||||||
static bool
|
static inline bool
|
||||||
is_consonant (const hb_glyph_info_t &info)
|
is_joiner (const hb_glyph_info_t &info)
|
||||||
{
|
{
|
||||||
/* Note:
|
return is_one_of (info, JOINER_FLAGS);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Note:
|
||||||
*
|
*
|
||||||
* We treat Vowels and placeholders 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
|
* 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! */
|
* consonant syllable logic from the vowel syllable function and get it all right! */
|
||||||
return !!(FLAG (info.indic_category()) & CONSONANT_FLAGS);
|
#define CONSONANT_FLAGS (FLAG (OT_C) | FLAG (OT_Ra) | FLAG (OT_V) | FLAG (OT_NBSP) | FLAG (OT_DOTTEDCIRCLE))
|
||||||
|
static inline bool
|
||||||
|
is_consonant (const hb_glyph_info_t &info)
|
||||||
|
{
|
||||||
|
return is_one_of (info, CONSONANT_FLAGS);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define HALANT_OR_COENG_FLAGS (FLAG (OT_H) | FLAG (OT_Coeng))
|
#define HALANT_OR_COENG_FLAGS (FLAG (OT_H) | FLAG (OT_Coeng))
|
||||||
static bool
|
static inline bool
|
||||||
is_halant_or_coeng (const hb_glyph_info_t &info)
|
is_halant_or_coeng (const hb_glyph_info_t &info)
|
||||||
{
|
{
|
||||||
return !!(FLAG (info.indic_category()) & HALANT_OR_COENG_FLAGS);
|
return is_one_of (info, HALANT_OR_COENG_FLAGS);
|
||||||
}
|
|
||||||
|
|
||||||
static bool
|
|
||||||
is_one_of (const hb_glyph_info_t &info, unsigned int flags)
|
|
||||||
{
|
|
||||||
return !!(FLAG (info.indic_category()) & flags);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
|
@ -726,7 +729,7 @@ initial_reordering_consonant_syllable (const hb_ot_map_t *map, hb_buffer_t *buff
|
||||||
/* XXX This will not match for old-Indic spec since the Halant-Ra order is reversed already. */
|
/* XXX This will not match for old-Indic spec since the Halant-Ra order is reversed already. */
|
||||||
if (basic_mask_array[PREF] && base + 2 < end)
|
if (basic_mask_array[PREF] && base + 2 < end)
|
||||||
{
|
{
|
||||||
/* Find a Halant,Ra sequence and mark it fore pre-base reordering processing. */
|
/* Find a Halant,Ra sequence and mark it for pre-base reordering processing. */
|
||||||
for (unsigned int i = base + 1; i + 1 < end; i++)
|
for (unsigned int i = base + 1; i + 1 < end; i++)
|
||||||
if (is_halant_or_coeng (info[i]) &&
|
if (is_halant_or_coeng (info[i]) &&
|
||||||
info[i + 1].indic_category() == OT_Ra)
|
info[i + 1].indic_category() == OT_Ra)
|
||||||
|
|
|
@ -29,3 +29,4 @@
|
||||||
ර්ම
|
ර්ම
|
||||||
ශී්ර
|
ශී්ර
|
||||||
ස්ට්රේ
|
ස්ට්රේ
|
||||||
|
ග්යෙ
|
||||||
|
|
Loading…
Reference in New Issue