Patches for supporting Sinhala script
| Newsgroups | gmane.comp.lib.icu.general |
|---|---|
| Message-ID | <OF3EFEB5EB.C2CD1DF5-ON46256DA1.0030ABEF-46256DA1.0041A5B3@keells.com> |
Dear Sir, I have made the necessary amendments to IndicClassTables.cpp and LayoutEngine.cpp. I have also made a small modification to saveMatra() method in IndicReordering.cpp. This hack was done because in Sinhala there are two-part dependent vowel signs ( DIGA KOMBUVA (0x0DDA) & SINHALA VOWEL SIGN KOMBUVA HAA DIGA AELA-PILLA (0x0DDD) ) which are composed of a matra and a virama/halant sign, and when they are split and reordered the virama sign was getting dropped. I am not familiar with other indic scripts and what affect this will have on them so I just made this temp hack for my testing purposes. I was not quite sure about the script_flags so I just used the tamil script flags since Tamil script is very close to Sinhala. I have tested the shaper using Layoutsample and microsoft 'Iskoola pota' (beta) opentype font. If these patches are ok, I would like to update the pango code as well. My objective is to see Sinhala on Linux desktop. thank you. Yours sincerely, Harsha Senanayake. ps will these patches go into ICU4J? (See attached file: IndicClassTables.patch)(See attached file: IndicReordering.patch)(See attached file: LayoutEngine.patch)(See attached file: icu_sinhala.jpg) _____________________________________________________________________________________________________ CONFIDENTIALITY AND DISCLAIMER This communication is privileged and confidential, and is directed to and for the use of the addressee only. If this message reaches any person other than the intended recipient, we request such person to preserve its confidentiality, not read, reproduce, copy, disseminate or in any manner distribute it. We further request such recipient to notify us immediately by email that such message has been received and delete the original message. Please note that we reserve the right to monitor all email communications through our network. Home Page : www.keells.com __________________________________________
IndicClassTables.patch
(application/octet-stream, 2.5 KB)
--- layout.ori\IndicClassTables.cpp Wed Jun 04 02:58:22 2003
+++ layout\IndicClassTables.cpp Sun Sep 14 15:09:52 2003
@@ -177,6 +178,19 @@
_iv, _iv, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx // 0D60 - 0D6F
};
+
+static const IndicClassTable::CharClass sinhCharClasses[] =
+{
+ _xx, _xx, _ma, _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 - 0DB0
+ _ct, _ct, _xx, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _xx, _ct, _xx, _xx, // 0DB0 - 0DAF
+ _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, _ct // 0DF0 - 0DF4
+};
+
//
// Split matra tables
//
@@ -193,6 +207,8 @@
static const SplitMatra mlymSplitTable[] = {{0x0D46, 0x0D3E}, {0x0D47, 0x0D3E}, {0x0D46, 0x0D57}};
+static const SplitMatra sinhSplitTable[] = {{0x0DD9, 0x0DCA}, {0x0DD9, 0x0DCF}, {0x0DD9, 0x0DCF,0x0DCA}, {0x0DD9, 0x0DF3} };
+
//
// Script Flags
//
@@ -209,6 +225,7 @@
#define TELU_SCRIPT_FLAGS (IndicClassTable::SF_MATRAS_AFTER_BASE | 3)
#define KNDA_SCRIPT_FLAGS (IndicClassTable::SF_MATRAS_AFTER_BASE | 3)
#define MLYM_SCRIPT_FLAGS (IndicClassTable::SF_MPRE_FIXUP | IndicClassTable::SF_NO_POST_BASE_LIMIT)
+#define SINH_SCRIPT_FLAGS (IndicClassTable::SF_MPRE_FIXUP | IndicClassTable::SF_NO_POST_BASE_LIMIT)
//
// Indic Class Tables
@@ -231,6 +248,8 @@
static const IndicClassTable mlymClassTable = {0x0D00, 0x0D6F, 3, MLYM_SCRIPT_FLAGS, mlymCharClasses, mlymSplitTable};
+static const IndicClassTable sinhClassTable = {0x0D80, 0x0DF4, 3, SINH_SCRIPT_FLAGS, sinhCharClasses, sinhSplitTable};
+
//
// IndicClassTable addresses
//
@@ -268,7 +287,7 @@
NULL, /* 'ital' (OLD-ITALIC) */
&oryaClassTable, /* 'orya' (ORIYA) */
NULL, /* 'runr' (RUNIC) */
- NULL, /* 'sinh' (SINHALA) */
+ &sinhClassTable, /* 'sinh' (SINHALA) */
NULL, /* 'syrc' (SYRIAC) */
&tamlClassTable, /* 'taml' (TAMIL) */
&teluClassTable, /* 'telu' (TELUGU) */
IndicReordering.patch
(application/octet-stream, 591 B)
--- layout.ori\IndicReordering.cpp Wed Jun 04 02:58:22 2003
+++ layout\IndicReordering.cpp Sun Sep 14 15:53:18 2003
@@ -45,7 +45,7 @@
fMabove = matra;
} else if (IndicClassTable::isMpost(matraClass)) {
fMpost = matra;
- } else if (IndicClassTable::isLengthMark(matraClass)) {
+ } else if (IndicClassTable::isLengthMark(matraClass)||IndicClassTable::isVirama(matraClass)/*temp hack for Sinhala DIGA KOMBUVA (0x0DDA) & SINHALA VOWEL SIGN KOMBUVA HAA DIGA AELA-PILLA (0x0DDD) */) {
fLengthMark = matra;
}
}
LayoutEngine.patch
(application/octet-stream, 380 B)
--- layout.ori\LayoutEngine.cpp Thu Jun 05 04:39:18 2003
+++ layout\LayoutEngine.cpp Sat Sep 13 15:55:03 2003
@@ -424,6 +424,7 @@
case guruScriptCode:
case tamlScriptCode:
case teluScriptCode:
+ case sinhScriptCode:
result = new IndicOpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, gsubTable);
break;
icu_sinhala.jpg
(image/jpeg, 16.1 KB) - not displayed