summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBehdad Esfahbod <behdad@gnome.org>2006-10-12 18:45:30 +0000
committerBehdad Esfahbod <behdad@src.gnome.org>2006-10-12 18:45:30 +0000
commit49370acd3a526f325066c8ca7d9f9188bb2a0f00 (patch)
tree1ee091dbff4bd7113b5711e67b28c93f36596303
parent2013f4794f5c2d8a1b03c7184740c9195a48fdb2 (diff)
downloadpango-49370acd3a526f325066c8ca7d9f9188bb2a0f00.tar.gz
Bug 353877 – Sinhala is_cursor_position and backspace_deletes_character
2006-10-12 Behdad Esfahbod <behdad@gnome.org> Bug 353877 – Sinhala is_cursor_position and backspace_deletes_character issues Patch from Akira TAGOH * configure.in: * modules/indic/Makefile.am: * modules/indic/indic-lang.c: Add a simple Indic language engine.
-rw-r--r--ChangeLog10
-rw-r--r--configure.in4
-rw-r--r--modules/indic/Makefile.am18
-rw-r--r--modules/indic/indic-lang.c165
4 files changed, 196 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 57863eee..d5b0f186 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,15 @@
2006-10-12 Behdad Esfahbod <behdad@gnome.org>
+ Bug 353877 – Sinhala is_cursor_position and
+ backspace_deletes_character issues
+ Patch from Akira TAGOH
+
+ * configure.in:
+ * modules/indic/Makefile.am:
+ * modules/indic/indic-lang.c: Add a simple Indic language engine.
+
+2006-10-12 Behdad Esfahbod <behdad@gnome.org>
+
Bug 358224 – Telugu Character U+0C31 does not render its below-base
form.
Patch from Rahul Bhalerao
diff --git a/configure.in b/configure.in
index 6d71993e..2987ca06 100644
--- a/configure.in
+++ b/configure.in
@@ -398,7 +398,7 @@ arabic_modules="arabic-fc,arabic-lang"
basic_modules="basic-fc,basic-win32,basic-x,basic-atsui"
hangul_modules="hangul-fc"
hebrew_modules="hebrew-fc"
-indic_modules="indic-fc"
+indic_modules="indic-fc,indic-lang"
khmer_modules="khmer-fc"
syriac_modules="syriac-fc"
thai_modules="thai-fc"
@@ -480,6 +480,7 @@ AM_CONDITIONAL(INCLUDE_BASIC_ATSUI, echo $included_modules | egrep '(^|,)basic-a
AM_CONDITIONAL(INCLUDE_HANGUL_FC, echo $included_modules | egrep '(^|,)hangul-fc($|,)' > /dev/null)
AM_CONDITIONAL(INCLUDE_HEBREW_FC, echo $included_modules | egrep '(^|,)hebrew-fc($|,)' > /dev/null)
AM_CONDITIONAL(INCLUDE_INDIC_FC, echo $included_modules | egrep '(^|,)indic-fc($|,)' > /dev/null)
+AM_CONDITIONAL(INCLUDE_INDIC_LANG, echo $included_modules | egrep '(^|,)indic-lang($|,)' > /dev/null)
AM_CONDITIONAL(INCLUDE_KHMER_FC, echo $included_modules | egrep '(^|,)khmer-fc($|,)' > /dev/null)
AM_CONDITIONAL(INCLUDE_SYRIAC_FC, echo $included_modules | egrep '(^|,)syriac-fc($|,)' > /dev/null)
AM_CONDITIONAL(INCLUDE_THAI_FC, echo $included_modules | egrep '(^|,)thai-fc($|,)' > /dev/null)
@@ -494,6 +495,7 @@ AM_CONDITIONAL(DYNAMIC_BASIC_ATSUI, echo $dynamic_modules | egrep '(^|,)basic-at
AM_CONDITIONAL(DYNAMIC_HANGUL_FC, echo $dynamic_modules | egrep '(^|,)hangul-fc($|,)' > /dev/null)
AM_CONDITIONAL(DYNAMIC_HEBREW_FC, echo $dynamic_modules | egrep '(^|,)hebrew-fc($|,)' > /dev/null)
AM_CONDITIONAL(DYNAMIC_INDIC_FC, echo $dynamic_modules | egrep '(^|,)indic-fc($|,)' > /dev/null)
+AM_CONDITIONAL(DYNAMIC_INDIC_LANG, echo $dynamic_modules | egrep '(^|,)indic-lang($|,)' > /dev/null)
AM_CONDITIONAL(DYNAMIC_KHMER_FC, echo $dynamic_modules | egrep '(^|,)khmer-fc($|,)' > /dev/null)
AM_CONDITIONAL(DYNAMIC_SYRIAC_FC, echo $dynamic_modules | egrep '(^|,)syriac-fc($|,)' > /dev/null)
AM_CONDITIONAL(DYNAMIC_THAI_FC, echo $dynamic_modules | egrep '(^|,)thai-fc($|,)' > /dev/null)
diff --git a/modules/indic/Makefile.am b/modules/indic/Makefile.am
index f2b19197..76494e3c 100644
--- a/modules/indic/Makefile.am
+++ b/modules/indic/Makefile.am
@@ -24,3 +24,21 @@ pango_indic_fc_la_LIBADD = $(pangoft2libs)
pango_indic_fc_la_SOURCES = $(fc_sources)
libpango_indic_fc_la_SOURCES = $(fc_sources)
libpango_indic_fc_la_CFLAGS = -DPANGO_MODULE_PREFIX=_pango_indic_fc
+
+
+if INCLUDE_INDIC_LANG
+noinst_LTLIBRARIES += libpango-indic-lang.la
+else
+if DYNAMIC_INDIC_LANG
+module_LTLIBRARIES += pango-indic-lang.la
+endif
+endif
+
+lang_sources = \
+ indic-lang.c
+
+pango_indic_lang_la_LDFLAGS = -module $(MODULE_LIBTOOL_OPTIONS)
+pango_indic_lang_la_LIBADD = $(pangolibs)
+pango_indic_lang_la_SOURCES = $(lang_sources)
+libpango_indic_lang_la_SOURCES = $(lang_sources)
+libpango_indic_lang_la_CFLAGS = -DPANGO_MODULE_PREFIX=_pango_indic_lang
diff --git a/modules/indic/indic-lang.c b/modules/indic/indic-lang.c
new file mode 100644
index 00000000..c03b9184
--- /dev/null
+++ b/modules/indic/indic-lang.c
@@ -0,0 +1,165 @@
+/* Pango
+ * indic-lang.c:
+ *
+ * Copyright (C) 2006 Red Hat Software
+ * Author: Akira TAGOH <tagoh@redhat.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include <config.h>
+#include <string.h>
+
+#include "pango-engine.h"
+#include "pango-break.h"
+
+typedef PangoEngineLang IndicEngineLang;
+typedef PangoEngineLangClass IndicEngineLangClass;
+
+#define ENGINE_SUFFIX "IndicScriptEngineLang"
+#define RENDER_TYPE PANGO_RENDER_TYPE_NONE
+#define INDIC_ENGINE_INFO(script) \
+ {#script ENGINE_SUFFIX, PANGO_ENGINE_TYPE_LANG, RENDER_TYPE, script##_scripts, G_N_ELEMENTS(script##_scripts)}
+
+
+static PangoEngineScriptInfo deva_scripts[] = {
+ { PANGO_SCRIPT_DEVANAGARI, "*" }
+};
+
+static PangoEngineScriptInfo sinh_scripts[] = {
+ { PANGO_SCRIPT_SINHALA, "*" }
+};
+
+static PangoEngineInfo script_engines[] = {
+ INDIC_ENGINE_INFO(deva),
+ INDIC_ENGINE_INFO(sinh)
+};
+
+
+static void
+indic_engine_break (PangoEngineLang *engine,
+ const char *text,
+ int length,
+ PangoAnalysis *analysis,
+ PangoLogAttr *attrs,
+ int attrs_len)
+{
+ const gchar *p, *next = NULL, *next_next;
+ gunichar prev_wc, this_wc, next_wc, next_next_wc;
+ gboolean makes_rephaya_syllable = FALSE;
+ int i;
+
+ for (p = text, prev_wc = 0, i = 0;
+ p != NULL && p < (text + length);
+ p = next, prev_wc = this_wc, i++)
+ {
+ this_wc = g_utf8_get_char (p);
+ next = g_utf8_next_char (p);
+ if (next != NULL && next < (text + length))
+ {
+ next_wc = g_utf8_get_char (next);
+ next_next = g_utf8_next_char (next);
+ }
+ else
+ {
+ next_wc = 0;
+ next_next = NULL;
+ }
+ if (next_next != NULL && next_next < (text + length))
+ next_next_wc = g_utf8_get_char (next_next);
+ else
+ next_next_wc = 0;
+
+ if (prev_wc != 0 && this_wc == 0x0DBB &&
+ next_wc == 0x0DCA && next_next_wc == 0x200D)
+ {
+ /* Determine whether or not this forms a Rephaya syllable.
+ * SINHALA LETTER + U+0DBB U+0DCA U+200D + SINHALA LETTER is
+ * the kind of Rephaya.
+ */
+ makes_rephaya_syllable = TRUE;
+ attrs[i].is_cursor_position = FALSE;
+ attrs[i].is_char_break = FALSE;
+ attrs[i].is_line_break = FALSE;
+ attrs[i].is_mandatory_break = FALSE;
+ }
+ else if (prev_wc == 0x200D &&
+ (makes_rephaya_syllable || this_wc == 0x0DBB || this_wc == 0x0DBA))
+ {
+ /* fixes the cursor break in Sinhala.
+ * SINHALA LETTER + SINHALA VOWEL + ZWJ + 0x0DBB/0x0DBA is
+ * the kind of Rakaransaya/Yansaya. these characters has to
+ * be dealt as one character.
+ */
+ attrs[i].is_cursor_position = FALSE;
+ attrs[i].is_char_break = FALSE;
+ attrs[i].is_line_break = FALSE;
+ attrs[i].is_mandatory_break = FALSE;
+ makes_rephaya_syllable = FALSE;
+ }
+ else if (this_wc == 0x200D &&
+ ((makes_rephaya_syllable && next_wc != 0) ||
+ (next_wc == 0x0DBB || next_wc == 0x0DBA)))
+ {
+ attrs[i].is_cursor_position = FALSE;
+ attrs[i].is_char_break = FALSE;
+ attrs[i].is_line_break = FALSE;
+ attrs[i].is_mandatory_break = FALSE;
+ }
+ }
+}
+
+static void
+indic_engine_lang_class_init (PangoEngineLangClass *klass)
+{
+ klass->script_break = indic_engine_break;
+}
+
+PANGO_ENGINE_LANG_DEFINE_TYPE (IndicEngineLang, indic_engine_lang,
+ indic_engine_lang_class_init, NULL)
+
+void
+PANGO_MODULE_ENTRY(init) (GTypeModule *module)
+{
+ indic_engine_lang_register_type (module);
+}
+
+void
+PANGO_MODULE_ENTRY(exit) (void)
+{
+}
+
+void
+PANGO_MODULE_ENTRY(list) (PangoEngineInfo **engines,
+ int *n_engines)
+{
+ *engines = script_engines;
+ *n_engines = G_N_ELEMENTS (script_engines);
+}
+
+PangoEngine *
+PANGO_MODULE_ENTRY(create) (const char *id)
+{
+ guint i;
+
+ for (i = 0; i < G_N_ELEMENTS(script_engines); i++)
+ {
+ if (!strcmp (id, script_engines[i].id))
+ return g_object_new (indic_engine_lang_type, NULL);
+ }
+
+ return NULL;
+}