Add Unicode 5.2 scripts

This commit is contained in:
Behdad Esfahbod 2010-05-21 13:29:12 +01:00
parent ee1b322100
commit 4fa67f34ec
4 changed files with 83 additions and 5 deletions

View File

@ -31,6 +31,7 @@
#include "hb-unicode-private.h"
#include <unicode/uversion.h>
#include <unicode/uchar.h>
#include <unicode/uscript.h>
@ -110,7 +111,10 @@ hb_icu_get_script (hb_codepoint_t unicode)
UScriptCode scriptCode = uscript_getScript(unicode, &status);
switch ((int) scriptCode)
{
#define CHECK_ICU_VERSION(major, minor) \
U_ICU_VERSION_MAJOR_NUM > (major) || (U_ICU_VERSION_MAJOR_NUM == (major) && U_ICU_VERSION_MINOR_NUM >= (minor))
#define MATCH_SCRIPT(C) case USCRIPT_##C: return HB_SCRIPT_##C
#define MATCH_SCRIPT2(C1, C2) case USCRIPT_##C1: return HB_SCRIPT_##C2
MATCH_SCRIPT (INVALID_CODE);
MATCH_SCRIPT (COMMON); /* Zyyy */
MATCH_SCRIPT (INHERITED); /* Qaai */
@ -198,6 +202,29 @@ hb_icu_get_script (hb_codepoint_t unicode)
MATCH_SCRIPT (CARIAN); /* Cari */
MATCH_SCRIPT (LYCIAN); /* Lyci */
MATCH_SCRIPT (LYDIAN); /* Lydi */
/* Unicode-5.2 additions */
MATCH_SCRIPT (AVESTAN); /* Avst */
#if CHECK_ICU_VERSION (4, 4)
MATCH_SCRIPT (BAMUM); /* Bamu */
#endif
MATCH_SCRIPT (EGYPTIAN_HIEROGLYPHS); /* Egyp */
MATCH_SCRIPT (IMPERIAL_ARAMAIC); /* Armi */
MATCH_SCRIPT (INSCRIPTIONAL_PAHLAVI); /* Phli */
MATCH_SCRIPT (INSCRIPTIONAL_PARTHIAN); /* Prti */
MATCH_SCRIPT (JAVANESE); /* Java */
MATCH_SCRIPT (KAITHI); /* Kthi */
MATCH_SCRIPT2(LANNA, TAI_THAM); /* Lana */
#if CHECK_ICU_VERSION (4, 4)
MATCH_SCRIPT (LISU); /* Lisu */
#endif
MATCH_SCRIPT (MEITEI_MAYEK); /* Mtei */
#if CHECK_ICU_VERSION (4, 4)
MATCH_SCRIPT (OLD_SOUTH_ARABIAN); /* Sarb */
#endif
MATCH_SCRIPT2(ORKHON, OLD_TURKIC); /* Orkh */
MATCH_SCRIPT (SAMARITAN); /* Samr */
MATCH_SCRIPT (TAI_VIET); /* Tavt */
}
return HB_SCRIPT_UNKNOWN;
}

View File

