diff options
author | Behdad Esfahbod <behdad@behdad.org> | 2015-04-04 18:46:20 -0700 |
---|---|---|
committer | Behdad Esfahbod <behdad@behdad.org> | 2015-04-04 18:48:43 -0700 |
commit | 137832fa931e875b900dedd1c8909b46d1f7e8ad (patch) | |
tree | a9086e8e1f7707a4cc92369491c28d392f827018 | |
parent | ef69cbb18b00d7e454cf881a8f58bdabad04ecef (diff) | |
download | pango-137832fa931e875b900dedd1c8909b46d1f7e8ad.tar.gz |
[modules] Move language modules in source tree and remove modules/
This should complete the kill-modules effort. What is left is leftover
removal and unbreaking stuff.
Bug 733882 - Kill Pango modules, engines, and config files
-rw-r--r-- | Makefile.am | 2 | ||||
-rw-r--r-- | configure.ac | 200 | ||||
-rw-r--r-- | docs/Makefile.am | 1 | ||||
-rw-r--r-- | modules/Makefile.am | 8 | ||||
-rw-r--r-- | modules/arabic/Makefile.am | 14 | ||||
-rw-r--r-- | modules/indic/Makefile.am | 14 | ||||
-rw-r--r-- | modules/thai/Makefile.am | 17 | ||||
-rw-r--r-- | pango/Makefile.am | 46 | ||||
-rw-r--r-- | pango/break-arabic.c (renamed from modules/arabic/arabic-lang.c) | 73 | ||||
-rw-r--r-- | pango/break-indic.c (renamed from modules/indic/indic-lang.c) | 113 | ||||
-rw-r--r-- | pango/break-thai.c (renamed from modules/thai/thai-lang.c) | 82 | ||||
-rw-r--r-- | pango/break.c | 86 | ||||
-rw-r--r-- | pango/module-defs-fc.c.win32 | 9 | ||||
-rw-r--r-- | pango/module-defs-lang.c.win32 | 11 | ||||
-rw-r--r-- | pango/module-defs-win32.c.win32 | 9 | ||||
-rw-r--r-- | pango/module-defs.h.win32 | 29 | ||||
-rw-r--r-- | pango/pango-context.c | 19 | ||||
-rw-r--r-- | pango/pango-engine-private.h | 4 |
18 files changed, 111 insertions, 626 deletions
diff --git a/Makefile.am b/Makefile.am index 43249703..4bae8dbf 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,6 +1,6 @@ ## Process this file with automake to create Makefile.in. -SUBDIRS= pango modules pango-view examples docs tools tests build +SUBDIRS= pango pango-view examples docs tools tests build EXTRA_DIST = \ autogen.sh \ diff --git a/configure.ac b/configure.ac index 235d0085..117edb4c 100644 --- a/configure.ac +++ b/configure.ac @@ -455,7 +455,9 @@ AC_SUBST(GLIB_MKENUMS) # LIBTHAI_REQUIRED_VERSION=0.1.9 PKG_CHECK_MODULES(LIBTHAI, libthai >= $LIBTHAI_REQUIRED_VERSION, have_libthai=true, have_libthai=false) -AM_CONDITIONAL(HAVE_LIBTHAI, $have_libthai) +if $have_libthai; then + AC_DEFINE(HAVE_LIBTHAI, 1, [Whether libthai is available]) +fi # # Checks for GObject Introspection @@ -463,43 +465,6 @@ AM_CONDITIONAL(HAVE_LIBTHAI, $have_libthai) GOBJECT_INTROSPECTION_CHECK([0.9.5]) -# -# Modules to build -# -arabic_modules="arabic-lang" -indic_modules="indic-lang" -thai_modules="" - -if $have_libthai ; then - thai_modules="thai-lang" -fi - -all_modules="$arabic_modules,$indic_modules,$thai_modules" - -INCLUDED_FC_MODULES= -INCLUDED_WIN32_MODULES= -INCLUDED_CORE_TEXT_MODULES= -INCLUDED_LANG_MODULES= - -AC_SUBST(INCLUDED_FC_MODULES) -AC_SUBST(INCLUDED_WIN32_MODULES) -AC_SUBST(INCLUDED_CORE_TEXT_MODULES) -AC_SUBST(INCLUDED_LANG_MODULES) - -IFS="${IFS= }"; pango_save_ifs="$IFS"; IFS=", " -for module in $all_modules; do - dir=`echo $module | sed "s/-.*//"` - included_path="\$(top_builddir)/modules/$dir/libpango-$module.la" - - case $module in - *-fc) INCLUDED_FC_MODULES="$INCLUDED_FC_MODULES $included_path" ;; - *-win32) INCLUDED_WIN32_MODULES="$INCLUDED_WIN32_MODULES $included_path" ;; - *-coretext) INCLUDED_CORE_TEXT_MODULES="$INCLUDED_CORE_TEXT_MODULES $included_path" ;; - *-lang) INCLUDED_LANG_MODULES="$INCLUDED_LANG_MODULES $included_path" ;; - *) IFS="$pango_save_ifs"; AC_MSG_ERROR([specified module $module not recognized]) ;; - esac -done -IFS="$pango_save_ifs" # # We use flockfile to implement pango_getline() - should be moved to GLib @@ -584,18 +549,6 @@ AC_ARG_ENABLE(installed_tests, AM_CONDITIONAL(BUILDOPT_INSTALL_TESTS, test x$enable_installed_tests = xyes) -dnl ******************************************************** -dnl * See whether we need to load our modules as .la files * -dnl ******************************************************** - -use_la_modules=false - -# is there any platform that we have to use .la files? - -if $use_la_modules ; then - AC_DEFINE(USE_LA_MODULES, 1, [Whether to load modules via .la files rather than directly]) -fi - dnl ****************************************************** dnl * See whether to include shared library dependencies * dnl ****************************************************** @@ -644,149 +597,6 @@ AC_SUBST(PKGCONFIG_MATH_LIBS) AC_SUBST(PKGCONFIG_CAIRO_REQUIRES) AM_CONDITIONAL(DISABLE_EXPLICIT_DEPS, test $enable_explicit_deps = no) -AC_CONFIG_COMMANDS([pango/module-defs.h], -[ -cat > pango/module-defs.h <<EOTEXT -/* Autogenerated by configure. Do not edit */ - -#include "modules.h" - -EOTEXT - -IFS="${IFS= }"; pango_save_ifs="$IFS"; IFS="," -for module in $all_modules; do - module_c=`echo $module | sed s/-/_/` - cat >> pango/module-defs.h <<EOTEXT -extern void _pango_${module_c}_script_engine_list (PangoEngineInfo **engines, int *n_engines); -extern void _pango_${module_c}_script_engine_init (GTypeModule *module); -extern void _pango_${module_c}_script_engine_exit (void); -extern PangoEngine *_pango_${module_c}_script_engine_create (const char *id); - -EOTEXT -done - -IFS="$pango_save_ifs" -],[ -all_modules=$all_modules -]) - -AC_CONFIG_COMMANDS([pango/module-defs-fc.c], -[ -### FC modules -cat > pango/module-defs-fc.c <<EOTEXT -/* Autogenerated by configure. Do not edit */ - -#include "module-defs.h" - -PangoIncludedModule _pango_included_fc_modules@<:@@:>@ = { -EOTEXT - -IFS="${IFS= }"; pango_save_ifs="$IFS"; IFS="," -for module in $all_modules; do - if echo $module | egrep -- "-fc($|,)" > /dev/null; then - module_c=`echo $module | sed s/-/_/` - cat >> pango/module-defs-fc.c <<EOTEXT - { _pango_${module_c}_script_engine_list, _pango_${module_c}_script_engine_init, _pango_${module_c}_script_engine_exit, _pango_${module_c}_script_engine_create }, -EOTEXT - fi -done - -IFS="$pango_save_ifs" - -cat >> pango/module-defs-fc.c <<EOTEXT - { NULL, NULL, NULL, NULL }, -}; -EOTEXT -]) - -AC_CONFIG_COMMANDS([pango/module-defs-win32.c], -[ -### Win32 modules -cat > pango/module-defs-win32.c <<EOTEXT -/* Autogenerated by configure. Do not edit */ - -#include "module-defs.h" - -PangoIncludedModule _pango_included_win32_modules@<:@@:>@ = { -EOTEXT - -IFS="${IFS= }"; pango_save_ifs="$IFS"; IFS="," -for module in $all_modules; do - if echo $module | egrep -- "-win32($|,)" > /dev/null; then - module_c=`echo $module | sed s/-/_/` - cat >> pango/module-defs-win32.c <<EOTEXT - { _pango_${module_c}_script_engine_list, _pango_${module_c}_script_engine_init, _pango_${module_c}_script_engine_exit, _pango_${module_c}_script_engine_create }, -EOTEXT - fi -done - -IFS="$pango_save_ifs" - -cat >> pango/module-defs-win32.c <<EOTEXT - { NULL, NULL, NULL, NULL }, -}; -EOTEXT -]) - -AC_CONFIG_COMMANDS([pango/module-defs-coretext.c], -[ -### CoreText modules -cat > pango/module-defs-coretext.c <<EOTEXT -/* Autogenerated by configure. Do not edit */ - -#include "module-defs.h" - -PangoIncludedModule _pango_included_core_text_modules@<:@@:>@ = { -EOTEXT - -IFS="${IFS= }"; pango_save_ifs="$IFS"; IFS="," -for module in $all_modules; do - if echo $module | egrep -- "-coretext($|,)" > /dev/null; then - module_c=`echo $module | sed s/-/_/` - cat >> pango/module-defs-coretext.c <<EOTEXT - { _pango_${module_c}_script_engine_list, _pango_${module_c}_script_engine_init, _pango_${module_c}_script_engine_exit, _pango_${module_c}_script_engine_create }, -EOTEXT - fi -done - -IFS="$pango_save_ifs" - -cat >> pango/module-defs-coretext.c <<EOTEXT - { NULL, NULL, NULL, NULL }, -}; -EOTEXT -]) - -AC_CONFIG_COMMANDS([pango/module-defs-lang.c], -[ -### lang modules -cat > pango/module-defs-lang.c <<EOTEXT -/* Autogenerated by configure. Do not edit */ - -#include "module-defs.h" - -PangoIncludedModule _pango_included_lang_modules@<:@@:>@ = { -EOTEXT - -IFS="${IFS= }"; pango_save_ifs="$IFS"; IFS="," -for module in $all_modules; do - if echo $module | egrep -- "-lang($|,)" > /dev/null; then - module_c=`echo $module | sed s/-/_/` - cat >> pango/module-defs-lang.c <<EOTEXT - { _pango_${module_c}_script_engine_list, _pango_${module_c}_script_engine_init, _pango_${module_c}_script_engine_exit, _pango_${module_c}_script_engine_create }, -EOTEXT - fi -done - -IFS="$pango_save_ifs" - -cat >> pango/module-defs-lang.c <<EOTEXT - { NULL, NULL, NULL, NULL }, -}; -EOTEXT -]) - - AC_HEADER_DIRENT AC_CHECK_HEADERS(unistd.h) @@ -836,10 +646,6 @@ pango/pangowin32.rc pango/pangocairo.rc pango/pangoxft.rc pango-view/Makefile -modules/Makefile -modules/arabic/Makefile -modules/indic/Makefile -modules/thai/Makefile examples/Makefile docs/Makefile docs/version.xml diff --git a/docs/Makefile.am b/docs/Makefile.am index 19124137..1a10da84 100644 --- a/docs/Makefile.am +++ b/docs/Makefile.am @@ -24,7 +24,6 @@ IGNORE_HFILES= \ ftglue.h \ mini-fribidi \ opentype \ - module-defs.h \ modules.h \ pangoatsui-private.h \ pangocairo-private.h \ diff --git a/modules/Makefile.am b/modules/Makefile.am deleted file mode 100644 index fa58389e..00000000 --- a/modules/Makefile.am +++ /dev/null @@ -1,8 +0,0 @@ -## Process this file with automake to create Makefile.in. - -SUBDIRS = \ - arabic \ - indic \ - thai - --include $(top_srcdir)/git.mk diff --git a/modules/arabic/Makefile.am b/modules/arabic/Makefile.am deleted file mode 100644 index 7b800cfd..00000000 --- a/modules/arabic/Makefile.am +++ /dev/null @@ -1,14 +0,0 @@ -INCLUDES = \ - -DG_LOG_DOMAIN=\"Pango\" \ - -DPANGO_ENABLE_ENGINE \ - $(PANGO_DEBUG_FLAGS) \ - -I$(top_srcdir) \ - -I$(top_srcdir)/pango \ - $(GLIB_CFLAGS) - -noinst_LTLIBRARIES = libpango-arabic-lang.la - -libpango_arabic_lang_la_SOURCES = arabic-lang.c -libpango_arabic_lang_la_CFLAGS = -DPANGO_MODULE_PREFIX=_pango_arabic_lang - --include $(top_srcdir)/git.mk diff --git a/modules/indic/Makefile.am b/modules/indic/Makefile.am deleted file mode 100644 index a3f23fd7..00000000 --- a/modules/indic/Makefile.am +++ /dev/null @@ -1,14 +0,0 @@ -INCLUDES = \ - -DG_LOG_DOMAIN=\"Pango\" \ - -DPANGO_ENABLE_ENGINE \ - $(PANGO_DEBUG_FLAGS) \ - -I$(top_srcdir) \ - -I$(top_srcdir)/pango \ - $(GLIB_CFLAGS) - -noinst_LTLIBRARIES = libpango-indic-lang.la - -libpango_indic_lang_la_SOURCES = indic-lang.c -libpango_indic_lang_la_CFLAGS = -DPANGO_MODULE_PREFIX=_pango_indic_lang - --include $(top_srcdir)/git.mk diff --git a/modules/thai/Makefile.am b/modules/thai/Makefile.am deleted file mode 100644 index 4345845d..00000000 --- a/modules/thai/Makefile.am +++ /dev/null @@ -1,17 +0,0 @@ -INCLUDES = \ - -DG_LOG_DOMAIN=\"Pango\" \ - -DPANGO_ENABLE_ENGINE \ - $(PANGO_DEBUG_FLAGS) \ - -I$(top_srcdir) \ - -I$(top_srcdir)/pango \ - $(GLIB_CFLAGS) - -if HAVE_LIBTHAI -noinst_LTLIBRARIES = libpango-thai-lang.la -endif - -libpango_thai_lang_la_SOURCES = thai-lang.c -libpango_thai_lang_la_CFLAGS = -DPANGO_MODULE_PREFIX=_pango_thai_lang $(LIBTHAI_CFLAGS) -libpango_thai_lang_la_LIBADD = $(LIBTHAI_LIBS) - --include $(top_srcdir)/git.mk diff --git a/pango/Makefile.am b/pango/Makefile.am index d1561e23..f5ad2d0b 100644 --- a/pango/Makefile.am +++ b/pango/Makefile.am @@ -46,13 +46,10 @@ INTROSPECTION_GIRS += Pango-1.0.gir libpango_1_0_la_LDFLAGS = $(LIBRARY_LIBTOOL_OPTIONS) libpango_1_0_la_LIBADD = \ $(GLIB_LIBS) \ - $(libm) \ - $(INCLUDED_LANG_MODULES) -libpango_1_0_la_DEPENDENCIES = \ - $(INCLUDED_LANG_MODULES) + $(libm) libpango_1_0_la_LIBADD += mini-fribidi/libmini-fribidi.la -libpango_1_0_la_DEPENDENCIES += mini-fribidi/libmini-fribidi.la +libpango_1_0_la_DEPENDENCIES = mini-fribidi/libmini-fribidi.la if PLATFORM_WIN32 libpango_1_0_la_LDFLAGS += -export-symbols $(srcdir)/pango.def -Wl,pango-win32-res.o @@ -95,8 +92,7 @@ libpango_1_0_la_SOURCES = \ pango-utils.c \ reorder-items.c \ shape.c \ - pango-enum-types.c \ - module-defs-lang.c + pango-enum-types.c pango_headers = \ pango.h \ @@ -189,18 +185,15 @@ pangoft2_public_sources = \ libpangoft2_1_0_la_LDFLAGS = $(LIBRARY_LIBTOOL_OPTIONS) libpangoft2_1_0_la_LIBADD = \ libpango-$(PANGO_API_VERSION).la \ - $(INCLUDED_FC_MODULES) \ $(GLIB_LIBS) \ $(HARFBUZZ_LIBS) \ $(FREETYPE_LIBS) \ $(libm) libpangoft2_1_0_la_DEPENDENCIES = \ - libpango-$(PANGO_API_VERSION).la \ - $(INCLUDED_FC_MODULES) + libpango-$(PANGO_API_VERSION).la libpangoft2_1_0_la_SOURCES = \ $(pangoft2_public_sources) \ modules.h \ - module-defs-fc.c \ pangofc-private.h \ pangoft2.h \ pangoft2-private.h \ @@ -343,7 +336,6 @@ if HAVE_CAIRO_QUARTZ if HAVE_CORE_TEXT libpangocairo_1_0_la_SOURCES += \ modules.h \ - module-defs-coretext.c \ pangocoretext.h \ pangocoretext.c \ pangocoretext-private.h \ @@ -356,7 +348,6 @@ libpangocairo_1_0_la_SOURCES += \ pangoinclude_HEADERS += pangocoretext.h libpangocairo_1_0_la_LDFLAGS += -framework CoreFoundation -framework ApplicationServices -libpangocairo_1_0_la_LIBADD += $(INCLUDED_CORE_TEXT_MODULES) # We don't have an CoreText GIR right now, so this is just hypothetical # PANGOCAIRO_FONT_BACKEND_GI_MODULE = PangoCoreText-1.0.gir endif @@ -391,15 +382,12 @@ endif libpangowin32_1_0_la_LDFLAGS = $(LIBRARY_LIBTOOL_OPTIONS) libpangowin32_1_0_la_LIBADD = \ libpango-$(PANGO_API_VERSION).la \ - $(INCLUDED_WIN32_MODULES) \ $(GLIB_LIBS) \ -lgdi32 -lusp10 libpangowin32_1_0_la_DEPENDENCIES = \ - libpango-$(PANGO_API_VERSION).la \ - $(INCLUDED_WIN32_MODULES) + libpango-$(PANGO_API_VERSION).la libpangowin32_1_0_la_SOURCES = \ modules.h \ - module-defs-win32.c \ pangowin32.h \ pangowin32.c \ pangowin32-private.h \ @@ -432,11 +420,6 @@ EXTRA_DIST = \ pango-enum-types.h \ pango-enum-types.h.template \ pango-enum-types.c.template \ - module-defs.h \ - module-defs.h.win32 \ - module-defs-lang.c.win32 \ - module-defs-fc.c.win32 \ - module-defs-win32.c.win32 \ pango.def \ pangocairo.def \ pangowin32.def \ @@ -455,24 +438,6 @@ EXTRA_DIST = \ check.defs -modules: - $(AM_V_GEN) cd $(top_builddir)/modules && $(MAKE) $(AM_MAKEFLAGS) - -$(INCLUDED_LANG_MODULES) $(INCLUDED_FC_MODULES) $(INCLUDED_WIN32_MODULES) $(INCLUDED_CORE_TEXT_MODULES): modules - $(AM_V_GEN) true - -.PHONY: modules - -MODULE_DEF_FILES = \ - module-defs.h \ - module-defs-lang.c \ - module-defs-fc.c \ - module-defs-win32.c \ - module-defs-coretext.c - -$(MODULE_DEF_FILES): $(top_builddir)/config.status - $(AM_V_GEN) cd $(top_builddir) && $(SHELL) ./config.status pango/$@ - include $(top_srcdir)/build/Makefile-msvcproj.am dist-hook: $(pango_vcproj_stuff) @@ -491,7 +456,6 @@ MOSTLYCLEANFILES = \ DISTCLEANFILES = \ pango-features.h \ - $(MODULE_DEF_FILES) \ $(pango_vcproj_stuff) install-exec-hook: diff --git a/modules/arabic/arabic-lang.c b/pango/break-arabic.c index ee23bad1..5e2f6068 100644 --- a/modules/arabic/arabic-lang.c +++ b/pango/break-arabic.c @@ -1,5 +1,5 @@ /* Pango - * arabic-lang.c: + * break-arabic.c: * * Copyright (C) 2006 Red Hat Software * Copyright (C) 2006 Sharif FarsiWeb, Inc. @@ -23,32 +23,9 @@ */ #include "config.h" -#include <string.h> -#include "pango-engine.h" #include "pango-break.h" -/* No extra fields needed */ -typedef PangoEngineLang ArabicEngineLang; -typedef PangoEngineLangClass ArabicEngineLangClass ; - -#define SCRIPT_ENGINE_NAME "ArabicScriptEngineLang" -#define RENDER_TYPE PANGO_RENDER_TYPE_NONE - -static PangoEngineScriptInfo arabic_scripts[] = { - { PANGO_SCRIPT_ARABIC, "*" }, -}; - -static PangoEngineInfo script_engines[] = { - { - SCRIPT_ENGINE_NAME, - PANGO_ENGINE_TYPE_LANG, - RENDER_TYPE, - arabic_scripts, G_N_ELEMENTS(arabic_scripts) - } -}; - - #define ALEF_WITH_MADDA_ABOVE 0x0622 #define YEH_WITH_HAMZA_ABOVE 0x0626 #define ALEF 0x0627 @@ -71,12 +48,11 @@ static PangoEngineInfo script_engines[] = { #define IS_COMPOSITE_WITH_ALEF(c) (MADDAH_ABOVE <= (c) && (c) <= HAMZA_BELOW) static void -arabic_engine_break (PangoEngineLang *engine G_GNUC_UNUSED, - const char *text, - int length, - PangoAnalysis *analysis G_GNUC_UNUSED, - PangoLogAttr *attrs, - int attrs_len G_GNUC_UNUSED) +break_arabic (const char *text, + int length, + const PangoAnalysis *analysis G_GNUC_UNUSED, + PangoLogAttr *attrs, + int attrs_len G_GNUC_UNUSED) { int i; const char *p; @@ -113,40 +89,3 @@ arabic_engine_break (PangoEngineLang *engine G_GNUC_UNUSED, attrs[i+1].backspace_deletes_character = FALSE; } } - -static void -arabic_engine_lang_class_init (PangoEngineLangClass *class) -{ - class->script_break = arabic_engine_break; -} - -PANGO_ENGINE_LANG_DEFINE_TYPE (ArabicEngineLang, arabic_engine_lang, - arabic_engine_lang_class_init, NULL) - -void -PANGO_MODULE_ENTRY(init) (GTypeModule *module) -{ - arabic_engine_lang_register_type (module); -} - -void -PANGO_MODULE_ENTRY(exit) (void) -{ -} - -void -PANGO_MODULE_ENTRY(list) (PangoEngineInfo **engines, - int *n_engines) -{ - *engines = script_engines; - *n_engines = G_N_ELEMENTS (script_engines); -} - -PangoEngine * -PANGO_MODULE_ENTRY(create) (const char *id) -{ - if (!strcmp (id, SCRIPT_ENGINE_NAME)) - return g_object_new (arabic_engine_lang_type, NULL); - else - return NULL; -} diff --git a/modules/indic/indic-lang.c b/pango/break-indic.c index dc01b6fe..bb44d64c 100644 --- a/modules/indic/indic-lang.c +++ b/pango/break-indic.c @@ -1,5 +1,5 @@ /* Pango - * indic-lang.c: + * break-indic.c: * * Copyright (C) 2006 Red Hat Software * Author: Akira TAGOH <tagoh@redhat.com> @@ -21,19 +21,9 @@ */ #include "config.h" -#include <string.h> -#include "pango-engine.h" #include "pango-break.h" -typedef PangoEngineLang IndicEngineLang; -typedef PangoEngineLangClass IndicEngineLangClass; - -#define ENGINE_SUFFIX "IndicScriptEngineLang" -#define RENDER_TYPE PANGO_RENDER_TYPE_NONE -#define INDIC_ENGINE_INFO(script) \ - {#script ENGINE_SUFFIX, PANGO_ENGINE_TYPE_LANG, RENDER_TYPE, script##_scripts, G_N_ELEMENTS(script##_scripts)} - #define DEV_RRA 0x0931 /* 0930 + 093c */ #define DEV_QA 0x0958 /* 0915 + 093c */ #define DEV_YA 0x095F /* 092f + 003c */ @@ -101,54 +91,6 @@ typedef PangoEngineLangClass IndicEngineLangClass; (c >= MLYM_O && c <= MLYM_AU) || \ FALSE) - -static PangoEngineScriptInfo deva_scripts[] = { - { PANGO_SCRIPT_DEVANAGARI, "*" } -}; - -static PangoEngineScriptInfo beng_scripts[] = { - { PANGO_SCRIPT_BENGALI, "*" } -}; - -static PangoEngineScriptInfo guru_scripts[] = { - { PANGO_SCRIPT_GURMUKHI, "*" } -}; - -static PangoEngineScriptInfo gujr_scripts[] = { - { PANGO_SCRIPT_GUJARATI, "*" } -}; - -static PangoEngineScriptInfo orya_scripts[] = { - { PANGO_SCRIPT_ORIYA, "*" } -}; - -static PangoEngineScriptInfo taml_scripts[] = { - { PANGO_SCRIPT_TAMIL, "*" } -}; - -static PangoEngineScriptInfo telu_scripts[] = { - { PANGO_SCRIPT_TELUGU, "*" } -}; - -static PangoEngineScriptInfo knda_scripts[] = { - { PANGO_SCRIPT_KANNADA, "*" } -}; - -static PangoEngineScriptInfo mlym_scripts[] = { - { PANGO_SCRIPT_MALAYALAM, "*" } -}; - -static PangoEngineScriptInfo sinh_scripts[] = { - { PANGO_SCRIPT_SINHALA, "*" } -}; - -static PangoEngineInfo script_engines[] = { - INDIC_ENGINE_INFO(deva), INDIC_ENGINE_INFO(beng), INDIC_ENGINE_INFO(guru), - INDIC_ENGINE_INFO(gujr), INDIC_ENGINE_INFO(orya), INDIC_ENGINE_INFO(taml), - INDIC_ENGINE_INFO(telu), INDIC_ENGINE_INFO(knda), INDIC_ENGINE_INFO(mlym), - INDIC_ENGINE_INFO(sinh) -}; - static void not_cursor_position (PangoLogAttr *attr) { @@ -159,12 +101,11 @@ not_cursor_position (PangoLogAttr *attr) } static void -indic_engine_break (PangoEngineLang *engine G_GNUC_UNUSED, - const char *text, - int length, - PangoAnalysis *analysis, - PangoLogAttr *attrs, - int attrs_len G_GNUC_UNUSED) +break_indic (const char *text, + int length, + const PangoAnalysis *analysis, + PangoLogAttr *attrs, + int attrs_len G_GNUC_UNUSED) { const gchar *p, *next = NULL, *next_next; gunichar prev_wc, this_wc, next_wc, next_next_wc; @@ -265,45 +206,3 @@ indic_engine_break (PangoEngineLang *engine G_GNUC_UNUSED, } } } - -static void -indic_engine_lang_class_init (PangoEngineLangClass *klass) -{ - klass->script_break = indic_engine_break; -} - -PANGO_ENGINE_LANG_DEFINE_TYPE (IndicEngineLang, indic_engine_lang, - indic_engine_lang_class_init, NULL) - -void -PANGO_MODULE_ENTRY(init) (GTypeModule *module) -{ - indic_engine_lang_register_type (module); -} - -void -PANGO_MODULE_ENTRY(exit) (void) -{ -} - -void -PANGO_MODULE_ENTRY(list) (PangoEngineInfo **engines, - int *n_engines) -{ - *engines = script_engines; - *n_engines = G_N_ELEMENTS (script_engines); -} - -PangoEngine * -PANGO_MODULE_ENTRY(create) (const char *id) -{ - guint i; - - for (i = 0; i < G_N_ELEMENTS(script_engines); i++) - { - if (!strcmp (id, script_engines[i].id)) - return g_object_new (indic_engine_lang_type, NULL); - } - - return NULL; -} diff --git a/modules/thai/thai-lang.c b/pango/break-thai.c index 31571445..e7462999 100644 --- a/modules/thai/thai-lang.c +++ b/pango/break-thai.c @@ -1,5 +1,5 @@ /* Pango - * thai-lang.c: + * break-thai.c: * * Copyright (C) 2003 Theppitak Karoonboonyanan <thep@linux.thai.net> * @@ -18,33 +18,14 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ +#include "config.h" -#include <string.h> -#include <glib.h> -#include <pango/pango-engine.h> #include <pango/pango-break.h> + +#ifdef HAVE_LIBTHAI #include <thai/thwchar.h> #include <thai/thbrk.h> -/* No extra fields needed */ -typedef PangoEngineLang ThaiEngineLang; -typedef PangoEngineLangClass ThaiEngineLangClass; - -#define SCRIPT_ENGINE_NAME "ThaiScriptEngineLang" - -static PangoEngineScriptInfo thai_scripts[] = { - { PANGO_SCRIPT_THAI, "*" } -}; - -static PangoEngineInfo script_engines[] = { - { - SCRIPT_ENGINE_NAME, - PANGO_ENGINE_TYPE_LANG, - PANGO_RENDER_TYPE_NONE, - thai_scripts, G_N_ELEMENTS(thai_scripts) - } -}; - /* * tis_text is assumed to be large enough to hold the converted string, * i.e. it must be at least g_utf8_strlen(text, len)+1 bytes. @@ -64,22 +45,21 @@ utf8_to_tis (const char *text, int len, thchar_t *tis_text, int *tis_cnt) return tis_text; } +#endif static void -thai_engine_break (PangoEngineLang *engine G_GNUC_UNUSED, - const char *text, - int len, - PangoAnalysis *analysis G_GNUC_UNUSED, - PangoLogAttr *attrs, - int attrs_len G_GNUC_UNUSED) +break_thai (const char *text, + int len, + const PangoAnalysis *analysis G_GNUC_UNUSED, + PangoLogAttr *attrs, + int attrs_len G_GNUC_UNUSED) { +#ifdef HAVE_LIBTHAI thchar_t tis_stack[512]; int brk_stack[512]; thchar_t *tis_text; int *brk_pnts; int cnt; - if (len < 0) - len = strlen (text); cnt = g_utf8_strlen (text, len) + 1; tis_text = tis_stack; @@ -106,43 +86,5 @@ thai_engine_break (PangoEngineLang *engine G_GNUC_UNUSED, if (tis_text != tis_stack) g_free (tis_text); +#endif } - -static void -thai_engine_lang_class_init (PangoEngineLangClass *class) -{ - class->script_break = thai_engine_break; -} - -PANGO_ENGINE_LANG_DEFINE_TYPE (ThaiEngineLang, thai_engine_lang, - thai_engine_lang_class_init, NULL); - -void -PANGO_MODULE_ENTRY(init) (GTypeModule *module) -{ - thai_engine_lang_register_type (module); -} - -void -PANGO_MODULE_ENTRY(exit) (void) -{ -} - -void -PANGO_MODULE_ENTRY(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 * -PANGO_MODULE_ENTRY(create) (const char *id) -{ - if (!strcmp (id, SCRIPT_ENGINE_NAME)) - return g_object_new (thai_engine_lang_type, NULL); - else - return NULL; -} - diff --git a/pango/break.c b/pango/break.c index 4076d9fb..64b6d370 100644 --- a/pango/break.c +++ b/pango/break.c @@ -22,7 +22,7 @@ #include "config.h" #include "pango-break.h" -#include "pango-modules.h" +#include "pango-engine-private.h" #include "pango-script-private.h" #include "pango-impl-utils.h" #include <string.h> @@ -1849,10 +1849,7 @@ pango_get_log_attrs (const char *text, PangoLogAttr *log_attrs, int attrs_len) { - PangoMap *lang_map; int chars_broken; - static guint engine_type_id = 0; /* MT-safe */ - static guint render_type_id = 0; /* MT-safe */ PangoAnalysis analysis = { NULL }; PangoScriptIter iter; @@ -1863,13 +1860,6 @@ pango_get_log_attrs (const char *text, pango_default_break (text, length, &analysis, log_attrs, attrs_len); - if (engine_type_id == 0) - engine_type_id = g_quark_from_static_string (PANGO_ENGINE_TYPE_LANG); - if (render_type_id == 0) - render_type_id = g_quark_from_static_string (PANGO_RENDER_TYPE_NONE); - - lang_map = pango_find_map (language, engine_type_id, render_type_id); - chars_broken = 0; _pango_script_iter_init (&iter, text, length); @@ -1880,7 +1870,7 @@ pango_get_log_attrs (const char *text, pango_script_iter_get_range (&iter, &run_start, &run_end, &script); analysis.script = script; - analysis.lang_engine = (PangoEngineLang*) pango_map_get_engine (lang_map, analysis.script); + analysis.lang_engine = _pango_get_language_engine (); chars_broken += tailor_segment (run_start, run_end, chars_broken, &analysis, log_attrs); } @@ -1891,3 +1881,75 @@ pango_get_log_attrs (const char *text, chars_broken + 1, attrs_len); } + +#include "break-arabic.c" +#include "break-indic.c" +#include "break-thai.c" + +static void +break_script (const char *item_text, + unsigned int item_length, + const PangoAnalysis *analysis, + PangoLogAttr *attrs, + int attrs_len) +{ + switch (analysis->script) + { + case PANGO_SCRIPT_ARABIC: + break_arabic (item_text, item_length, analysis, attrs, attrs_len); + break; + + case PANGO_SCRIPT_DEVANAGARI: + case PANGO_SCRIPT_BENGALI: + case PANGO_SCRIPT_GURMUKHI: + case PANGO_SCRIPT_GUJARATI: + case PANGO_SCRIPT_ORIYA: + case PANGO_SCRIPT_TAMIL: + case PANGO_SCRIPT_TELUGU: + case PANGO_SCRIPT_KANNADA: + case PANGO_SCRIPT_MALAYALAM: + case PANGO_SCRIPT_SINHALA: + break_indic (item_text, item_length, analysis, attrs, attrs_len); + break; + + case PANGO_SCRIPT_THAI: + break_thai (item_text, item_length, analysis, attrs, attrs_len); + break; + } +} + + +/* Wrap language breaker in PangoEngineLang to pass it through old API, + * from times when there were modules and engines. */ +typedef PangoEngineLang PangoLanguageEngine; +typedef PangoEngineLangClass PangoLanguageEngineClass; +static GType pango_language_engine_get_type (void) G_GNUC_CONST; +G_DEFINE_TYPE (PangoLanguageEngine, pango_language_engine, PANGO_TYPE_ENGINE_LANG); +static void +_pango_language_engine_break (PangoEngineLang *engine G_GNUC_UNUSED, + const char *item_text, + int item_length, + PangoAnalysis *analysis, + PangoLogAttr *attrs, + int attrs_len) +{ + break_script (item_text, item_length, analysis, attrs, attrs_len); +} +static void +pango_language_engine_class_init (PangoEngineLangClass *class) +{ + class->script_break = _pango_language_engine_break; +} +static void +pango_language_engine_init (PangoEngineLang *object) +{ +} + +PangoEngineLang * +_pango_get_language_engine (void) +{ + static PangoEngineLang *engine; + if (g_once_init_enter (&engine)) + g_once_init_leave (&engine, g_object_new (pango_language_engine_get_type(), NULL)); + return engine; +} diff --git a/pango/module-defs-fc.c.win32 b/pango/module-defs-fc.c.win32 deleted file mode 100644 index 2fe0cfb9..00000000 --- a/pango/module-defs-fc.c.win32 +++ /dev/null @@ -1,9 +0,0 @@ -/* Autogenerated by configure and then saved for use when compiling with - Visual C. */ - -#include "module-defs.h" - -PangoIncludedModule _pango_included_fc_modules[] = { - { _pango_basic_fc_script_engine_list, _pango_basic_fc_script_engine_init, _pango_basic_fc_script_engine_exit, _pango_basic_fc_script_engine_create }, - { NULL, NULL, NULL, NULL }, -}; diff --git a/pango/module-defs-lang.c.win32 b/pango/module-defs-lang.c.win32 deleted file mode 100644 index d1fe979d..00000000 --- a/pango/module-defs-lang.c.win32 +++ /dev/null @@ -1,11 +0,0 @@ -/* Autogenerated and saved for builds using Microsoft's compiler, - * when the configure mechanism isn't used. - */ - -#include "module-defs.h" - -PangoIncludedModule _pango_included_lang_modules[] = { - { _pango_arabic_lang_script_engine_list, _pango_arabic_lang_script_engine_init, _pango_arabic_lang_script_engine_exit, _pango_arabic_lang_script_engine_create }, - { _pango_indic_lang_script_engine_list, _pango_indic_lang_script_engine_init, _pango_indic_lang_script_engine_exit, _pango_indic_lang_script_engine_create }, - { NULL, NULL, NULL, NULL }, -}; diff --git a/pango/module-defs-win32.c.win32 b/pango/module-defs-win32.c.win32 deleted file mode 100644 index 5c1698c6..00000000 --- a/pango/module-defs-win32.c.win32 +++ /dev/null @@ -1,9 +0,0 @@ -/* Autogenerated by configure and then saved for use when compiling with - Visual C. */ - -#include "module-defs.h" - -PangoIncludedModule _pango_included_win32_modules[] = { - { _pango_basic_win32_script_engine_list, _pango_basic_win32_script_engine_init, _pango_basic_win32_script_engine_exit, _pango_basic_win32_script_engine_create }, - { NULL, NULL, NULL, NULL }, -}; diff --git a/pango/module-defs.h.win32 b/pango/module-defs.h.win32 deleted file mode 100644 index ff982698..00000000 --- a/pango/module-defs.h.win32 +++ /dev/null @@ -1,29 +0,0 @@ -/* Autogenerated by configure. Do not edit */ - -#include "modules.h" - -extern void _pango_arabic_lang_script_engine_list (PangoEngineInfo **engines, int *n_engines); -extern void _pango_arabic_lang_script_engine_init (GTypeModule *module); -extern void _pango_arabic_lang_script_engine_exit (void); -extern PangoEngine *_pango_arabic_lang_script_engine_create (const char *id); - -extern void _pango_basic_fc_script_engine_list (PangoEngineInfo **engines, int *n_engines); -extern void _pango_basic_fc_script_engine_init (GTypeModule *module); -extern void _pango_basic_fc_script_engine_exit (void); -extern PangoEngine *_pango_basic_fc_script_engine_create (const char *id); - -extern void _pango_basic_win32_script_engine_list (PangoEngineInfo **engines, int *n_engines); -extern void _pango_basic_win32_script_engine_init (GTypeModule *module); -extern void _pango_basic_win32_script_engine_exit (void); -extern PangoEngine *_pango_basic_win32_script_engine_create (const char *id); - -extern void _pango_basic_coretext_script_engine_list (PangoEngineInfo **engines, int *n_engines); -extern void _pango_basic_coretext_script_engine_init (GTypeModule *module); -extern void _pango_basic_coretext_script_engine_exit (void); -extern PangoEngine *_pango_basic_coretext_script_engine_create (const char *id); - -extern void _pango_indic_lang_script_engine_list (PangoEngineInfo **engines, int *n_engines); -extern void _pango_indic_lang_script_engine_init (GTypeModule *module); -extern void _pango_indic_lang_script_engine_exit (void); -extern PangoEngine *_pango_indic_lang_script_engine_create (const char *id); - diff --git a/pango/pango-context.c b/pango/pango-context.c index b353d8ef..dafc5dd1 100644 --- a/pango/pango-context.c +++ b/pango/pango-context.c @@ -36,9 +36,7 @@ #include "pango-context.h" #include "pango-impl-utils.h" -#include "pango-engine.h" #include "pango-engine-private.h" -#include "pango-modules.h" #include "pango-script-private.h" /** @@ -1279,20 +1277,6 @@ compute_derived_language (PangoLanguage *lang, return derived_lang; } -static PangoMap * -get_lang_map (PangoLanguage *lang) -{ - static guint engine_type_id = 0; /* MT-safe */ - static guint render_type_id = 0; /* MT-safe */ - - if (engine_type_id == 0) - engine_type_id = g_quark_from_static_string (PANGO_ENGINE_TYPE_LANG); - if (render_type_id == 0) - render_type_id = g_quark_from_static_string (PANGO_RENDER_TYPE_NONE); - - return pango_find_map (lang, engine_type_id, render_type_id); -} - static void itemize_state_update_for_new_run (ItemizeState *state) { @@ -1338,8 +1322,7 @@ itemize_state_update_for_new_run (ItemizeState *state) if ((state->changed & DERIVED_LANG_CHANGED) || !state->lang_engine) { - PangoMap *lang_map = get_lang_map (state->derived_lang); - state->lang_engine = (PangoEngineLang *)pango_map_get_engine (lang_map, state->script); + state->lang_engine = _pango_get_language_engine (); } if (state->changed & (FONT_CHANGED | DERIVED_LANG_CHANGED) && diff --git a/pango/pango-engine-private.h b/pango/pango-engine-private.h index 760144ec..de54ee09 100644 --- a/pango/pango-engine-private.h +++ b/pango/pango-engine-private.h @@ -40,7 +40,9 @@ PangoCoverageLevel _pango_engine_shape_covers (PangoEngineShape *engine, PangoLanguage *language, gunichar wc); -PangoEngineShape *_pango_get_fallback_shaper (void); +PangoEngineShape *_pango_get_fallback_shaper (void) /* XXX got to go when we switch to harfbuzz-only. */; + +PangoEngineLang *_pango_get_language_engine (void); G_END_DECLS |