2000-11-28 20:56:52 +00:00
|
|
|
/*
|
|
|
|
*
|
2007-07-24 22:37:22 +00:00
|
|
|
* (C) Copyright IBM Corp. 1998-2007 - All Rights Reserved
|
2000-11-28 20:56:52 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "LETypes.h"
|
2001-09-20 00:37:55 +00:00
|
|
|
#include "LEScripts.h"
|
2000-11-28 20:56:52 +00:00
|
|
|
#include "OpenTypeTables.h"
|
|
|
|
#include "OpenTypeUtilities.h"
|
|
|
|
#include "IndicReordering.h"
|
|
|
|
|
2001-10-16 00:39:01 +00:00
|
|
|
U_NAMESPACE_BEGIN
|
|
|
|
|
2005-06-22 21:22:43 +00:00
|
|
|
// Split matra table indices
|
|
|
|
#define _x1 (1 << CF_INDEX_SHIFT)
|
|
|
|
#define _x2 (2 << CF_INDEX_SHIFT)
|
|
|
|
#define _x3 (3 << CF_INDEX_SHIFT)
|
|
|
|
#define _x4 (4 << CF_INDEX_SHIFT)
|
|
|
|
#define _x5 (5 << CF_INDEX_SHIFT)
|
|
|
|
#define _x6 (6 << CF_INDEX_SHIFT)
|
|
|
|
#define _x7 (7 << CF_INDEX_SHIFT)
|
|
|
|
#define _x8 (8 << CF_INDEX_SHIFT)
|
|
|
|
#define _x9 (9 << CF_INDEX_SHIFT)
|
2000-11-28 20:56:52 +00:00
|
|
|
|
2005-06-22 21:22:43 +00:00
|
|
|
// simple classes
|
|
|
|
#define _xx (CC_RESERVED)
|
|
|
|
#define _ma (CC_VOWEL_MODIFIER | CF_POS_ABOVE)
|
|
|
|
#define _mp (CC_VOWEL_MODIFIER | CF_POS_AFTER)
|
|
|
|
#define _sa (CC_STRESS_MARK | CF_POS_ABOVE)
|
|
|
|
#define _sb (CC_STRESS_MARK | CF_POS_BELOW)
|
|
|
|
#define _iv (CC_INDEPENDENT_VOWEL)
|
|
|
|
#define _i2 (CC_INDEPENDENT_VOWEL_2)
|
2005-07-28 21:27:12 +00:00
|
|
|
#define _i3 (CC_INDEPENDENT_VOWEL_3)
|
2005-06-22 21:22:43 +00:00
|
|
|
#define _ct (CC_CONSONANT | CF_CONSONANT)
|
|
|
|
#define _cn (CC_CONSONANT_WITH_NUKTA | CF_CONSONANT)
|
|
|
|
#define _nu (CC_NUKTA)
|
|
|
|
#define _dv (CC_DEPENDENT_VOWEL)
|
|
|
|
#define _dl (_dv | CF_POS_BEFORE)
|
|
|
|
#define _db (_dv | CF_POS_BELOW)
|
|
|
|
#define _da (_dv | CF_POS_ABOVE)
|
|
|
|
#define _dr (_dv | CF_POS_AFTER)
|
|
|
|
#define _lm (_dv | CF_LENGTH_MARK)
|
|
|
|
#define _l1 (CC_SPLIT_VOWEL_PIECE_1 | CF_POS_BEFORE)
|
|
|
|
#define _a1 (CC_SPLIT_VOWEL_PIECE_1 | CF_POS_ABOVE)
|
2005-07-28 21:27:12 +00:00
|
|
|
#define _b2 (CC_SPLIT_VOWEL_PIECE_2 | CF_POS_BELOW)
|
2005-06-22 21:22:43 +00:00
|
|
|
#define _r2 (CC_SPLIT_VOWEL_PIECE_2 | CF_POS_AFTER)
|
|
|
|
#define _m2 (CC_SPLIT_VOWEL_PIECE_2 | CF_LENGTH_MARK)
|
|
|
|
#define _m3 (CC_SPLIT_VOWEL_PIECE_3 | CF_LENGTH_MARK)
|
|
|
|
#define _vr (CC_VIRAMA)
|
2000-11-28 20:56:52 +00:00
|
|
|
|
2005-06-22 21:22:43 +00:00
|
|
|
// split matras
|
|
|
|
#define _s1 (_dv | _x1)
|
|
|
|
#define _s2 (_dv | _x2)
|
|
|
|
#define _s3 (_dv | _x3)
|
|
|
|
#define _s4 (_dv | _x4)
|
|
|
|
#define _s5 (_dv | _x5)
|
|
|
|
#define _s6 (_dv | _x6)
|
|
|
|
#define _s7 (_dv | _x7)
|
|
|
|
#define _s8 (_dv | _x8)
|
|
|
|
#define _s9 (_dv | _x9)
|
2000-11-28 20:56:52 +00:00
|
|
|
|
2005-06-22 21:22:43 +00:00
|
|
|
// consonants with special forms
|
|
|
|
// NOTE: this assumes that no consonants with nukta have
|
|
|
|
// special forms... (Bengali RA?)
|
|
|
|
#define _bb (_ct | CF_BELOW_BASE)
|
|
|
|
#define _pb (_ct | CF_POST_BASE)
|
|
|
|
#define _vt (_bb | CF_VATTU)
|
|
|
|
#define _rv (_vt | CF_REPH)
|
|
|
|
#define _rp (_pb | CF_REPH)
|
|
|
|
#define _rb (_bb | CF_REPH)
|
2000-11-28 20:56:52 +00:00
|
|
|
|
|
|
|
//
|
|
|
|
// Character class tables
|
|
|
|
//
|
2001-10-23 16:52:55 +00:00
|
|
|
static const IndicClassTable::CharClass devaCharClasses[] =
|
2000-11-28 20:56:52 +00:00
|
|
|
{
|
2004-02-11 00:15:05 +00:00
|
|
|
_xx, _ma, _ma, _mp, _iv, _iv, _iv, _iv, _iv, _iv, _iv, _iv, _iv, _iv, _iv, _iv, // 0900 - 090F
|
2000-11-28 20:56:52 +00:00
|
|
|
_iv, _iv, _iv, _iv, _iv, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, // 0910 - 091F
|
|
|
|
_ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _cn, _ct, _ct, _ct, _ct, _ct, _ct, // 0920 - 092F
|
2004-02-11 00:15:05 +00:00
|
|
|
_rv, _cn, _ct, _ct, _cn, _ct, _ct, _ct, _ct, _ct, _xx, _xx, _nu, _xx, _dr, _dl, // 0930 - 093F
|
2000-11-28 20:56:52 +00:00
|
|
|
_dr, _db, _db, _db, _db, _da, _da, _da, _da, _dr, _dr, _dr, _dr, _vr, _xx, _xx, // 0940 - 094F
|
2004-02-13 19:34:17 +00:00
|
|
|
_xx, _sa, _sb, _sa, _sa, _xx, _xx, _xx, _cn, _cn, _cn, _cn, _cn, _cn, _cn, _cn, // 0950 - 095F
|
2000-11-28 20:56:52 +00:00
|
|
|
_iv, _iv, _db, _db, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, // 0960 - 096F
|
|
|
|
_xx // 0970
|
|
|
|
};
|
|
|
|
|
2001-10-23 16:52:55 +00:00
|
|
|
static const IndicClassTable::CharClass bengCharClasses[] =
|
2000-11-28 20:56:52 +00:00
|
|
|
{
|
2004-08-06 18:13:16 +00:00
|
|
|
_xx, _ma, _mp, _mp, _xx, _i2, _iv, _iv, _iv, _iv, _iv, _iv, _iv, _xx, _xx, _i2, // 0980 - 098F
|
2000-11-28 20:56:52 +00:00
|
|
|
_iv, _xx, _xx, _iv, _iv, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, // 0990 - 099F
|
|
|
|
_ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _xx, _ct, _ct, _bb, _ct, _ct, _pb, // 09A0 - 09AF
|
2004-08-24 22:42:42 +00:00
|
|
|
_rv, _xx, _ct, _xx, _xx, _xx, _ct, _ct, _ct, _ct, _xx, _xx, _nu, _xx, _r2, _dl, // 09B0 - 09BF
|
|
|
|
_dr, _db, _db, _db, _db, _xx, _xx, _l1, _dl, _xx, _xx, _s1, _s2, _vr, _xx, _xx, // 09C0 - 09CF
|
|
|
|
_xx, _xx, _xx, _xx, _xx, _xx, _xx, _m2, _xx, _xx, _xx, _xx, _cn, _cn, _xx, _cn, // 09D0 - 09DF
|
2000-11-28 20:56:52 +00:00
|
|
|
_iv, _iv, _dv, _dv, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, // 09E0 - 09EF
|
2006-11-14 23:48:42 +00:00
|
|
|
_rv, _ct, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx // 09F0 - 09FA
|
2000-11-28 20:56:52 +00:00
|
|
|
};
|
|
|
|
|
2001-10-23 16:52:55 +00:00
|
|
|
static const IndicClassTable::CharClass punjCharClasses[] =
|
2000-11-28 20:56:52 +00:00
|
|
|
{
|
2004-10-17 20:45:06 +00:00
|
|
|
_xx, _ma, _ma, _mp, _xx, _iv, _iv, _iv, _iv, _iv, _iv, _xx, _xx, _xx, _xx, _iv, // 0A00 - 0A0F
|
2005-07-28 21:27:12 +00:00
|
|
|
_iv, _xx, _xx, _i3, _iv, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, // 0A10 - 0A1F
|
2000-11-28 20:56:52 +00:00
|
|
|
_ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _xx, _ct, _ct, _ct, _ct, _ct, _bb, // 0A20 - 0A2F
|
2005-06-16 23:53:41 +00:00
|
|
|
_vt, _xx, _ct, _cn, _xx, _bb, _cn, _xx, _ct, _bb, _xx, _xx, _nu, _xx, _dr, _dl, // 0A30 - 0A3F
|
2005-07-28 21:27:12 +00:00
|
|
|
_dr, _b2, _db, _xx, _xx, _xx, _xx, _da, _da, _xx, _xx, _a1, _da, _vr, _xx, _xx, // 0A40 - 0A4F
|
2005-07-11 22:10:52 +00:00
|
|
|
_xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _cn, _cn, _cn, _ct, _xx, _cn, _xx, // 0A50 - 0A5F
|
2000-11-28 20:56:52 +00:00
|
|
|
_xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, // 0A60 - 0A6F
|
2005-07-25 18:55:48 +00:00
|
|
|
_ma, _ma, _xx, _xx, _xx // 0A70 - 0A74
|
2000-11-28 20:56:52 +00:00
|
|
|
};
|
|
|
|
|
2001-10-23 16:52:55 +00:00
|
|
|
static const IndicClassTable::CharClass gujrCharClasses[] =
|
2000-11-28 20:56:52 +00:00
|
|
|
{
|
|
|
|
_xx, _ma, _ma, _mp, _xx, _iv, _iv, _iv, _iv, _iv, _iv, _iv, _xx, _iv, _xx, _iv, // 0A80 - 0A8F
|
|
|
|
_iv, _iv, _xx, _iv, _iv, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, // 0A90 - 0A9F
|
|
|
|
_ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _xx, _ct, _ct, _ct, _ct, _ct, _ct, // 0AA0 - 0AAF
|
|
|
|
_rv, _xx, _ct, _ct, _xx, _ct, _ct, _ct, _ct, _ct, _xx, _xx, _nu, _xx, _dr, _dl, // 0AB0 - 0ABF
|
|
|
|
_dr, _db, _db, _db, _db, _da, _xx, _da, _da, _dr, _xx, _dr, _dr, _vr, _xx, _xx, // 0AC0 - 0ACF
|
|
|
|
_xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, // 0AD0 - 0ADF
|
2007-07-24 22:37:22 +00:00
|
|
|
_iv, _iv, _db, _db, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx // 0AE0 - 0AEF
|
2000-11-28 20:56:52 +00:00
|
|
|
};
|
|
|
|
|
2006-11-10 19:30:16 +00:00
|
|
|
#if 1
|
|
|
|
static const IndicClassTable::CharClass oryaCharClasses[] =
|
|
|
|
{
|
|
|
|
_xx, _ma, _mp, _mp, _xx, _iv, _iv, _iv, _iv, _iv, _iv, _iv, _iv, _xx, _xx, _iv, /* 0B00 - 0B0F */
|
|
|
|
_iv, _xx, _xx, _iv, _iv, _bb, _bb, _bb, _bb, _bb, _bb, _bb, _bb, _bb, _ct, _bb, /* 0B10 - 0B1F */
|
|
|
|
_bb, _bb, _bb, _bb, _bb, _bb, _bb, _bb, _bb, _xx, _bb, _bb, _bb, _bb, _bb, _pb, /* 0B20 - 0B2F */
|
|
|
|
_rb, _xx, _bb, _bb, _xx, _bb, _bb, _bb, _bb, _bb, _xx, _xx, _nu, _xx, _dr, _da, /* 0B30 - 0B3F */
|
|
|
|
_dr, _db, _db, _db, _xx, _xx, _xx, _dl, _s1, _xx, _xx, _s2, _s3, _vr, _xx, _xx, /* 0B40 - 0B4F */
|
|
|
|
_xx, _xx, _xx, _xx, _xx, _xx, _da, _dr, _xx, _xx, _xx, _xx, _cn, _cn, _xx, _pb, /* 0B50 - 0B5F */
|
|
|
|
_iv, _iv, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, /* 0B60 - 0B6F */
|
|
|
|
_xx, _bb /* 0B70 - 0B71 */
|
|
|
|
};
|
|
|
|
#else
|
2001-10-23 16:52:55 +00:00
|
|
|
static const IndicClassTable::CharClass oryaCharClasses[] =
|
2000-11-28 20:56:52 +00:00
|
|
|
{
|
2005-07-11 22:22:05 +00:00
|
|
|
_xx, _ma, _mp, _mp, _xx, _iv, _iv, _iv, _iv, _iv, _iv, _iv, _iv, _xx, _xx, _iv, // 0B00 - 0B0F
|
2000-11-28 20:56:52 +00:00
|
|
|
_iv, _xx, _xx, _iv, _iv, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, // 0B10 - 0B1F
|
|
|
|
_ct, _ct, _ct, _ct, _bb, _ct, _ct, _ct, _bb, _xx, _ct, _ct, _bb, _bb, _bb, _pb, // 0B20 - 0B2F
|
2005-07-11 22:22:05 +00:00
|
|
|
_rb, _xx, _bb, _bb, _xx, _ct, _ct, _ct, _ct, _ct, _xx, _xx, _nu, _xx, _r2, _da, // 0B30 - 0B3F
|
2004-08-24 22:42:42 +00:00
|
|
|
_dr, _db, _db, _db, _xx, _xx, _xx, _l1, _s1, _xx, _xx, _s2, _s3, _vr, _xx, _xx, // 0B40 - 0B4F
|
|
|
|
_xx, _xx, _xx, _xx, _xx, _xx, _m2, _m2, _xx, _xx, _xx, _xx, _cn, _cn, _xx, _cn, // 0B50 - 0B5F
|
2000-11-28 20:56:52 +00:00
|
|
|
_iv, _iv, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, // 0B60 - 0B6F
|
2005-07-11 22:22:05 +00:00
|
|
|
_xx, _ct // 0B70 - 0B71
|
2000-11-28 20:56:52 +00:00
|
|
|
};
|
2006-11-10 19:30:16 +00:00
|
|
|
#endif
|
2000-11-28 20:56:52 +00:00
|
|
|
|
2001-10-23 16:52:55 +00:00
|
|
|
static const IndicClassTable::CharClass tamlCharClasses[] =
|
2000-11-28 20:56:52 +00:00
|
|
|
{
|
2006-08-14 21:21:30 +00:00
|
|
|
_xx, _xx, _ma, _xx, _xx, _iv, _iv, _iv, _iv, _iv, _iv, _xx, _xx, _xx, _iv, _iv, // 0B80 - 0B8F
|
2000-11-28 20:56:52 +00:00
|
|
|
_iv, _xx, _iv, _iv, _iv, _ct, _xx, _xx, _xx, _ct, _ct, _xx, _ct, _xx, _ct, _ct, // 0B90 - 0B9F
|
|
|
|
_xx, _xx, _xx, _ct, _ct, _xx, _xx, _xx, _ct, _ct, _ct, _xx, _xx, _xx, _ct, _ct, // 0BA0 - 0BAF
|
2004-08-24 22:42:42 +00:00
|
|
|
_ct, _ct, _ct, _ct, _ct, _ct, _xx, _ct, _ct, _ct, _xx, _xx, _xx, _xx, _r2, _dr, // 0BB0 - 0BBF
|
|
|
|
_da, _dr, _dr, _xx, _xx, _xx, _l1, _l1, _dl, _xx, _s1, _s2, _s3, _vr, _xx, _xx, // 0BC0 - 0BCF
|
|
|
|
_xx, _xx, _xx, _xx, _xx, _xx, _xx, _m2, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, // 0BD0 - 0BDF
|
2000-11-28 20:56:52 +00:00
|
|
|
_xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, // 0BE0 - 0BEF
|
|
|
|
_xx, _xx, _xx // 0BF0 - 0BF2
|
|
|
|
};
|
|
|
|
|
|
|
|
// FIXME: Should some of the bb's be pb's? (KA, NA, MA, YA, VA, etc. (approx 13))
|
2001-10-23 16:52:55 +00:00
|
|
|
static const IndicClassTable::CharClass teluCharClasses[] =
|
2000-11-28 20:56:52 +00:00
|
|
|
{
|
|
|
|
_xx, _mp, _mp, _mp, _xx, _iv, _iv, _iv, _iv, _iv, _iv, _iv, _iv, _xx, _iv, _iv, // 0C00 - 0C0F
|
|
|
|
_iv, _xx, _iv, _iv, _iv, _bb, _bb, _bb, _bb, _bb, _bb, _bb, _bb, _bb, _bb, _bb, // 0C10 - 0C1F
|
|
|
|
_bb, _bb, _bb, _bb, _bb, _bb, _bb, _bb, _bb, _xx, _bb, _bb, _bb, _bb, _bb, _bb, // 0C20 - 0C2F
|
2006-11-10 22:45:50 +00:00
|
|
|
_bb, _bb, _bb, _bb, _xx, _bb, _bb, _bb, _bb, _bb, _xx, _xx, _xx, _xx, _da, _da, // 0C30 - 0C3F
|
2004-08-24 22:42:42 +00:00
|
|
|
_da, _dr, _dr, _dr, _dr, _xx, _a1, _da, _s1, _xx, _da, _da, _da, _vr, _xx, _xx, // 0C40 - 0C4F
|
|
|
|
_xx, _xx, _xx, _xx, _xx, _da, _m2, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, // 0C50 - 0C5F
|
2000-11-28 20:56:52 +00:00
|
|
|
_iv, _iv, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx // 0C60 - 0C6F
|
|
|
|
};
|
|
|
|
|
2004-08-06 18:35:12 +00:00
|
|
|
// U+CC3 and U+CC4 are _lm here not _dr since the Kannada rendering
|
|
|
|
// rules want them below and to the right of the entire cluster
|
|
|
|
//
|
|
|
|
// There's some information about this in:
|
|
|
|
//
|
|
|
|
// http://brahmi.sourceforge.net/docs/KannadaComputing.html
|
2001-10-23 16:52:55 +00:00
|
|
|
static const IndicClassTable::CharClass kndaCharClasses[] =
|
2000-11-28 20:56:52 +00:00
|
|
|
{
|
|
|
|
_xx, _xx, _mp, _mp, _xx, _iv, _iv, _iv, _iv, _iv, _iv, _iv, _iv, _iv, _xx, _iv, // 0C80 - 0C8F
|
|
|
|
_iv, _xx, _iv, _iv, _iv, _bb, _bb, _bb, _bb, _bb, _bb, _bb, _bb, _bb, _bb, _bb, // 0C90 - 0C9F
|
|
|
|
_bb, _bb, _bb, _bb, _bb, _bb, _bb, _bb, _bb, _xx, _bb, _bb, _bb, _bb, _bb, _bb, // 0CA0 - 0CAF
|
2001-09-20 00:37:55 +00:00
|
|
|
_rb, _ct, _bb, _bb, _xx, _bb, _bb, _bb, _bb, _bb, _xx, _xx, _xx, _xx, _dr, _da, // 0CB0 - 0CBF
|
2004-08-24 22:42:42 +00:00
|
|
|
_s1, _dr, _r2, _lm, _lm, _xx, _a1, _s2, _s3, _xx, _s4, _s5, _da, _vr, _xx, _xx, // 0CC0 - 0CCF
|
|
|
|
_xx, _xx, _xx, _xx, _xx, _m3, _m2, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _ct, _xx, // 0CD0 - 0CDF
|
2000-11-28 20:56:52 +00:00
|
|
|
_iv, _iv, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx // 0CE0 - 0CEF
|
|
|
|
};
|
|
|
|
|
|
|
|
// FIXME: this is correct for old-style Malayalam (MAL) but not for reformed Malayalam (MLR)
|
|
|
|
// FIXME: should there be a REPH for old-style Malayalam?
|
2001-10-23 16:52:55 +00:00
|
|
|
static const IndicClassTable::CharClass mlymCharClasses[] =
|
2000-11-28 20:56:52 +00:00
|
|
|
{
|
|
|
|
_xx, _xx, _mp, _mp, _xx, _iv, _iv, _iv, _iv, _iv, _iv, _iv, _iv, _xx, _iv, _iv, // 0D00 - 0D0F
|
2006-11-14 00:42:49 +00:00
|
|
|
_iv, _xx, _iv, _iv, _iv, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, // 0D10 - 0D1F
|
|
|
|
_ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _xx, _ct, _ct, _ct, _ct, _ct, _pb, // 0D20 - 0D2F
|
2004-08-24 22:42:42 +00:00
|
|
|
_pb, _cn, _bb, _ct, _ct, _pb, _ct, _ct, _ct, _ct, _xx, _xx, _xx, _xx, _r2, _dr, // 0D30 - 0D3F
|
|
|
|
_dr, _dr, _dr, _dr, _xx, _xx, _l1, _l1, _dl, _xx, _s1, _s2, _s3, _vr, _xx, _xx, // 0D40 - 0D4F
|
|
|
|
_xx, _xx, _xx, _xx, _xx, _xx, _xx, _m2, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, // 0D50 - 0D5F
|
2000-11-28 20:56:52 +00:00
|
|
|
_iv, _iv, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx // 0D60 - 0D6F
|
|
|
|
};
|
2005-07-28 20:56:04 +00:00
|
|
|
|
|
|
|
static const IndicClassTable::CharClass sinhCharClasses[] =
|
|
|
|
{
|
|
|
|
_xx, _xx, _mp, _mp, _xx, _iv, _iv, _iv, _iv, _iv, _iv, _iv, _iv, _iv, _iv, _iv, // 0D80 - 0D8F
|
|
|
|
_iv, _iv, _iv, _iv, _iv, _iv, _iv, _xx, _xx, _xx, _ct, _ct, _ct, _ct, _ct, _ct, // 0D90 - 0D9F
|
|
|
|
_ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, // 0DA0 - 0DAF
|
|
|
|
_ct, _ct, _xx, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _xx, _ct, _xx, _xx, // 0DB0 - 0DBF
|
|
|
|
_ct, _ct, _ct, _ct, _ct, _ct, _ct, _xx, _xx, _xx, _vr, _xx, _xx, _xx, _xx, _dr, // 0DC0 - 0DCF
|
|
|
|
_dr, _dr, _da, _da, _db, _xx, _db, _xx, _dr, _dl, _s1, _dl, _s2, _s3, _s4, _dr, // 0DD0 - 0DDF
|
|
|
|
_xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, // 0DE0 - 0DEF
|
|
|
|
_xx, _xx, _dr, _dr, _xx // 0DF0 - 0DF4
|
|
|
|
};
|
2000-11-28 20:56:52 +00:00
|
|
|
|
|
|
|
//
|
|
|
|
// Split matra tables
|
|
|
|
//
|
2001-10-23 16:52:55 +00:00
|
|
|
static const SplitMatra bengSplitTable[] = {{0x09C7, 0x09BE}, {0x09C7, 0x09D7}};
|
2000-11-28 20:56:52 +00:00
|
|
|
|
2001-10-23 16:52:55 +00:00
|
|
|
static const SplitMatra oryaSplitTable[] = {{0x0B47, 0x0B56}, {0x0B47, 0x0B3E}, {0x0B47, 0x0B57}};
|
2000-11-28 20:56:52 +00:00
|
|
|
|
2001-10-23 16:52:55 +00:00
|
|
|
static const SplitMatra tamlSplitTable[] = {{0x0BC6, 0x0BBE}, {0x0BC7, 0x0BBE}, {0x0BC6, 0x0BD7}};
|
2000-11-28 20:56:52 +00:00
|
|
|
|
2001-10-23 16:52:55 +00:00
|
|
|
static const SplitMatra teluSplitTable[] = {{0x0C46, 0x0C56}};
|
2000-11-28 20:56:52 +00:00
|
|
|
|
2001-10-23 16:52:55 +00:00
|
|
|
static const SplitMatra kndaSplitTable[] = {{0x0CBF, 0x0CD5}, {0x0CC6, 0x0CD5}, {0x0CC6, 0x0CD6}, {0x0CC6, 0x0CC2},
|
2005-07-28 20:56:04 +00:00
|
|
|
{0x0CC6, 0x0CC2, 0x0CD5}};
|
2000-11-28 20:56:52 +00:00
|
|
|
|
2001-10-23 16:52:55 +00:00
|
|
|
static const SplitMatra mlymSplitTable[] = {{0x0D46, 0x0D3E}, {0x0D47, 0x0D3E}, {0x0D46, 0x0D57}};
|
2000-11-28 20:56:52 +00:00
|
|
|
|
2005-07-28 20:56:04 +00:00
|
|
|
|
|
|
|
static const SplitMatra sinhSplitTable[] = {{0x0DD9, 0x0DCA}, {0x0DD9, 0x0DCF}, {0x0DD9, 0x0DCF,0x0DCA},
|
|
|
|
{0x0DD9, 0x0DDF}};
|
2000-11-28 20:56:52 +00:00
|
|
|
//
|
|
|
|
// Script Flags
|
|
|
|
//
|
|
|
|
|
|
|
|
// FIXME: post 'GSUB' reordering of MATRA_PRE's for Malayalam and Tamil
|
|
|
|
// FIXME: reformed Malayalam needs to reorder VATTU to before base glyph...
|
2006-11-14 00:42:49 +00:00
|
|
|
// FIXME: not sure passing ZWJ/ZWNJ is best way to render Malayalam Cillu...
|
2000-11-28 20:56:52 +00:00
|
|
|
// FIXME: eyelash RA only for Devanagari??
|
2005-09-02 18:22:09 +00:00
|
|
|
#define DEVA_SCRIPT_FLAGS (SF_EYELASH_RA | SF_NO_POST_BASE_LIMIT | SF_FILTER_ZERO_WIDTH)
|
|
|
|
#define BENG_SCRIPT_FLAGS (SF_REPH_AFTER_BELOW | SF_NO_POST_BASE_LIMIT | SF_FILTER_ZERO_WIDTH)
|
|
|
|
#define PUNJ_SCRIPT_FLAGS (SF_NO_POST_BASE_LIMIT | SF_FILTER_ZERO_WIDTH)
|
|
|
|
#define GUJR_SCRIPT_FLAGS (SF_NO_POST_BASE_LIMIT | SF_FILTER_ZERO_WIDTH)
|
|
|
|
#define ORYA_SCRIPT_FLAGS (SF_REPH_AFTER_BELOW | SF_NO_POST_BASE_LIMIT | SF_FILTER_ZERO_WIDTH)
|
|
|
|
#define TAML_SCRIPT_FLAGS (SF_MPRE_FIXUP | SF_NO_POST_BASE_LIMIT | SF_FILTER_ZERO_WIDTH)
|
|
|
|
#define TELU_SCRIPT_FLAGS (SF_MATRAS_AFTER_BASE | SF_FILTER_ZERO_WIDTH | 3)
|
|
|
|
#define KNDA_SCRIPT_FLAGS (SF_MATRAS_AFTER_BASE | SF_FILTER_ZERO_WIDTH | 3)
|
2006-11-14 00:42:49 +00:00
|
|
|
#define MLYM_SCRIPT_FLAGS (SF_MPRE_FIXUP | SF_NO_POST_BASE_LIMIT /*| SF_FILTER_ZERO_WIDTH*/)
|
2005-07-28 20:56:04 +00:00
|
|
|
#define SINH_SCRIPT_FLAGS (SF_MPRE_FIXUP | SF_NO_POST_BASE_LIMIT)
|
2000-11-28 20:56:52 +00:00
|
|
|
|
|
|
|
//
|
|
|
|
// Indic Class Tables
|
|
|
|
//
|
2001-10-23 16:52:55 +00:00
|
|
|
static const IndicClassTable devaClassTable = {0x0900, 0x0970, 2, DEVA_SCRIPT_FLAGS, devaCharClasses, NULL};
|
2000-11-28 20:56:52 +00:00
|
|
|
|
2001-10-23 16:52:55 +00:00
|
|
|
static const IndicClassTable bengClassTable = {0x0980, 0x09FA, 3, BENG_SCRIPT_FLAGS, bengCharClasses, bengSplitTable};
|
2000-11-28 20:56:52 +00:00
|
|
|
|
2001-10-23 16:52:55 +00:00
|
|
|
static const IndicClassTable punjClassTable = {0x0A00, 0x0A74, 2, PUNJ_SCRIPT_FLAGS, punjCharClasses, NULL};
|
2000-11-28 20:56:52 +00:00
|
|
|
|
2001-10-23 16:52:55 +00:00
|
|
|
static const IndicClassTable gujrClassTable = {0x0A80, 0x0AEF, 2, GUJR_SCRIPT_FLAGS, gujrCharClasses, NULL};
|
2000-11-28 20:56:52 +00:00
|
|
|
|
2005-07-11 22:22:05 +00:00
|
|
|
static const IndicClassTable oryaClassTable = {0x0B00, 0x0B71, 3, ORYA_SCRIPT_FLAGS, oryaCharClasses, oryaSplitTable};
|
2000-11-28 20:56:52 +00:00
|
|
|
|
2001-10-23 16:52:55 +00:00
|
|
|
static const IndicClassTable tamlClassTable = {0x0B80, 0x0BF2, 3, TAML_SCRIPT_FLAGS, tamlCharClasses, tamlSplitTable};
|
2000-11-28 20:56:52 +00:00
|
|
|
|
2001-10-23 16:52:55 +00:00
|
|
|
static const IndicClassTable teluClassTable = {0x0C00, 0x0C6F, 3, TELU_SCRIPT_FLAGS, teluCharClasses, teluSplitTable};
|
2000-11-28 20:56:52 +00:00
|
|
|
|
2001-10-23 16:52:55 +00:00
|
|
|
static const IndicClassTable kndaClassTable = {0x0C80, 0x0CEF, 4, KNDA_SCRIPT_FLAGS, kndaCharClasses, kndaSplitTable};
|
2000-11-28 20:56:52 +00:00
|
|
|
|
2001-10-23 16:52:55 +00:00
|
|
|
static const IndicClassTable mlymClassTable = {0x0D00, 0x0D6F, 3, MLYM_SCRIPT_FLAGS, mlymCharClasses, mlymSplitTable};
|
2000-11-28 20:56:52 +00:00
|
|
|
|
2006-11-14 23:55:04 +00:00
|
|
|
static const IndicClassTable sinhClassTable = {0x0D80, 0x0DF4, 4, SINH_SCRIPT_FLAGS, sinhCharClasses, sinhSplitTable};
|
2005-07-28 20:56:04 +00:00
|
|
|
|
2000-11-28 20:56:52 +00:00
|
|
|
//
|
|
|
|
// IndicClassTable addresses
|
|
|
|
//
|
2006-03-18 00:04:26 +00:00
|
|
|
static const IndicClassTable * const indicClassTables[scriptCodeCount] = {
|
2001-10-13 00:34:00 +00:00
|
|
|
NULL, /* 'zyyy' (COMMON) */
|
|
|
|
NULL, /* 'qaai' (INHERITED) */
|
|
|
|
NULL, /* 'arab' (ARABIC) */
|
|
|
|
NULL, /* 'armn' (ARMENIAN) */
|
|
|
|
&bengClassTable, /* 'beng' (BENGALI) */
|
|
|
|
NULL, /* 'bopo' (BOPOMOFO) */
|
|
|
|
NULL, /* 'cher' (CHEROKEE) */
|
2005-07-20 22:15:24 +00:00
|
|
|
NULL, /* 'copt' (COPTIC) */
|
2001-10-13 00:34:00 +00:00
|
|
|
NULL, /* 'cyrl' (CYRILLIC) */
|
|
|
|
NULL, /* 'dsrt' (DESERET) */
|
|
|
|
&devaClassTable, /* 'deva' (DEVANAGARI) */
|
|
|
|
NULL, /* 'ethi' (ETHIOPIC) */
|
|
|
|
NULL, /* 'geor' (GEORGIAN) */
|
|
|
|
NULL, /* 'goth' (GOTHIC) */
|
|
|
|
NULL, /* 'grek' (GREEK) */
|
|
|
|
&gujrClassTable, /* 'gujr' (GUJARATI) */
|
|
|
|
&punjClassTable, /* 'guru' (GURMUKHI) */
|
|
|
|
NULL, /* 'hani' (HAN) */
|
|
|
|
NULL, /* 'hang' (HANGUL) */
|
|
|
|
NULL, /* 'hebr' (HEBREW) */
|
|
|
|
NULL, /* 'hira' (HIRAGANA) */
|
|
|
|
&kndaClassTable, /* 'knda' (KANNADA) */
|
|
|
|
NULL, /* 'kata' (KATAKANA) */
|
|
|
|
NULL, /* 'khmr' (KHMER) */
|
|
|
|
NULL, /* 'laoo' (LAO) */
|
|
|
|
NULL, /* 'latn' (LATIN) */
|
|
|
|
&mlymClassTable, /* 'mlym' (MALAYALAM) */
|
|
|
|
NULL, /* 'mong' (MONGOLIAN) */
|
|
|
|
NULL, /* 'mymr' (MYANMAR) */
|
|
|
|
NULL, /* 'ogam' (OGHAM) */
|
|
|
|
NULL, /* 'ital' (OLD-ITALIC) */
|
|
|
|
&oryaClassTable, /* 'orya' (ORIYA) */
|
|
|
|
NULL, /* 'runr' (RUNIC) */
|
2005-07-28 20:56:04 +00:00
|
|
|
&sinhClassTable, /* 'sinh' (SINHALA) */
|
2001-10-13 00:34:00 +00:00
|
|
|
NULL, /* 'syrc' (SYRIAC) */
|
|
|
|
&tamlClassTable, /* 'taml' (TAMIL) */
|
|
|
|
&teluClassTable, /* 'telu' (TELUGU) */
|
|
|
|
NULL, /* 'thaa' (THAANA) */
|
|
|
|
NULL, /* 'thai' (THAI) */
|
|
|
|
NULL, /* 'tibt' (TIBETAN) */
|
|
|
|
NULL, /* 'cans' (CANADIAN-ABORIGINAL) */
|
2002-12-16 23:12:45 +00:00
|
|
|
NULL, /* 'yiii' (YI) */
|
|
|
|
NULL, /* 'tglg' (TAGALOG) */
|
|
|
|
NULL, /* 'hano' (HANUNOO) */
|
|
|
|
NULL, /* 'buhd' (BUHID) */
|
2003-04-15 20:44:11 +00:00
|
|
|
NULL, /* 'tagb' (TAGBANWA) */
|
|
|
|
NULL, /* 'brai' (BRAILLE) */
|
|
|
|
NULL, /* 'cprt' (CYPRIOT) */
|
|
|
|
NULL, /* 'limb' (LIMBU) */
|
|
|
|
NULL, /* 'linb' (LINEAR_B) */
|
|
|
|
NULL, /* 'osma' (OSMANYA) */
|
|
|
|
NULL, /* 'shaw' (SHAVIAN) */
|
|
|
|
NULL, /* 'tale' (TAI_LE) */
|
2004-05-15 00:49:38 +00:00
|
|
|
NULL, /* 'ugar' (UGARITIC) */
|
2005-07-20 22:15:24 +00:00
|
|
|
NULL, /* 'hrkt' (KATAKANA_OR_HIRAGANA) */
|
|
|
|
NULL, /* 'bugi' (BUGINESE) */
|
|
|
|
NULL, /* 'glag' (GLAGOLITIC) */
|
2005-07-22 21:50:45 +00:00
|
|
|
NULL, /* 'khar' (KHAROSHTHI) */
|
2005-07-20 22:15:24 +00:00
|
|
|
NULL, /* 'sylo' (SYLOTI_NAGRI) */
|
|
|
|
NULL, /* 'talu' (NEW_TAI_LUE) */
|
|
|
|
NULL, /* 'tfng' (TIFINAGH) */
|
2006-08-22 18:51:13 +00:00
|
|
|
NULL, /* 'xpeo' (OLD_PERSIAN) */
|
|
|
|
NULL, /* 'bali' (BALINESE) */
|
|
|
|
NULL, /* 'batk' (BATK) */
|
|
|
|
NULL, /* 'blis' (BLIS) */
|
|
|
|
NULL, /* 'brah' (BRAH) */
|
|
|
|
NULL, /* 'cham' (CHAM) */
|
|
|
|
NULL, /* 'cirt' (CIRT) */
|
|
|
|
NULL, /* 'cyrs' (CYRS) */
|
|
|
|
NULL, /* 'egyd' (EGYD) */
|
|
|
|
NULL, /* 'egyh' (EGYH) */
|
|
|
|
NULL, /* 'egyp' (EGYP) */
|
|
|
|
NULL, /* 'geok' (GEOK) */
|
|
|
|
NULL, /* 'hans' (HANS) */
|
|
|
|
NULL, /* 'hant' (HANT) */
|
|
|
|
NULL, /* 'hmng' (HMNG) */
|
|
|
|
NULL, /* 'hung' (HUNG) */
|
|
|
|
NULL, /* 'inds' (INDS) */
|
|
|
|
NULL, /* 'java' (JAVA) */
|
|
|
|
NULL, /* 'kali' (KALI) */
|
|
|
|
NULL, /* 'latf' (LATF) */
|
|
|
|
NULL, /* 'latg' (LATG) */
|
|
|
|
NULL, /* 'lepc' (LEPC) */
|
|
|
|
NULL, /* 'lina' (LINA) */
|
2006-08-23 00:12:41 +00:00
|
|
|
NULL, /* 'mand' (MAND) */
|
2006-08-22 18:51:13 +00:00
|
|
|
NULL, /* 'maya' (MAYA) */
|
|
|
|
NULL, /* 'mero' (MERO) */
|
|
|
|
NULL, /* 'nko ' (NKO) */
|
|
|
|
NULL, /* 'orkh' (ORKH) */
|
|
|
|
NULL, /* 'perm' (PERM) */
|
|
|
|
NULL, /* 'phag' (PHAGS_PA) */
|
|
|
|
NULL, /* 'phnx' (PHOENICIAN) */
|
|
|
|
NULL, /* 'plrd' (PLRD) */
|
|
|
|
NULL, /* 'roro' (RORO) */
|
|
|
|
NULL, /* 'sara' (SARA) */
|
|
|
|
NULL, /* 'syre' (SYRE) */
|
|
|
|
NULL, /* 'syrj' (SYRJ) */
|
|
|
|
NULL, /* 'syrn' (SYRN) */
|
|
|
|
NULL, /* 'teng' (TENG) */
|
|
|
|
NULL, /* 'vai ' (VAII) */
|
2006-08-23 00:12:41 +00:00
|
|
|
NULL, /* 'visp' (VISP) */
|
2006-08-22 18:51:13 +00:00
|
|
|
NULL, /* 'xsux' (CUNEIFORM) */
|
|
|
|
NULL, /* 'zxxx' (ZXXX) */
|
2007-09-03 20:26:38 +00:00
|
|
|
NULL, /* 'zzzz' (UNKNOWN) */
|
|
|
|
NULL, /* 'cari' (CARI) */
|
|
|
|
NULL, /* 'jpan' (JPAN) */
|
|
|
|
NULL, /* 'lana' (LANA) */
|
|
|
|
NULL, /* 'lyci' (LYCI) */
|
|
|
|
NULL, /* 'lydi' (LYDI) */
|
|
|
|
NULL, /* 'olck' (OLCK) */
|
|
|
|
NULL, /* 'rjng' (RJNG) */
|
|
|
|
NULL, /* 'saur' (SAUR) */
|
|
|
|
NULL, /* 'sgnw' (SGNW) */
|
|
|
|
NULL, /* 'sund' (SUND) */
|
|
|
|
NULL, /* 'moon' (MOON) */
|
|
|
|
NULL /* 'mtei' (MTEI) */
|
2000-11-28 20:56:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
IndicClassTable::CharClass IndicClassTable::getCharClass(LEUnicode ch) const
|
|
|
|
{
|
|
|
|
if (ch == C_SIGN_ZWJ) {
|
|
|
|
return CF_CONSONANT | CC_ZERO_WIDTH_MARK;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ch == C_SIGN_ZWNJ) {
|
|
|
|
return CC_ZERO_WIDTH_MARK;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ch < firstChar || ch > lastChar) {
|
|
|
|
return CC_RESERVED;
|
|
|
|
}
|
|
|
|
|
|
|
|
return classTable[ch - firstChar];
|
|
|
|
}
|
|
|
|
|
|
|
|
const IndicClassTable *IndicClassTable::getScriptClassTable(le_int32 scriptCode)
|
|
|
|
{
|
2001-10-23 16:52:55 +00:00
|
|
|
if (scriptCode < 0 || scriptCode >= scriptCodeCount) {
|
|
|
|
return NULL;
|
|
|
|
}
|
2000-11-28 20:56:52 +00:00
|
|
|
|
2001-10-23 16:52:55 +00:00
|
|
|
return indicClassTables[scriptCode];
|
2000-11-28 20:56:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
le_int32 IndicReordering::getWorstCaseExpansion(le_int32 scriptCode)
|
|
|
|
{
|
|
|
|
const IndicClassTable *classTable = IndicClassTable::getScriptClassTable(scriptCode);
|
|
|
|
|
|
|
|
if (classTable == NULL) {
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
return classTable->getWorstCaseExpansion();
|
|
|
|
}
|
|
|
|
|
2005-09-02 18:22:09 +00:00
|
|
|
le_bool IndicReordering::getFilterZeroWidth(le_int32 scriptCode)
|
|
|
|
{
|
|
|
|
const IndicClassTable *classTable = IndicClassTable::getScriptClassTable(scriptCode);
|
|
|
|
|
|
|
|
if (classTable == NULL) {
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return classTable->getFilterZeroWidth();
|
|
|
|
}
|
|
|
|
|
2001-10-16 00:39:01 +00:00
|
|
|
U_NAMESPACE_END
|