@ -120,7 +120,24 @@ static const hb_tag_t ot_scripts[][3] = {
{HB_TAG('v','a','i',' ')}, /* HB_SCRIPT_VAI */
{HB_TAG('c','a','r','i')}, /* HB_SCRIPT_CARIAN */
{HB_TAG('l','y','c','i')}, /* HB_SCRIPT_LYCIAN */
{HB_TAG('l','y','d','i')} /* HB_SCRIPT_LYDIAN */
{HB_TAG('l','y','d','i')}, /* HB_SCRIPT_LYDIAN */
/* Unicode-5.2 additions */
{HB_TAG('D','F','L','T')}, /* HB_SCRIPT_AVESTAN */
{HB_TAG('D','F','L','T')}, /* HB_SCRIPT_BAMUM */
{HB_TAG('D','F','L','T')}, /* HB_SCRIPT_EGYPTIAN_HIEROGLYPHS */
{HB_TAG('D','F','L','T')}, /* HB_SCRIPT_IMPERIAL_ARAMAIC */
{HB_TAG('D','F','L','T')}, /* HB_SCRIPT_INSCRIPTIONAL_PAHLAVI */
{HB_TAG('D','F','L','T')}, /* HB_SCRIPT_INSCRIPTIONAL_PARTHIAN */
{HB_TAG('j','a','v','a')}, /* HB_SCRIPT_JAVANESE */
{HB_TAG('D','F','L','T')}, /* HB_SCRIPT_KAITHI */
{HB_TAG('D','F','L','T')}, /* HB_SCRIPT_LISU */
{HB_TAG('D','F','L','T')}, /* HB_SCRIPT_MEITEI_MAYEK */
{HB_TAG('D','F','L','T')}, /* HB_SCRIPT_OLD_SOUTH_ARABIAN */
{HB_TAG('D','F','L','T')}, /* HB_SCRIPT_OLD_TURKIC */
{HB_TAG('D','F','L','T')}, /* HB_SCRIPT_SAMARITAN */
{HB_TAG('D','F','L','T')}, /* HB_SCRIPT_TAI_THAM */
{HB_TAG('D','F','L','T')} /* HB_SCRIPT_TAI_VIET */
};
const hb_tag_t *
@ -140,7 +157,7 @@ hb_ot_tag_to_script (hb_tag_t tag)
int i;
for (i = 0; i < ARRAY_LENGTH (ot_scripts); i++) {
hb_tag_t *p = ot_scripts[i];
const hb_tag_t *p = ot_scripts[i];
while (*p)
if (tag == *p)
return i;

View File

@ -286,7 +286,24 @@ const hb_direction_t horiz_dir[] =
LTR, /* Vaii */
LTR, /* Cari */
LTR, /* Lyci */
LTR /* Lydi */
LTR, /* Lydi */
/* Unicode-5.2 additions */
RTL, /* Avst */
LTR, /* Bamu */
LTR, /* Egyp */
RTL, /* Armi */
RTL, /* Phli */
RTL, /* Prti */
LTR, /* Java */
LTR, /* Kthi */
LTR, /* Lisu */
LTR, /* Mtei */
RTL, /* Sarb */
RTL, /* Orkh */
RTL, /* Samr */
LTR, /* Lana */
LTR /* Tavt */
};
#undef LTR
#undef RTL

View File

@ -155,7 +155,24 @@ typedef enum
HB_SCRIPT_VAI, /* Vaii */
HB_SCRIPT_CARIAN, /* Cari */
HB_SCRIPT_LYCIAN, /* Lyci */
HB_SCRIPT_LYDIAN /* Lydi */
HB_SCRIPT_LYDIAN, /* Lydi */
/* Unicode-5.2 additions */
HB_SCRIPT_AVESTAN, /* Avst */
HB_SCRIPT_BAMUM, /* Bamu */
HB_SCRIPT_EGYPTIAN_HIEROGLYPHS, /* Egyp */
HB_SCRIPT_IMPERIAL_ARAMAIC, /* Armi */
HB_SCRIPT_INSCRIPTIONAL_PAHLAVI, /* Phli */
HB_SCRIPT_INSCRIPTIONAL_PARTHIAN, /* Prti */
HB_SCRIPT_JAVANESE, /* Java */
HB_SCRIPT_KAITHI, /* Kthi */
HB_SCRIPT_LISU, /* Lisu */
HB_SCRIPT_MEITEI_MAYEK, /* Mtei */
HB_SCRIPT_OLD_SOUTH_ARABIAN, /* Sarb */
HB_SCRIPT_OLD_TURKIC, /* Orkh */
HB_SCRIPT_SAMARITAN, /* Samr */
HB_SCRIPT_TAI_THAM, /* Lana */
HB_SCRIPT_TAI_VIET /* Tavt */
} hb_script_t;