summaryrefslogtreecommitdiff
path: root/modules/indic
diff options
context:
space:
mode:
authorOwen Taylor <otaylor@redhat.com>2004-12-15 02:03:53 +0000
committerOwen Taylor <otaylor@src.gnome.org>2004-12-15 02:03:53 +0000
commit0c4b49df06146fdeb4af5ba5b04d62ca116b3998 (patch)
tree10ac4aeb7eddab6feef7edade35723d33847e5fa /modules/indic
parentb777d084ee081e06650eb7014d71b512370ed552 (diff)
downloadpango-0c4b49df06146fdeb4af5ba5b04d62ca116b3998.tar.gz
Sinhala support (#153517, Anuradha Ratnaweera)
Tue Dec 14 20:44:53 2004 Owen Taylor <otaylor@redhat.com> Sinhala support (#153517, Anuradha Ratnaweera) * modules/indic/indic-ot.h modules/indic/indic-fc.c modules/indic/indic-ot-class-tables.c: Add tables for Sinhala. * modules/indic/indic-ot.c (indic_ot_reorder): Add handling of Virama for two-part dependent vowels.
Diffstat (limited to 'modules/indic')
-rw-r--r--modules/indic/indic-fc.c11
-rw-r--r--modules/indic/indic-ot-class-tables.c20
-rw-r--r--modules/indic/indic-ot.c16
-rw-r--r--modules/indic/indic-ot.h1
4 files changed, 44 insertions, 4 deletions
diff --git a/modules/indic/indic-fc.c b/modules/indic/indic-fc.c
index 4fab97cc..721e974b 100644
--- a/modules/indic/indic-fc.c
+++ b/modules/indic/indic-fc.c
@@ -65,6 +65,7 @@ struct _PangoIndicInfo
#define OT_TAG_telu FT_MAKE_TAG('t','e','l','u')
#define OT_TAG_knda FT_MAKE_TAG('k','n','d','a')
#define OT_TAG_mlym FT_MAKE_TAG('m','l','y','m')
+#define OT_TAG_sinh FT_MAKE_TAG('s','i','n','h')
static PangoEngineScriptInfo deva_scripts[] = {
{ PANGO_SCRIPT_DEVANAGARI, "*" }
@@ -102,10 +103,15 @@ static PangoEngineScriptInfo mlym_scripts[] = {
{ PANGO_SCRIPT_MALAYALAM, "*" }
};
+static PangoEngineScriptInfo sinh_scripts[] = {
+ { PANGO_SCRIPT_SINHALA, "*" }
+};
+
static PangoEngineInfo script_engines[] = {
INDIC_ENGINE_INFO(deva), INDIC_ENGINE_INFO(beng), INDIC_ENGINE_INFO(guru),
INDIC_ENGINE_INFO(gujr), INDIC_ENGINE_INFO(orya), INDIC_ENGINE_INFO(taml),
- INDIC_ENGINE_INFO(telu), INDIC_ENGINE_INFO(knda), INDIC_ENGINE_INFO(mlym)
+ INDIC_ENGINE_INFO(telu), INDIC_ENGINE_INFO(knda), INDIC_ENGINE_INFO(mlym),
+ INDIC_ENGINE_INFO(sinh)
};
/*
@@ -119,7 +125,8 @@ static PangoEngineInfo script_engines[] = {
static PangoIndicInfo indic_info[] = {
PANGO_INDIC_INFO(deva), PANGO_INDIC_INFO(beng), PANGO_INDIC_INFO(guru),
PANGO_INDIC_INFO(gujr), PANGO_INDIC_INFO(orya), PANGO_INDIC_INFO(taml),
- PANGO_INDIC_INFO(telu), PANGO_INDIC_INFO(knda), PANGO_INDIC_INFO(mlym)
+ PANGO_INDIC_INFO(telu), PANGO_INDIC_INFO(knda), PANGO_INDIC_INFO(mlym),
+ PANGO_INDIC_INFO(sinh)
};
static void
diff --git a/modules/indic/indic-ot-class-tables.c b/modules/indic/indic-ot-class-tables.c
index d159f95d..20d92ddd 100644
--- a/modules/indic/indic-ot-class-tables.c
+++ b/modules/indic/indic-ot-class-tables.c
@@ -192,6 +192,19 @@ static IndicOTCharClass mlymCharClasses[] =
_iv, _iv, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx /* 0D60 - 0D6F */
};
+static IndicOTCharClass 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 */
+};
+
+
/*
* Split matra tables
*/
@@ -208,6 +221,10 @@ static const IndicOTSplitMatra kndaSplitTable[] = {{0x0CBF, 0x0CD5}, {0x0CC6, 0x
static const IndicOTSplitMatra mlymSplitTable[] = {{0x0D46, 0x0D3E}, {0x0D47, 0x0D3E}, {0x0D46, 0x0D57}};
+static const IndicOTSplitMatra sinhSplitTable[] = {{0x0DD9, 0x0DCA}, {0x0DD9, 0x0DCF}, {0x0DD9, 0x0DCF, 0x0DCA},
+ {0x0DD9, 0x0DF3} };
+
+
/*
* Script Flags
*/
@@ -226,6 +243,7 @@ static const IndicOTSplitMatra mlymSplitTable[] = {{0x0D46, 0x0D3E}, {0x0D47, 0x
#define TELU_SCRIPT_FLAGS (SF_MATRAS_AFTER_BASE | 3)
#define KNDA_SCRIPT_FLAGS (SF_MATRAS_AFTER_BASE | 3)
#define MLYM_SCRIPT_FLAGS (SF_MPRE_FIXUP | SF_NO_POST_BASE_LIMIT)
+#define SINH_SCRIPT_FLAGS (SF_MPRE_FIXUP | SF_NO_POST_BASE_LIMIT)
/*
* Indic Class Tables
@@ -248,6 +266,8 @@ IndicOTClassTable knda_class_table = {0x0C80, 0x0CEF, 4, KNDA_SCRIPT_FLAGS, knda
IndicOTClassTable mlym_class_table = {0x0D00, 0x0D6F, 3, MLYM_SCRIPT_FLAGS, mlymCharClasses, mlymSplitTable};
+IndicOTClassTable sinh_class_table = {0x0D80, 0x0DF4, 3, SINH_SCRIPT_FLAGS, sinhCharClasses, sinhSplitTable};
+
const IndicOTSplitMatra *indic_ot_get_split_matra(const IndicOTClassTable *class_table, IndicOTCharClass char_class)
{
gint32 index = (char_class & CF_INDEX_MASK) >> CF_INDEX_SHIFT;
diff --git a/modules/indic/indic-ot.c b/modules/indic/indic-ot.c
index 941688f1..159cecdc 100644
--- a/modules/indic/indic-ot.c
+++ b/modules/indic/indic-ot.c
@@ -29,6 +29,7 @@ struct _Output
gunichar fMabove;
gunichar fMpost;
gunichar fLengthMark;
+ gunichar fVirama; /* to handle virama in sinhala split matras */
glong fMatraIndex;
gulong fMatraTags;
gboolean fMatraWordStart;
@@ -50,7 +51,7 @@ static void initOutput(Output *output, const glong *originalOffsets, gunichar *o
output->fOutIndex = 0;
output->fMatraTags = 0;
- output->fMpre = output->fMbelow = output->fMabove = output->fMpost = output->fLengthMark = 0;
+ output->fMpre = output->fMbelow = output->fMabove = output->fMpost = output->fLengthMark = output->fVirama = 0;
output->fMPreOutIndex = -1;
output->fMPreFixups = mpreFixups;
@@ -69,12 +70,14 @@ static void saveMatra(Output *output, gunichar matra, IndicOTCharClass matraClas
output->fMpost = matra;
} else if (IS_LENGTH_MARK(matraClass)) {
output->fLengthMark = matra;
+ } else if (IS_VIRAMA(matraClass)) {
+ output->fVirama = matra;
}
}
static void initMatra(Output *output, guint32 matraIndex, gulong matraTags, gboolean wordStart)
{
- output->fMpre = output->fMbelow = output->fMabove = output->fMpost = output->fLengthMark = 0;
+ output->fMpre = output->fMbelow = output->fMabove = output->fMpost = output->fLengthMark = output->fVirama = 0;
output->fMPreOutIndex = -1;
output->fMatraIndex = matraIndex;
output->fMatraTags = matraTags;
@@ -162,6 +165,13 @@ static void writeLengthMark(Output *output)
}
}
+static void writeVirama(Output *output)
+{
+ if (output->fVirama != 0) {
+ writeChar(output, output->fVirama, output->fMatraIndex, output->fMatraTags);
+ }
+}
+
static glong getOutputIndex(Output *output)
{
return output->fOutIndex;
@@ -230,6 +240,7 @@ glong indic_ot_reorder(const gunichar *chars, const glong *utf8_offsets, glong c
writeMabove(&output);
writeMpost(&output);
writeLengthMark(&output);
+ writeVirama(&output);
break;
case CC_CONSONANT:
@@ -414,6 +425,7 @@ glong indic_ot_reorder(const gunichar *chars, const glong *utf8_offsets, glong c
}
writeLengthMark(&output);
+ writeVirama(&output);
/* write reph */
if ((class_table->scriptFlags & SF_REPH_AFTER_BELOW) == 0) {
diff --git a/modules/indic/indic-ot.h b/modules/indic/indic-ot.h
index 3337fe0e..f7d13559 100644
--- a/modules/indic/indic-ot.h
+++ b/modules/indic/indic-ot.h
@@ -197,6 +197,7 @@ extern IndicOTClassTable taml_class_table;
extern IndicOTClassTable telu_class_table;
extern IndicOTClassTable knda_class_table;
extern IndicOTClassTable mlym_class_table;
+extern IndicOTClassTable sinh_class_table;
const IndicOTSplitMatra *indic_ot_get_split_matra(const IndicOTClassTable *class_table, IndicOTCharClass char_class);