summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog33
-rw-r--r--ChangeLog.pre-1-033
-rw-r--r--ChangeLog.pre-1-1033
-rw-r--r--ChangeLog.pre-1-233
-rw-r--r--ChangeLog.pre-1-433
-rw-r--r--ChangeLog.pre-1-633
-rw-r--r--ChangeLog.pre-1-833
-rw-r--r--configure.in56
-rw-r--r--modules/arabic/Makefile.am20
-rw-r--r--modules/arabic/arabic-x.c4
-rw-r--r--modules/arabic/arabic.c362
-rw-r--r--modules/basic/Makefile.am18
-rw-r--r--modules/basic/basic-x.c4
-rw-r--r--modules/basic/basic.c505
-rw-r--r--modules/hangul/Makefile.am16
-rw-r--r--modules/hangul/hangul-x.c4
-rw-r--r--modules/hangul/hangul.c760
-rw-r--r--modules/indic/Makefile.am106
-rw-r--r--modules/indic/bengali-x.c4
-rw-r--r--modules/indic/bengali.c314
-rw-r--r--modules/indic/devanagari-x.c4
-rw-r--r--modules/indic/devanagari.c366
-rw-r--r--modules/indic/gujarati-x.c4
-rw-r--r--modules/indic/gujarati.c342
-rw-r--r--modules/indic/gurmukhi-x.c4
-rw-r--r--modules/indic/gurmukhi.c256
-rw-r--r--modules/indic/myanmar-x.c4
-rw-r--r--modules/indic/myanmar.c236
-rw-r--r--modules/tamil/Makefile.am16
-rw-r--r--modules/tamil/tamil-x.c4
-rw-r--r--modules/tamil/tamil.c215
-rw-r--r--modules/thai/Makefile.am18
-rw-r--r--modules/thai/thai-x.c6
-rw-r--r--modules/thai/thai.c903
34 files changed, 377 insertions, 4405 deletions
diff --git a/ChangeLog b/ChangeLog
index 8309c780..d983b965 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,39 @@
2001-01-03 Alexander Larsson <alexl@redhat.com>
* configure.in:
+ * modules/arabic/Makefile.am:
+ * modules/arabic/arabic-x.c:
+ * modules/basic/Makefile.am:
+ * modules/basic/basic-x.c:
+ * modules/hangul/Makefile.am:
+ * modules/hangul/hangul-x.c:
+ * modules/indic/Makefile.am:
+ * modules/indic/bengali-x.c:
+ * modules/indic/devanagari-x.c:
+ * modules/indic/gujarati-x.c:
+ * modules/indic/gurmukhi-x.c:
+ * modules/indic/myanmar-x.c:
+ * modules/tamil/Makefile.am:
+ * modules/tamil/tamil-x.c:
+ * modules/thai/Makefile.am:
+ * modules/thai/thai-x.c:
+ Rename all x modules from abc to abc-x.
+
+ * modules/arabic/arabic.c:
+ * modules/basic/basic.c:
+ * modules/hangul/hangul.c:
+ * modules/indic/bengali.c:
+ * modules/indic/devanagari.c:
+ * modules/indic/gujarati.c:
+ * modules/indic/gurmukhi.c:
+ * modules/indic/myanmar.c:
+ * modules/tamil/tamil.c:
+ * modules/thai/thai.c:
+ These were all copied to file-x.c and then removed.
+
+2001-01-03 Alexander Larsson <alexl@redhat.com>
+
+ * configure.in:
Update the default list of included modules for
--with-included-modules=yes to include all new modules.
Split INCLUDED_MODULES and module-defs.c into per shaper
diff --git a/ChangeLog.pre-1-0 b/ChangeLog.pre-1-0
index 8309c780..d983b965 100644
--- a/ChangeLog.pre-1-0
+++ b/ChangeLog.pre-1-0
@@ -1,6 +1,39 @@
2001-01-03 Alexander Larsson <alexl@redhat.com>
* configure.in:
+ * modules/arabic/Makefile.am:
+ * modules/arabic/arabic-x.c:
+ * modules/basic/Makefile.am:
+ * modules/basic/basic-x.c:
+ * modules/hangul/Makefile.am:
+ * modules/hangul/hangul-x.c:
+ * modules/indic/Makefile.am:
+ * modules/indic/bengali-x.c:
+ * modules/indic/devanagari-x.c:
+ * modules/indic/gujarati-x.c:
+ * modules/indic/gurmukhi-x.c:
+ * modules/indic/myanmar-x.c:
+ * modules/tamil/Makefile.am:
+ * modules/tamil/tamil-x.c:
+ * modules/thai/Makefile.am:
+ * modules/thai/thai-x.c:
+ Rename all x modules from abc to abc-x.
+
+ * modules/arabic/arabic.c:
+ * modules/basic/basic.c:
+ * modules/hangul/hangul.c:
+ * modules/indic/bengali.c:
+ * modules/indic/devanagari.c:
+ * modules/indic/gujarati.c:
+ * modules/indic/gurmukhi.c:
+ * modules/indic/myanmar.c:
+ * modules/tamil/tamil.c:
+ * modules/thai/thai.c:
+ These were all copied to file-x.c and then removed.
+
+2001-01-03 Alexander Larsson <alexl@redhat.com>
+
+ * configure.in:
Update the default list of included modules for
--with-included-modules=yes to include all new modules.
Split INCLUDED_MODULES and module-defs.c into per shaper
diff --git a/ChangeLog.pre-1-10 b/ChangeLog.pre-1-10
index 8309c780..d983b965 100644
--- a/ChangeLog.pre-1-10
+++ b/ChangeLog.pre-1-10
@@ -1,6 +1,39 @@
2001-01-03 Alexander Larsson <alexl@redhat.com>
* configure.in:
+ * modules/arabic/Makefile.am:
+ * modules/arabic/arabic-x.c:
+ * modules/basic/Makefile.am:
+ * modules/basic/basic-x.c:
+ * modules/hangul/Makefile.am:
+ * modules/hangul/hangul-x.c:
+ * modules/indic/Makefile.am:
+ * modules/indic/bengali-x.c:
+ * modules/indic/devanagari-x.c:
+ * modules/indic/gujarati-x.c:
+ * modules/indic/gurmukhi-x.c:
+ * modules/indic/myanmar-x.c:
+ * modules/tamil/Makefile.am:
+ * modules/tamil/tamil-x.c:
+ * modules/thai/Makefile.am:
+ * modules/thai/thai-x.c:
+ Rename all x modules from abc to abc-x.
+
+ * modules/arabic/arabic.c:
+ * modules/basic/basic.c:
+ * modules/hangul/hangul.c:
+ * modules/indic/bengali.c:
+ * modules/indic/devanagari.c:
+ * modules/indic/gujarati.c:
+ * modules/indic/gurmukhi.c:
+ * modules/indic/myanmar.c:
+ * modules/tamil/tamil.c:
+ * modules/thai/thai.c:
+ These were all copied to file-x.c and then removed.
+
+2001-01-03 Alexander Larsson <alexl@redhat.com>
+
+ * configure.in:
Update the default list of included modules for
--with-included-modules=yes to include all new modules.
Split INCLUDED_MODULES and module-defs.c into per shaper
diff --git a/ChangeLog.pre-1-2 b/ChangeLog.pre-1-2
index 8309c780..d983b965 100644
--- a/ChangeLog.pre-1-2
+++ b/ChangeLog.pre-1-2
@@ -1,6 +1,39 @@
2001-01-03 Alexander Larsson <alexl@redhat.com>
* configure.in:
+ * modules/arabic/Makefile.am:
+ * modules/arabic/arabic-x.c:
+ * modules/basic/Makefile.am:
+ * modules/basic/basic-x.c:
+ * modules/hangul/Makefile.am:
+ * modules/hangul/hangul-x.c:
+ * modules/indic/Makefile.am:
+ * modules/indic/bengali-x.c:
+ * modules/indic/devanagari-x.c:
+ * modules/indic/gujarati-x.c:
+ * modules/indic/gurmukhi-x.c:
+ * modules/indic/myanmar-x.c:
+ * modules/tamil/Makefile.am:
+ * modules/tamil/tamil-x.c:
+ * modules/thai/Makefile.am:
+ * modules/thai/thai-x.c:
+ Rename all x modules from abc to abc-x.
+
+ * modules/arabic/arabic.c:
+ * modules/basic/basic.c:
+ * modules/hangul/hangul.c:
+ * modules/indic/bengali.c:
+ * modules/indic/devanagari.c:
+ * modules/indic/gujarati.c:
+ * modules/indic/gurmukhi.c:
+ * modules/indic/myanmar.c:
+ * modules/tamil/tamil.c:
+ * modules/thai/thai.c:
+ These were all copied to file-x.c and then removed.
+
+2001-01-03 Alexander Larsson <alexl@redhat.com>
+
+ * configure.in:
Update the default list of included modules for
--with-included-modules=yes to include all new modules.
Split INCLUDED_MODULES and module-defs.c into per shaper
diff --git a/ChangeLog.pre-1-4 b/ChangeLog.pre-1-4
index 8309c780..d983b965 100644
--- a/ChangeLog.pre-1-4
+++ b/ChangeLog.pre-1-4
@@ -1,6 +1,39 @@
2001-01-03 Alexander Larsson <alexl@redhat.com>
* configure.in:
+ * modules/arabic/Makefile.am:
+ * modules/arabic/arabic-x.c:
+ * modules/basic/Makefile.am:
+ * modules/basic/basic-x.c:
+ * modules/hangul/Makefile.am:
+ * modules/hangul/hangul-x.c:
+ * modules/indic/Makefile.am:
+ * modules/indic/bengali-x.c:
+ * modules/indic/devanagari-x.c:
+ * modules/indic/gujarati-x.c:
+ * modules/indic/gurmukhi-x.c:
+ * modules/indic/myanmar-x.c:
+ * modules/tamil/Makefile.am:
+ * modules/tamil/tamil-x.c:
+ * modules/thai/Makefile.am:
+ * modules/thai/thai-x.c:
+ Rename all x modules from abc to abc-x.
+
+ * modules/arabic/arabic.c:
+ * modules/basic/basic.c:
+ * modules/hangul/hangul.c:
+ * modules/indic/bengali.c:
+ * modules/indic/devanagari.c:
+ * modules/indic/gujarati.c:
+ * modules/indic/gurmukhi.c:
+ * modules/indic/myanmar.c:
+ * modules/tamil/tamil.c:
+ * modules/thai/thai.c:
+ These were all copied to file-x.c and then removed.
+
+2001-01-03 Alexander Larsson <alexl@redhat.com>
+
+ * configure.in:
Update the default list of included modules for
--with-included-modules=yes to include all new modules.
Split INCLUDED_MODULES and module-defs.c into per shaper
diff --git a/ChangeLog.pre-1-6 b/ChangeLog.pre-1-6
index 8309c780..d983b965 100644
--- a/ChangeLog.pre-1-6
+++ b/ChangeLog.pre-1-6
@@ -1,6 +1,39 @@
2001-01-03 Alexander Larsson <alexl@redhat.com>
* configure.in:
+ * modules/arabic/Makefile.am:
+ * modules/arabic/arabic-x.c:
+ * modules/basic/Makefile.am:
+ * modules/basic/basic-x.c:
+ * modules/hangul/Makefile.am:
+ * modules/hangul/hangul-x.c:
+ * modules/indic/Makefile.am:
+ * modules/indic/bengali-x.c:
+ * modules/indic/devanagari-x.c:
+ * modules/indic/gujarati-x.c:
+ * modules/indic/gurmukhi-x.c:
+ * modules/indic/myanmar-x.c:
+ * modules/tamil/Makefile.am:
+ * modules/tamil/tamil-x.c:
+ * modules/thai/Makefile.am:
+ * modules/thai/thai-x.c:
+ Rename all x modules from abc to abc-x.
+
+ * modules/arabic/arabic.c:
+ * modules/basic/basic.c:
+ * modules/hangul/hangul.c:
+ * modules/indic/bengali.c:
+ * modules/indic/devanagari.c:
+ * modules/indic/gujarati.c:
+ * modules/indic/gurmukhi.c:
+ * modules/indic/myanmar.c:
+ * modules/tamil/tamil.c:
+ * modules/thai/thai.c:
+ These were all copied to file-x.c and then removed.
+
+2001-01-03 Alexander Larsson <alexl@redhat.com>
+
+ * configure.in:
Update the default list of included modules for
--with-included-modules=yes to include all new modules.
Split INCLUDED_MODULES and module-defs.c into per shaper
diff --git a/ChangeLog.pre-1-8 b/ChangeLog.pre-1-8
index 8309c780..d983b965 100644
--- a/ChangeLog.pre-1-8
+++ b/ChangeLog.pre-1-8
@@ -1,6 +1,39 @@
2001-01-03 Alexander Larsson <alexl@redhat.com>
* configure.in:
+ * modules/arabic/Makefile.am:
+ * modules/arabic/arabic-x.c:
+ * modules/basic/Makefile.am:
+ * modules/basic/basic-x.c:
+ * modules/hangul/Makefile.am:
+ * modules/hangul/hangul-x.c:
+ * modules/indic/Makefile.am:
+ * modules/indic/bengali-x.c:
+ * modules/indic/devanagari-x.c:
+ * modules/indic/gujarati-x.c:
+ * modules/indic/gurmukhi-x.c:
+ * modules/indic/myanmar-x.c:
+ * modules/tamil/Makefile.am:
+ * modules/tamil/tamil-x.c:
+ * modules/thai/Makefile.am:
+ * modules/thai/thai-x.c:
+ Rename all x modules from abc to abc-x.
+
+ * modules/arabic/arabic.c:
+ * modules/basic/basic.c:
+ * modules/hangul/hangul.c:
+ * modules/indic/bengali.c:
+ * modules/indic/devanagari.c:
+ * modules/indic/gujarati.c:
+ * modules/indic/gurmukhi.c:
+ * modules/indic/myanmar.c:
+ * modules/tamil/tamil.c:
+ * modules/thai/thai.c:
+ These were all copied to file-x.c and then removed.
+
+2001-01-03 Alexander Larsson <alexl@redhat.com>
+
+ * configure.in:
Update the default list of included modules for
--with-included-modules=yes to include all new modules.
Split INCLUDED_MODULES and module-defs.c into per shaper
diff --git a/configure.in b/configure.in
index 7c977d0a..ebef855b 100644
--- a/configure.in
+++ b/configure.in
@@ -145,8 +145,8 @@ AC_MSG_CHECKING(modules to link statically)
AC_ARG_WITH(included_modules, [ --with-included-modules=MODULE1,MODULE2,... Build the given modules into Pango])
-indic_modules="gurmukhi,bengali,gujarati,devanagari,myanmar"
-all_modules="arabic,arabic-xft,basic,basic-ft2,basic-xft,hangul,tamil,thai,$indic_modules"
+indic_modules="gurmukhi-x,bengali-x,gujarati-x,devanagari-x,myanmar-x"
+all_modules="arabic-x,arabic-xft,basic-x,basic-ft2,basic-xft,hangul-x,tamil-x,thai-x,$indic_modules"
included_modules=""
if test "x$with_included_modules" != xno || test "x$with_included_modules" = x ; then
@@ -166,22 +166,20 @@ INCLUDED_XFT_MODULES=
INCLUDED_FT2_MODULES=
IFS="${IFS= }"; pango_save_ifs="$IFS"; IFS=","
for module in $included_modules; do
- if ! (echo "$all_modules" | grep "\(^\|,\)$module\(\$\|,\)" > /dev/null); then
- AC_MSG_ERROR([the specified module $module does not exist])
+ if echo $indic_modules | grep "\(^\| \)$module\(\$\| \)" > /dev/null; then
+ dir=indic
else
- if echo $indic_modules | grep "\(^\| \)$module\(\$\| \)" > /dev/null; then
- dir=indic
- else
- dir=`echo $module | sed "s/-.*//"`
- fi
+ dir=`echo $module | sed "s/-.*//"`
+ fi
- if echo $module | grep -- "-xft" > /dev/null; then
- INCLUDED_XFT_MODULES="$INCLUDED_XFT_MODULES \$(top_builddir)/modules/$dir/libpango-$module.la"
- elif echo $module | grep -- "-ft2" > /dev/null; then
- INCLUDED_FT2_MODULES="$INCLUDED_FT2_MODULES \$(top_builddir)/modules/$dir/libpango-$module.la"
- else
- INCLUDED_X_MODULES="$INCLUDED_X_MODULES \$(top_builddir)/modules/$dir/libpango-$module.la"
- fi
+ if echo $module | grep -- "-xft\($\|,\)" > /dev/null; then
+ INCLUDED_XFT_MODULES="$INCLUDED_XFT_MODULES \$(top_builddir)/modules/$dir/libpango-$module.la"
+ elif echo $module | grep -- "-ft2\($\|,\)" > /dev/null; then
+ INCLUDED_FT2_MODULES="$INCLUDED_FT2_MODULES \$(top_builddir)/modules/$dir/libpango-$module.la"
+ elif echo $module | grep -- "-x\($\|,\)" > /dev/null; then
+ INCLUDED_X_MODULES="$INCLUDED_X_MODULES \$(top_builddir)/modules/$dir/libpango-$module.la"
+ else
+ AC_MSG_ERROR([the specified module $module does not exist])
fi
done
IFS="$pango_save_ifs"
@@ -190,20 +188,20 @@ AC_SUBST(INCLUDED_X_MODULES)
AC_SUBST(INCLUDED_XFT_MODULES)
AC_SUBST(INCLUDED_FT2_MODULES)
-AM_CONDITIONAL(INCLUDE_ARABIC,echo $included_modules | grep '\(^\|,\)arabic\($\|,\)' > /dev/null)
+AM_CONDITIONAL(INCLUDE_ARABIC_X,echo $included_modules | grep '\(^\|,\)arabic-x\($\|,\)' > /dev/null)
AM_CONDITIONAL(INCLUDE_ARABIC_XFT,echo $included_modules | grep '\(^\|,\)arabic-xft\($\|,\)' > /dev/null)
-AM_CONDITIONAL(INCLUDE_BASIC,echo $included_modules | grep '\(^\|,\)basic\($\|,\)' > /dev/null)
+AM_CONDITIONAL(INCLUDE_BASIC_X,echo $included_modules | grep '\(^\|,\)basic-x\($\|,\)' > /dev/null)
AM_CONDITIONAL(INCLUDE_BASIC_FT2,echo $included_modules | grep '\(^\|,\)basic-ft2\($\|,\)' > /dev/null)
AM_CONDITIONAL(INCLUDE_BASIC_XFT,echo $included_modules | grep '\(^\|,\)basic-xft\($\|,\)' > /dev/null)
-AM_CONDITIONAL(INCLUDE_HANGUL,echo $included_modules | grep '\(^\|,\)hangul\($\|,\)' > /dev/null)
-AM_CONDITIONAL(INCLUDE_TAMIL,echo $included_modules | grep '\(^\|,\)tamil\($\|,\)' > /dev/null)
-AM_CONDITIONAL(INCLUDE_THAI,echo $included_modules | grep '\(^\|,\)thai\($\|,\)' > /dev/null)
+AM_CONDITIONAL(INCLUDE_HANGUL_X,echo $included_modules | grep '\(^\|,\)hangul-x\($\|,\)' > /dev/null)
+AM_CONDITIONAL(INCLUDE_TAMIL_X,echo $included_modules | grep '\(^\|,\)tamil-x\($\|,\)' > /dev/null)
+AM_CONDITIONAL(INCLUDE_THAI_X,echo $included_modules | grep '\(^\|,\)thai-x\($\|,\)' > /dev/null)
-AM_CONDITIONAL(INCLUDE_MYANMAR,echo $included_modules | grep '\(^\|,\)myanmar\($\|,\)' > /dev/null)
-AM_CONDITIONAL(INCLUDE_GURMUKHI,echo $included_modules | grep '\(^\|,\)gurmukhi\($\|,\)' > /dev/null)
-AM_CONDITIONAL(INCLUDE_BENGALI,echo $included_modules | grep '\(^\|,\)bengali\($\|,\)' > /dev/null)
-AM_CONDITIONAL(INCLUDE_GUJARATI,echo $included_modules | grep '\(^\|,\)gujarati\($\|,\)' > /dev/null)
-AM_CONDITIONAL(INCLUDE_DEVANAGARI,echo $included_modules | grep '\(^\|,\)devanagari\($\|,\)' > /dev/null)
+AM_CONDITIONAL(INCLUDE_MYANMAR_X,echo $included_modules | grep '\(^\|,\)myanmar-x\($\|,\)' > /dev/null)
+AM_CONDITIONAL(INCLUDE_GURMUKHI_X,echo $included_modules | grep '\(^\|,\)gurmukhi-x\($\|,\)' > /dev/null)
+AM_CONDITIONAL(INCLUDE_BENGALI_X,echo $included_modules | grep '\(^\|,\)bengali-x\($\|,\)' > /dev/null)
+AM_CONDITIONAL(INCLUDE_GUJARATI_X,echo $included_modules | grep '\(^\|,\)gujarati-x\($\|,\)' > /dev/null)
+AM_CONDITIONAL(INCLUDE_DEVANAGARI_X,echo $included_modules | grep '\(^\|,\)devanagari-x\($\|,\)' > /dev/null)
have_indic_modules="no"
IFS="${IFS= }"; pango_save_ifs="$IFS"; IFS=","
@@ -329,7 +327,7 @@ EOTEXT
IFS="${IFS= }"; pango_save_ifs="$IFS"; IFS=","
for module in $included_modules; do
- if ! (echo $module | grep -- "-ft2" > /dev/null || echo $module | grep -- "-xft" > /dev/null); then
+ if echo $module | grep -- "-x\($\|,\)" > /dev/null; then
module_c=`echo $module | sed s/-/_/`
cat >> pango/module-defs-x.c <<EOTEXT
{ _pango_${module_c}_script_engine_list, _pango_${module_c}_script_engine_load,_pango_${module_c}_script_engine_unload },
@@ -356,7 +354,7 @@ EOTEXT
IFS="${IFS= }"; pango_save_ifs="$IFS"; IFS=","
for module in $included_modules; do
- if echo $module | grep -- "-xft" > /dev/null; then
+ if echo $module | grep -- "-xft\($\|,\)" > /dev/null; then
module_c=`echo $module | sed s/-/_/`
cat >> pango/module-defs-xft.c <<EOTEXT
{ _pango_${module_c}_script_engine_list, _pango_${module_c}_script_engine_load,_pango_${module_c}_script_engine_unload },
@@ -383,7 +381,7 @@ EOTEXT
IFS="${IFS= }"; pango_save_ifs="$IFS"; IFS=","
for module in $included_modules; do
- if echo $module | grep -- "-ft2" > /dev/null; then
+ if echo $module | grep -- "-ft2\($\|,\)" > /dev/null; then
module_c=`echo $module | sed s/-/_/`
cat >> pango/module-defs-ft2.c <<EOTEXT
{ _pango_${module_c}_script_engine_list, _pango_${module_c}_script_engine_load,_pango_${module_c}_script_engine_unload },
diff --git a/modules/arabic/Makefile.am b/modules/arabic/Makefile.am
index e12664c5..c456342d 100644
--- a/modules/arabic/Makefile.am
+++ b/modules/arabic/Makefile.am
@@ -15,8 +15,8 @@ XFT_INCLUDED=
XFT_PREFIX=
endif
-sources = \
- arabic.c \
+x_sources = \
+ arabic-x.c \
arconv.c \
mulefont.c \
mulefont.h \
@@ -31,12 +31,12 @@ xft_sources = \
arabic-ot.c \
arabic-ot.h
-if INCLUDE_ARABIC
+if INCLUDE_ARABIC_X
X_MODULES=
-X_INCLUDED=libpango-arabic.la
-X_PREFIX=-DMODULE_PREFIX
+X_INCLUDED=libpango-arabic-x.la
+X_PREFIX=-DX_MODULE_PREFIX
else
-X_MODULES=pango-arabic.la
+X_MODULES=pango-arabic-x.la
X_INCLUDED=
X_PREFIX=
endif
@@ -50,13 +50,15 @@ moduleflags=-rpath $(libdir)
INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/pango/ $(moddefine) $(X_CFLAGS) $(FREETYPE_CFLAGS)
-pango_arabic_la_LDFLAGS = $(moduleflags) -export-dynamic -avoid-version -module
-pango_arabic_la_SOURCES = $(sources)
+pango_arabic_x_la_LDFLAGS = $(moduleflags) -export-dynamic -avoid-version -module
+pango_arabic_x_la_SOURCES = $(x_sources)
-libpango_arabic_la_SOURCES = $(sources)
+libpango_arabic_x_la_SOURCES = $(x_sources)
pango_arabic_xft_la_LDFLAGS = -rpath $(libdir) -export-dynamic -avoid-version -module
pango_arabic_xft_la_LIBADD =
pango_arabic_xft_la_SOURCES = $(xft_sources)
libpango_arabic_xft_la_SOURCES = $(xft_sources)
+
+
diff --git a/modules/arabic/arabic-x.c b/modules/arabic/arabic-x.c
index ebacdfbd..7828d546 100644
--- a/modules/arabic/arabic-x.c
+++ b/modules/arabic/arabic-x.c
@@ -334,8 +334,8 @@ arabic_engine_x_new ()
/* The following three functions provide the public module API for
* Pango
*/
-#ifdef MODULE_PREFIX
-#define MODULE_ENTRY(func) _pango_arabic_##func
+#ifdef X_MODULE_PREFIX
+#define MODULE_ENTRY(func) _pango_arabic_x_##func
#else
#define MODULE_ENTRY(func) func
#endif
diff --git a/modules/arabic/arabic.c b/modules/arabic/arabic.c
deleted file mode 100644
index ebacdfbd..00000000
--- a/modules/arabic/arabic.c
+++ /dev/null
@@ -1,362 +0,0 @@
-/* Pango - Arabic module
- * arabic module
- *
- * (C) 2000 Karl Koehler<koehler@or.uni-bonn.de>
- * Owen Taylor <otaylor@redhat.com>
- *
- */
-
-#include <stdio.h>
-#include <glib.h>
-#include <string.h>
-#include "pango-engine.h"
-#include "pangox.h"
-
-#include "arconv.h"
-#include "mulefont.h"
-#include "langboxfont.h"
-#include "naqshfont.h"
-
-/* #define DEBUG */
-#ifdef DEBUG
-#include <stdio.h>
-#endif
-
-
-static PangoEngineRange arabic_range[] = {
- { 0x060B, 0x06D3, "*" } /* 0x060B, 0x06D3 */
-};
-
-static PangoEngineInfo script_engines[] = {
- {
- "ArabicScriptEngineX",
- PANGO_ENGINE_TYPE_SHAPE,
- PANGO_RENDER_TYPE_X,
- arabic_range, G_N_ELEMENTS(arabic_range)
- }
-};
-
-static gint n_script_engines = G_N_ELEMENTS (script_engines);
-
-/*
- * X window system script engine portion
- */
-
-static ArabicFontInfo*
-arabic_unicodeinit(PangoFont *font, PangoXSubfont subfont)
-{
- ArabicFontInfo *fs = NULL;
-
- if (subfont != 0)
- {
- if ( pango_x_has_glyph /* Alif-Madda */
- (font,PANGO_X_MAKE_GLYPH(subfont,0xFE81)))
- {
- fs = g_new (ArabicFontInfo,1);
- fs->level = ar_standard | ar_unifont;
- fs->subfonts[0] = subfont;
-
- if ( pango_x_has_glyph /* Shadda+Kasra */
- (font,PANGO_X_MAKE_GLYPH(subfont,0xFC62)))
- {
- fs->level |= ar_composedtashkeel;
- /* extra vowels in font, hopefully */
- }
- if ( pango_x_has_glyph /* Lam-Min alone */
- (font,PANGO_X_MAKE_GLYPH(subfont,0xFC42)))
- {
- fs->level |= ar_lig;
- /* extra ligatures in font, hopefully */
- }
- }
- }
- return fs;
-}
-
-static ArabicFontInfo*
-find_unic_font (PangoFont *font)
-{
- static char *charsets[] = {
- "iso10646-1",
- "iso8859-6.8x",
- "mulearabic-2",
- "urdunaqsh-0",
-/* "symbol-0" */
- };
-
- ArabicFontInfo *fs = NULL;
- PangoXSubfont *subfonts;
- int *subfont_charsets;
- int n_subfonts;
- int i;
-
- GQuark info_id = g_quark_from_string ("arabic-font-info");
- fs = g_object_get_qdata (G_OBJECT (font), info_id);
- if (fs) return fs;
-
- n_subfonts = pango_x_list_subfonts (font, charsets, 4,
- &subfonts, &subfont_charsets);
-
- for (i=0; i < n_subfonts; i++)
- {
- if ( !strcmp (charsets[subfont_charsets[i]], "mulearabic-2"))
- {
-#ifdef DEBUG
- if (getenv("PANGO_AR_NOMULEFONT") == NULL )
-#endif
- fs = arabic_muleinit(font);
- }
- else if ( !strcmp (charsets[subfont_charsets[i]], "iso8859-6.8x"))
- {
-#ifdef DEBUG
- if (getenv("PANGO_AR_NOLBOXFONT") == NULL )
-#endif
- fs = arabic_lboxinit(font);
- }
- else if ( !strcmp (charsets[subfont_charsets[i]], "urdunaqsh-0"))
- {
-#ifdef DEBUG
- if (getenv("PANGO_AR_NONQFONT") == NULL )
-#endif
- fs = urdu_naqshinit(font);
- }
- else
- {
-#ifdef DEBUG
- if (getenv("PANGO_AR_NOUNIFONT") == NULL )
-#endif
- fs = arabic_unicodeinit(font,subfonts[i]);
- }
- if (fs){
- g_object_set_qdata_full (G_OBJECT (font), info_id,
- fs, (GDestroyNotify)g_free);
- break;
- }
- }
-
- g_free (subfonts);
- g_free (subfont_charsets);
-
- return fs;
-}
-
-
-
-static void
-set_glyph (PangoGlyphString *glyphs,
- PangoFont *font, PangoXSubfont subfont,
- int i, int cluster_start, int glyph, int is_vowel)
-{
- PangoRectangle logical_rect;
-
- glyphs->glyphs[i].glyph = PANGO_X_MAKE_GLYPH (subfont, glyph);
-
- glyphs->glyphs[i].geometry.x_offset = 0;
- glyphs->glyphs[i].geometry.y_offset = 0;
-
- pango_font_get_glyph_extents (font, glyphs->glyphs[i].glyph, NULL, &logical_rect);
- glyphs->log_clusters[i] = cluster_start;
- if (is_vowel)
- {
- glyphs->glyphs[i].geometry.width = 0;
- }
- else
- {
- glyphs->glyphs[i].geometry.width = logical_rect.width;
- }
-}
-
-
-/* The following thing is actually critical ... */
-
-static void
-arabic_engine_shape (PangoFont *font,
- const char *text,
- int length,
- PangoAnalysis *analysis,
- PangoGlyphString *glyphs)
-{
- PangoXSubfont subfont;
- int n_chars;
- int i;
- ArabicFontInfo *fs;
- const char *p;
- const char *pold;
- gunichar *wc;
-
- g_return_if_fail (font != NULL);
- g_return_if_fail (text != NULL);
- g_return_if_fail (length >= 0);
- g_return_if_fail (analysis != NULL);
-
- /* We hope there is a suitible font installed ..
- */
-
- if (! (fs = find_unic_font (font)) )
- {
-
- PangoGlyph unknown_glyph = pango_x_get_unknown_glyph (font);
-
- n_chars = g_utf8_strlen(text,length);
- pango_glyph_string_set_size (glyphs, n_chars);
-
- p = text;
- for (i=0; i<n_chars; i++)
- {
- set_glyph (glyphs, font,
- PANGO_X_GLYPH_SUBFONT (unknown_glyph), i,
- p - text, PANGO_X_GLYPH_INDEX (unknown_glyph),0);
- p = g_utf8_next_char (p);
- }
- return;
- }
-
-
- p = text;
- if (analysis->level % 2 == 0)
- {
- wc = g_utf8_to_ucs4(text,length);
- n_chars = g_utf8_strlen(text,length);
- /* We were called on a LTR directional run (e.g. some numbers);
- fallback as simple as possible */
- pango_glyph_string_set_size (glyphs, n_chars);
-
- }
- else
- {
- wc = (gunichar *)g_malloc(sizeof(gunichar)* (length) ); /* length is succicient: all arabic chars use at
- least 2 bytes in utf-8 encoding */
- n_chars = length;
- arabic_reshape(&n_chars,text,wc,fs->level);
- pango_glyph_string_set_size (glyphs, n_chars);
- };
-
-
- p = text;
- pold = p;
- i = 0;
- subfont = fs->subfonts[0];
-
- while(i < n_chars)
- {
- if (wc[i] == 0)
- {
- p = g_utf8_next_char (p);
-#ifdef DEBUG
- fprintf(stderr,"NULL-character detected in generated string.!");
-#endif
- i++;
- }
- else
- {
- int cluster_start ;
- int is_vowel = arabic_isvowel(wc[i]);
- cluster_start = is_vowel ? pold - text : p - text;
-
- if ( fs->level & ar_mulefont )
- {
- arabic_mule_recode(&subfont,&(wc[i]),
- fs->subfonts);
- }
- else if ( fs->level & ar_lboxfont )
- {
- if (( i < n_chars-1 )&&(wc[i+1] == 0))
- {
- arabic_lbox_recode(&subfont,&(wc[i]),
- &(wc[i+1]),
- fs->subfonts);
- }
- else
- arabic_lbox_recode(&subfont,&(wc[i]),NULL,
- fs->subfonts);
- }
- else if ( fs->level & ar_naqshfont )
- {
- if (( i < n_chars-1 )&&(wc[i+1] == 0))
- {
- urdu_naqsh_recode(&subfont,&(wc[i]),
- &(wc[i+1]),
- fs->subfonts);
- }
- else
- urdu_naqsh_recode(&subfont,&(wc[i]),NULL,
- fs->subfonts);
- }
-
- set_glyph(glyphs, font, subfont, n_chars - i - 1,
- cluster_start, wc[i], is_vowel);
-
- pold = p;
- p = g_utf8_next_char (p);
- i++;
- }
- }
-
- g_free(wc);
-}
-
-
-static PangoCoverage *
-arabic_engine_get_coverage (PangoFont *font,
- const char *lang)
-{
- gunichar i;
- PangoCoverage *result = pango_coverage_new ();
-
- for (i = 0x60B; i <= 0x66D; i++)
- pango_coverage_set (result, i, PANGO_COVERAGE_EXACT);
- for (i = 0x670; i <= 0x6D3; i++)
- pango_coverage_set (result, i, PANGO_COVERAGE_EXACT);
-
- return result;
-}
-
-static PangoEngine *
-arabic_engine_x_new ()
-{
- PangoEngineShape *result;
-
- result = g_new (PangoEngineShape, 1);
-
- result->engine.id = "ArabicScriptEngine";
- result->engine.type = PANGO_ENGINE_TYPE_SHAPE;
- result->engine.length = sizeof (result);
- result->script_shape = arabic_engine_shape;
- result->get_coverage = arabic_engine_get_coverage;
-
- return (PangoEngine *)result;
-}
-
-
-
-
-
-/* The following three functions provide the public module API for
- * Pango
- */
-#ifdef MODULE_PREFIX
-#define MODULE_ENTRY(func) _pango_arabic_##func
-#else
-#define MODULE_ENTRY(func) func
-#endif
-
-void
-MODULE_ENTRY(script_engine_list) (PangoEngineInfo **engines, int *n_engines)
-{
- *engines = script_engines;
- *n_engines = n_script_engines;
-}
-
-PangoEngine *
-MODULE_ENTRY(script_engine_load) (const char *id)
-{
- if (!strcmp (id, "ArabicScriptEngineX"))
- return arabic_engine_x_new ();
- else
- return NULL;
-}
-
-void
-MODULE_ENTRY(script_engine_unload) (PangoEngine *engine)
-{
-}
diff --git a/modules/basic/Makefile.am b/modules/basic/Makefile.am
index f3d0b191..8bcd7afb 100644
--- a/modules/basic/Makefile.am
+++ b/modules/basic/Makefile.am
@@ -1,6 +1,6 @@
## Process this file with automake to create Makefile.in.
-basic_sources = basic.c
+basic_sources = basic-x.c
if HAVE_XFT
if INCLUDE_BASIC_XFT
@@ -34,13 +34,13 @@ FT2_INCLUDED=
FT2_PREFIX=
endif
-if INCLUDE_BASIC
-X_INCLUDED=libpango-basic.la
+if INCLUDE_BASIC_X
+X_INCLUDED=libpango-basic-x.la
X_MODULES=
-X_PREFIX=-DMODULE_PREFIX
+X_PREFIX=-DX_MODULE_PREFIX
else
X_INCLUDED=
-X_MODULES=pango-basic.la
+X_MODULES=pango-basic-x.la
X_PREFIX=
endif
@@ -57,10 +57,10 @@ INCLUDES = \
$(FREETYPE_CFLAGS) \
$(moddefine)
-pango_basic_la_LDFLAGS = $(moduleflags) -export-dynamic -avoid-version -module
-pango_basic_la_LIBADD =
-pango_basic_la_SOURCES = $(basic_sources)
-libpango_basic_la_SOURCES = $(basic_sources)
+pango_basic_x_la_LDFLAGS = $(moduleflags) -export-dynamic -avoid-version -module
+pango_basic_x_la_LIBADD =
+pango_basic_x_la_SOURCES = $(basic_sources)
+libpango_basic_x_la_SOURCES = $(basic_sources)
pango_basic_xft_la_LDFLAGS = -rpath $(libdir) -export-dynamic -avoid-version -module
pango_basic_xft_la_LIBADD =
diff --git a/modules/basic/basic-x.c b/modules/basic/basic-x.c
index 627bc531..205079c5 100644
--- a/modules/basic/basic-x.c
+++ b/modules/basic/basic-x.c
@@ -476,8 +476,8 @@ basic_engine_x_new ()
/* The following three functions provide the public module API for
* Pango
*/
-#ifdef MODULE_PREFIX
-#define MODULE_ENTRY(func) _pango_basic_##func
+#ifdef X_MODULE_PREFIX
+#define MODULE_ENTRY(func) _pango_basic_x_##func
#else
#define MODULE_ENTRY(func) func
#endif
diff --git a/modules/basic/basic.c b/modules/basic/basic.c
deleted file mode 100644
index 627bc531..00000000
--- a/modules/basic/basic.c
+++ /dev/null
@@ -1,505 +0,0 @@
-/* Pango
- * basic.c:
- *
- * Copyright (C) 1999 Red Hat Software
- *
- * 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 <glib.h>
-#include <string.h>
-#include "pangox.h"
-#include "pango-engine.h"
-#include "pango-utils.h"
-
-typedef struct _CharRange CharRange;
-typedef struct _Charset Charset;
-typedef struct _CharCache CharCache;
-typedef struct _MaskTable MaskTable;
-
-typedef PangoGlyph (*ConvFunc) (CharCache *cache,
- Charset *charset,
- const gchar *input);
-
-#define MAX_CHARSETS 32
-
-struct _Charset
-{
- int index;
- char *id;
- char *x_charset;
- ConvFunc conv_func;
-};
-
-struct _CharRange
-{
- guint16 start;
- guint16 end;
- guint16 charsets;
-};
-
-struct _MaskTable
-{
- int n_subfonts;
-
- PangoXSubfont *subfonts;
- Charset **charsets;
-};
-
-struct _CharCache
-{
- MaskTable *mask_tables[256];
- GIConv converters[MAX_CHARSETS];
-};
-
-static PangoGlyph conv_8bit (CharCache *cache,
- Charset *charset,
- const char *input);
-static PangoGlyph conv_euc (CharCache *cache,
- Charset *charset,
- const char *input);
-static PangoGlyph conv_ucs4 (CharCache *cache,
- Charset *charset,
- const char *input);
-
-#include "tables-big.i"
-
-static PangoEngineRange basic_ranges[] = {
- /* Language characters */
- { 0x0000, 0x02af, "*" },
- { 0x02b0, 0x02ff, "" },
- { 0x0380, 0x058f, "*" },
- { 0x0591, 0x05f4, "*" }, /* Hebrew */
- { 0x060c, 0x06f9, "" }, /* Arabic */
- { 0x0e01, 0x0e5b, "" }, /* Thai */
- { 0x10a0, 0x10ff, "*" }, /* Georgian */
- { 0x1200, 0x16ff, "*" }, /* Ethiopic,Cherokee,Canadian,Ogham,Runic */
- { 0x1e00, 0x1fff, "*" },
- { 0x2000, 0x9fff, "*" },
- { 0xac00, 0xd7a3, "kr" },
- { 0xf900, 0xfa0b, "kr" },
- { 0xff00, 0xffe3, "*" }
-};
-
-static PangoEngineInfo script_engines[] = {
- {
- "BasicScriptEngineX",
- PANGO_ENGINE_TYPE_SHAPE,
- PANGO_RENDER_TYPE_X,
- basic_ranges, G_N_ELEMENTS(basic_ranges)
- }
-};
-
-static gint n_script_engines = G_N_ELEMENTS (script_engines);
-
-/*
- * X window system script engine portion
- */
-
-static CharCache *
-char_cache_new (void)
-{
- CharCache *result;
- int i;
-
- result = g_new0 (CharCache, 1);
-
- for (i=0; i<MAX_CHARSETS; i++)
- result->converters[i] = (GIConv)-1;
-
- return result;
-}
-
-static void
-char_cache_free (CharCache *cache)
-{
- int i;
-
- for (i=0; i<256; i++)
- if (cache->mask_tables[i])
- {
- g_free (cache->mask_tables[i]->subfonts);
- g_free (cache->mask_tables[i]->charsets);
-
- g_free (cache->mask_tables[i]);
- }
-
- for (i=0; i<MAX_CHARSETS; i++)
- if (cache->converters[i] != (GIConv)-1)
- g_iconv_close (cache->converters[i]);
-
- g_free (cache);
-}
-
-PangoGlyph
-find_char (CharCache *cache, PangoFont *font, gunichar wc, const char *input)
-{
- int mask_index;
- MaskTable *mask_table;
- int i;
-
- if (wc >= G_N_ELEMENTS (char_masks))
- mask_index = 0;
- else
- mask_index = char_masks[wc];
-
- if (cache->mask_tables[mask_index])
- mask_table = cache->mask_tables[mask_index];
- else
- {
- char *charset_names[G_N_ELEMENTS(charsets)];
- Charset *charsets_map[G_N_ELEMENTS(charsets)];
- guint mask;
- int n_charsets = 0;
- int *subfont_charsets;
-
- mask_table = g_new (MaskTable, 1);
-
- mask = char_mask_map[mask_index] | ENC_ISO_10646;
-
- /* Find the character sets that are included in this mask
- */
-
- for (i=0; i<G_N_ELEMENTS(charsets); i++)
- {
- if (mask & (1 << i))
- {
- charset_names[n_charsets] = charsets[i].x_charset;
- charsets_map[n_charsets] = &charsets[i];
-
- n_charsets++;
- }
- }
-
- mask_table->n_subfonts = pango_x_list_subfonts (font, charset_names, n_charsets, &mask_table->subfonts, &subfont_charsets);
-
- mask_table->charsets = g_new (Charset *, mask_table->n_subfonts);
- for (i=0; i<mask_table->n_subfonts; i++)
- mask_table->charsets[i] = charsets_map[subfont_charsets[i]];
-
- g_free (subfont_charsets);
-
- cache->mask_tables[mask_index] = mask_table;
- }
-
- for (i=0; i < mask_table->n_subfonts; i++)
- {
- PangoGlyph index;
- PangoGlyph glyph;
-
- index = (*mask_table->charsets[i]->conv_func) (cache, mask_table->charsets[i], input);
-
- glyph = PANGO_X_MAKE_GLYPH (mask_table->subfonts[i], index);
-
- if (pango_x_has_glyph (font, glyph))
- return glyph;
- }
-
- return 0;
-}
-
-static void
-set_glyph (PangoFont *font, PangoGlyphString *glyphs, int i, int offset, PangoGlyph glyph)
-{
- PangoRectangle logical_rect;
-
- glyphs->glyphs[i].glyph = glyph;
-
- glyphs->glyphs[i].geometry.x_offset = 0;
- glyphs->glyphs[i].geometry.y_offset = 0;
-
- glyphs->log_clusters[i] = offset;
-
- pango_font_get_glyph_extents (font, glyphs->glyphs[i].glyph, NULL, &logical_rect);
- glyphs->glyphs[i].geometry.width = logical_rect.width;
-}
-
-static GIConv
-find_converter (CharCache *cache, Charset *charset)
-{
- GIConv cd = cache->converters[charset->index];
- if (cd == (GIConv)-1)
- {
- cd = g_iconv_open (charset->id, "UTF-8");
- g_assert (cd != (GIConv)-1);
- cache->converters[charset->index] = cd;
- }
-
- return cd;
-}
-
-static PangoGlyph
-conv_8bit (CharCache *cache,
- Charset *charset,
- const char *input)
-{
- GIConv cd;
- char outbuf;
-
- const char *inptr = input;
- size_t inbytesleft;
- char *outptr = &outbuf;
- size_t outbytesleft = 1;
-
- inbytesleft = g_utf8_next_char (input) - input;
-
- cd = find_converter (cache, charset);
-
- g_iconv (cd, (char **)&inptr, &inbytesleft, &outptr, &outbytesleft);
-
- return (guchar)outbuf;
-}
-
-static PangoGlyph
-conv_euc (CharCache *cache,
- Charset *charset,
- const char *input)
-{
- GIConv cd;
- char outbuf[2];
-
- const char *inptr = input;
- size_t inbytesleft;
- char *outptr = outbuf;
- size_t outbytesleft = 2;
-
- inbytesleft = g_utf8_next_char (input) - input;
-
- cd = find_converter (cache, charset);
-
- g_iconv (cd, (char **)&inptr, &inbytesleft, &outptr, &outbytesleft);
-
- if ((guchar)outbuf[0] < 128)
- return outbuf[0];
- else
- return ((guchar)outbuf[0] & 0x7f) * 256 + ((guchar)outbuf[1] & 0x7f);
-}
-
-static PangoGlyph
-conv_ucs4 (CharCache *cache,
- Charset *charset,
- const char *input)
-{
- return g_utf8_get_char (input);
-}
-
-static void
-swap_range (PangoGlyphString *glyphs, int start, int end)
-{
- int i, j;
-
- for (i = start, j = end - 1; i < j; i++, j--)
- {
- PangoGlyphInfo glyph_info;
- gint log_cluster;
-
- glyph_info = glyphs->glyphs[i];
- glyphs->glyphs[i] = glyphs->glyphs[j];
- glyphs->glyphs[j] = glyph_info;
-
- log_cluster = glyphs->log_clusters[i];
- glyphs->log_clusters[i] = glyphs->log_clusters[j];
- glyphs->log_clusters[j] = log_cluster;
- }
-}
-
-static CharCache *
-get_char_cache (PangoFont *font)
-{
- GQuark cache_id = g_quark_from_string ("basic-char-cache");
-
- CharCache *cache = g_object_get_qdata (G_OBJECT (font), cache_id);
- if (!cache)
- {
- cache = char_cache_new ();
- g_object_set_qdata_full (G_OBJECT (font), cache_id,
- cache, (GDestroyNotify)char_cache_free);
- }
-
- return cache;
-}
-
-static void
-basic_engine_shape (PangoFont *font,
- const char *text,
- gint length,
- PangoAnalysis *analysis,
- PangoGlyphString *glyphs)
-{
- int n_chars;
- int i;
- const char *p;
-
- CharCache *cache;
-
- g_return_if_fail (font != NULL);
- g_return_if_fail (text != NULL);
- g_return_if_fail (length >= 0);
- g_return_if_fail (analysis != NULL);
-
- cache = get_char_cache (font);
-
- n_chars = g_utf8_strlen (text, length);
- pango_glyph_string_set_size (glyphs, n_chars);
-
- p = text;
- for (i=0; i < n_chars; i++)
- {
- gunichar wc;
- gunichar mirrored_ch;
- PangoGlyph index;
- char buf[6];
- const char *input;
-
- wc = g_utf8_get_char (p);
-
- input = p;
- if (analysis->level % 2)
- if (pango_get_mirror_char (wc, &mirrored_ch))
- {
- wc = mirrored_ch;
-
- g_unichar_to_utf8 (wc, buf);
- input = buf;
- }
-
- if (wc == 0x200B || wc == 0x200E || wc == 0x200F) /* Zero-width characters */
- {
- set_glyph (font, glyphs, i, p - text, 0);
- }
- else
- {
- index = find_char (cache, font, wc, input);
- if (index)
- {
- set_glyph (font, glyphs, i, p - text, index);
-
- if (g_unichar_type (wc) == G_UNICODE_NON_SPACING_MARK)
- {
- if (i > 0)
- {
- PangoRectangle logical_rect, ink_rect;
-
- glyphs->glyphs[i].geometry.width = MAX (glyphs->glyphs[i-1].geometry.width,
- glyphs->glyphs[i].geometry.width);
- glyphs->glyphs[i-1].geometry.width = 0;
- glyphs->log_clusters[i] = glyphs->log_clusters[i-1];
-
- /* Some heuristics to try to guess how overstrike glyphs are
- * done and compensate
- */
- pango_font_get_glyph_extents (font, glyphs->glyphs[i].glyph, &ink_rect, &logical_rect);
- if (logical_rect.width == 0 && ink_rect.x == 0)
- glyphs->glyphs[i].geometry.x_offset = (glyphs->glyphs[i].geometry.width - ink_rect.width) / 2;
- }
- }
- }
- else
- set_glyph (font, glyphs, i, p - text, pango_x_get_unknown_glyph (font));
- }
-
- p = g_utf8_next_char (p);
- }
-
- /* Simple bidi support... may have separate modules later */
-
- if (analysis->level % 2)
- {
- int start, end;
-
- /* Swap all glyphs */
- swap_range (glyphs, 0, n_chars);
-
- /* Now reorder glyphs within each cluster back to LTR */
- for (start=0; start<n_chars;)
- {
- end = start;
- while (end < n_chars &&
- glyphs->log_clusters[end] == glyphs->log_clusters[start])
- end++;
-
- swap_range (glyphs, start, end);
- start = end;
- }
- }
-}
-
-static PangoCoverage *
-basic_engine_get_coverage (PangoFont *font,
- const char *lang)
-{
- CharCache *cache = get_char_cache (font);
- PangoCoverage *result = pango_coverage_new ();
- gunichar wc;
-
- for (wc = 0; wc < 65536; wc++)
- {
- char buf[6];
-
- g_unichar_to_utf8 (wc, buf);
- if (find_char (cache, font, wc, buf))
- pango_coverage_set (result, wc, PANGO_COVERAGE_EXACT);
- }
-
- return result;
-}
-
-static PangoEngine *
-basic_engine_x_new ()
-{
- PangoEngineShape *result;
-
- result = g_new (PangoEngineShape, 1);
-
- result->engine.id = "BasicScriptEngine";
- result->engine.type = PANGO_ENGINE_TYPE_SHAPE;
- result->engine.length = sizeof (result);
- result->script_shape = basic_engine_shape;
- result->get_coverage = basic_engine_get_coverage;
-
- return (PangoEngine *)result;
-}
-
-/* The following three functions provide the public module API for
- * Pango
- */
-#ifdef MODULE_PREFIX
-#define MODULE_ENTRY(func) _pango_basic_##func
-#else
-#define MODULE_ENTRY(func) func
-#endif
-
-void
-MODULE_ENTRY(script_engine_list) (PangoEngineInfo **engines, gint *n_engines)
-{
- *engines = script_engines;
- *n_engines = n_script_engines;
-}
-
-PangoEngine *
-MODULE_ENTRY(script_engine_load) (const char *id)
-{
- if (!strcmp (id, "BasicScriptEngineX"))
- return basic_engine_x_new ();
- else
- return NULL;
-}
-
-void
-MODULE_ENTRY(script_engine_unload) (PangoEngine *engine)
-{
-}
-
diff --git a/modules/hangul/Makefile.am b/modules/hangul/Makefile.am
index 8b67f4ec..f651033b 100644
--- a/modules/hangul/Makefile.am
+++ b/modules/hangul/Makefile.am
@@ -1,22 +1,22 @@
## Process this file with automake to create Makefile.in.
-sources = hangul.c
+sources = hangul-x.c
-if INCLUDE_HANGUL
-noinst_LTLIBRARIES = libpango-hangul.la
-moddefine = -DMODULE_PREFIX
+if INCLUDE_HANGUL_X
+noinst_LTLIBRARIES = libpango-hangul-x.la
+moddefine = -DX_MODULE_PREFIX
else
moduledir = $(libdir)/pango/modules
-module_LTLIBRARIES = pango-hangul.la
+module_LTLIBRARIES = pango-hangul-x.la
moduleflags= -rpath $(libdir)
endif
INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/pango/ $(moddefine)
-pango_hangul_la_LDFLAGS = $(moduleflags) -export-dynamic -avoid-version -module
-pango_hangul_la_SOURCES = $(sources)
+pango_hangul_x_la_LDFLAGS = $(moduleflags) -export-dynamic -avoid-version -module
+pango_hangul_x_la_SOURCES = $(sources)
-libpango_hangul_la_SOURCES = $(sources)
+libpango_hangul_x_la_SOURCES = $(sources)
EXTRA_DIST = \
tables-ksc5601.i \
diff --git a/modules/hangul/hangul-x.c b/modules/hangul/hangul-x.c
index 7583981c..54f3bbda 100644
--- a/modules/hangul/hangul-x.c
+++ b/modules/hangul/hangul-x.c
@@ -731,8 +731,8 @@ hangul_engine_x_new ()
* Pango
*/
-#ifdef MODULE_PREFIX
-#define MODULE_ENTRY(func) _pango_hangul_##func
+#ifdef X_MODULE_PREFIX
+#define MODULE_ENTRY(func) _pango_hangul_x_##func
#else
#define MODULE_ENTRY(func) func
#endif
diff --git a/modules/hangul/hangul.c b/modules/hangul/hangul.c
deleted file mode 100644
index 7583981c..00000000
--- a/modules/hangul/hangul.c
+++ /dev/null
@@ -1,760 +0,0 @@
-/* Pango
- * hangul.c:
- *
- * Copyright (C) 1999 Changwoo Ryu
- *
- * 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 <glib.h>
-#include <string.h>
-
-#include "pangox.h"
-#include "pango-engine.h"
-
-static PangoEngineRange hangul_ranges[] = {
-
- /* Hangul Jamo U+1100 -- U+11FF */
- { 0x1100, 0x11ff, "*" },
- /* Hangul Compatibility Jamo U+3130 -- U+318F */
-/* { 0x3130, 0x318f, "*" }, */
- /* Hangul (pre-composed) Syllables U+AC00 -- U+D7A3 */
- { 0xac00, 0xd7a3, "*" }
-};
-
-
-static PangoEngineInfo script_engines[] = {
- {
- "HangulScriptEngineX",
- PANGO_ENGINE_TYPE_SHAPE,
- PANGO_RENDER_TYPE_X,
- hangul_ranges, G_N_ELEMENTS(hangul_ranges)
- }
-};
-
-static int n_script_engines = G_N_ELEMENTS (script_engines);
-
-/*
- * X window system script engine portion
- */
-
-static void
-set_glyph (PangoGlyphString *glyphs,
- int i,
- PangoFont *font,
- PangoXSubfont subfont,
- guint16 gindex)
-{
- PangoRectangle logical_rect;
-
- glyphs->glyphs[i].glyph = PANGO_X_MAKE_GLYPH (subfont, gindex);
-
- glyphs->glyphs[i].geometry.x_offset = 0;
- glyphs->glyphs[i].geometry.y_offset = 0;
-
- pango_font_get_glyph_extents (font, glyphs->glyphs[i].glyph, NULL, &logical_rect);
- glyphs->glyphs[i].geometry.width = logical_rect.width;
-}
-
-
-/*
- * From 3.10 of the Unicode 2.0 Book; used for combining Jamos.
- */
-
-#define SBASE 0xAC00
-#define LBASE 0x1100
-#define VBASE 0x1161
-#define TBASE 0x11A7
-#define SCOUNT 11172
-#define LCOUNT 19
-#define VCOUNT 21
-#define TCOUNT 28
-#define NCOUNT (VCOUNT * TCOUNT)
-
-/*
- * Unicode 2.0 doesn't define the fill for trailing consonants, but
- * I'll use 0x11A7 as that purpose internally.
- */
-
-#define LFILL 0x115F
-#define VFILL 0x1160
-#define TFILL 0x11A7
-
-#define IS_L(wc) (wc >= 0x1100 && wc < 0x115F)
-#define IS_V(wc) (wc >= 0x1160 && wc < 0x11A2)
-#define IS_T(wc) (wc >= 0x11A7 && wc < 0x11F9)
-
-
-typedef void (* RenderSyllableFunc) (PangoFont *font, PangoXSubfont subfont,
- gunichar2 *text, int length,
- PangoGlyphString *glyphs,
- int *n_glyphs, int cluster_offset);
-
-
-
-#include "tables-johabfont.i"
-#include "tables-ksc5601.i"
-
-#define JOHAB_COMMON \
- int i; \
- guint16 gindex; \
- \
- /* \
- * Check if there are one CHOSEONG, one JUNGSEONG, and no more \
- * than one JONGSEONG. \
- */ \
- int n_cho = 0, n_jung = 0, n_jong = 0; \
- i = 0; \
- while (i < length && IS_L (text[i])) \
- { \
- n_cho++; \
- i++; \
- } \
- while (i < length && IS_V (text[i])) \
- { \
- n_jung++; \
- i++; \
- } \
- while (i < length && IS_T (text[i])) \
- { \
- n_jong++; \
- i++; \
- } \
- \
- if (n_cho <= 1 && n_jung <= 1 && n_jong <= 1) \
- { \
- gunichar2 l, v, t; \
- \
- if (n_cho > 0) \
- l = text[0]; \
- else \
- l = LFILL; \
- \
- if (n_jung > 0) \
- v = text[n_cho]; \
- else \
- v = VFILL; \
- \
- if (n_jong > 0) \
- t = text[n_cho + n_jung]; \
- else \
- t = TFILL; \
- \
- /* COMPOSABLE */ \
- if ((__choseong_johabfont_base[l - LBASE] != 0 || l == LFILL) && \
- (__jungseong_johabfont_base[v - VBASE] != 0 || v == VFILL) && \
- (__jongseong_johabfont_base[t - TBASE] != 0 || t == TFILL)) \
- { \
- if (l != LFILL) \
- { \
- gindex = __choseong_johabfont_base[l - LBASE]; \
- if (t == TFILL) \
- { \
- if (v == VFILL) \
- gindex += 1; \
- else \
- gindex += __choseong_map_1[v - VBASE]; \
- } \
- else \
- { \
- if (v == VFILL) \
- gindex += 6; \
- else \
- gindex += __choseong_map_2[v - VBASE]; \
- } \
- pango_glyph_string_set_size (glyphs, *n_glyphs + 1); \
- set_glyph (glyphs, *n_glyphs, font, subfont, gindex); \
- glyphs->log_clusters[*n_glyphs] = cluster_offset; \
- (*n_glyphs)++; \
- } \
- \
- if (v != VFILL) \
- { \
- gindex = __jungseong_johabfont_base[v - VBASE]; \
- switch (__johabfont_jungseong_kind[v - VBASE]) \
- { \
- case 3: \
- gindex += __johabfont_jongseong_kind[t - TBASE]; \
- break; \
- case 4: \
- gindex += ((l == 0x1100 || l == 0x110f) ? 0 : 1) + \
- ((t != TFILL) ? 2 : 0); \
- break; \
- } \
- \
- pango_glyph_string_set_size (glyphs, *n_glyphs + 1); \
- set_glyph (glyphs, *n_glyphs, font, subfont, gindex); \
- glyphs->log_clusters[*n_glyphs] = cluster_offset; \
- (*n_glyphs)++; \
- } \
- \
- if (t != TFILL) \
- { \
- gindex = __jongseong_johabfont_base[t - TBASE] + \
- __jongseong_map[v - VBASE]; \
- pango_glyph_string_set_size (glyphs, *n_glyphs + 1); \
- set_glyph (glyphs, *n_glyphs, font, subfont, gindex); \
- glyphs->log_clusters[*n_glyphs] = cluster_offset; \
- (*n_glyphs)++; \
- } \
- \
- if (v == VFILL && t == TFILL) /* dummy for no zero width */ \
- { \
- pango_glyph_string_set_size (glyphs, *n_glyphs + 1); \
- set_glyph (glyphs, *n_glyphs, font, subfont, JOHAB_FILLER); \
- glyphs->log_clusters[*n_glyphs] = cluster_offset; \
- (*n_glyphs)++; \
- } \
- \
- return; \
- } \
- }
-
-static void
-render_syllable_with_johabs (PangoFont *font, PangoXSubfont subfont,
- gunichar2 *text, int length,
- PangoGlyphString *glyphs,
- int *n_glyphs, int cluster_offset)
-{
-JOHAB_COMMON
-
- /* Render as uncomposed forms as a fallback. */
- for (i = 0; i < length; i++)
- {
- int j;
-
- /*
- * Uses KSC5601 symbol glyphs which johabS-1 has; they're
- * not in the normal johab-1. The glyphs are better than composable
- * components.
- */
- for (j = 0; j < 3; j++)
- {
- gindex = __jamo_to_ksc5601[text[i] - LBASE][j];
-
- if (gindex != 0)
- {
- if ((gindex >= 0x2421) && (gindex <= 0x247f))
- gindex += (0x032b - 0x2420);
- else if ((gindex >= 0x2421) && (gindex <= 0x247f))
- gindex += (0x02cd - 0x2321);
- else
- break;
-
- pango_glyph_string_set_size (glyphs, *n_glyphs + 1);
- set_glyph (glyphs, *n_glyphs, font, subfont, gindex);
- glyphs->log_clusters[*n_glyphs] = cluster_offset;
- (*n_glyphs)++;
- }
- else
- break;
- }
- }
-}
-
-static void
-render_syllable_with_johab (PangoFont *font, PangoXSubfont subfont,
- gunichar2 *text, int length,
- PangoGlyphString *glyphs,
- int *n_glyphs, int cluster_offset)
-{
-JOHAB_COMMON
-
- /* Render as uncomposed forms as a fallback. */
- for (i = 0; i < length; i++)
- {
- int j;
- gunichar2 wc;
-
- wc = text[i];
- for (j = 0; (j < 3) && (__jamo_to_johabfont[wc-LBASE][j] != 0); j++)
- {
- pango_glyph_string_set_size (glyphs, *n_glyphs + 1);
- set_glyph (glyphs, *n_glyphs, font, subfont,
- __jamo_to_johabfont[wc - LBASE][j]);
- glyphs->log_clusters[*n_glyphs] = cluster_offset;
- (*n_glyphs)++;
- if (IS_L (wc))
- {
- pango_glyph_string_set_size (glyphs, *n_glyphs + 1);
- set_glyph (glyphs, *n_glyphs, font, subfont, JOHAB_FILLER);
- glyphs->log_clusters[*n_glyphs] = cluster_offset;
- (*n_glyphs)++;
- }
- }
- }
-}
-
-static void
-render_syllable_with_iso10646 (PangoFont *font, PangoXSubfont subfont,
- gunichar2 *text, int length,
- PangoGlyphString *glyphs,
- int *n_glyphs, int cluster_offset)
-{
- guint16 gindex;
- int i;
-
- /*
- * Check if there are one CHOSEONG, one JUNGSEONG, and no more
- * than one JONGSEONG.
- */
- int n_cho = 0, n_jung = 0, n_jong = 0;
- i = 0;
- while (i < length && IS_L (text[i]))
- {
- n_cho++;
- i++;
- }
- while (i < length && IS_V (text[i]))
- {
- n_jung++;
- i++;
- }
- while (i < length && IS_T (text[i]))
- {
- n_jong++;
- i++;
- }
-
- if (n_cho == 1 && n_jung == 1 && n_jong <= 1)
- {
- int lindex, vindex, tindex;
-
- lindex = text[0] - LBASE;
- vindex = text[1] - VBASE;
- if (n_jong > 0)
- tindex = text[2] - TBASE;
- else
- tindex = 0;
-
- /* COMPOSABLE */
- if (lindex >= 0 && lindex < LCOUNT &&
- vindex >= 0 && vindex < VCOUNT &&
- tindex >= 0 && tindex < TCOUNT)
- {
- gindex = (lindex * VCOUNT + vindex) * TCOUNT + tindex + SBASE;
- /* easy for composed syllables. */
- pango_glyph_string_set_size (glyphs, *n_glyphs + 1);
- set_glyph (glyphs, *n_glyphs, font, subfont, gindex);
- glyphs->log_clusters[*n_glyphs] = cluster_offset;
- (*n_glyphs)++;
- return;
- }
- }
-
- /* Render as uncomposed forms as a fallback. */
- for (i = 0; i < length; i++)
- {
- gindex = text[i];
- pango_glyph_string_set_size (glyphs, *n_glyphs + 1);
- set_glyph (glyphs, *n_glyphs, font, subfont, gindex);
- glyphs->log_clusters[*n_glyphs] = cluster_offset;
- (*n_glyphs)++;
- }
-}
-
-static void
-render_syllable_with_ksc5601 (PangoFont *font, PangoXSubfont subfont,
- gunichar2 *text, int length,
- PangoGlyphString *glyphs,
- int *n_glyphs, int cluster_offset)
-{
- guint16 sindex;
- guint16 gindex;
- int i;
-
- /*
- * Check if there are one CHOSEONG, one JUNGSEONG, and no more
- * than one JONGSEONG.
- */
- int n_cho = 0, n_jung = 0, n_jong = 0;
- i = 0;
- while (i < length && IS_L (text[i]))
- {
- n_cho++;
- i++;
- }
- while (i < length && IS_V (text[i]))
- {
- n_jung++;
- i++;
- }
- while (i < length && IS_T (text[i]))
- {
- n_jong++;
- i++;
- }
-
- if (n_cho == 1 && n_jung == 1 && n_jong <= 1)
- {
- int lindex, vindex, tindex;
-
- lindex = text[0] - LBASE;
- vindex = text[1] - VBASE;
- if (n_jong > 0)
- tindex = text[2] - TBASE;
- else
- tindex = 0;
-
- /* COMPOSABLE */
- if (lindex >= 0 && lindex < LCOUNT &&
- vindex >= 0 && vindex < VCOUNT &&
- tindex >= 0 && tindex < TCOUNT)
- {
- int l = 0;
- int u = KSC5601_HANGUL - 1;
- guint16 try;
-
- sindex = (lindex * VCOUNT + vindex) * TCOUNT + tindex + SBASE;
-
- /* Do binary search. */
- while (l <= u)
- {
- int m = (l + u) / 2;
- try = __ksc5601_hangul_to_ucs[m];
- if (try > sindex)
- u = m - 1;
- else if (try < sindex)
- l = m + 1;
- else
- {
- gindex = (((m / 94) + 0x30) << 8) | ((m % 94) + 0x21);
-
- pango_glyph_string_set_size (glyphs, *n_glyphs + 1);
- set_glyph (glyphs, *n_glyphs, font, subfont, gindex);
- glyphs->log_clusters[*n_glyphs] = cluster_offset;
- (*n_glyphs)++;
- return;
- }
- }
- }
- }
-
- for (i = 0; i < length; i++)
- {
- int j;
-
- gindex = text[i];
- for (j = 0; (j < 3) && (__jamo_to_ksc5601[gindex - LBASE][j] != 0); j++)
- {
- pango_glyph_string_set_size (glyphs, *n_glyphs + 1);
- set_glyph (glyphs, *n_glyphs, font, subfont,
- __jamo_to_ksc5601[gindex - LBASE][j]);
- glyphs->log_clusters[*n_glyphs] = cluster_offset;
- (*n_glyphs)++;
- }
- }
-}
-
-static gboolean
-subfont_has_korean (PangoFont *font,
- PangoXSubfont subfont)
-{
- /* Check for syllables and for uncomposed jamos. We do this
- * very unscientifically - if we have the first glyph, we
- * assume we have them all. It might be better to try
- * for the last one, to account for lazy font designers.
- */
-
- if (!pango_x_has_glyph (font, PANGO_X_MAKE_GLYPH (subfont, 0xac00)))
- return FALSE;
- if (!pango_x_has_glyph (font, PANGO_X_MAKE_GLYPH (subfont, 0x1100)))
- return FALSE;
-
- return TRUE;
-}
-
-static gboolean
-find_subfont (PangoFont *font, char **charsets, int n_charsets,
- PangoXSubfont *subfont, RenderSyllableFunc *render_func)
-{
- int i;
- int n_subfonts;
- PangoXSubfont *subfonts;
- int *subfont_charsets;
-
- n_subfonts = pango_x_list_subfonts (font, charsets, n_charsets, &subfonts, &subfont_charsets);
-
- *subfont = 0;
-
- for (i=0; i<n_subfonts; i++)
- {
- if (strcmp (charsets[subfont_charsets[i]], "johabs-1") == 0)
- {
- *subfont = subfonts[i];
- *render_func = render_syllable_with_johabs;
- break;
- }
- else if (strcmp (charsets[subfont_charsets[i]], "johab-1") == 0)
- {
- *subfont = subfonts[i];
- *render_func = render_syllable_with_johab;
- break;
- }
- else if (strcmp (charsets[subfont_charsets[i]], "iso10646-1") == 0)
- {
- if (subfont_has_korean (font, subfonts[i]))
- {
- *subfont = subfonts[i];
- *render_func = render_syllable_with_iso10646;
- break;
- }
- }
- else if (strcmp (charsets[subfont_charsets[i]], "ksc5601.1987-0") == 0)
- {
- *subfont = subfonts[i];
- *render_func = render_syllable_with_ksc5601;
- break;
- }
- }
-
- g_free (subfonts);
- g_free (subfont_charsets);
-
- return (*subfont != 0);
-}
-
-static char *default_charset[] = {
- "johabs-1"
-};
-
-static char *secondary_charset[] = {
- "johab-1"
-};
-
-static char *fallback_charsets[] = {
- "iso10646-1",
- "ksc5601.1987-0"
-};
-
-static void
-hangul_engine_shape (PangoFont *font,
- const char *text,
- int length,
- PangoAnalysis *analysis,
- PangoGlyphString *glyphs)
-{
- PangoXSubfont subfont;
- RenderSyllableFunc render_func = NULL;
-
- const char *ptr;
- const char *next;
- int i, n_chars;
- gunichar2 jamos[4];
- int n_jamos = 0;
-
- int n_glyphs = 0, cluster_offset = 0;
-
- g_return_if_fail (font != NULL);
- g_return_if_fail (text != NULL);
- g_return_if_fail (length >= 0);
- g_return_if_fail (analysis != NULL);
-
- /* check available fonts. Always use a johab font if available;
- * otherwise use iso-10646 or KSC font depending on the ordering
- * of the fontlist.
- */
- if (!find_subfont (font, default_charset, G_N_ELEMENTS (default_charset), &subfont, &render_func))
- if (!find_subfont (font, secondary_charset, G_N_ELEMENTS (secondary_charset), &subfont, &render_func))
- if (!find_subfont (font, fallback_charsets, G_N_ELEMENTS (fallback_charsets), &subfont, &render_func))
- {
- n_chars = g_utf8_strlen (text, length);
- pango_x_fallback_shape (font, glyphs, text, n_chars);
- return;
- }
-
- n_chars = g_utf8_strlen (text, length);
- ptr = text;
-
- for (i = 0; i < n_chars; i++)
- {
- gunichar wc4;
- gunichar2 wcs[4], wc;
- int n_code = 0;
-
- wc4 = g_utf8_get_char (ptr);
- next = g_utf8_next_char (ptr);
-
- if (wc4 >= SBASE && wc4 < (SBASE + SCOUNT))
- {
- /* decompose the syllable. */
- gint16 sindex;
-
- sindex = wc4 - SBASE;
- wcs[0] = LBASE + (sindex / NCOUNT);
- wcs[1] = VBASE + ((sindex % NCOUNT) / TCOUNT);
- wcs[2] = TBASE + (sindex % TCOUNT);
- n_code = 3;
-
- if (n_jamos > 0)
- {
- (*render_func) (font, subfont, jamos, n_jamos,
- glyphs, &n_glyphs, cluster_offset);
- cluster_offset = next - text;
- n_jamos = 0;
- }
-
- /* Draw a syllable. */
- (*render_func) (font, subfont, wcs, 3,
- glyphs, &n_glyphs, cluster_offset);
- cluster_offset = next - text;
- /* Clear. */
- }
- else if (wc4 >= 0x1100 && wc4 <= 0x11ff)
- {
- wc = (gunichar2) wc4;
-
- if (n_jamos == 0)
- {
- jamos[n_jamos++] = wc;
- }
- else
- {
- /* Check syllable boundaries. */
- if ((IS_T (jamos[n_jamos - 1]) && IS_L (wc)) ||
- (IS_V (jamos[n_jamos - 1]) && IS_L (wc)) ||
- (IS_T (jamos[n_jamos - 1]) && IS_V (wc)))
- {
- /* Draw a syllable. */
- (*render_func) (font, subfont, jamos, n_jamos,
- glyphs, &n_glyphs, cluster_offset);
- cluster_offset = next - text;
- /* Clear. */
- n_jamos = 0;
- }
- jamos[n_jamos++] = wc;
- }
- }
- else
- {
- g_warning ("Unknown character 0x04%x", wc4);
- continue;
- }
-
- ptr = next;
- }
-
- /* Draw the remaining Jamos. */
- if (n_jamos > 0)
- {
- (*render_func) (font, subfont, jamos, n_jamos,
- glyphs, &n_glyphs, cluster_offset);
- cluster_offset = next - text;
- n_jamos = 0;
- }
-}
-
-static PangoCoverage *
-hangul_engine_get_coverage (PangoFont *font,
- const char *lang)
-{
- PangoCoverage *result = pango_coverage_new ();
- PangoXSubfont subfont;
- RenderSyllableFunc render_func = NULL;
- int i;
-
- /* An approximate implementation, please check and fix as necessary!
- * OWT 2 Feb 2000
- */
- if (find_subfont (font, default_charset, G_N_ELEMENTS (default_charset), &subfont, &render_func) ||
- find_subfont (font, secondary_charset, G_N_ELEMENTS (secondary_charset), &subfont, &render_func) ||
- find_subfont (font, fallback_charsets, G_N_ELEMENTS (fallback_charsets), &subfont, &render_func))
- {
- if (render_func == render_syllable_with_johabs ||
- render_func == render_syllable_with_johab)
- {
- for (i = 0x1100; i <= 0x11ff; i++)
- pango_coverage_set (result, i, PANGO_COVERAGE_EXACT);
-
- for (i = 0xac00; i <= 0xd7a3; i++)
- pango_coverage_set (result, i, PANGO_COVERAGE_EXACT);
-
- }
- else if (render_func == render_syllable_with_iso10646)
- {
- for (i = 0x1100; i <= 0x11ff; i++)
- pango_coverage_set (result, i, PANGO_COVERAGE_FALLBACK);
-
- for (i = 0xac00; i <= 0xd7a3; i++)
- pango_coverage_set (result, i, PANGO_COVERAGE_EXACT);
- }
- else if (render_func == render_syllable_with_ksc5601)
- {
- for (i = 0x1100; i <= 0x11ff; i++)
- pango_coverage_set (result, i, PANGO_COVERAGE_FALLBACK);
-
- for (i = 0xac00; i <= 0xd7a3; i++)
- pango_coverage_set (result, i, PANGO_COVERAGE_FALLBACK);
-
- for (i=0; i<KSC5601_HANGUL; i++)
- pango_coverage_set (result, __ksc5601_hangul_to_ucs[i], PANGO_COVERAGE_EXACT);
- }
- else
- g_assert_not_reached();
- }
-
- return result;
-}
-
-static PangoEngine *
-hangul_engine_x_new ()
-{
- PangoEngineShape *result;
-
- result = g_new (PangoEngineShape, 1);
-
- result->engine.id = "HangulScriptEngine";
- result->engine.type = PANGO_ENGINE_TYPE_SHAPE;
- result->engine.length = sizeof (result);
- result->script_shape = hangul_engine_shape;
- result->get_coverage = hangul_engine_get_coverage;
-
- return (PangoEngine *)result;
-}
-
-
-
-/* The following three functions provide the public module API for
- * Pango
- */
-
-#ifdef MODULE_PREFIX
-#define MODULE_ENTRY(func) _pango_hangul_##func
-#else
-#define MODULE_ENTRY(func) func
-#endif
-
-void
-MODULE_ENTRY(script_engine_list) (PangoEngineInfo **engines, int *n_engines)
-{
- *engines = script_engines;
- *n_engines = n_script_engines;
-}
-
-PangoEngine *
-MODULE_ENTRY(script_engine_load) (const char *id)
-{
- if (!strcmp (id, "HangulScriptEngineX"))
- return hangul_engine_x_new ();
- else
- return NULL;
-}
-
-void
-MODULE_ENTRY(script_engine_unload) (PangoEngine *engine)
-{
-}
-
diff --git a/modules/indic/Makefile.am b/modules/indic/Makefile.am
index 5f5db4dc..2759dd2e 100644
--- a/modules/indic/Makefile.am
+++ b/modules/indic/Makefile.am
@@ -1,98 +1,98 @@
## Process this file with automake to create Makefile.in.
sources = \
- myanmar.c \
- gurmukhi.c \
- bengali.c \
- gujarati.c \
- devanagari.c \
+ myanmar-x.c \
+ gurmukhi-x.c \
+ bengali-x.c \
+ gujarati-x.c \
+ devanagari-x.c \
pango-indic-script.h
-if INCLUDE_MYANMAR
-myanmar_noinst=libpango-myanmar.la
-myanmar_cflags=-DMYANMAR_MODULE_PREFIX
+if INCLUDE_MYANMAR_X
+myanmar_x_noinst=libpango-myanmar-x.la
+myanmar_x_cflags=-DMYANMAR_X_MODULE_PREFIX
else
-myanmar_inst=pango-myanmar.la
-myanmar_moduleflags=-rpath $(libdir)
+myanmar_x_inst=pango-myanmar-x.la
+myanmar_x_moduleflags=-rpath $(libdir)
endif
-if INCLUDE_GURMUKHI
-gurmukhi_noinst=libpango-gurmukhi.la
-gurmukhi_cflags=-DGURMUKHI_MODULE_PREFIX
+if INCLUDE_GURMUKHI_X
+gurmukhi_x_noinst=libpango-gurmukhi-x.la
+gurmukhi_x_cflags=-DGURMUKHI_X_MODULE_PREFIX
else
-gurmukhi_inst=pango-gurmukhi.la
-gurmukhi_moduleflags=-rpath $(libdir)
+gurmukhi_x_inst=pango-gurmukhi-x.la
+gurmukhi_x_moduleflags=-rpath $(libdir)
endif
-if INCLUDE_BENGALI
-bengali_noinst=libpango-bengali.la
-bengali_cflags=-DBENGALI_MODULE_PREFIX
+if INCLUDE_BENGALI_X
+bengali_x_noinst=libpango-bengali-x.la
+bengali_x_cflags=-DBENGALI_X_MODULE_PREFIX
else
-bengali_inst=pango-bengali.la
-bengali_moduleflags=-rpath $(libdir)
+bengali_x_inst=pango-bengali-x.la
+bengali_x_moduleflags=-rpath $(libdir)
endif
-if INCLUDE_DEVANAGARI
-devanagari_noinst=libpango-devanagari.la
-devanagari_cflags=-DDEVANAGARI_MODULE_PREFIX
+if INCLUDE_DEVANAGARI_X
+devanagari_x_noinst=libpango-devanagari-x.la
+devanagari_x_cflags=-DDEVANAGARI_X_MODULE_PREFIX
else
-devanagari_inst=pango-devanagari.la
-devanagari_moduleflags=-rpath $(libdir)
+devanagari_x_inst=pango-devanagari-x.la
+devanagari_x_moduleflags=-rpath $(libdir)
endif
-if INCLUDE_GUJARATI
-gujarati_noinst=libpango-gujarati.la
-gujarati_cflags=-DGUJARATI_MODULE_PREFIX
+if INCLUDE_GUJARATI_X
+gujarati_x_noinst=libpango-gujarati-x.la
+gujarati_x_cflags=-DGUJARATI_X_MODULE_PREFIX
else
-gujarati_inst=pango-gujarati.la
-gujarati_moduleflags=-rpath $(libdir)
+gujarati_x_inst=pango-gujarati-x.la
+gujarati_x_moduleflags=-rpath $(libdir)
endif
if INCLUDE_ANY_INDIC
-noinst_LTLIBRARIES = $(myanmar_noinst) $(gurmukhi_noinst) $(bengali_noinst) $(devanagari_noinst) $(gujarati_noinst)
+noinst_LTLIBRARIES = $(myanmar_x_noinst) $(gurmukhi_x_noinst) $(bengali_x_noinst) $(devanagari_x_noinst) $(gujarati_x_noinst)
else
moduledir = $(libdir)/pango/modules
-module_LTLIBRARIES = $(myanmar_inst) $(gurmukhi_inst) $(bengali_inst) $(devanagari_inst) $(gujarati_inst)
+module_LTLIBRARIES = $(myanmar_x_inst) $(gurmukhi_x_inst) $(bengali_x_inst) $(devanagari_x_inst) $(gujarati_x_inst)
endif
-INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/pango/ $(myanmar_cflags) $(gurmukhi_cflags) $(bengali_cflags) $(devanagari_cflags) $(gujarati_cflags)
+INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/pango/ $(myanmar_x_cflags) $(gurmukhi_x_cflags) $(bengali_x_cflags) $(devanagari_x_cflags) $(gujarati_x_cflags)
EXTRA_DIST = \
pango-indic-script.h
-pango_devanagari_la_LDFLAGS = $(devanagari_moduleflags) -export-dynamic -avoid-version -module
-if INCLUDE_DEVANAGARI
-libpango_devanagari_la_SOURCES = devanagari.c
+pango_devanagari_x_la_LDFLAGS = $(devanagari_x_moduleflags) -export-dynamic -avoid-version -module
+if INCLUDE_DEVANAGARI_X
+libpango_devanagari_x_la_SOURCES = devanagari-x.c
else
-pango_devanagari_la_SOURCES = devanagari.c
+pango_devanagari_x_la_SOURCES = devanagari-x.c
endif
-pango_myanmar_la_LDFLAGS = $(myanmar_moduleflags) -export-dynamic -avoid-version -module
-if INCLUDE_MYANMAR
-libpango_myanmar_la_SOURCES = myanmar.c
+pango_myanmar_x_la_LDFLAGS = $(myanmar_x_moduleflags) -export-dynamic -avoid-version -module
+if INCLUDE_MYANMAR_X
+libpango_myanmar_x_la_SOURCES = myanmar-x.c
else
-pango_myanmar_la_SOURCES = myanmar.c
+pango_myanmar_x_la_SOURCES = myanmar-x.c
endif
-pango_gurmukhi_la_LDFLAGS = $(gurmukhi_moduleflags) -export-dynamic -avoid-version -module
-if INCLUDE_GURMUKHI
-libpango_gurmukhi_la_SOURCES = gurmukhi.c
+pango_gurmukhi_x_la_LDFLAGS = $(gurmukhi_x_moduleflags) -export-dynamic -avoid-version -module
+if INCLUDE_GURMUKHI_X
+libpango_gurmukhi_x_la_SOURCES = gurmukhi-x.c
else
-pango_gurmukhi_la_SOURCES = gurmukhi.c
+pango_gurmukhi_x_la_SOURCES = gurmukhi-x.c
endif
-pango_bengali_la_LDFLAGS = $(bengali_moduleflags) -export-dynamic -avoid-version -module
-if INCLUDE_BENGALI
-libpango_bengali_la_SOURCES = bengali.c
+pango_bengali_x_la_LDFLAGS = $(bengali_x_moduleflags) -export-dynamic -avoid-version -module
+if INCLUDE_BENGALI_X
+libpango_bengali_x_la_SOURCES = bengali-x.c
else
-pango_bengali_la_SOURCES = bengali.c
+pango_bengali_x_la_SOURCES = bengali-x.c
endif
-pango_gujarati_la_LDFLAGS = $(gujarati_moduleflags) -export-dynamic -avoid-version -module
-if INCLUDE_GUJARATI
-libpango_gujarati_la_SOURCES = gujarati.c
+pango_gujarati_x_la_LDFLAGS = $(gujarati_x_moduleflags) -export-dynamic -avoid-version -module
+if INCLUDE_GUJARATI_X
+libpango_gujarati_x_la_SOURCES = gujarati-x.c
else
-pango_gujarati_la_SOURCES = gujarati.c
+pango_gujarati_x_la_SOURCES = gujarati-x.c
endif
diff --git a/modules/indic/bengali-x.c b/modules/indic/bengali-x.c
index 823c895d..6d2f1f52 100644
--- a/modules/indic/bengali-x.c
+++ b/modules/indic/bengali-x.c
@@ -285,8 +285,8 @@ pango_indic_engine_x_new ()
return (PangoEngine *) result;
}
-#ifdef BENGALI_MODULE_PREFIX
-#define MODULE_ENTRY(func) _pango_bengali_##func
+#ifdef BENGALI_X_MODULE_PREFIX
+#define MODULE_ENTRY(func) _pango_bengali_x_##func
#else
#define MODULE_ENTRY(func) func
#endif
diff --git a/modules/indic/bengali.c b/modules/indic/bengali.c
deleted file mode 100644
index 823c895d..00000000
--- a/modules/indic/bengali.c
+++ /dev/null
@@ -1,314 +0,0 @@
-/* Pango - Bengali module
- * bengali.c:
- *
- * Copyright (C) 2000 Robert Brady,
- * (C) 2000 SuSE Linux Ltd.
- *
- * Author: Robert Brady <rwb197@zepler.org>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * Licence as published by the Free Software Foundation; either
- * version 2 of the licence, 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
- * Lesser General Public Licence for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * Licence along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/*
- * This is the renderer for Bengali script.
- *
- * This script is used to write many languages including the
- * following.
- *
- * as Assamese
- * bn Bengali
- * kha Khasi
- * mni Manipuri
- * mun Munda
- * sat Santali
- *
- */
-
-
-#include <glib.h>
-#include <stdio.h>
-
-#include "pangox.h"
-#include "pango-indic.h"
-#include "pango-engine.h"
-
-#define SCRIPT_STRING "Bengali"
-#define ISCII_BASED
-#define RANGE_START 0x980
-#define RANGE_SIZE 0x80
-
-#include "pango-indic-script.h"
-
-static gboolean is_prefixing_vowel (gunichar i);
-static gboolean is_vowel_sign (gunichar i);
-static gboolean is_vowel_half (gunichar i);
-static gunichar vowel_sign_to_matra (gunichar i);
-static gboolean vowel_split (gunichar i, gunichar *a, gunichar *b);
-
-static PangoIndicScript script = {
- SCRIPT_STRING,
- &is_prefixing_vowel,
- &is_vowel_sign,
- &vowel_sign_to_matra,
- &is_vowel_half,
- &vowel_split,
-};
-
-static gunichar
-vowel_sign_to_matra (gunichar i)
-{
- if (!is_vowel_sign (i))
- return i;
- return i + 0x987 - 0x9c8;
-}
-
-gboolean
-vowel_split (gunichar i, gunichar *a, gunichar *b)
-{
- if (i == 0x9cb || i == 0x9cc) {
- if (a)
- *a = 0x9c7;
- if (b) {
- if (i == 0x9cc)
- *b = 0xe9d7;
- else
- *b = 0xe9be;
- }
- return TRUE;
- }
- return FALSE;
-}
-
-#define RA_SUPERSCRIPT 0xe9ff
-#define RA_SUBSCRIPT 0xe9fe
-
-static char *default_charset = "iso10646-bng";
-
-static PangoEngineRange pango_indic_range[] =
-{
- {RANGE_START, RANGE_END, "*"},
-};
-
-SCRIPT_ENGINE_DEFINITION
-
-static PangoCoverage *
-pango_indic_engine_get_coverage (PangoFont * font, const char *lang)
-{
- gunichar i;
- PangoCoverage *result = pango_coverage_new ();
- PangoXSubfont subfont;
-
- int dev_font = pango_x_find_first_subfont (font, &default_charset, 1, &subfont);
-
- if (dev_font)
- {
- for (i = RANGE_START; i <= RANGE_END; i++)
- pango_coverage_set (result, i, PANGO_COVERAGE_EXACT);
-
- pango_coverage_set (result, 0x10000, PANGO_COVERAGE_EXACT);
- }
-
- return result;
-}
-
-static gboolean
-is_vowel_sign (gunichar i)
-{
- /* one that combines, whether or not it spaces */
- return (i >= 0x9BE && i <= 0x9Cc) || (i >= 0x9E2 && i <= 0x9E3);
-}
-
-static int
-is_consonant (int i)
-{
- return (i >= 0x995 && i <= 0x9b9) || (i >= 0x9dc && i <= 0x9df) || (i >= 0x9f0 && i <= 0x09f1);
-}
-
-static int
-is_ind_vowel (int i)
-{
- return (i >= 0x985 && i <= 0x994);
-}
-
-static gboolean
-is_vowel_half (gunichar i)
-{
- return (i == 0xe9d7) || (i == 0xe9be) || (i == 0x9d7);
-}
-
-static int
-is_prefixing_vowel (gunichar what)
-{
- return (what == 0x9bf) || (what == 0x9c7) || (what == 0x9c8);
-}
-
-static void
-pango_indic_make_ligs (gunichar * start, gunichar * end)
-{
- int num = end - start;
- int i;
-
- for (i = 0; i < (end - start); i++)
- {
- gunichar t0 = pango_indic_get_char (start + i, end);
- gunichar t1 = pango_indic_get_char (start + 1 + i, end);
- gunichar t2 = pango_indic_get_char (start + 2 + i, end);
-
- if ((t0 == VIRAMA) && (t1 == 0x9af))
- {
- start[i+0] = 0;
- start[i+1] = 0xe9fd;
- }
- }
-
- if (start[0] == RA && start[1] == VIRAMA && is_consonant (start[2]))
- {
- start[0] = 0;
- start[1] = start[2];
- start[2] = RA_SUPERSCRIPT;
- }
-
- for (i = 0; i < (end - start - 1); i++)
- {
- if (start[i] == VIRAMA)
- {
- if (start[i+1] == RA)
- {
- start[i] = 0;
- start[i+1] = RA_SUBSCRIPT;
- break;
- }
- }
- }
-
-}
-
-static void
-pango_indic_engine_shape (PangoFont * font,
- const char *text,
- int length,
- PangoAnalysis * analysis, PangoGlyphString * glyphs)
-{
- PangoXSubfont subfont;
-
- int n_chars, n_glyph;
- int lvl;
- const char *p;
- int i, k;
- gunichar *wc;
- int sb;
- int n_syls;
- gunichar **syls = g_malloc (sizeof (gunichar **));
- g_return_if_fail (font != NULL);
- g_return_if_fail (text != NULL);
- g_return_if_fail (length >= 0);
- g_return_if_fail (analysis != NULL);
-
- n_chars = n_glyph = g_utf8_strlen (text, length);
- lvl = pango_x_find_first_subfont (font, &default_charset, 1, &subfont);
- if (!lvl)
- {
- pango_x_fallback_shape (font, glyphs, text, n_chars);
- return;
- }
-
- pango_indic_split_out_characters (&script, text, n_chars, &wc,
- &n_glyph, glyphs);
- pango_indic_convert_vowels (&script, TRUE, &n_glyph, wc,
- pango_x_has_glyph (font,
- PANGO_X_MAKE_GLYPH (subfont, 0xc9bd)));
-
- n_syls = 1;
- syls[0] = wc;
- sb = glyphs->log_clusters[0];
- for (i = 0; i < n_glyph; i++)
- {
- if (i && (is_consonant (wc[i]) | is_ind_vowel (wc[i]))
- && wc[i - 1] != VIRAMA)
- {
- syls = g_realloc (syls, ((n_syls + 2) * sizeof (gunichar **)));
- syls[n_syls] = wc + i;
- n_syls++;
- sb = glyphs->log_clusters[i];
- }
- glyphs->log_clusters[i] = sb;
- }
- syls[n_syls] = wc + i;
-
- for (i = 0; i < n_syls; i++)
- {
- pango_indic_make_ligs (syls[i], syls[i+1]);
- pango_indic_shift_vowels (&script, syls[i], syls[i + 1]);
- }
-
- pango_indic_compact (&script, &n_glyph, wc, glyphs->log_clusters);
- pango_x_apply_ligatures (font, subfont, &wc, &n_glyph, &glyphs->log_clusters);
- pango_indic_compact (&script, &n_glyph, wc, glyphs->log_clusters);
- pango_glyph_string_set_size (glyphs, n_glyph);
-
- for (i = 0; i < n_glyph; i++)
- {
- PangoRectangle logical_rect;
- glyphs->glyphs[i].glyph = PANGO_X_MAKE_GLYPH (subfont, wc[i]);
- pango_font_get_glyph_extents (font, glyphs->glyphs[i].glyph,
- NULL, &logical_rect);
- glyphs->glyphs[i].geometry.x_offset = 0;
- glyphs->glyphs[i].geometry.y_offset = 0;
- glyphs->glyphs[i].geometry.width = logical_rect.width;
- }
- g_free (syls);
-}
-
-static PangoEngine *
-pango_indic_engine_x_new ()
-{
- PangoEngineShape *result;
- result = g_new (PangoEngineShape, 1);
- result->engine.id = SCRIPT_STRING "ScriptEngine";
- result->engine.type = PANGO_ENGINE_TYPE_SHAPE;
- result->engine.length = sizeof (result);
- result->script_shape = pango_indic_engine_shape;
- result->get_coverage = pango_indic_engine_get_coverage;
- return (PangoEngine *) result;
-}
-
-#ifdef BENGALI_MODULE_PREFIX
-#define MODULE_ENTRY(func) _pango_bengali_##func
-#else
-#define MODULE_ENTRY(func) func
-#endif
-
-void
-MODULE_ENTRY(script_engine_list) (PangoEngineInfo ** engines, int *n_engines)
-{
- *engines = script_engines;
- *n_engines = n_script_engines;
-}
-
-PangoEngine *
-MODULE_ENTRY(script_engine_load) (const char *id)
-{
- if (!strcmp (id, SCRIPT_STRING "ScriptEngineX"))
- return pango_indic_engine_x_new ();
- else
- return NULL;
-}
-
-void
-MODULE_ENTRY(script_engine_unload) (PangoEngine * engine)
-{
-}
-
diff --git a/modules/indic/devanagari-x.c b/modules/indic/devanagari-x.c
index 34348255..c09f6f41 100644
--- a/modules/indic/devanagari-x.c
+++ b/modules/indic/devanagari-x.c
@@ -338,8 +338,8 @@ pango_indic_engine_x_new ()
return (PangoEngine *) result;
}
-#ifdef DEVANAGARI_MODULE_PREFIX
-#define MODULE_ENTRY(func) _pango_devanagari_##func
+#ifdef DEVANAGARI_X_MODULE_PREFIX
+#define MODULE_ENTRY(func) _pango_devanagari_x_##func
#else
#define MODULE_ENTRY(func) func
#endif
diff --git a/modules/indic/devanagari.c b/modules/indic/devanagari.c
deleted file mode 100644
index 34348255..00000000
--- a/modules/indic/devanagari.c
+++ /dev/null
@@ -1,366 +0,0 @@
-/* Pango - Devanagari module
- *
- * Copyright (C) 2000 SuSE Linux Ltd
- * Author: Robert Brady <robert@suse.co.uk>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * Licence as published by the Free Software Foundation; either
- * version 2.1 of the Licence, 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
- * Lesser General Public Licence for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * Licence along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/*
- * This is the renderer for the Devanagari script.
- *
- * This script is used to write many languages, including the
- * following.
- *
- * awa Awadhi bh Bihari bra Braj Bhasa
- * gon Gondhi hi Hindi kok Konkani
- * mr Marathi new Newari ne Nepali
- * sa Sanskrit sat Santali
- *
- * For a description of the rendering algorithm, see section 9.1 of
- * /The Unicode Standard Version 3.0/.
- */
-
-
-#include <glib.h>
-#include <stdio.h>
-
-#include "pangox.h"
-#include "pango-engine.h"
-
-#define RANGE_START 0x900
-#define RANGE_SIZE 0x80
-
-#define ISCII_BASED
-#define SCRIPT_STRING "Devanagari"
-
-#include "pango-indic.h"
-#include "pango-indic-script.h"
-
-static gboolean is_prefixing_vowel (gunichar i);
-static gboolean is_vowel_sign (gunichar i);
-static gunichar vowel_sign_to_matra (gunichar i);
-
-static PangoIndicScript script =
-{
- SCRIPT_STRING,
- &is_prefixing_vowel,
- &is_vowel_sign,
- &vowel_sign_to_matra,
- NULL, /* no split vowels for Devanagari */
-};
-
-#define INTERMEDIATE_HALF_FORM_OFFSET 0xf000
-#define FINAL_HALF_FORM_OFFSET 0xe000
-
-#define RA_SUPERSCRIPT 0xc97f
-#define RA_SUBSCRIPT 0xc97e
-
-static char *default_charset = "iso10646-dev";
-
-static PangoEngineRange pango_indic_range[] =
-{
- {RANGE_START, RANGE_END, "*"},
- {ZERO_WIDTH_JOINER, ZERO_WIDTH_JOINER, "*"},
-};
-
-SCRIPT_ENGINE_DEFINITION
-
-static PangoCoverage *
-pango_indic_engine_get_coverage (PangoFont * font, const char *lang)
-{
- gunichar i;
- PangoCoverage *result = pango_coverage_new ();
- PangoXSubfont subfont;
-
- int dev_font = pango_x_find_first_subfont (font, &default_charset, 1, &subfont);
-
- if (dev_font)
- {
- for (i = RANGE_START; i <= RANGE_END; i++)
- pango_coverage_set (result, i, PANGO_COVERAGE_EXACT);
-
- pango_coverage_set (result, ZERO_WIDTH_JOINER, PANGO_COVERAGE_EXACT);
- }
-
- return result;
-}
-
-static gboolean
-is_vowel_sign (gunichar i)
-{
- /* one that combines, whether or not it spaces */
- return (i >= 0x93E && i <= 0x94c) || (i >= 0x962 && i <= 0x963);
-}
-
-static int
-is_consonant (int i)
-{
- return (i >= 0x915 && i <= 0x939) || (i >= 0x958 && i <= 0x95f);
-}
-
-static int
-is_ind_vowel (int i)
-{
- return (i >= 0x905 && i <= 0x914);
-}
-
-static gunichar
-vowel_sign_to_matra (gunichar i)
-{
- if (is_vowel_sign (i))
- return i + 0x905 - 0x93e;
- return i;
-}
-
-static gboolean
-is_prefixing_vowel (gunichar i)
-{
- return i == 0x93f;
-}
-
-static void
-dev_mini_shuffle (gunichar *s, gunichar *e)
-{
- gunichar *dest = s;
- while (s < e)
- {
- if (*s)
- {
- *dest = *s;
- dest++;
- }
- s++;
- }
- while (dest < e)
- {
- *dest = 0;
- dest++;
- }
-}
-
-static int
-is_intermediate_form (int q)
-{
- return (q >= 0xf000 && q <= 0xffff);
-}
-
-static int
-is_consonantal_form (int q)
-{
- return (q == ZERO_WIDTH_JOINER) || is_consonant (q) || (q >= 0xd000);
-}
-
-static int
-nominal_form (int q)
-{
- return q - 0xf000;
-}
-
-static int
-half_form (int q)
-{
- return (q & 0xfff) + 0xe000;
-}
-
-static void
-shuffle_one_along (gunichar *start, gunichar *end)
-{
- end--;
- if (*end != 0)
- fprintf (stderr, "pango devanagari error, please report. bad shuffle!\n");
- while (end > start)
- {
- end[0] = end[-1];
- end--;
- }
- start[0] = 0;
-}
-
-static void
-pango_indic_make_ligs (gunichar * start, gunichar * end)
-{
- int num = end - start;
- int i;
-
- for (i = 0; i < (end - start); i++)
- {
- gunichar t0 = pango_indic_get_char (start + i, end);
- gunichar t1 = pango_indic_get_char (start + 1 + i, end);
-
- if (is_consonant (t0) && t1 == VIRAMA)
- {
- start[i+0] = t0 + INTERMEDIATE_HALF_FORM_OFFSET;
- start[i+1] = 0;
- }
- }
-
- if (num > 2 && start[0] == INTERMEDIATE_HALF_FORM_OFFSET + RA)
- {
- for (i=1;i<num;i++)
- start[i-1] = start[i];
-
- start[num-1] = RA_SUPERSCRIPT;
- }
-
- dev_mini_shuffle (start, end);
-
- for (i = 0; i < (end - start - 1); i++)
- if (is_intermediate_form (start[i]))
- {
- if (start[i+1] == RA)
- {
- start[i] = nominal_form (start[i]);
- start[i+1] = RA_SUBSCRIPT;
- }
- else if (start[i+1] == (RA + INTERMEDIATE_HALF_FORM_OFFSET))
- {
- start[i] = nominal_form (start[i]);
- start[i+1] = RA_SUBSCRIPT;
- shuffle_one_along (start+2, end);
- start[i+2] = VIRAMA;
- }
- }
-}
-
-static void
-pango_indic_engine_shape (PangoFont * font,
- const char *text,
- int length,
- PangoAnalysis * analysis,
- PangoGlyphString * glyphs)
-{
- PangoXSubfont subfont;
-
- int n_chars, n_glyph;
- int lvl;
- const char *p;
- int i;
- gunichar *wc;
- int sb;
- int n_syls;
- gunichar **syls = g_malloc (sizeof (gunichar **));
-
- g_return_if_fail (font != NULL);
- g_return_if_fail (text != NULL);
- g_return_if_fail (length >= 0);
- g_return_if_fail (analysis != NULL);
-
- n_chars = n_glyph = g_utf8_strlen (text, length);
- lvl = pango_x_find_first_subfont (font, &default_charset, 1, &subfont);
- if (!lvl)
- {
- pango_x_fallback_shape (font, glyphs, text, n_chars);
- return;
- }
-
- pango_indic_split_out_characters (&script, text, n_chars, &wc, &n_glyph,
- glyphs);
- pango_indic_convert_vowels (&script, TRUE, &n_glyph, wc,
- pango_x_has_glyph (font,
- PANGO_X_MAKE_GLYPH(subfont, 0xc93e)));
-
- n_syls = 1;
- syls[0] = wc;
- sb = glyphs->log_clusters[0];
- for (i = 0; i < n_chars; i++)
- {
- if (i && (is_consonant (wc[i]) | is_ind_vowel (wc[i]))
- && wc[i - 1] != VIRAMA)
- {
- syls = g_realloc (syls, ((n_syls + 2) * sizeof (gunichar **)));
- syls[n_syls] = wc + i;
- n_syls++;
- sb = glyphs->log_clusters[i];
- }
- glyphs->log_clusters[i] = sb;
- }
- syls[n_syls] = wc + i;
-
- for (i = 0; i < n_syls; i++)
- {
- pango_indic_make_ligs (syls[i], syls[i+1]);
- pango_indic_shift_vowels (&script, syls[i], syls[i + 1]);
- }
-
- pango_indic_compact (&script, &n_glyph, wc, glyphs->log_clusters);
- pango_x_apply_ligatures (font, subfont, &wc, &n_glyph, &glyphs->log_clusters);
- pango_indic_compact (&script, &n_glyph, wc, glyphs->log_clusters);
- pango_glyph_string_set_size (glyphs, n_glyph);
-
- for (i = 0; i < n_glyph; i++)
- {
- PangoRectangle logical_rect;
-#if 0
- if (i && (wc[i] == VIRAMA) && (wc[i-1] == RA_SUBSCRIPT))
- {
- wc[i] = LOWER_VIRAMA_GLYPH;
- }
-#endif
- if ((i != (n_glyph - 1)) && is_intermediate_form (wc[i]) &&
- is_consonantal_form (wc[i+1]))
- {
- wc[i] = half_form (wc[i]);
- }
- glyphs->glyphs[i].glyph = PANGO_X_MAKE_GLYPH (subfont, wc[i]);
- pango_font_get_glyph_extents (font, glyphs->glyphs[i].glyph,
- NULL, &logical_rect);
- glyphs->glyphs[i].geometry.x_offset = 0;
- glyphs->glyphs[i].geometry.y_offset = 0;
- glyphs->glyphs[i].geometry.width = logical_rect.width;
- }
- g_free (syls);
-}
-
-static PangoEngine *
-pango_indic_engine_x_new ()
-{
- PangoEngineShape *result;
- result = g_new (PangoEngineShape, 1);
- result->engine.id = SCRIPT_STRING "ScriptEngine";
- result->engine.type = PANGO_ENGINE_TYPE_SHAPE;
- result->engine.length = sizeof (result);
- result->script_shape = pango_indic_engine_shape;
- result->get_coverage = pango_indic_engine_get_coverage;
- return (PangoEngine *) result;
-}
-
-#ifdef DEVANAGARI_MODULE_PREFIX
-#define MODULE_ENTRY(func) _pango_devanagari_##func
-#else
-#define MODULE_ENTRY(func) func
-#endif
-
-void
-MODULE_ENTRY(script_engine_list) (PangoEngineInfo ** engines, int *n_engines)
-{
- *engines = script_engines;
- *n_engines = n_script_engines;
-}
-
-PangoEngine *
-MODULE_ENTRY(script_engine_load) (const char *id)
-{
- if (!strcmp (id, SCRIPT_STRING "ScriptEngineX"))
- return pango_indic_engine_x_new ();
- else
- return NULL;
-}
-
-void
-MODULE_ENTRY(script_engine_unload) (PangoEngine * engine)
-{
-}
diff --git a/modules/indic/gujarati-x.c b/modules/indic/gujarati-x.c
index c8e53170..8307e5c4 100644
--- a/modules/indic/gujarati-x.c
+++ b/modules/indic/gujarati-x.c
@@ -314,8 +314,8 @@ pango_indic_engine_x_new ()
return (PangoEngine *) result;
}
-#ifdef GUJARATI_MODULE_PREFIX
-#define MODULE_ENTRY(func) _pango_gujarati_##func
+#ifdef GUJARATI_X_MODULE_PREFIX
+#define MODULE_ENTRY(func) _pango_gujarati_x_##func
#else
#define MODULE_ENTRY(func) func
#endif
diff --git a/modules/indic/gujarati.c b/modules/indic/gujarati.c
deleted file mode 100644
index c8e53170..00000000
--- a/modules/indic/gujarati.c
+++ /dev/null
@@ -1,342 +0,0 @@
-/* Pango - Gujarati module
- *
- * Copyright (C) 2000 SuSE Linux Ltd
- * Author: Robert Brady <robert@suse.co.uk>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * Licence as published by the Free Software Foundation; either
- * version 2.1 of the Licence, 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
- * Lesser General Public Licence for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * Licence along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/*
- */
-
-
-#include <glib.h>
-#include <stdio.h>
-
-#include "pangox.h"
-
-#define RANGE_START 0xA80
-#define RANGE_SIZE 0x80
-
-#define ISCII_BASED
-#define SCRIPT_STRING "Gujarati"
-
-#include "pango-indic.h"
-#include "pango-indic-script.h"
-#include "pango-engine.h"
-
-static gboolean is_prefixing_vowel (gunichar i);
-static gboolean is_vowel_sign (gunichar i);
-static gunichar vowel_sign_to_matra (gunichar i);
-
-static PangoIndicScript script = {
- SCRIPT_STRING,
- &is_prefixing_vowel,
- &is_vowel_sign,
- NULL, /* vowel sign to matra must die! */
- NULL, /* no split vowels for Devanagari */
-};
-
-#define INTERMEDIATE_HALF_FORM_OFFSET 0xf000
-#define FINAL_HALF_FORM_OFFSET 0xe000
-#define RA_SUPERSCRIPT 0xeaff
-#define RA_SUBSCRIPT 0xeafe
-
-static char *default_charset = "iso10646-guj";
-
-static PangoEngineRange pango_indic_range[] =
-{
- {RANGE_START, RANGE_END, "*"},
- {ZERO_WIDTH_JOINER, ZERO_WIDTH_JOINER, "*"},
-};
-
-SCRIPT_ENGINE_DEFINITION
-
-static PangoCoverage *
-pango_indic_engine_get_coverage (PangoFont * font, const char *lang)
-{
- gunichar i;
- PangoCoverage *result = pango_coverage_new ();
- PangoXSubfont subfont;
-
- int dev_font = pango_x_find_first_subfont (font, &default_charset, 1, &subfont);
-
- if (dev_font)
- {
- for (i = RANGE_START; i <= RANGE_END; i++)
- pango_coverage_set (result, i, PANGO_COVERAGE_EXACT);
-
- pango_coverage_set (result, ZERO_WIDTH_JOINER, PANGO_COVERAGE_EXACT);
- }
-
- return result;
-}
-
-static gboolean
-is_vowel_sign (gunichar i)
-{
- /* one that combines, whether or not it spaces */
- return (i >= 0xABE && i <= 0xACC);
-}
-
-static int
-is_consonant (int i)
-{
- return (i >= 0xA95 && i <= 0xAB9) || (i == 0xAE0);
-}
-
-static int
-is_ind_vowel (int i)
-{
- return (i >= 0xA85 && i <= 0xA94);
-}
-
-static gboolean
-is_prefixing_vowel (gunichar i)
-{
- return i == 0xABF;
-}
-
-static void
-dev_mini_shuffle (gunichar *s, gunichar *e)
-{
- gunichar *dest = s;
- while (s < e)
- {
- if (*s)
- {
- *dest = *s;
- dest++;
- }
- s++;
- }
- while (dest < e)
- {
- *dest = 0;
- dest++;
- }
-}
-
-static int
-is_intermediate_form (int q)
-{
- return (q >= 0xf000 && q <= 0xffff);
-}
-
-static int
-is_consonantal_form (int q)
-{
- return (q == ZERO_WIDTH_JOINER) || is_consonant (q) || (q >= 0xc000);
-}
-
-static int
-nominal_form (int q)
-{
- return q - 0xf000;
-}
-
-static int
-half_form (int q)
-{
- return (q & 0xfff) + 0xe000;
-}
-
-static void
-shuffle_one_along (gunichar *start, gunichar *end)
-{
- end--;
- if (*end != 0)
- {
- return;
- }
- while (end > start)
- {
- end[0] = end[-1];
- end--;
- }
- start[0] = 0;
-}
-
-static void
-pango_indic_make_ligs (gunichar * start, gunichar * end)
-{
- int num = end - start;
- int i;
-
- for (i = 0; i < (end - start); i++)
- {
- gunichar t0 = pango_indic_get_char (start + i, end);
- gunichar t1 = pango_indic_get_char (start + 1 + i, end);
-
- if (is_consonant (t0) && t1 == VIRAMA)
- {
- start[i+0] = t0 + INTERMEDIATE_HALF_FORM_OFFSET;
- start[i+1] = 0;
- }
- }
-
- while (num && !is_consonant (start[num-1]))
- {
- num--;
- }
- if (num > 2 && start[0] == INTERMEDIATE_HALF_FORM_OFFSET + RA)
- {
- for (i=1;i<num;i++)
- {
- start[i-1] = start[i];
- }
- start[num-1] = RA_SUPERSCRIPT;
- }
-
- dev_mini_shuffle (start, end);
-
- for (i = 0; i < (end - start - 1); i++)
- if (is_intermediate_form (start[i]))
- {
- if (start[i+1] == RA)
- {
- start[i] = nominal_form (start[i]);
- start[i+1] = RA_SUBSCRIPT;
- }
- else if (start[i+1] == (RA + INTERMEDIATE_HALF_FORM_OFFSET))
- {
- start[i] = nominal_form (start[i]);
- start[i+1] = RA_SUBSCRIPT;
- shuffle_one_along (start+2, end);
- start[i+2] = VIRAMA;
- }
- }
-}
-
-static void
-pango_indic_engine_shape (PangoFont * font,
- const char *text,
- int length,
- PangoAnalysis * analysis, PangoGlyphString * glyphs)
-{
- PangoXSubfont subfont;
-
- int n_chars, n_glyph;
- int lvl;
- const char *p;
- int i;
- gunichar *wc;
- int sb;
- int n_syls;
- gunichar **syls = g_malloc (sizeof (gunichar **));
-
- g_return_if_fail (font != NULL);
- g_return_if_fail (text != NULL);
- g_return_if_fail (length >= 0);
- g_return_if_fail (analysis != NULL);
-
- n_chars = n_glyph = g_utf8_strlen (text, length);
- lvl = pango_x_find_first_subfont (font, &default_charset, 1, &subfont);
- if (!lvl)
- {
- pango_x_fallback_shape (font, glyphs, text, n_chars);
- return;
- }
-
- pango_indic_split_out_characters (&script, text, n_chars, &wc,
- &n_glyph, glyphs);
- pango_indic_convert_vowels (&script, TRUE, &n_glyph, wc, FALSE);
-
- n_syls = 1;
- syls[0] = wc;
- sb = glyphs->log_clusters[0];
- for (i = 0; i < n_chars; i++)
- {
- if (i && (is_consonant (wc[i]) | is_ind_vowel (wc[i]))
- && wc[i - 1] != VIRAMA)
- {
- syls = g_realloc (syls, ((n_syls + 2) * sizeof (gunichar **)));
- syls[n_syls] = wc + i;
- n_syls++;
- sb = glyphs->log_clusters[i];
- }
- glyphs->log_clusters[i] = sb;
- }
- syls[n_syls] = wc + i;
-
- for (i = 0; i < n_syls; i++)
- {
- pango_indic_make_ligs (syls[i], syls[i+1]);
- pango_indic_shift_vowels (&script, syls[i], syls[i + 1]);
- }
-
- pango_indic_compact (&script, &n_glyph, wc, glyphs->log_clusters);
- pango_x_apply_ligatures (font, subfont, &wc, &n_glyph, &glyphs->log_clusters);
- pango_indic_compact (&script, &n_glyph, wc, glyphs->log_clusters);
- pango_glyph_string_set_size (glyphs, n_glyph);
-
- for (i = 0; i < n_glyph; i++)
- {
- PangoRectangle logical_rect;
- if ((i != (n_glyph - 1)) && is_intermediate_form (wc[i]) &&
- is_consonantal_form (wc[i+1]))
- {
- wc[i] = half_form (wc[i]);
- }
- glyphs->glyphs[i].glyph = PANGO_X_MAKE_GLYPH (subfont, wc[i]);
- pango_font_get_glyph_extents (font, glyphs->glyphs[i].glyph,
- NULL, &logical_rect);
- glyphs->glyphs[i].geometry.x_offset = 0;
- glyphs->glyphs[i].geometry.y_offset = 0;
- glyphs->glyphs[i].geometry.width = logical_rect.width;
- }
- g_free (syls);
-}
-
-static PangoEngine *
-pango_indic_engine_x_new ()
-{
- PangoEngineShape *result;
- result = g_new (PangoEngineShape, 1);
- result->engine.id = SCRIPT_STRING "ScriptEngine";
- result->engine.type = PANGO_ENGINE_TYPE_SHAPE;
- result->engine.length = sizeof (result);
- result->script_shape = pango_indic_engine_shape;
- result->get_coverage = pango_indic_engine_get_coverage;
- return (PangoEngine *) result;
-}
-
-#ifdef GUJARATI_MODULE_PREFIX
-#define MODULE_ENTRY(func) _pango_gujarati_##func
-#else
-#define MODULE_ENTRY(func) func
-#endif
-
-void
-MODULE_ENTRY(script_engine_list) (PangoEngineInfo ** engines, int *n_engines)
-{
- *engines = script_engines;
- *n_engines = n_script_engines;
-}
-
-PangoEngine *
-MODULE_ENTRY(script_engine_load) (const char *id)
-{
- if (!strcmp (id, SCRIPT_STRING "ScriptEngineX"))
- return pango_indic_engine_x_new ();
- else
- return NULL;
-}
-
-void
-MODULE_ENTRY(script_engine_unload) (PangoEngine * engine)
-{
-}
diff --git a/modules/indic/gurmukhi-x.c b/modules/indic/gurmukhi-x.c
index 179a3d11..5a08f0f5 100644
--- a/modules/indic/gurmukhi-x.c
+++ b/modules/indic/gurmukhi-x.c
@@ -228,8 +228,8 @@ pango_indic_engine_x_new ()
return (PangoEngine *) result;
}
-#ifdef GURMUKHI_MODULE_PREFIX
-#define MODULE_ENTRY(func) _pango_gurmukhi_##func
+#ifdef GURMUKHI_X_MODULE_PREFIX
+#define MODULE_ENTRY(func) _pango_gurmukhi_x_##func
#else
#define MODULE_ENTRY(func) func
#endif
diff --git a/modules/indic/gurmukhi.c b/modules/indic/gurmukhi.c
deleted file mode 100644
index 179a3d11..00000000
--- a/modules/indic/gurmukhi.c
+++ /dev/null
@@ -1,256 +0,0 @@
-/* Pango - Gurmukhi module
- * gurmukhi.c:
- *
- * Copyright (C) 2000 SuSE Linux Ltd
- * Author: Robert Brady <robert@suse.co.uk>
- *
- * 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.
- */
-
-/*
- * This is the renderer for Gurmukhi. This script is primarily used
- * to write the Panjabi (pa) language.
- */
-
-
-#include <glib.h>
-#include <stdio.h>
-#include <string.h>
-
-#include "pangox.h"
-#include "pango-indic.h"
-#include "pango-engine.h"
-
-#define RANGE_START 0xa00
-#define RANGE_SIZE 0x80
-#define SCRIPT_STRING "Gurmukhi"
-#define ISCII_BASED
-
-#include "pango-indic-script.h"
-
-static gboolean is_prefixing_vowel (gunichar i);
-static gunichar vowel_sign_to_matra (gunichar i);
-static gboolean is_vowel_sign (gunichar i);
-static gboolean is_vowel_half (gunichar i);
-
-static PangoIndicScript script = {
- SCRIPT_STRING,
- &is_prefixing_vowel,
- &is_vowel_sign,
- &vowel_sign_to_matra,
- &is_vowel_half,
-};
-
-#define RA_SUBSCRIPT 0xea7e
-
-static char *default_charset = "iso10646-gur";
-
-static PangoEngineRange pango_indic_range[] =
-{
- {RANGE_START, RANGE_END, "*"},
-};
-
-SCRIPT_ENGINE_DEFINITION
-
-static PangoCoverage *
-pango_indic_engine_get_coverage (PangoFont * font, const char *lang)
-{
- gunichar i;
- PangoCoverage *result = pango_coverage_new ();
- PangoXSubfont subfont;
-
- int dev_font = pango_x_find_first_subfont (font, &default_charset, 1, &subfont);
-
- if (dev_font)
- {
- for (i = RANGE_START; i <= RANGE_END; i++)
- pango_coverage_set (result, i, PANGO_COVERAGE_EXACT);
-
- }
-
- return result;
-}
-
-static gboolean
-is_vowel_sign (gunichar i)
-{
- /* one that combines, whether or not it spaces */
- return (i >= 0xa3e && i <= 0xa4c);
-}
-
-static gunichar
-vowel_sign_to_matra (gunichar i)
-{
- if (i >= 0xa3e && i <= 0xa4c)
- return i - 0xa3e + 0xa06;
- return i;
-}
-
-static int
-is_consonant (int i)
-{
- return (i >= 0xa15 && i <= 0xa39) ||
- (i >= 0xa59 && i <= 0xa5e);
-}
-
-static int
-is_ind_vowel (int i)
-{
- return (i >= 0xa05 && i <= 0xa14);
-}
-
-static gboolean
-is_vowel_half (gunichar i)
-{
- return 0;
-}
-
-static int
-is_prefixing_vowel (gunichar what)
-{
- return (what == 0xa3f);
-}
-
-static void
-pango_indic_make_ligs (gunichar * start, gunichar * end)
-{
- int i;
- for (i = 0; i < (end-start-2);i++)
- {
- if (is_consonant (start[i]))
- {
- if (start[i+2]==RA && start[i+1]==VIRAMA)
- {
- start[i+1] = 0;
- start[i+2] = RA_SUBSCRIPT;
- }
- }
- }
-}
-
-static void
-pango_indic_engine_shape (PangoFont * font,
- const char *text,
- int length,
- PangoAnalysis * analysis, PangoGlyphString * glyphs)
-{
- PangoXSubfont subfont;
-
- int n_chars, n_glyph;
- int lvl;
- int i;
- gunichar *wc;
- int sb;
- int n_syls;
- gunichar **syls = g_malloc (sizeof (gunichar **));
-
- g_return_if_fail (font != NULL);
- g_return_if_fail (text != NULL);
- g_return_if_fail (length >= 0);
- g_return_if_fail (analysis != NULL);
-
- n_chars = n_glyph = g_utf8_strlen (text, length);
- lvl = pango_x_find_first_subfont (font, &default_charset, 1, &subfont);
- if (!lvl)
- {
- pango_x_fallback_shape (font, glyphs, text, n_chars);
- return;
- }
-
- pango_indic_split_out_characters (&script, text, n_chars, &wc,
- &n_glyph, glyphs);
- pango_indic_convert_vowels (&script, TRUE, &n_glyph, wc, FALSE);
-
- n_syls = 1;
- syls[0] = wc;
- sb = glyphs->log_clusters[0];
- for (i = 0; i < n_glyph; i++)
- {
- if (i && (is_consonant (wc[i]) | is_ind_vowel (wc[i]))
- && wc[i - 1] != VIRAMA)
- {
- syls = g_realloc (syls, ((n_syls + 2) * sizeof (gunichar **)));
- syls[n_syls] = wc + i;
- n_syls++;
- sb = glyphs->log_clusters[i];
- }
- glyphs->log_clusters[i] = sb;
- }
- syls[n_syls] = wc + i;
-
- for (i = 0; i < n_syls; i++)
- {
- pango_indic_make_ligs (syls[i], syls[i+1]);
- pango_indic_shift_vowels (&script, syls[i], syls[i + 1]);
- }
-
- pango_indic_compact (&script, &n_glyph, wc, glyphs->log_clusters);
- pango_x_apply_ligatures (font, subfont, &wc, &n_glyph, &glyphs->log_clusters);
- pango_indic_compact (&script, &n_glyph, wc, glyphs->log_clusters);
- pango_glyph_string_set_size (glyphs, n_glyph);
-
- for (i = 0; i < n_glyph; i++)
- {
- PangoRectangle logical_rect;
- glyphs->glyphs[i].glyph = PANGO_X_MAKE_GLYPH (subfont, wc[i]);
- pango_font_get_glyph_extents (font, glyphs->glyphs[i].glyph,
- NULL, &logical_rect);
- glyphs->glyphs[i].geometry.x_offset = 0;
- glyphs->glyphs[i].geometry.y_offset = 0;
- glyphs->glyphs[i].geometry.width = logical_rect.width;
- }
- g_free (syls);
-}
-
-static PangoEngine *
-pango_indic_engine_x_new ()
-{
- PangoEngineShape *result;
- result = g_new (PangoEngineShape, 1);
- result->engine.id = SCRIPT_STRING "ScriptEngine";
- result->engine.type = PANGO_ENGINE_TYPE_SHAPE;
- result->engine.length = sizeof (result);
- result->script_shape = pango_indic_engine_shape;
- result->get_coverage = pango_indic_engine_get_coverage;
- return (PangoEngine *) result;
-}
-
-#ifdef GURMUKHI_MODULE_PREFIX
-#define MODULE_ENTRY(func) _pango_gurmukhi_##func
-#else
-#define MODULE_ENTRY(func) func
-#endif
-
-void
-MODULE_ENTRY(script_engine_list) (PangoEngineInfo ** engines, int *n_engines)
-{
- *engines = script_engines;
- *n_engines = n_script_engines;
-}
-
-PangoEngine *
-MODULE_ENTRY(script_engine_load) (const char *id)
-{
- if (!strcmp (id, SCRIPT_STRING "ScriptEngineX"))
- return pango_indic_engine_x_new ();
- else
- return NULL;
-}
-
-void
-MODULE_ENTRY(script_engine_unload) (PangoEngine * engine)
-{
-}
diff --git a/modules/indic/myanmar-x.c b/modules/indic/myanmar-x.c
index 214ebac5..3e4e1d71 100644
--- a/modules/indic/myanmar-x.c
+++ b/modules/indic/myanmar-x.c
@@ -208,8 +208,8 @@ pango_engine_x_new ()
return (PangoEngine *) result;
}
-#ifdef MYANMAR_MODULE_PREFIX
-#define MODULE_ENTRY(func) _pango_myanmar_##func
+#ifdef MYANMAR_X_MODULE_PREFIX
+#define MODULE_ENTRY(func) _pango_myanmar_x_##func
#else
#define MODULE_ENTRY(func) func
#endif
diff --git a/modules/indic/myanmar.c b/modules/indic/myanmar.c
deleted file mode 100644
index 214ebac5..00000000
--- a/modules/indic/myanmar.c
+++ /dev/null
@@ -1,236 +0,0 @@
-/* Pango - Myanmar module
- * myanmar.c:
- *
- * Copyright (C) 2000 SuSE Linux Ltd
- * Author: Robert Brady <robert@suse.co.uk>
- *
- * 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.
- */
-
-/*
- * This is the renderer for the Burmese (Myanmar) script. This
- * script is used to write the following languages :
- *
- * my Burmese
- * shn Shan
- * mkh Mon
- * pi Pali
- *
- */
-
-
-#include <glib.h>
-#include <stdio.h>
-#include <string.h>
-
-#include "pangox.h"
-#include "pango-indic.h"
-#include "pango-engine.h"
-
-#define RANGE_START 0x1000
-#define RANGE_SIZE 0x80
-#define SCRIPT_STRING "Myanmar"
-#define VIRAMA 0x1039
-
-#include "pango-indic-script.h"
-
-static gboolean is_prefixing_vowel (gunichar i);
-static gboolean is_vowel_sign (gunichar i);
-static gunichar vowel_sign_to_matra (gunichar i);
-
-static PangoIndicScript script = {
- SCRIPT_STRING,
- &is_prefixing_vowel,
- &is_vowel_sign,
- &vowel_sign_to_matra,
-};
-
-static char *default_charset = "iso10646-brm";
-
-static PangoEngineRange pango_indic_range[] =
-{
- {RANGE_START, RANGE_END, "*"},
-};
-
-SCRIPT_ENGINE_DEFINITION
-
-static PangoCoverage *
-pango_engine_get_coverage (PangoFont * font, const char *lang)
-{
- gunichar i;
- PangoCoverage *result = pango_coverage_new ();
- PangoXSubfont subfont;
-
- int dev_font = pango_x_find_first_subfont (font, &default_charset, 1, &subfont);
-
- if (dev_font)
- {
- for (i = RANGE_START; i <= RANGE_END; i++)
- pango_coverage_set (result, i, PANGO_COVERAGE_EXACT);
-
- }
-
- return result;
-}
-
-static gboolean
-is_vowel_sign (gunichar i)
-{
- /* one that combines, whether or not it spaces */
- return (i >= 0x102c && i <= 0x1032) || (i >= 0x1056 && i <= 0x1059);
-}
-
-static gunichar
-vowel_sign_to_matra (gunichar i)
-{
- if (i >= 0x102d && i <= 0x1032)
- return i - 0x102d + 0x1023;
- return i;
-}
-
-static int
-is_consonant (int i)
-{
- return (i >= 0x1000 && i <= 0x1020) || (i >= 0x1052 && i <= 0x1053);
-}
-
-static int
-is_ind_vowel (int i)
-{
- return (i >= 0x1021 && i <= 0x102a);
-}
-
-static int
-is_prefixing_vowel (gunichar what)
-{
- return (what == 0x1031);
-}
-
-static void
-pango_engine_shape (PangoFont * font,
- const char *text,
- int length,
- PangoAnalysis * analysis, PangoGlyphString * glyphs)
-{
- PangoXSubfont subfont;
-
- int n_chars, n_glyph;
- int lvl;
- int i;
- gunichar *wc;
- int sb;
- int n_syls;
- gunichar **syls = g_malloc (sizeof (gunichar **));
-
- g_return_if_fail (font != NULL);
- g_return_if_fail (text != NULL);
- g_return_if_fail (length >= 0);
- g_return_if_fail (analysis != NULL);
-
- n_chars = n_glyph = g_utf8_strlen (text, length);
- lvl = pango_x_find_first_subfont (font, &default_charset, 1, &subfont);
- if (!lvl)
- {
- pango_x_fallback_shape (font, glyphs, text, n_chars);
- return;
- }
-
- pango_indic_split_out_characters (&script, text, n_chars, &wc,
- &n_glyph, glyphs);
- pango_indic_convert_vowels (&script, FALSE, &n_glyph, wc, FALSE);
-
- n_syls = 1;
- syls[0] = wc;
- sb = glyphs->log_clusters[0];
- for (i = 0; i < n_glyph; i++)
- {
- if (i && (is_consonant (wc[i]) | is_ind_vowel (wc[i]))
- && wc[i - 1] != VIRAMA)
- {
- syls = g_realloc (syls, ((n_syls + 2) * sizeof (gunichar **)));
- syls[n_syls] = wc + i;
- n_syls++;
- sb = glyphs->log_clusters[i];
- }
- glyphs->log_clusters[i] = sb;
- }
- syls[n_syls] = wc + i;
-
- for (i = 0; i < n_syls; i++)
- {
- pango_indic_shift_vowels (&script, syls[i], syls[i + 1]);
- }
-
- pango_indic_compact (&script, &n_glyph, wc, glyphs->log_clusters);
- while ((i=pango_x_apply_ligatures (font, subfont, &wc, &n_glyph, &glyphs->log_clusters)))
- {
- pango_indic_compact (&script, &n_glyph, wc, glyphs->log_clusters);
- }
- pango_indic_compact (&script, &n_glyph, wc, glyphs->log_clusters);
- pango_glyph_string_set_size (glyphs, n_glyph);
-
- for (i = 0; i < n_glyph; i++)
- {
- PangoRectangle logical_rect;
- glyphs->glyphs[i].glyph = PANGO_X_MAKE_GLYPH (subfont, wc[i]);
- pango_font_get_glyph_extents (font, glyphs->glyphs[i].glyph,
- NULL, &logical_rect);
- glyphs->glyphs[i].geometry.x_offset = 0;
- glyphs->glyphs[i].geometry.y_offset = 0;
- glyphs->glyphs[i].geometry.width = logical_rect.width;
- }
- g_free (syls);
-}
-
-static PangoEngine *
-pango_engine_x_new ()
-{
- PangoEngineShape *result;
- result = g_new (PangoEngineShape, 1);
- result->engine.id = SCRIPT_STRING "ScriptEngine";
- result->engine.type = PANGO_ENGINE_TYPE_SHAPE;
- result->engine.length = sizeof (result);
- result->script_shape = pango_engine_shape;
- result->get_coverage = pango_engine_get_coverage;
- return (PangoEngine *) result;
-}
-
-#ifdef MYANMAR_MODULE_PREFIX
-#define MODULE_ENTRY(func) _pango_myanmar_##func
-#else
-#define MODULE_ENTRY(func) func
-#endif
-
-void
-MODULE_ENTRY(script_engine_list) (PangoEngineInfo ** engines, int *n_engines)
-{
- *engines = script_engines;
- *n_engines = n_script_engines;
-}
-
-PangoEngine *
-MODULE_ENTRY(script_engine_load) (const char *id)
-{
- if (!strcmp (id, SCRIPT_STRING "ScriptEngineX"))
- return pango_engine_x_new ();
- else
- return NULL;
-}
-
-void
-MODULE_ENTRY(script_engine_unload) (PangoEngine * engine)
-{
-}
diff --git a/modules/tamil/Makefile.am b/modules/tamil/Makefile.am
index 29430e5d..7cbbc4fa 100644
--- a/modules/tamil/Makefile.am
+++ b/modules/tamil/Makefile.am
@@ -1,19 +1,19 @@
## Process this file with automake to create Makefile.in.
-sources = tamil.c taconv.c taconv.h tadefs.h
+sources = tamil-x.c taconv.c taconv.h tadefs.h
-if INCLUDE_TAMIL
-noinst_LTLIBRARIES = libpango-tamil.la
-moddefine = -DMODULE_PREFIX=_pango_tamil_
+if INCLUDE_TAMIL_X
+noinst_LTLIBRARIES = libpango-tamil-x.la
+moddefine = -DX_MODULE_PREFIX
else
moduledir = $(libdir)/pango/modules
-module_LTLIBRARIES = pango-tamil.la
+module_LTLIBRARIES = pango-tamil-x.la
moduleflags=-rpath $(libdir)
endif
INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/pango/ $(moddefine)
-pango_tamil_la_LDFLAGS = $(moduleflags) -export-dynamic -avoid-version -module
-pango_tamil_la_SOURCES = $(sources)
+pango_tamil_x_la_LDFLAGS = $(moduleflags) -export-dynamic -avoid-version -module
+pango_tamil_x_la_SOURCES = $(sources)
-libpango_tamil_la_SOURCES = $(sources)
+libpango_tamil_x_la_SOURCES = $(sources)
diff --git a/modules/tamil/tamil-x.c b/modules/tamil/tamil-x.c
index f6ee22d0..3ff5f433 100644
--- a/modules/tamil/tamil-x.c
+++ b/modules/tamil/tamil-x.c
@@ -186,8 +186,8 @@ tamil_engine_x_new ()
* Pango
*/
-#ifdef MODULE_PREFIX
-#define MODULE_ENTRY(func) _pango_tamil_##func
+#ifdef X_MODULE_PREFIX
+#define MODULE_ENTRY(func) _pango_tamil_x_##func
#else
#define MODULE_ENTRY(func) func
#endif
diff --git a/modules/tamil/tamil.c b/modules/tamil/tamil.c
deleted file mode 100644
index f6ee22d0..00000000
--- a/modules/tamil/tamil.c
+++ /dev/null
@@ -1,215 +0,0 @@
-/* Pango - Tamil module
- * tamil.c:
- *
- * Copyright (C) 2000 Sivaraj D
- *
- */
-
-#include <stdio.h>
-#include <glib.h>
-#include "pangox.h"
-#include "taconv.h"
-#include "pango-engine.h"
-#include <string.h>
-
-static PangoEngineRange tamil_range[] = {
- { 0x0b80, 0x0bff, "*" },
-};
-
-static PangoEngineInfo script_engines[] = {
- {
- "TamilScriptEngineX",
- PANGO_ENGINE_TYPE_SHAPE,
- PANGO_RENDER_TYPE_X,
- tamil_range, G_N_ELEMENTS(tamil_range)
- }
-};
-
-static gint n_script_engines = G_N_ELEMENTS (script_engines);
-
-/*
- * X window system script engine portion
- */
-
-/* We will need some type of kerning support for use with ikaram/iikaaram.
- * But we can live with this for time being
- */
-static void
-set_glyph (PangoGlyphString *glyphs, int i, int cluster_start,
- PangoFont *font, PangoXSubfont subfont, guint16 gindex)
-{
- PangoRectangle logical_rect;
-
- glyphs->glyphs[i].glyph = PANGO_X_MAKE_GLYPH (subfont, gindex);
-
- glyphs->glyphs[i].geometry.x_offset = 0;
- glyphs->glyphs[i].geometry.y_offset = 0;
-
- glyphs->log_clusters[i] = cluster_start;
-
- pango_font_get_glyph_extents (font, glyphs->glyphs[i].glyph, NULL, &logical_rect);
- glyphs->glyphs[i].geometry.width = logical_rect.width;
-}
-
-static PangoXSubfont
-find_tscii_font (PangoFont *font)
-{
- char *charsets[] = { "tscii-0" };
- PangoXSubfont *subfonts;
- int *subfont_charsets;
- int n_subfonts;
- PangoXSubfont result = 0;
-
- n_subfonts = pango_x_list_subfonts (font, charsets, 1, &subfonts, &subfont_charsets);
-
- if (n_subfonts > 0)
- result = subfonts[0];
-
- g_free (subfonts);
- g_free (subfont_charsets);
-
- return result;
-}
-
-static void
-tamil_engine_shape (PangoFont *font,
- const char *text,
- int length,
- PangoAnalysis *analysis,
- PangoGlyphString *glyphs)
-{
- int n_chars, n_glyph;
- int i, j;
- const char *cluster_start;
- const char *p;
- gunichar *wc, *uni_str;
- int res;
- unsigned char tsc_str[6];
- int ntsc, nuni;
-
- PangoXSubfont tscii_font;
-
- g_return_if_fail (font != NULL);
- g_return_if_fail (text != NULL);
- g_return_if_fail (length >= 0);
- g_return_if_fail (analysis != NULL);
-
- tscii_font = find_tscii_font (font);
- if (!tscii_font)
- {
- g_warning ("Cannot find a tscii font!\n");
- return;
- }
-
- n_chars = g_utf8_strlen (text, length);
-
- /* temporarily set the size to 3 times the number of unicode chars */
- pango_glyph_string_set_size (glyphs, n_chars * 3);
-
- wc = (gunichar *)g_malloc(sizeof(gunichar)*n_chars);
-
- p = text;
- for (i=0; i < n_chars; i++)
- {
- wc[i] = g_utf8_get_char (p);
- p = g_utf8_next_char (p);
- }
-
- n_glyph = 0;
- uni_str = wc;
-
- cluster_start = text;
- j = 0;
- while (j < n_chars)
- {
- res = uni2tsc(uni_str, tsc_str, &nuni, &ntsc, n_chars - j, 6);
-
- uni_str = uni_str + nuni;
- /* We need to differentiate between different return codes later */
- if (res != TA_SUCCESS)
- {
- set_glyph (glyphs, n_glyph, cluster_start - text, font, tscii_font, ' ');
- n_glyph++;
- j = j + nuni;
- continue;
- }
- for (i = 0; i < ntsc; i++)
- {
- set_glyph (glyphs, n_glyph, cluster_start - text, font, tscii_font, (PangoGlyph) tsc_str[i]);
- n_glyph++;
- }
- j = j + nuni;
- while (nuni--)
- cluster_start = g_utf8_next_char (cluster_start);
- }
-
- pango_glyph_string_set_size (glyphs, n_glyph);
-
- g_free(wc);
-}
-
-static PangoCoverage *
-tamil_engine_get_coverage (PangoFont *font,
- const char *lang)
-{
- PangoCoverage *result = pango_coverage_new ();
-
- PangoXSubfont tscii_font = find_tscii_font (font);
- if (tscii_font)
- {
- gunichar i;
-
- for (i = 0xb80; i <= 0xbff; i++)
- pango_coverage_set (result, i, PANGO_COVERAGE_EXACT);
- }
-
- return result;
-}
-
-static PangoEngine *
-tamil_engine_x_new ()
-{
- PangoEngineShape *result;
-
- result = g_new (PangoEngineShape, 1);
-
- result->engine.id = "TamilScriptEngine";
- result->engine.type = PANGO_ENGINE_TYPE_SHAPE;
- result->engine.length = sizeof (result);
- result->script_shape = tamil_engine_shape;
- result->get_coverage = tamil_engine_get_coverage;
-
- return (PangoEngine *)result;
-}
-
-/* The following three functions provide the public module API for
- * Pango
- */
-
-#ifdef MODULE_PREFIX
-#define MODULE_ENTRY(func) _pango_tamil_##func
-#else
-#define MODULE_ENTRY(func) func
-#endif
-
-void
-MODULE_ENTRY(script_engine_list) (PangoEngineInfo **engines, int *n_engines)
-{
- *engines = script_engines;
- *n_engines = n_script_engines;
-}
-
-PangoEngine *
-MODULE_ENTRY(script_engine_load) (const char *id)
-{
- if (!strcmp (id, "TamilScriptEngineX"))
- return tamil_engine_x_new ();
- else
- return NULL;
-}
-
-void
-MODULE_ENTRY(script_engine_unload) (PangoEngine *engine)
-{
-}
-
diff --git a/modules/thai/Makefile.am b/modules/thai/Makefile.am
index c77249b9..10dbe681 100644
--- a/modules/thai/Makefile.am
+++ b/modules/thai/Makefile.am
@@ -1,21 +1,21 @@
## Process this file with automake to create Makefile.in.
-sources = thai.c
+sources = thai-x.c
-if INCLUDE_THAI
-noinst_LTLIBRARIES = libpango-thai.la
-moddefine = -DMODULE_PREFIX
+if INCLUDE_THAI_X
+noinst_LTLIBRARIES = libpango-thai-x.la
+moddefine = -DX_MODULE_PREFIX
else
moduledir = $(libdir)/pango/modules
-module_LTLIBRARIES = pango-thai.la
+module_LTLIBRARIES = pango-thai-x.la
moduleflags=-rpath $(libdir)
endif
INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/pango/ $(moddefine)
-pango_thai_la_LDFLAGS = $(moduleflags) -export-dynamic -avoid-version -module
-pango_thai_la_LIBADD =
-pango_thai_la_SOURCES = $(sources)
+pango_thai_x_la_LDFLAGS = $(moduleflags) -export-dynamic -avoid-version -module
+pango_thai_x_la_LIBADD =
+pango_thai_x_la_SOURCES = $(sources)
-libpango_thai_la_SOURCES = $(sources)
+libpango_thai_x_la_SOURCES = $(sources)
diff --git a/modules/thai/thai-x.c b/modules/thai/thai-x.c
index 40dcd78f..c32e3386 100644
--- a/modules/thai/thai-x.c
+++ b/modules/thai/thai-x.c
@@ -868,10 +868,10 @@ thai_engine_x_new ()
* entry points script_engine_list, etc. But if we are compiling
* it for inclusion directly in Pango, then we need them to
* to have distinct names for this module, so we prepend
- * _pango_thai_
+ * _pango_thai_x_
*/
-#ifdef MODULE_PREFIX
-#define MODULE_ENTRY(func) _pango_thai_##func
+#ifdef X_MODULE_PREFIX
+#define MODULE_ENTRY(func) _pango_thai_x_##func
#else
#define MODULE_ENTRY(func) func
#endif
diff --git a/modules/thai/thai.c b/modules/thai/thai.c
deleted file mode 100644
index 40dcd78f..00000000
--- a/modules/thai/thai.c
+++ /dev/null
@@ -1,903 +0,0 @@
-/* Pango
- * thai.c:
- *
- * Copyright (C) 1999 Red Hat Software
- * Author: Owen Taylor <otaylor@redhat.com>
- *
- * Software and Language Engineering Laboratory, NECTEC
- * Author: Theppitak Karoonboonyanan <thep@links.nectec.or.th>
- *
- * Copyright (c) 1996-2000 by Sun Microsystems, Inc.
- * Author: Chookij Vanatham <Chookij.Vanatham@Eng.Sun.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 <string.h>
-
-#include <glib.h>
-#include <string.h>
-#include "pangox.h"
-#include "pango-engine.h"
-
-#define ucs2tis(wc) (unsigned int)((unsigned int)(wc) - 0x0E00 + 0xA0)
-#define tis2uni(c) ((gunichar)(c) - 0xA0 + 0x0E00)
-
-#define MAX_CLUSTER_CHRS 256
-#define MAX_GLYPHS 256
-
-/* Define TACTIS character classes */
-#define CTRL 0
-#define NON 1
-#define CONS 2
-#define LV 3
-#define FV1 4
-#define FV2 5
-#define FV3 6
-#define BV1 7
-#define BV2 8
-#define BD 9
-#define TONE 10
-#define AD1 11
-#define AD2 12
-#define AD3 13
-#define AV1 14
-#define AV2 15
-#define AV3 16
-
-#define _ND 0
-#define _NC 1
-#define _UC (1<<1)
-#define _BC (1<<2)
-#define _SC (1<<3)
-#define _AV (1<<4)
-#define _BV (1<<5)
-#define _TN (1<<6)
-#define _AD (1<<7)
-#define _BD (1<<8)
-#define _AM (1<<9)
-
-#define NoTailCons _NC
-#define UpTailCons _UC
-#define BotTailCons _BC
-#define SpltTailCons _SC
-#define Cons (NoTailCons|UpTailCons|BotTailCons|SpltTailCons)
-#define AboveVowel _AV
-#define BelowVowel _BV
-#define Tone _TN
-#define AboveDiac _AD
-#define BelowDiac _BD
-#define SaraAm _AM
-
-#define char_class(wc) TAC_char_class[(unsigned int)(wc)]
-#define is_char_type(wc, mask) (char_type_table[ucs2tis ((wc))] & (mask))
-
-/* We handle the range U+0e01 to U+0e5b exactly
- */
-static PangoEngineRange thai_ranges[] = {
- { 0x0e01, 0x0e5b, "*" }, /* Thai */
-};
-
-static PangoEngineInfo script_engines[] = {
- {
- "ThaiScriptEngineX",
- PANGO_ENGINE_TYPE_SHAPE,
- PANGO_RENDER_TYPE_X,
- thai_ranges, G_N_ELEMENTS(thai_ranges)
- }
-};
-
-/*
- * X window system script engine portion
- */
-
-typedef struct _ThaiFontInfo ThaiFontInfo;
-
-/* The type of encoding that we will use
- */
-typedef enum {
- THAI_FONT_NONE,
- THAI_FONT_XTIS,
- THAI_FONT_TIS,
- THAI_FONT_TIS_MAC,
- THAI_FONT_TIS_WIN,
- THAI_FONT_ISO10646
-} ThaiFontType;
-
-struct _ThaiFontInfo
-{
- PangoFont *font;
- ThaiFontType type;
- PangoXSubfont subfont;
-};
-
-/* All combining marks for Thai fall in the range U+0E30-U+0E50,
- * so we confine our data tables to that range, and use
- * default values for characters outside those ranges.
- */
-
-/* Map from code point to group used for rendering with XTIS fonts
- * (0 == base character)
- */
-static const char groups[32] = {
- 0, 1, 0, 0, 1, 1, 1, 1,
- 1, 1, 1, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 2,
- 2, 2, 2, 2, 2, 2, 1, 0
-};
-
-/* Map from code point to index within group 1
- * (0 == no combining mark from group 1)
- */
-static const char group1_map[32] = {
- 0, 1, 0, 0, 2, 3, 4, 5,
- 6, 7, 8, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0
-};
-
-/* Map from code point to index within group 2
- * (0 == no combining mark from group 2)
- */
-static const char group2_map[32] = {
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 1,
- 2, 3, 4, 5, 6, 7, 1, 0
-};
-
-static const gint char_type_table[256] = {
- /* 0, 1, 2, 3, 4, 5, 6, 7,
- 8, 9, A, B, C, D, E, F */
-
- /*00*/ _ND, _ND, _ND, _ND, _ND, _ND, _ND, _ND,
- _ND, _ND, _ND, _ND, _ND, _ND, _ND, _ND,
- /*10*/ _ND, _ND, _ND, _ND, _ND, _ND, _ND, _ND,
- _ND, _ND, _ND, _ND, _ND, _ND, _ND, _ND,
- /*20*/ _ND, _ND, _ND, _ND, _ND, _ND, _ND, _ND,
- _ND, _ND, _ND, _ND, _ND, _ND, _ND, _ND,
- /*30*/ _ND, _ND, _ND, _ND, _ND, _ND, _ND, _ND,
- _ND, _ND, _ND, _ND, _ND, _ND, _ND, _ND,
- /*40*/ _ND, _ND, _ND, _ND, _ND, _ND, _ND, _ND,
- _ND, _ND, _ND, _ND, _ND, _ND, _ND, _ND,
- /*50*/ _ND, _ND, _ND, _ND, _ND, _ND, _ND, _ND,
- _ND, _ND, _ND, _ND, _ND, _ND, _ND, _ND,
- /*60*/ _ND, _ND, _ND, _ND, _ND, _ND, _ND, _ND,
- _ND, _ND, _ND, _ND, _ND, _ND, _ND, _ND,
- /*70*/ _ND, _ND, _ND, _ND, _ND, _ND, _ND, _ND,
- _ND, _ND, _ND, _ND, _ND, _ND, _ND, _ND,
- /*80*/ _ND, _ND, _ND, _ND, _ND, _ND, _ND, _ND,
- _ND, _ND, _ND, _ND, _ND, _ND, _ND, _ND,
- /*90*/ _ND, _ND, _ND, _ND, _ND, _ND, _ND, _ND,
- _ND, _ND, _ND, _ND, _ND, _ND, _ND, _ND,
-
- /*A0*/ _ND, _NC, _NC, _NC, _NC, _NC, _NC, _NC,
- _NC, _NC, _NC, _NC, _NC, _SC, _BC, _BC,
- /*B0*/ _SC, _NC, _NC, _NC, _NC, _NC, _NC, _NC,
- _NC, _NC, _NC, _UC, _NC, _UC, _NC, _UC,
- /*C0*/ _NC, _NC, _NC, _NC, _ND, _NC, _ND, _NC,
- _NC, _NC, _NC, _NC, _UC, _NC, _NC, _ND,
- /*D0*/ _ND, _AV, _ND, _AM, _AV, _AV, _AV, _AV,
- _BV, _BV, _BD, _ND, _ND, _ND, _ND, _ND,
- /*E0*/ _ND, _ND, _ND, _ND, _ND, _ND, _ND, _AD,
- _TN, _TN, _TN, _TN, _AD, _AD, _AD, _ND,
- /*F0*/ _ND, _ND, _ND, _ND, _ND, _ND, _ND, _ND,
- _ND, _ND, _ND, _ND, _ND, _ND, _ND, _ND,
-};
-
-static const gint TAC_char_class[256] = {
- /* 0, 1, 2, 3, 4, 5, 6, 7,
- 8, 9, A, B, C, D, E, F */
-
- /*00*/ CTRL,CTRL,CTRL,CTRL,CTRL,CTRL,CTRL,CTRL,
- CTRL,CTRL,CTRL,CTRL,CTRL,CTRL,CTRL,CTRL,
- /*10*/ CTRL,CTRL,CTRL,CTRL,CTRL,CTRL,CTRL,CTRL,
- CTRL,CTRL,CTRL,CTRL,CTRL,CTRL,CTRL,CTRL,
- /*20*/ NON, NON, NON, NON, NON, NON, NON, NON,
- NON, NON, NON, NON, NON, NON, NON, NON,
- /*30*/ NON, NON, NON, NON, NON, NON, NON, NON,
- NON, NON, NON, NON, NON, NON, NON, NON,
- /*40*/ NON, NON, NON, NON, NON, NON, NON, NON,
- NON, NON, NON, NON, NON, NON, NON, NON,
- /*50*/ NON, NON, NON, NON, NON, NON, NON, NON,
- NON, NON, NON, NON, NON, NON, NON, NON,
- /*60*/ NON, NON, NON, NON, NON, NON, NON, NON,
- NON, NON, NON, NON, NON, NON, NON, NON,
- /*70*/ NON, NON, NON, NON, NON, NON, NON, NON,
- NON, NON, NON, NON, NON, NON, NON,CTRL,
- /*80*/ CTRL,CTRL,CTRL,CTRL,CTRL,CTRL,CTRL,CTRL,
- CTRL,CTRL,CTRL,CTRL,CTRL,CTRL,CTRL,CTRL,
- /*90*/ CTRL,CTRL,CTRL,CTRL,CTRL,CTRL,CTRL,CTRL,
- CTRL,CTRL,CTRL,CTRL,CTRL,CTRL,CTRL,CTRL,
- /*A0*/ NON,CONS,CONS,CONS,CONS,CONS,CONS,CONS,
- CONS,CONS,CONS,CONS,CONS,CONS,CONS,CONS,
- /*B0*/ CONS,CONS,CONS,CONS,CONS,CONS,CONS,CONS,
- CONS,CONS,CONS,CONS,CONS,CONS,CONS,CONS,
- /*C0*/ CONS,CONS,CONS,CONS, FV3,CONS, FV3,CONS,
- CONS,CONS,CONS,CONS,CONS,CONS,CONS, NON,
- /*D0*/ FV1, AV2, FV1, FV1, AV1, AV3, AV2, AV3,
- BV1, BV2, BD, NON, NON, NON, NON, NON,
- /*E0*/ LV, LV, LV, LV, LV, FV2, NON, AD2,
- TONE,TONE,TONE,TONE, AD1, AD1, AD3, NON,
- /*F0*/ NON, NON, NON, NON, NON, NON, NON, NON,
- NON, NON, NON, NON, NON, NON, NON,CTRL,
-};
-
-static const gchar TAC_compose_and_input_check_type_table[17][17] = {
- /* Cn */ /* 0, 1, 2, 3, 4, 5, 6, 7,
- 8, 9, A, B, C, D, E, F */
- /* Cn-1 00 */ { 'X', 'A', 'A', 'A', 'A', 'A', 'A', 'R',
- 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R' },
- /* 10 */ { 'X', 'A', 'A', 'A', 'S', 'S', 'A', 'R',
- 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R' },
- /* 20 */ { 'X', 'A', 'A', 'A', 'A', 'S', 'A', 'C',
- 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C' },
- /* 30 */ {'X', 'S', 'A', 'S', 'S', 'S', 'S', 'R',
- 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R' },
- /* 40 */ { 'X', 'S', 'A', 'A', 'S', 'S', 'A', 'R',
- 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R' },
- /* 50 */ { 'X', 'A', 'A', 'A', 'A', 'S', 'A', 'R',
- 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R' },
- /* 60 */ { 'X', 'A', 'A', 'A', 'S', 'A', 'S', 'R',
- 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R' },
- /* 70 */ { 'X', 'A', 'A', 'A', 'S', 'S', 'A', 'R',
- 'R', 'R', 'C', 'C', 'R', 'R', 'R', 'R', 'R' },
- /* 80 */ { 'X', 'A', 'A', 'A', 'S', 'S', 'A', 'R',
- 'R', 'R', 'C', 'R', 'R', 'R', 'R', 'R', 'R' },
- /* 90 */ { 'X', 'A', 'A', 'A', 'S', 'S', 'A', 'R',
- 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R' },
- /* A0 */ { 'X', 'A', 'A', 'A', 'A', 'A', 'A', 'R',
- 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R' },
- /* B0 */ { 'X', 'A', 'A', 'A', 'S', 'S', 'A', 'R',
- 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R' },
- /* C0 */ { 'X', 'A', 'A', 'A', 'S', 'S', 'A', 'R',
- 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R' },
- /* D0 */ { 'X', 'A', 'A', 'A', 'S', 'S', 'A', 'R',
- 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R' },
- /* E0 */ { 'X', 'A', 'A', 'A', 'S', 'S', 'A', 'R',
- 'R', 'R', 'C', 'C', 'R', 'R', 'R', 'R', 'R' },
- /* F0 */ { 'X', 'A', 'A', 'A', 'S', 'S', 'A', 'R',
- 'R', 'R', 'C', 'R', 'R', 'R', 'R', 'R', 'R' },
- { 'X', 'A', 'A', 'A', 'S', 'S', 'A', 'R',
- 'R', 'R', 'C', 'R', 'C', 'R', 'R', 'R', 'R' }
-};
-
-typedef struct {
- gint ShiftDown_TONE_AD[8];
- gint ShiftDownLeft_TONE_AD[8];
- gint ShiftLeft_TONE_AD[8];
- gint ShiftLeft_AV[7];
- gint ShiftDown_BV_BD[3];
- gint TailCutCons[4];
-} ThaiShapeTable;
-
-#define shiftdown_tone_ad(c,tbl) ((tbl)->ShiftDown_TONE_AD[(c)-0xE7])
-#define shiftdownleft_tone_ad(c,tbl) ((tbl)->ShiftDownLeft_TONE_AD[(c)-0xE7])
-#define shiftleft_tone_ad(c,tbl) ((tbl)->ShiftLeft_TONE_AD[(c)-0xE7])
-#define shiftleft_av(c,tbl) ((tbl)->ShiftLeft_AV[(c)-0xD1])
-#define shiftdown_bv_bd(c,tbl) ((tbl)->ShiftDown_BV_BD[(c)-0xD8])
-#define tailcutcons(c,tbl) ((tbl)->TailCutCons[(c)-0xAD])
-
-/* Macintosh
- */
-static const ThaiShapeTable Mac_shape_table = {
- { 0xE7, 0x88, 0x89, 0x8A, 0x8B, 0x8C, 0xED, 0xEE },
- { 0xE7, 0x83, 0x84, 0x85, 0x86, 0x87, 0x8F, 0xEE },
- { 0x93, 0x98, 0x99, 0x9A, 0x9B, 0x9C, 0x8F, 0xEE },
- { 0x92, 0x00, 0x00, 0x94, 0x95, 0x96, 0x97 },
- { 0xD8, 0xD9, 0xDA },
- { 0xAD, 0x00, 0x00, 0xB0 }
-};
-
-/* Microsoft Window
- */
-static const ThaiShapeTable Win_shape_table = {
- { 0xE7, 0x8B, 0x8C, 0x8D, 0x8E, 0x8F, 0xED, 0xEE },
- { 0xE7, 0x86, 0x87, 0x88, 0x89, 0x8A, 0x99, 0xEE },
- { 0x9A, 0x9B, 0x9C, 0x9D, 0x9E, 0x9F, 0x99, 0xEE },
- { 0x98, 0x00, 0x00, 0x81, 0x82, 0x83, 0x84 },
- { 0xFC, 0xFD, 0xFE },
- { 0x90, 0x00, 0x00, 0x80 }
-};
-
-/* Returns a structure with information we will use to rendering given the
- * #PangoFont. This is computed once per font and cached for later retrieval.
- */
-static ThaiFontInfo *
-get_font_info (PangoFont *font)
-{
- static const char *charsets[] = {
- "tis620-2",
- "tis620-1",
- "tis620-0",
- "xtis620.2529-1",
- "xtis-0",
- "tis620.2533-1",
- "tis620.2529-1",
- "iso8859-11",
- "iso10646-1",
- };
-
- static const int charset_types[] = {
- THAI_FONT_TIS_WIN,
- THAI_FONT_TIS_MAC,
- THAI_FONT_TIS,
- THAI_FONT_XTIS,
- THAI_FONT_XTIS,
- THAI_FONT_TIS,
- THAI_FONT_TIS,
- THAI_FONT_TIS,
- THAI_FONT_ISO10646
- };
-
- ThaiFontInfo *font_info;
- GQuark info_id = g_quark_from_string ("thai-font-info");
-
- font_info = g_object_get_qdata (G_OBJECT (font), info_id);
-
- if (!font_info)
- {
- /* No cached information not found, so we need to compute it
- * from scratch
- */
- PangoXSubfont *subfont_ids;
- gint *subfont_charsets;
- gint n_subfonts, i;
-
- font_info = g_new (ThaiFontInfo, 1);
- font_info->font = font;
- font_info->type = THAI_FONT_NONE;
-
- g_object_set_qdata_full (G_OBJECT (font), info_id, font_info, (GDestroyNotify)g_free);
-
- n_subfonts = pango_x_list_subfonts (font, (char **)charsets, G_N_ELEMENTS (charsets),
- &subfont_ids, &subfont_charsets);
-
- for (i=0; i < n_subfonts; i++)
- {
- ThaiFontType font_type = charset_types[subfont_charsets[i]];
-
- if (font_type != THAI_FONT_ISO10646 ||
- pango_x_has_glyph (font, PANGO_X_MAKE_GLYPH (subfont_ids[i], 0xe01)))
- {
- font_info->type = font_type;
- font_info->subfont = subfont_ids[i];
-
- break;
- }
- }
-
- g_free (subfont_ids);
- g_free (subfont_charsets);
- }
-
- return font_info;
-}
-
-static void
-add_glyph (ThaiFontInfo *font_info,
- PangoGlyphString *glyphs,
- gint cluster_start,
- PangoGlyph glyph,
- gboolean combining)
-{
- PangoRectangle ink_rect, logical_rect;
- gint index = glyphs->num_glyphs;
-
- pango_glyph_string_set_size (glyphs, index + 1);
-
- glyphs->glyphs[index].glyph = glyph;
- glyphs->glyphs[index].attr.is_cluster_start = combining ? 0 : 1;
-
- glyphs->log_clusters[index] = cluster_start;
-
- pango_font_get_glyph_extents (font_info->font,
- glyphs->glyphs[index].glyph, &ink_rect, &logical_rect);
-
- if (combining)
- {
- if (font_info->type == THAI_FONT_TIS ||
- font_info->type == THAI_FONT_TIS_MAC ||
- font_info->type == THAI_FONT_TIS_WIN)
- {
- glyphs->glyphs[index].geometry.width =
- logical_rect.width + glyphs->glyphs[index - 1].geometry.width;
- if (logical_rect.width > 0)
- glyphs->glyphs[index].geometry.x_offset = glyphs->glyphs[index - 1].geometry.width;
- else
- glyphs->glyphs[index].geometry.x_offset = glyphs->glyphs[index].geometry.width;
- glyphs->glyphs[index - 1].geometry.width = 0;
- }
- else
- {
- glyphs->glyphs[index].geometry.width =
- MAX (logical_rect.width, glyphs->glyphs[index - 1].geometry.width);
- glyphs->glyphs[index - 1].geometry.width = 0;
- glyphs->glyphs[index].geometry.x_offset = 0;
- }
- }
- else
- {
- glyphs->glyphs[index].geometry.x_offset = 0;
- glyphs->glyphs[index].geometry.width = logical_rect.width;
- }
-
- glyphs->glyphs[index].geometry.y_offset = 0;
-}
-
-static gint
-get_adjusted_glyphs_list (ThaiFontInfo *font_info,
- gunichar *cluster,
- gint num_chrs,
- PangoGlyph *glyph_lists,
- const ThaiShapeTable *shaping_table)
-{
- switch (num_chrs)
- {
- case 1:
- if (is_char_type (cluster[0], BelowVowel|BelowDiac|AboveVowel|AboveDiac|Tone))
- {
- glyph_lists[0] = PANGO_X_MAKE_GLYPH (font_info->subfont, 0x7F);
- glyph_lists[1] =
- PANGO_X_MAKE_GLYPH (font_info->subfont, ucs2tis (cluster[0]));
- return 2;
- }
- else
- {
- glyph_lists[0] =
- PANGO_X_MAKE_GLYPH (font_info->subfont, ucs2tis (cluster[0]));
- return 1;
- }
- break;
-
- case 2:
- if (is_char_type (cluster[0], NoTailCons|BotTailCons|SpltTailCons) &&
- is_char_type (cluster[1], SaraAm))
- {
- glyph_lists[0] =
- PANGO_X_MAKE_GLYPH (font_info->subfont, ucs2tis (cluster[0]));
- glyph_lists[1] = PANGO_X_MAKE_GLYPH (font_info->subfont, 0xED);
- glyph_lists[2] = PANGO_X_MAKE_GLYPH (font_info->subfont, 0xD2);
- return 3;
- }
- else if (is_char_type (cluster[0], UpTailCons) &&
- is_char_type (cluster[1], SaraAm))
- {
- glyph_lists[0] =
- PANGO_X_MAKE_GLYPH (font_info->subfont, ucs2tis (cluster[0]));
- glyph_lists[1] = PANGO_X_MAKE_GLYPH (font_info->subfont,
- shiftleft_tone_ad (0xED, shaping_table));
- glyph_lists[2] = PANGO_X_MAKE_GLYPH (font_info->subfont, 0xD2);
- return 3;
- }
- else if (is_char_type (cluster[0], NoTailCons|BotTailCons|SpltTailCons) &&
- is_char_type (cluster[1], AboveVowel))
- {
- glyph_lists[0] =
- PANGO_X_MAKE_GLYPH (font_info->subfont, ucs2tis (cluster[0]));
- glyph_lists[1] =
- PANGO_X_MAKE_GLYPH (font_info->subfont, ucs2tis (cluster[1]));
- return 2;
- }
- else if (is_char_type (cluster[0], NoTailCons|BotTailCons|SpltTailCons) &&
- is_char_type (cluster[1], AboveDiac|Tone))
- {
- glyph_lists[0] =
- PANGO_X_MAKE_GLYPH (font_info->subfont, ucs2tis (cluster[0]));
- glyph_lists[1] = PANGO_X_MAKE_GLYPH (font_info->subfont,
- shiftdown_tone_ad (ucs2tis (cluster[1]), shaping_table));
- return 2;
- }
- else if (is_char_type (cluster[0], UpTailCons) &&
- is_char_type (cluster[1], AboveVowel))
- {
- glyph_lists[0] =
- PANGO_X_MAKE_GLYPH (font_info->subfont, ucs2tis (cluster[0]));
- glyph_lists[1] = PANGO_X_MAKE_GLYPH (font_info->subfont,
- shiftleft_av (ucs2tis (cluster[1]), shaping_table));
- return 2;
- }
- else if (is_char_type (cluster[0], UpTailCons) &&
- is_char_type (cluster[1], AboveDiac|Tone))
- {
- glyph_lists[0] =
- PANGO_X_MAKE_GLYPH (font_info->subfont, ucs2tis (cluster[0]));
- glyph_lists[1] = PANGO_X_MAKE_GLYPH (font_info->subfont,
- shiftdownleft_tone_ad (ucs2tis (cluster[1]), shaping_table));
- return 2;
- }
- else if (is_char_type (cluster[0], NoTailCons|UpTailCons) &&
- is_char_type (cluster[1], BelowVowel|BelowDiac))
- {
- glyph_lists[0] =
- PANGO_X_MAKE_GLYPH (font_info->subfont, ucs2tis (cluster[0]));
- glyph_lists[1] =
- PANGO_X_MAKE_GLYPH (font_info->subfont, ucs2tis (cluster[1]));
- return 2;
- }
- else if (is_char_type (cluster[0], BotTailCons) &&
- is_char_type (cluster[1], BelowVowel|BelowDiac))
- {
- glyph_lists[0] =
- PANGO_X_MAKE_GLYPH (font_info->subfont, ucs2tis (cluster[0]));
- glyph_lists[1] =
- PANGO_X_MAKE_GLYPH (font_info->subfont,
- shiftdown_bv_bd (ucs2tis (cluster[1]), shaping_table));
- return 2;
- }
- else if (is_char_type (cluster[0], SpltTailCons) &&
- is_char_type (cluster[1], BelowVowel|BelowDiac))
- {
- glyph_lists[0] = PANGO_X_MAKE_GLYPH (font_info->subfont,
- tailcutcons (ucs2tis (cluster[0]), shaping_table));
- glyph_lists[1] =
- PANGO_X_MAKE_GLYPH (font_info->subfont, ucs2tis (cluster[1]));
- return 2;
- }
- else
- {
- glyph_lists[0] =
- PANGO_X_MAKE_GLYPH (font_info->subfont, 0x7F);
- glyph_lists[1] =
- PANGO_X_MAKE_GLYPH (font_info->subfont, ucs2tis (cluster[1]));
- glyph_lists[2] =
- PANGO_X_MAKE_GLYPH (font_info->subfont, ucs2tis (cluster[2]));
- return 3;
- }
- break;
-
- case 3:
- if (is_char_type (cluster[0], NoTailCons|BotTailCons|SpltTailCons) &&
- is_char_type (cluster[1], Tone) &&
- is_char_type (cluster[2], SaraAm))
- {
- glyph_lists[0] =
- PANGO_X_MAKE_GLYPH (font_info->subfont, ucs2tis (cluster[0]));
- glyph_lists[1] = PANGO_X_MAKE_GLYPH (font_info->subfont, 0xED);
- glyph_lists[2] =
- PANGO_X_MAKE_GLYPH (font_info->subfont, ucs2tis (cluster[1]));
- glyph_lists[3] = PANGO_X_MAKE_GLYPH (font_info->subfont, 0xD2);
- return 4;
- }
- else if (is_char_type (cluster[0], UpTailCons) &&
- is_char_type (cluster[1], Tone) &&
- is_char_type (cluster[2], SaraAm))
- {
- glyph_lists[0] =
- PANGO_X_MAKE_GLYPH (font_info->subfont, ucs2tis (cluster[0]));
- glyph_lists[1] = PANGO_X_MAKE_GLYPH (font_info->subfont,
- shiftleft_tone_ad (0xED, shaping_table));
- glyph_lists[2] = PANGO_X_MAKE_GLYPH (font_info->subfont,
- shiftleft_tone_ad (ucs2tis (cluster[1]), shaping_table));
- glyph_lists[3] = PANGO_X_MAKE_GLYPH (font_info->subfont, 0xD2);
- return 4;
- }
- else if (is_char_type (cluster[0], UpTailCons) &&
- is_char_type (cluster[1], AboveVowel) &&
- is_char_type (cluster[2], AboveDiac|Tone))
- {
- glyph_lists[0] =
- PANGO_X_MAKE_GLYPH (font_info->subfont, ucs2tis (cluster[0]));
- glyph_lists[1] = PANGO_X_MAKE_GLYPH (font_info->subfont,
- shiftleft_av (ucs2tis (cluster[1]), shaping_table));
- glyph_lists[2] = PANGO_X_MAKE_GLYPH (font_info->subfont,
- shiftleft_tone_ad (ucs2tis (cluster[2]), shaping_table));
- return 3;
- }
- else if (is_char_type (cluster[0], UpTailCons) &&
- is_char_type (cluster[1], BelowVowel) &&
- is_char_type (cluster[2], AboveDiac|Tone))
- {
- glyph_lists[0] =
- PANGO_X_MAKE_GLYPH (font_info->subfont, ucs2tis (cluster[0]));
- glyph_lists[1] =
- PANGO_X_MAKE_GLYPH (font_info->subfont, ucs2tis (cluster[1]));
- glyph_lists[2] = PANGO_X_MAKE_GLYPH (font_info->subfont,
- shiftdownleft_tone_ad (ucs2tis (cluster[2]), shaping_table));
- return 3;
- }
- else if (is_char_type (cluster[0], NoTailCons) &&
- is_char_type (cluster[1], BelowVowel) &&
- is_char_type (cluster[2], AboveDiac|Tone))
- {
- glyph_lists[0] =
- PANGO_X_MAKE_GLYPH (font_info->subfont, ucs2tis (cluster[0]));
- glyph_lists[1] =
- PANGO_X_MAKE_GLYPH (font_info->subfont, ucs2tis (cluster[1]));
- glyph_lists[2] =
- PANGO_X_MAKE_GLYPH (font_info->subfont,
- shiftdown_tone_ad (ucs2tis (cluster[2]), shaping_table));
- return 3;
- }
- else if (is_char_type (cluster[0], SpltTailCons) &&
- is_char_type (cluster[1], BelowVowel) &&
- is_char_type (cluster[2], AboveDiac|Tone))
- {
- glyph_lists[0] = PANGO_X_MAKE_GLYPH (font_info->subfont,
- tailcutcons (ucs2tis (cluster[0]), shaping_table));
- glyph_lists[1] =
- PANGO_X_MAKE_GLYPH (font_info->subfont, ucs2tis (cluster[1]));
- glyph_lists[2] = PANGO_X_MAKE_GLYPH (font_info->subfont,
- shiftdown_tone_ad (ucs2tis (cluster[2]), shaping_table));
- return 3;
- }
- else if (is_char_type (cluster[0], BotTailCons) &&
- is_char_type (cluster[1], BelowVowel) &&
- is_char_type (cluster[2], AboveDiac|Tone))
- {
- glyph_lists[0] =
- PANGO_X_MAKE_GLYPH (font_info->subfont, ucs2tis (cluster[0]));
- glyph_lists[1] = PANGO_X_MAKE_GLYPH (font_info->subfont,
- shiftdown_bv_bd (ucs2tis (cluster[1]), shaping_table));
- glyph_lists[2] = PANGO_X_MAKE_GLYPH (font_info->subfont,
- shiftdown_tone_ad (ucs2tis (cluster[2]), shaping_table));
- return 3;
- }
- else
- {
- glyph_lists[0] =
- PANGO_X_MAKE_GLYPH (font_info->subfont, ucs2tis (cluster[0]));
- glyph_lists[1] =
- PANGO_X_MAKE_GLYPH (font_info->subfont, ucs2tis (cluster[1]));
- glyph_lists[2] =
- PANGO_X_MAKE_GLYPH (font_info->subfont, ucs2tis (cluster[2]));
- return 3;
- }
- break;
- }
-
- return 0;
-}
-
-static gint
-get_glyphs_list (ThaiFontInfo *font_info,
- gunichar *cluster,
- gint num_chrs,
- PangoGlyph *glyph_lists)
-{
- PangoGlyph glyph;
- gint xtis_index;
- gint i;
-
- switch (font_info->type)
- {
- case THAI_FONT_NONE:
- for (i=0; i < num_chrs; i++)
- glyph_lists[i] = pango_x_get_unknown_glyph (font_info->font);
- return num_chrs;
-
- case THAI_FONT_XTIS:
- /* If we are rendering with an XTIS font, we try to find a precomposed
- * glyph for the cluster.
- */
- xtis_index = 0x100 * (cluster[0] - 0xe00 + 0x20) + 0x30;
- if (cluster[1])
- xtis_index +=8 * group1_map[cluster[1] - 0xe30];
- if (cluster[2])
- xtis_index += group2_map[cluster[2] - 0xe30];
- glyph = PANGO_X_MAKE_GLYPH (font_info->subfont, xtis_index);
- if (pango_x_has_glyph (font_info->font, glyph)) {
- glyph_lists[0] = glyph;
- return 1;
- }
- for (i=0; i < num_chrs; i++)
- glyph_lists[i] =
- PANGO_X_MAKE_GLYPH (font_info->subfont,
- 0x100 * (cluster[i] - 0xe00 + 0x20) + 0x30);
- return num_chrs;
-
- case THAI_FONT_TIS:
- for (i=0; i < num_chrs; i++)
- glyph_lists[i] =
- PANGO_X_MAKE_GLYPH (font_info->subfont, ucs2tis (cluster[i]));
- return num_chrs;
-
- case THAI_FONT_TIS_MAC:
- /* MacIntosh Extension
- */
- return get_adjusted_glyphs_list (font_info, cluster,
- num_chrs, glyph_lists, &Mac_shape_table);
-
- case THAI_FONT_TIS_WIN:
- /* Microsoft Extension
- */
- return get_adjusted_glyphs_list (font_info, cluster,
- num_chrs, glyph_lists, &Win_shape_table);
-
- case THAI_FONT_ISO10646:
- for (i=0; i < num_chrs; i++)
- glyph_lists[i] = PANGO_X_MAKE_GLYPH (font_info->subfont, cluster[i]);
- return num_chrs;
- }
-
- return 0; /* Quiet GCC */
-}
-
-static void
-add_cluster (ThaiFontInfo *font_info,
- PangoGlyphString *glyphs,
- gint cluster_start,
- gunichar *cluster,
- gint num_chrs)
-
-{
- PangoGlyph glyphs_list[MAX_GLYPHS];
- gint num_glyphs;
- gint i;
-
- num_glyphs = get_glyphs_list(font_info, cluster, num_chrs, glyphs_list);
- for (i=0; i<num_glyphs; i++)
- add_glyph (font_info, glyphs, cluster_start, glyphs_list[i],
- i == 0 ? FALSE : TRUE);
-}
-
-static gboolean
-is_wtt_composible (gunichar cur_wc, gunichar nxt_wc)
-{
- switch (TAC_compose_and_input_check_type_table[char_class (ucs2tis (cur_wc))]
- [char_class (ucs2tis (nxt_wc))])
- {
- case 'A':
- case 'S':
- case 'R':
- case 'X':
- return FALSE;
-
- case 'C':
- return TRUE;
- }
-
- g_assert_not_reached ();
- return FALSE;
-}
-
-static const char *
-get_next_cluster(const char *text,
- gint length,
- gunichar *cluster,
- gint *num_chrs)
-{
- const char *p;
- gint n_chars = 0;
-
- p = text;
- while (p < text + length && n_chars < 3)
- {
- gunichar current = g_utf8_get_char (p);
-
- if (n_chars == 0 ||
- is_wtt_composible ((gunichar)(cluster[n_chars - 1]), current) ||
- (n_chars == 1 &&
- is_char_type (cluster[0], Cons) &&
- is_char_type (current, SaraAm)) ||
- (n_chars == 2 &&
- is_char_type (cluster[0], Cons) &&
- is_char_type (cluster[1], Tone) &&
- is_char_type (current, SaraAm)))
- {
- cluster[n_chars++] = current;
- p = g_utf8_next_char (p);
- }
- else
- break;
- }
-
- *num_chrs = n_chars;
- return p;
-}
-
-static void
-thai_engine_shape (PangoFont *font,
- const char *text,
- gint length,
- PangoAnalysis *analysis,
- PangoGlyphString *glyphs)
-{
- ThaiFontInfo *font_info;
- const char *p;
- const char *log_cluster;
- gunichar cluster[MAX_CLUSTER_CHRS];
- gint num_chrs;
-
- pango_glyph_string_set_size (glyphs, 0);
-
- font_info = get_font_info (font);
-
- p = text;
- while (p < text + length)
- {
- log_cluster = p;
- p = get_next_cluster (p, text + length - p, cluster, &num_chrs);
- add_cluster (font_info, glyphs, log_cluster - text, cluster, num_chrs);
- }
-}
-
-static PangoCoverage *
-thai_engine_get_coverage (PangoFont *font,
- const char *lang)
-{
- PangoCoverage *result = pango_coverage_new ();
-
- ThaiFontInfo *font_info = get_font_info (font);
-
- if (font_info->type != THAI_FONT_NONE)
- {
- gunichar wc;
-
- for (wc = 0xe01; wc <= 0xe3a; wc++)
- pango_coverage_set (result, wc, PANGO_COVERAGE_EXACT);
- for (wc = 0xe3f; wc <= 0xe5b; wc++)
- pango_coverage_set (result, wc, PANGO_COVERAGE_EXACT);
- }
-
- return result;
-}
-
-static PangoEngine *
-thai_engine_x_new ()
-{
- PangoEngineShape *result;
-
- result = g_new (PangoEngineShape, 1);
-
- result->engine.id = "ThaiScriptEngine";
- result->engine.type = PANGO_ENGINE_TYPE_SHAPE;
- result->engine.length = sizeof (result);
- result->script_shape = thai_engine_shape;
- result->get_coverage = thai_engine_get_coverage;
-
- return (PangoEngine *)result;
-}
-
-/* The following three functions provide the public module API for
- * Pango. If we are compiling it is a module, then we name the
- * entry points script_engine_list, etc. But if we are compiling
- * it for inclusion directly in Pango, then we need them to
- * to have distinct names for this module, so we prepend
- * _pango_thai_
- */
-#ifdef MODULE_PREFIX
-#define MODULE_ENTRY(func) _pango_thai_##func
-#else
-#define MODULE_ENTRY(func) func
-#endif
-
-/* List the engines contained within this module
- */
-void
-MODULE_ENTRY(script_engine_list) (PangoEngineInfo **engines, gint *n_engines)
-{
- *engines = script_engines;
- *n_engines = G_N_ELEMENTS (script_engines);
-}
-
-/* Load a particular engine given the ID for the engine
- */
-PangoEngine *
-MODULE_ENTRY(script_engine_load) (const char *id)
-{
- if (!strcmp (id, "ThaiScriptEngineX"))
- return thai_engine_x_new ();
- else
- return NULL;
-}
-
-void
-MODULE_ENTRY(script_engine_unload) (PangoEngine *engine)
-{
-}
-