提交 43b65315 编写于 作者: B Behdad Esfahbod

[Indic] Another try to unbreak Sinhala split matras

Just read the comments...
上级 977f1740
...@@ -1317,15 +1317,42 @@ decompose_indic (const hb_ot_shape_normalize_context_t *c, ...@@ -1317,15 +1317,42 @@ decompose_indic (const hb_ot_shape_normalize_context_t *c,
#endif #endif
} }
if (indic_options ().uniscribe_bug_compatible) if ((ab == 0x0DDA || hb_in_range<hb_codepoint_t> (ab, 0x0DDC, 0x0DDE)))
switch (ab)
{ {
/* These Sinhala ones have Unicode decompositions, but Uniscribe /*
* decomposes them "Khmer-style". */ * Sinhala split matras... Let the fun begin.
case 0x0DDA : *a = 0x0DD9; *b= 0x0DDA; return true; *
case 0x0DDC : *a = 0x0DD9; *b= 0x0DDC; return true; * These four characters have Unicode decompositions. However, Uniscribe
case 0x0DDD : *a = 0x0DD9; *b= 0x0DDD; return true; * decomposes them "Khmer-style", that is, it uses the character itself to
case 0x0DDE : *a = 0x0DD9; *b= 0x0DDE; return true; * get the second half. The first half of all four decompositions is always
* U+0DD9.
*
* Now, there are buggy fonts, namely, the widely used lklug.ttf, that are
* broken with Uniscribe. But we need to support them. As such, we only
* do the Uniscribe-style decomposition if the character is transformed into
* its "sec.half" form by the 'pstf' feature. Otherwise, we fall back to
* Unicode decomposition.
*
* Note that we can't unconditionally use Unicode decomposition. That would
* break some other fonts, that are designed to work with Uniscribe, and
* don't have positioning features for the Unicode-style decomposition.
*
* Argh...
*/
const indic_shape_plan_t *indic_plan = (const indic_shape_plan_t *) c->plan->data;
hb_codepoint_t glyph;
if (indic_options ().uniscribe_bug_compatible ||
(c->font->get_glyph (ab, 0, &glyph) &&
indic_plan->pstf.would_substitute (&glyph, 1, true, c->font->face)))
{
/* Ok, safe to use Uniscribe-style decomposition. */
*a = 0x0DD9;
*b = ab;
return true;
}
} }
return c->unicode->decompose (ab, a, b); return c->unicode->decompose (ab, a, b);
......
extensive.txt extensive.txt
misc.txt misc.txt
reph.txt reph.txt
split-matras.txt
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册