summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBehdad Esfahbod <behdad@gnome.org>2006-10-12 18:15:25 +0000
committerBehdad Esfahbod <behdad@src.gnome.org>2006-10-12 18:15:25 +0000
commitc942fbcdc4949ea06b655bb3b2839a2bf42d610f (patch)
tree0b7df7afc9349397bb8a4e06320214be168f3857
parent687eb42f8686c125eb6af5b1bba6a2790026aa03 (diff)
downloadpango-c942fbcdc4949ea06b655bb3b2839a2bf42d610f.tar.gz
Backport the Arabic lang engine from HEAD.
2006-10-12 Behdad Esfahbod <behdad@gnome.org> * configure.in: * modules/arabic/Makefile.am: * modules/arabic/arabic-lang.c: Backport the Arabic lang engine from HEAD.
-rw-r--r--ChangeLog7
-rw-r--r--configure.in4
-rw-r--r--modules/arabic/Makefile.am18
-rw-r--r--modules/arabic/arabic-lang.c120
4 files changed, 148 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 8c1d9ae6..82dc91a1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
2006-10-12 Behdad Esfahbod <behdad@gnome.org>
+ * configure.in:
+ * modules/arabic/Makefile.am:
+ * modules/arabic/arabic-lang.c: Backport the Arabic lang engine from
+ HEAD.
+
+2006-10-12 Behdad Esfahbod <behdad@gnome.org>
+
* pango/break.c (pango_default_break), (tailor_break),
(pango_break), (pango_find_paragraph_boundary), (tailor_segment),
(pango_get_log_attrs): Backport (copy) break.c from HEAD. This makes
diff --git a/configure.in b/configure.in
index 5c3b99e8..6d71993e 100644
--- a/configure.in
+++ b/configure.in
@@ -394,7 +394,7 @@ fi
#
# Modules to build
#
-arabic_modules="arabic-fc"
+arabic_modules="arabic-fc,arabic-lang"
basic_modules="basic-fc,basic-win32,basic-x,basic-atsui"
hangul_modules="hangul-fc"
hebrew_modules="hebrew-fc"
@@ -472,6 +472,7 @@ done
IFS="$pango_save_ifs"
AM_CONDITIONAL(INCLUDE_ARABIC_FC, echo $included_modules | egrep '(^|,)arabic-fc($|,)' > /dev/null)
+AM_CONDITIONAL(INCLUDE_ARABIC_LANG, echo $included_modules | egrep '(^|,)arabic-lang($|,)' > /dev/null)
AM_CONDITIONAL(INCLUDE_BASIC_FC, echo $included_modules | egrep '(^|,)basic-fc($|,)' > /dev/null)
AM_CONDITIONAL(INCLUDE_BASIC_WIN32, echo $included_modules | egrep '(^|,)basic-win32($|,)' > /dev/null)
AM_CONDITIONAL(INCLUDE_BASIC_X, echo $included_modules | egrep '(^|,)basic-x($|,)' > /dev/null)
@@ -485,6 +486,7 @@ AM_CONDITIONAL(INCLUDE_THAI_FC, echo $included_modules | egrep '(^|,)thai-fc($|
AM_CONDITIONAL(INCLUDE_TIBETAN_FC, echo $included_modules | egrep '(^|,)tibetan-fc($|,)' > /dev/null)
AM_CONDITIONAL(DYNAMIC_ARABIC_FC, echo $dynamic_modules | egrep '(^|,)arabic-fc($|,)' > /dev/null)
+AM_CONDITIONAL(DYNAMIC_ARABIC_LANG, echo $dynamic_modules | egrep '(^|,)arabic-lang($|,)' > /dev/null)
AM_CONDITIONAL(DYNAMIC_BASIC_FC, echo $dynamic_modules | egrep '(^|,)basic-fc($|,)' > /dev/null)
AM_CONDITIONAL(DYNAMIC_BASIC_WIN32, echo $dynamic_modules | egrep '(^|,)basic-win32($|,)' > /dev/null)
AM_CONDITIONAL(DYNAMIC_BASIC_X, echo $dynamic_modules | egrep '(^|,)basic-x($|,)' > /dev/null)
diff --git a/modules/arabic/Makefile.am b/modules/arabic/Makefile.am
index ca129b8d..26b232eb 100644
--- a/modules/arabic/Makefile.am
+++ b/modules/arabic/Makefile.am
@@ -21,3 +21,21 @@ pango_arabic_fc_la_LIBADD = $(pangoft2libs)
pango_arabic_fc_la_SOURCES = $(fc_sources)
libpango_arabic_fc_la_SOURCES = $(fc_sources)
libpango_arabic_fc_la_CFLAGS = -DPANGO_MODULE_PREFIX=_pango_arabic_fc
+
+
+if INCLUDE_ARABIC_LANG
+noinst_LTLIBRARIES += libpango-arabic-lang.la
+else
+if DYNAMIC_ARABIC_LANG
+module_LTLIBRARIES += pango-arabic-lang.la
+endif
+endif
+
+lang_sources = \
+ arabic-lang.c
+
+pango_arabic_lang_la_LDFLAGS = -module $(MODULE_LIBTOOL_OPTIONS)
+pango_arabic_lang_la_LIBADD = $(pangolibs)
+pango_arabic_lang_la_SOURCES = $(lang_sources)
+libpango_arabic_lang_la_SOURCES = $(lang_sources)
+libpango_arabic_lang_la_CFLAGS = -DPANGO_MODULE_PREFIX=_pango_arabic_lang
diff --git a/modules/arabic/arabic-lang.c b/modules/arabic/arabic-lang.c
new file mode 100644
index 00000000..fc3b8795
--- /dev/null
+++ b/modules/arabic/arabic-lang.c
@@ -0,0 +1,120 @@
+/* Pango
+ * arabic-fc.h:
+ *
+ * Copyright (C) 2006 Red Hat Software
+ * Author: Behdad Esfahbod <besfahbo@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 "arabic-ot.h"
+
+#include "pango-engine.h"
+#include "pango-break.h"
+
+/* No extra fields needed */
+typedef PangoEngineLang ArabicEngineLang;
+typedef PangoEngineLangClass ArabicEngineLangClass ;
+
+#define SCRIPT_ENGINE_NAME "ArabicScriptEngineLang"
+#define RENDER_TYPE PANGO_RENDER_TYPE_NONE
+
+static PangoEngineScriptInfo arabic_scripts[] = {
+ { PANGO_SCRIPT_ARABIC, "*" },
+};
+
+static PangoEngineInfo script_engines[] = {
+ {
+ SCRIPT_ENGINE_NAME,
+ PANGO_ENGINE_TYPE_LANG,
+ RENDER_TYPE,
+ arabic_scripts, G_N_ELEMENTS(arabic_scripts)
+ }
+};
+
+
+static void
+arabic_engine_break (PangoEngineLang *engine,
+ const char *text,
+ int length,
+ PangoAnalysis *analysis,
+ PangoLogAttr *attrs,
+ int attrs_len)
+{
+ int i;
+ const char *p;
+ gunichar prev_wc, this_wc;
+
+ /* See http://bugzilla.gnome.org/show_bug.cgi?id=350132 for issues this
+ * module tries to solve.
+ */
+
+ for (p = text, i = 0, prev_wc = 0;
+ p < text + length;
+ p = g_utf8_next_char (p), i++, prev_wc = this_wc)
+ {
+ this_wc = g_utf8_get_char (p);
+
+ /*
+ * Unset backspace_deletes_character for various combinations:
+ */
+ if (G_UNLIKELY (
+ this_wc == 0x0622 /* ARABIC LETTER ALEF WITH MADDA ABOVE */ ||
+ (prev_wc == 0x0627 /* ARABIC LETTER ALEF */ && this_wc == 0x0653 /* ARABIC MADDAH ABOVE */)
+ ))
+ attrs[i+1].backspace_deletes_character = FALSE;
+ }
+}
+
+static void
+arabic_engine_lang_class_init (PangoEngineLangClass *class)
+{
+ class->script_break = arabic_engine_break;
+}
+
+PANGO_ENGINE_LANG_DEFINE_TYPE (ArabicEngineLang, arabic_engine_lang,
+ arabic_engine_lang_class_init, NULL)
+
+void
+PANGO_MODULE_ENTRY(init) (GTypeModule *module)
+{
+ arabic_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)
+{
+ if (!strcmp (id, SCRIPT_ENGINE_NAME))
+ return g_object_new (arabic_engine_lang_type, NULL);
+ else
+ return NULL;
+}