diff options
64 files changed, 451 insertions, 3101 deletions
diff --git a/Makefile.am b/Makefile.am index 9986f818..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 \ @@ -30,8 +30,6 @@ EXTRA_DIST = \ HACKING \ README.win32 \ config.h.win32 \ - pango-zip.sh.in \ - sanitize-la.sh \ pango.doap MAINTAINERCLEANFILES = \ @@ -2753,9 +2753,3 @@ Changes between 0.12 and 0.13 What is new in GScript 0.1: * Initial release - - -# Local Variables: -# coding: utf-8 -# End: -# vim: encoding=utf-8: diff --git a/build/win32/vs10/Makefile.am b/build/win32/vs10/Makefile.am index 0c9fd008..04318d68 100644 --- a/build/win32/vs10/Makefile.am +++ b/build/win32/vs10/Makefile.am @@ -24,9 +24,10 @@ EXTRA_DIST = \ pango-install.vcxproj \ README.txt -pango-install.props: $(top_srcdir)/build/win32/vs10/pango-install.propsin pango.vs10.headers - $(CPP) -P - <$(top_srcdir)/build/win32/vs10/pango-install.propsin >$@ - rm pango.vs10.headers +# TODO rewrite in a way that doesn't break make distcheck +#pango-install.props: $(top_srcdir)/build/win32/vs10/pango-install.propsin pango.vs10.headers +# $(CPP) -P - <$(top_srcdir)/build/win32/vs10/pango-install.propsin >$@ +# rm pango.vs10.headers DISTCLEANFILES = pango-install.props diff --git a/build/win32/vs11/Makefile.am b/build/win32/vs11/Makefile.am index 5c313184..b063acc0 100644 --- a/build/win32/vs11/Makefile.am +++ b/build/win32/vs11/Makefile.am @@ -1,21 +1,3 @@ -EXTRA_DIST = \ - pango.sln \ - pango-build-defines.props \ - pango-ignore-fc.props \ - pango-install-bin.props \ - pango-install.props \ - pango-prebuild.props \ - pango-version-paths.props \ - pango.vcxproj \ - pango.vcxproj.filters \ - pangoft2.vcxproj \ - pangoft2.vcxproj.filters \ - pangowin32.vcxproj \ - pangowin32.vcxproj.filters \ - pangocairo.vcxproj \ - pangocairo.vcxproj.filters \ - pango-install.vcxproj \ - README.txt DISTCLEANFILES = $(EXTRA_DIST) diff --git a/build/win32/vs12/Makefile.am b/build/win32/vs12/Makefile.am index 38502f5d..971316df 100644 --- a/build/win32/vs12/Makefile.am +++ b/build/win32/vs12/Makefile.am @@ -1,21 +1,3 @@ -EXTRA_DIST = \ - pango.sln \ - pango-build-defines.props \ - pango-ignore-fc.props \ - pango-install-bin.props \ - pango-install.props \ - pango-prebuild.props \ - pango-version-paths.props \ - pango.vcxproj \ - pango.vcxproj.filters \ - pangoft2.vcxproj \ - pangoft2.vcxproj.filters \ - pangowin32.vcxproj \ - pangowin32.vcxproj.filters \ - pangocairo.vcxproj \ - pangocairo.vcxproj.filters \ - pango-install.vcxproj \ - README.txt DISTCLEANFILES = $(EXTRA_DIST) diff --git a/build/win32/vs9/Makefile.am b/build/win32/vs9/Makefile.am index b8b71499..4645a6e3 100644 --- a/build/win32/vs9/Makefile.am +++ b/build/win32/vs9/Makefile.am @@ -18,9 +18,10 @@ EXTRA_DIST = \ stdint.h \ README.txt -pango-install.vsprops: $(top_srcdir)/build/win32/vs9/pango-install.vspropsin pango.vs9.headers - $(CPP) -P - <$(top_srcdir)/build/win32/vs9/pango-install.vspropsin >$@ - rm pango.vs9.headers +# TODO rewrite in a way that doesn't break make distcheck +#pango-install.vsprops: $(top_srcdir)/build/win32/vs9/pango-install.vspropsin pango.vs9.headers +# $(CPP) -P - <$(top_srcdir)/build/win32/vs9/pango-install.vspropsin >$@ +# rm pango.vs9.headers DISTCLEANFILES = pango-install.vsprops diff --git a/config.h.win32.in b/config.h.win32.in index f9ed4dc7..39259199 100644 --- a/config.h.win32.in +++ b/config.h.win32.in @@ -105,9 +105,6 @@ */ #define LT_OBJDIR ".libs/" -/* Module interface version */ -#define MODULE_VERSION "1.8.0" - /* Name of package */ #define PACKAGE "pango" @@ -147,8 +144,5 @@ /* Define to 1 if you have the ANSI C header files. */ #define STDC_HEADERS 1 -/* Whether to load modules via .la files rather than directly */ -/* #undef USE_LA_MODULES */ - /* Version number of package */ #define VERSION "@PANGO_VERSION@" diff --git a/configure.ac b/configure.ac index 6626f55e..5cb6e582 100644 --- a/configure.ac +++ b/configure.ac @@ -40,9 +40,6 @@ m4_if(m4_eval(pango_version_minor % 2), [1], dnl Number of releases since we've broken binary compatibility. m4_define([pango_binary_age], [m4_eval(100 * pango_version_minor + pango_version_micro)]) -dnl Module API version. This should be stepped up when a change causes -dnl older modules to not work with new pango. -m4_define([pango_module_version], [1.8.0]) AC_INIT(pango, pango_version(), @@ -64,7 +61,6 @@ PANGO_VERSION=pango_version() PANGO_API_VERSION=pango_api_version() PANGO_INTERFACE_AGE=pango_interface_age() PANGO_BINARY_AGE=pango_binary_age() -PANGO_MODULE_VERSION=pango_module_version() AC_SUBST(PANGO_VERSION_MAJOR) AC_SUBST(PANGO_VERSION_MINOR) @@ -73,9 +69,7 @@ AC_SUBST(PANGO_VERSION) AC_SUBST(PANGO_API_VERSION) AC_SUBST(PANGO_INTERFACE_AGE) AC_SUBST(PANGO_BINARY_AGE) -AC_SUBST(PANGO_MODULE_VERSION) -AC_DEFINE(MODULE_VERSION, "pango_module_version()", [Module interface version]) AC_DEFINE(PANGO_BINARY_AGE, pango_binary_age(), [PANGO binary age]) AC_DEFINE(PANGO_INTERFACE_AGE, pango_interface_age(), [PANGO interface age]) AC_DEFINE(PANGO_VERSION_MAJOR, pango_version_major(), [PANGO major version]) @@ -264,24 +258,15 @@ fi AM_CONDITIONAL(HAVE_XFT, test "x$with_xft" = xyes && $have_xft ) # -# Checks for Win32 GDI +# Checks for Win32 # have_win32=false -WIN32_LIBS="" -WIN32_CFLAGS="" # The following doesn't work with autoconf-2.13, so we check $host instead # AC_CHECK_LIB(gdi32, GetTextMetricsA@8, have_win32=true, : ) case "$host" in *-*-mingw*|*-*-cygwin*) have_win32=true ;; esac - - -if test $have_win32 = true; then - WIN32_LIBS="-lgdi32" -fi - -AC_SUBST(WIN32_LIBS) -AM_CONDITIONAL(HAVE_WIN32, $have_win32) +AM_CONDITIONAL(HAVE_WIN32, $have_win32) # Ensure MSVC-compatible struct packing convention is used when # compiling for Win32 with gcc. @@ -443,10 +428,7 @@ AM_CONDITIONAL(HAVE_CAIRO_QUARTZ, $have_cairo_quartz) # -# We must have some backend defined, in order for the pango-querymodules -# rule in pango/Makefile.am to work correctly. If you are up to writing -# a new Pango backend outside of Pango, you are up to sending the necessary -# patch to fix that rule. :-) +# We must have some backend defined # if $have_freetype || `test "x$with_xft" = xyes && $have_xft` || $have_cairo || $have_win32 ; then : ; else AC_MSG_ERROR([*** Could not enable any backends. @@ -457,7 +439,7 @@ fi # Checks for GLib # GLIB_REQUIRED_VERSION=2.33.12 -GLIB_MODULES="glib-2.0 >= $GLIB_REQUIRED_VERSION gobject-2.0 gmodule-no-export-2.0 gthread-2.0" +GLIB_MODULES="glib-2.0 >= $GLIB_REQUIRED_VERSION gobject-2.0 gthread-2.0" PKG_CHECK_MODULES(GLIB, $GLIB_MODULES, :, AC_MSG_ERROR([ @@ -473,6 +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) +if $have_libthai; then + AC_DEFINE(HAVE_LIBTHAI, 1, [Whether libthai is available]) +fi # # Checks for GObject Introspection @@ -480,95 +465,6 @@ PKG_CHECK_MODULES(LIBTHAI, libthai >= $LIBTHAI_REQUIRED_VERSION, have_libthai=tr GOBJECT_INTROSPECTION_CHECK([0.9.5]) -# -# Modules to build -# -arabic_modules="arabic-lang" -basic_modules="basic-fc,basic-win32,basic-coretext" -indic_modules="indic-lang" -thai_modules="" - -if $have_libthai ; then - thai_modules="thai-lang" -fi - -all_modules="$arabic_modules,$basic_modules,$indic_modules,$thai_modules" - -# -# Allow building some or all modules included -# -AC_MSG_CHECKING(modules to link statically) - -AC_ARG_WITH(included_modules, - AC_HELP_STRING([--with-included-modules=no/yes/MODULE1 MODULE2 ...], - [build the given modules included @<:@default=no@:>@])) - -included_modules="" -case x$with_included_modules in - xyes) included_modules=$all_modules ;; - xno|x) included_modules="" ;; - *) included_modules=$with_included_modules ;; -esac -AC_MSG_RESULT($included_modules) -AM_CONDITIONAL(HAVE_INCLUDED_MODULES, test "x$included_modules" != x) - -# -# Allow building only some or none of modules dynamic -# -AC_MSG_CHECKING(dynamic modules to build) - -AC_ARG_WITH(dynamic_modules, - AC_HELP_STRING([--with-dynamic-modules=no/yes/MODULE1 MODULE2 ...], - [build the given dynamic modules @<:@default=yes@:>@])) - -dynamic_modules="" -case x$with_dynamic_modules in - xyes|x) dynamic_modules=$all_modules ;; - xno) dynamic_modules="" ;; - *) dynamic_modules=$with_dynamic_modules ;; -esac -AC_MSG_RESULT([$dynamic_modules (those built into Pango will be excluded)]) -AM_CONDITIONAL(HAVE_DYNAMIC_MODULES, test "x$dynamic_modules" != x) - - -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 $included_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" - -AM_CONDITIONAL(INCLUDE_ARABIC_LANG, echo $included_modules | egrep '(^|,)arabic-lang($|,)' > /dev/null) -AM_CONDITIONAL(INCLUDE_BASIC_FC, echo $included_modules | egrep '(^|,)basic-fc($|,)' > /dev/null) -AM_CONDITIONAL(INCLUDE_BASIC_WIN32, echo $included_modules | egrep '(^|,)basic-win32($|,)' > /dev/null) -AM_CONDITIONAL(INCLUDE_BASIC_CORE_TEXT, echo $included_modules | egrep '(^|,)basic-coretext($|,)' > /dev/null) -AM_CONDITIONAL(INCLUDE_INDIC_LANG, echo $included_modules | egrep '(^|,)indic-lang($|,)' > /dev/null) -AM_CONDITIONAL(INCLUDE_THAI_LANG, echo $included_modules | egrep '(^|,)thai-lang($|,)' > /dev/null) - -AM_CONDITIONAL(DYNAMIC_ARABIC_LANG, echo $dynamic_modules | egrep '(^|,)arabic-lang($|,)' > /dev/null) -AM_CONDITIONAL(DYNAMIC_BASIC_FC, echo $dynamic_modules | egrep '(^|,)basic-fc($|,)' > /dev/null) -AM_CONDITIONAL(DYNAMIC_BASIC_WIN32, echo $dynamic_modules | egrep '(^|,)basic-win32($|,)' > /dev/null) -AM_CONDITIONAL(DYNAMIC_BASIC_CORE_TEXT, echo $dynamic_modules | egrep '(^|,)basic-coretext($|,)' > /dev/null) -AM_CONDITIONAL(DYNAMIC_INDIC_LANG, echo $dynamic_modules | egrep '(^|,)indic-lang($|,)' > /dev/null) -AM_CONDITIONAL(DYNAMIC_THAI_LANG, echo $dynamic_modules | egrep '(^|,)thai-lang($|,)' > /dev/null) # # We use flockfile to implement pango_getline() - should be moved to GLib @@ -589,32 +485,6 @@ fi GTK_DOC_CHECK([1.15], [--flavour no-tmpl]) -AC_ARG_ENABLE(man, - AC_HELP_STRING([--enable-man], - [regenerate man pages from Docbook @<:@default=no@:>@]), - enable_man=yes, - enable_man=no) - -if test "x$enable_man" != xno ; then - dnl - dnl Check for xsltproc - dnl - AC_PATH_PROG([XSLTPROC], [xsltproc]) - if test -z "$XSLTPROC"; then - enable_man=no - fi -fi - -if test "x$enable_man" != xno ; then - dnl check for DocBook DTD and stylesheets in the local catalog. - JH_CHECK_XML_CATALOG([-//OASIS//DTD DocBook XML V4.1.2//EN], - [DocBook XML DTD V4.1.2],,enable_man=no) - JH_CHECK_XML_CATALOG([http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl], - [DocBook XSL Stylesheets],,enable_man=no) -fi - -AM_CONDITIONAL(ENABLE_MAN, test x$enable_man != xno) - AC_ARG_ENABLE(doc-cross-references, AC_HELP_STRING([--disable-doc-cross-references], [cross reference glib and cairo symbols @<:@default=yes@:>@]), @@ -637,19 +507,15 @@ dnl ******************************************************** # that something like pango-basic-fc.la is a valid libtool archive # LIBRARY_LIBTOOL_OPTIONS="-version-info $VERSION_INFO" -MODULE_LIBTOOL_OPTIONS="-export-dynamic -avoid-version" if test "$pango_platform_win32" = yes; then # We currently use .def files on Windows LIBRARY_LIBTOOL_OPTIONS="$LIBRARY_LIBTOOL_OPTIONS -no-undefined" - MODULE_LIBTOOL_OPTIONS="$MODULE_LIBTOOL_OPTIONS -no-undefined" else # libtool option to control which symbols are exported # right now, symbols starting with '_' are not exported LIBRARY_LIBTOOL_OPTIONS="$LIBRARY_LIBTOOL_OPTIONS "'-export-symbols-regex "^pango_.*"' - MODULE_LIBTOOL_OPTIONS="$MODULE_LIBTOOL_OPTIONS "'-export-symbols-regex "^script_engine_.*"' fi AC_SUBST(LIBRARY_LIBTOOL_OPTIONS) -AC_SUBST(MODULE_LIBTOOL_OPTIONS) dnl dnl Check for -Bsymbolic-functions linker flag used to avoid @@ -683,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 ****************************************************** @@ -743,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 $included_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" -],[ -included_modules=$included_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 $included_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 $included_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 $included_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 $included_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) @@ -935,11 +646,6 @@ pango/pangowin32.rc pango/pangocairo.rc pango/pangoxft.rc pango-view/Makefile -modules/Makefile -modules/arabic/Makefile -modules/basic/Makefile -modules/indic/Makefile -modules/thai/Makefile examples/Makefile docs/Makefile docs/version.xml @@ -961,7 +667,6 @@ pangowin32-uninstalled.pc pangoft2-uninstalled.pc pangoxft-uninstalled.pc pangocairo-uninstalled.pc -pango-zip.sh config.h.win32 ]) diff --git a/docs/Makefile.am b/docs/Makefile.am index 89be228f..4c43dedd 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 \ @@ -85,8 +84,7 @@ GTKDOC_LIBS += $(GLIB_LIBS) # Non-autogenerated SGML files to be included in $(DOC_MAIN_SGML_FILE) content_files = \ pango_markup.sgml \ - version.xml \ - pango-querymodules.xml + version.xml # Images to copy into HTML directory HTML_IMAGES = \ @@ -116,32 +114,16 @@ BUILT_SOURCES = pango.types ######################################################################## -man_MANS = pango-querymodules.1 -if ENABLE_MAN -.xml.1: - @XSLTPROC@ -nonet http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl $< -dist-local-check-mans-enabled: - @if grep "Man generation disabled" $(man_MANS) >/dev/null; then $(RM) $(man_MANS); fi -else -$(man_MANS): - @echo Man generation disabled. Creating dummy $@. Configure with --enable-man to enable it. - @echo Man generation disabled. Remove this file, configure with --enable-man, and rebuild Pango > $@ -dist-local-check-mans-enabled: - @echo "*** --enable-man must be used in order to make dist" - @false -endif - -MAINTAINERCLEANFILES = $(man_MANS) $(BUILT_SOURCES) +MAINTAINERCLEANFILES = $(BUILT_SOURCES) EXTRA_DIST += \ layout.fig \ layout.eps \ version.xml.in \ check.docs \ - pango.types \ - $(man_MANS) + pango.types # force doc rebulid after configure -dist-hook-local: dist-local-check-mans-enabled dist-local-check-no-cross-references all-local +dist-hook-local: dist-local-check-no-cross-references all-local # # Require gtk-doc when making dist diff --git a/docs/pango-docs.sgml b/docs/pango-docs.sgml index 65514ab2..c5e3bb89 100644 --- a/docs/pango-docs.sgml +++ b/docs/pango-docs.sgml @@ -50,11 +50,6 @@ <xi:include href="xml/pango-version.xml"/> </chapter> - <chapter id="tools"> - <title>Pango Tools</title> - <xi:include href="pango-querymodules.xml"/> - </chapter> - <chapter id="pango-hierarchy"> <title>Object Hierarchy</title> <xi:include href="xml/tree_index.sgml"/> diff --git a/docs/pango-querymodules.xml b/docs/pango-querymodules.xml deleted file mode 100644 index 09c3209f..00000000 --- a/docs/pango-querymodules.xml +++ /dev/null @@ -1,131 +0,0 @@ -<refentry id="pango-querymodules"> - -<refentryinfo> -<title>pango-querymodules</title> -<productname>Pango</productname> -<authorgroup> -<author> -<contrib>Developer</contrib> -<firstname>Owen</firstname> -<surname>Taylor</surname> -</author> -<author> -<contrib>Developer</contrib> -<firstname>Behdad</firstname> -<surname>Esfahbod</surname> -</author> -</authorgroup> -</refentryinfo> - -<refmeta> -<refentrytitle>pango-querymodules</refentrytitle> -<manvolnum>1</manvolnum> -<refmiscinfo class="manual">User Commands</refmiscinfo> -</refmeta> - -<refnamediv> -<refname>pango-querymodules</refname> -<refpurpose>Module registration utility</refpurpose> -</refnamediv> - -<refsynopsisdiv> -<cmdsynopsis> -<command>pango-querymodules</command> -<arg choice="opt" rep="repeat">OPTION</arg> -<arg choice="opt" rep="repeat">MODULE</arg> -</cmdsynopsis> -</refsynopsisdiv> - -<refsect1 id="Description"><title>Description</title> -<para> -<command>pango-querymodules</command> collects information about loadable -modules for Pango and writes it to <filename>stdout</filename>. -</para> -<para> -If called without MODULE arguments, it looks for modules in the Pango -module path, which is specified by the key <literal>Pango/ModulesPath</literal> -in the Pango configuration database. -</para> -<para> -If called with MODULE arguments, it looks for the specified modules. The -arguments may be absolute or relative paths. -</para> -<para> -At runtime, Pango looks for the loadable module information (i.e. the output -of pango-querymodules) in <filename><replaceable>libdir</replaceable>/pango/1.8.0/modules.cache</filename>. -</para> -</refsect1> - -<refsect1><title>Options</title> -<variablelist> - -<varlistentry> -<term><option>-?</option>, <option>--help</option></term> -<listitem><para>Prints a short help text and exits.</para></listitem> -</varlistentry> - -<varlistentry> -<term><option>--version</option></term> -<listitem><para>Prints version information.</para></listitem> -</varlistentry> - -<varlistentry> -<term><option>--system</option></term> -<listitem><para>Do not load user-specific configuration.</para></listitem> -</varlistentry> - -<varlistentry> -<term><option>--update-cache</option></term> -<listitem><para>Update the Pango module cache file directly, -instead of writing the information to <filename>stdout</filename>.</para></listitem> -</varlistentry> - -</variablelist> - -</refsect1> - -<refsect1 id="Environment"><title>Environment</title> -<variablelist> - -<varlistentry> -<term><envar>PANGO_RC_FILE</envar></term> -<listitem><para>Specifies an additional rc file for the Pango configuration -database, in addition to the system-wide and per-user files.</para></listitem> -</varlistentry> - -</variablelist> - -</refsect1> - -<refsect1><title>Files</title> - -<variablelist> - -<varlistentry> -<term><filename><replaceable>sysconfdir</replaceable>/pango/pangorc</filename></term> -<listitem><para>System-wide Pango configuration file.</para></listitem> -</varlistentry> - -<varlistentry> -<term><filename><envar>$XDG_CONFIG_HOME</envar>/pango/pangorc</filename></term> -<listitem><para>User-specific Pango configuration file.</para></listitem> -</varlistentry> - -<varlistentry> -<term><filename><replaceable>libdir</replaceable>/pango/1.8.0/modules.cache</filename></term> -<listitem><para>Location of the module cache file read by Pango.</para></listitem> -</varlistentry> - -</variablelist> - -</refsect1> - -<refsect1 id="Bugs"><title>Bugs</title> -<para> -None known yet. -</para> -</refsect1> - -</refentry> - - diff --git a/examples/pangowin32tobmp.c b/examples/pangowin32tobmp.c index 8d317c09..b657744f 100644 --- a/examples/pangowin32tobmp.c +++ b/examples/pangowin32tobmp.c @@ -24,7 +24,6 @@ #include <glib.h> #include <stdlib.h> -#include <gmodule.h> #include "pango.h" #include "pango-impl-utils.h" #include "pangowin32.h" diff --git a/modules/Makefile.am b/modules/Makefile.am deleted file mode 100644 index 73b42f4d..00000000 --- a/modules/Makefile.am +++ /dev/null @@ -1,71 +0,0 @@ -## Process this file with automake to create Makefile.in. - -SUBDIRS = \ - arabic \ - basic \ - indic \ - thai - -EXTRA_DIST = \ - Module.mk \ - module.def \ - pangorc - -CLEANFILES = \ - pango.modules - -if CROSS_COMPILING -RUN_QUERY_MODULES_TEST=false -else -RUN_QUERY_MODULES_TEST=true -all-local: pango.modules -endif - -install-data-local: $(top_builddir)/pango/pango-querymodules$(EXEEXT) - @if $(RUN_QUERY_MODULES_TEST) && test -z "$(DESTDIR)" ; then \ - echo $(mkinstalldirs) $(DESTDIR)$(sysconfdir)/pango \&\& \ - $(top_builddir)/pango/pango-querymodules$(EXEEXT) \ - \> $(DESTDIR)$(sysconfdir)/pango/pango.modules ; \ - $(mkinstalldirs) $(DESTDIR)$(sysconfdir)/pango && \ - $(top_builddir)/pango/pango-querymodules$(EXEEXT) \ - > $(DESTDIR)$(sysconfdir)/pango/pango.modules ; \ - else \ - echo "***" ; \ - echo "*** Warning: $(sysconfdir)/pango/pango.modules" ; \ - echo "*** not created" ; \ - echo "*** Generate this file on the target system" ; \ - echo "*** using pango-querymodules" ; \ - echo "***" ; \ - fi - -uninstall-local: - $(RM) $(DESTDIR)$(sysconfdir)/pango/pango.modules - -pango.modules: \ - $(SUBDIRS) \ - $(top_builddir)/config.status \ - $(top_builddir)/pango/pango-querymodules$(EXEEXT) - $(AM_V_GEN) if $(RUN_QUERY_MODULES_TEST) && find . -name '*.la' | grep -v '\.libs' | grep -v libpango | grep '.' > /dev/null ; then \ - echo "Writing a pango.modules file to use with tests/examples."; \ - $(top_builddir)/pango/pango-querymodules$(EXEEXT) `find . -name '*.la' | grep -v '\.libs' | grep -v libpango` > $@ ;\ - else \ - echo "***" ; \ - echo "*** No dynamic modules found, or cross-compiling" ; \ - echo "*** Will use only static modules for tests and examples." ; \ - echo "***" ; \ - > $@; \ - fi - -included-modules: - @for d in $(SUBDIRS) ; do \ - ( cd $$d && $(MAKE) $(AM_MAKEFLAGS) included-modules ) ; \ - done - -dynamic-modules: - @for d in $(SUBDIRS) ; do \ - ( cd $$d && $(MAKE) $(AM_MAKEFLAGS) dynamic-modules ) ; \ - done - -.PHONY: included-modules dynamic-modules - --include $(top_srcdir)/git.mk diff --git a/modules/Module.mk b/modules/Module.mk deleted file mode 100644 index aa504700..00000000 --- a/modules/Module.mk +++ /dev/null @@ -1,35 +0,0 @@ -pangolibs = \ - $(GLIB_LIBS) \ - $(top_builddir)/pango/libpango-$(PANGO_API_VERSION).la -pangoxlibs = \ - $(pangolibs) \ - $(top_builddir)/pango/libpangox-$(PANGO_API_VERSION).la \ - $(X_LIBS) -pangoft2libs = \ - $(pangolibs) \ - $(top_builddir)/pango/libpangoft2-$(PANGO_API_VERSION).la \ - $(FREETYPE_LIBS) -pangowin32libs = \ - $(pangolibs) \ - $(top_builddir)/pango/libpangowin32-$(PANGO_API_VERSION).la -pangoatsuilibs = \ - $(pangolibs) \ - $(top_builddir)/pango/libpangocairo-$(PANGO_API_VERSION).la - -INCLUDES = \ - -DG_LOG_DOMAIN=\"Pango\" \ - -DPANGO_ENABLE_ENGINE \ - $(PANGO_DEBUG_FLAGS) \ - -I$(top_srcdir) \ - -I$(top_srcdir)/pango \ - $(GLIB_CFLAGS) - -moduledir = $(libdir)/pango/$(PANGO_MODULE_VERSION)/modules -module_LTLIBRARIES = -noinst_LTLIBRARIES = - - -included-modules: $(noinst_LTLIBRARIES) -dynamic-modules: $(module_LTLIBRARIES) - -.PHONY: included-modules dynamic-modules diff --git a/modules/arabic/Makefile.am b/modules/arabic/Makefile.am deleted file mode 100644 index 2a20532b..00000000 --- a/modules/arabic/Makefile.am +++ /dev/null @@ -1,21 +0,0 @@ -include $(top_srcdir)/modules/Module.mk - - -if INCLUDE_ARABIC_LANG -noinst_LTLIBRARIES += libpango-arabic-lang.la -else -if DYNAMIC_ARABIC_LANG -module_LTLIBRARIES += pango-arabic-lang.la -endif -endif - -lang_sources = \ - arabic-lang.c - -pango_arabic_lang_la_LDFLAGS = -module $(MODULE_LIBTOOL_OPTIONS) -pango_arabic_lang_la_LIBADD = $(pangolibs) -pango_arabic_lang_la_SOURCES = $(lang_sources) -libpango_arabic_lang_la_SOURCES = $(lang_sources) -libpango_arabic_lang_la_CFLAGS = -DPANGO_MODULE_PREFIX=_pango_arabic_lang - --include $(top_srcdir)/git.mk diff --git a/modules/basic/Makefile.am b/modules/basic/Makefile.am deleted file mode 100644 index 9726870b..00000000 --- a/modules/basic/Makefile.am +++ /dev/null @@ -1,55 +0,0 @@ -include $(top_srcdir)/modules/Module.mk - -if HAVE_FREETYPE -INCLUDES += $(FREETYPE_CFLAGS) $(HARFBUZZ_CFLAGS) -if INCLUDE_BASIC_FC -noinst_LTLIBRARIES += libpango-basic-fc.la -else -if DYNAMIC_BASIC_FC -module_LTLIBRARIES += pango-basic-fc.la -endif -endif -endif - -pango_basic_fc_la_LDFLAGS = -module $(MODULE_LIBTOOL_OPTIONS) -pango_basic_fc_la_LIBADD = $(pangoft2libs) $(HARFBUZZ_LIBS) -pango_basic_fc_la_SOURCES = basic-fc.c -libpango_basic_fc_la_SOURCES = basic-fc.c -libpango_basic_fc_la_CFLAGS = -DPANGO_MODULE_PREFIX=_pango_basic_fc - - -if HAVE_WIN32 -if INCLUDE_BASIC_WIN32 -noinst_LTLIBRARIES += libpango-basic-win32.la -else -if DYNAMIC_BASIC_WIN32 -module_LTLIBRARIES += pango-basic-win32.la -endif -endif -endif - -pango_basic_win32_la_LDFLAGS = -module $(MODULE_LIBTOOL_OPTIONS) -pango_basic_win32_la_LIBADD = $(pangowin32libs) -lgdi32 -lusp10 -libpango_basic_win32_la_LIBADD = -lgdi32 -lusp10 -pango_basic_win32_la_SOURCES = basic-win32.c -libpango_basic_win32_la_SOURCES = basic-win32.c -libpango_basic_win32_la_CFLAGS = -DPANGO_MODULE_PREFIX=_pango_basic_win32 - -if HAVE_CORE_TEXT -INCLUDES += $(CAIRO_CFLAGS) -if INCLUDE_BASIC_CORE_TEXT -noinst_LTLIBRARIES += libpango-basic-coretext.la -else -if DYNAMIC_BASIC_CORE_TEXT -module_LTLIBRARIES += pango-basic-coretext.la -endif -endif -endif - -pango_basic_coretext_la_LDFLAGS = -module $(MODULE_LIBTOOL_OPTIONS) -framework Carbon -pango_basic_coretext_la_LIBADD = $(pangocoretextlibs) -pango_basic_coretext_la_SOURCES = basic-coretext.c -libpango_basic_coretext_la_SOURCES = basic-coretext.c -libpango_basic_coretext_la_CFLAGS = -DPANGO_MODULE_PREFIX=_pango_basic_coretext - --include $(top_srcdir)/git.mk diff --git a/modules/indic/Makefile.am b/modules/indic/Makefile.am deleted file mode 100644 index 599a2eb5..00000000 --- a/modules/indic/Makefile.am +++ /dev/null @@ -1,20 +0,0 @@ -include $(top_srcdir)/modules/Module.mk - -if INCLUDE_INDIC_LANG -noinst_LTLIBRARIES += libpango-indic-lang.la -else -if DYNAMIC_INDIC_LANG -module_LTLIBRARIES += pango-indic-lang.la -endif -endif - -lang_sources = \ - indic-lang.c - -pango_indic_lang_la_LDFLAGS = -module $(MODULE_LIBTOOL_OPTIONS) -pango_indic_lang_la_LIBADD = $(pangolibs) -pango_indic_lang_la_SOURCES = $(lang_sources) -libpango_indic_lang_la_SOURCES = $(lang_sources) -libpango_indic_lang_la_CFLAGS = -DPANGO_MODULE_PREFIX=_pango_indic_lang - --include $(top_srcdir)/git.mk diff --git a/modules/module.def b/modules/module.def deleted file mode 100644 index 6e673874..00000000 --- a/modules/module.def +++ /dev/null @@ -1,5 +0,0 @@ -EXPORTS - script_engine_create - script_engine_list - script_engine_init - script_engine_exit diff --git a/modules/pangorc b/modules/pangorc deleted file mode 100644 index 3b60eceb..00000000 --- a/modules/pangorc +++ /dev/null @@ -1,8 +0,0 @@ -# -# pangorc file for uninstalled operation. -# We set the path as ../modules, such that it works from any of -# top level build subdirs. -# - -[Pango] -ModuleFiles = ../modules/pango.modules diff --git a/modules/thai/Makefile.am b/modules/thai/Makefile.am deleted file mode 100644 index ba9fa842..00000000 --- a/modules/thai/Makefile.am +++ /dev/null @@ -1,21 +0,0 @@ -include $(top_srcdir)/modules/Module.mk - -if INCLUDE_THAI_LANG -noinst_LTLIBRARIES += libpango-thai-lang.la -else -if DYNAMIC_THAI_LANG -module_LTLIBRARIES += pango-thai-lang.la -endif -endif - -lang_sources = \ - thai-lang.c - -pango_thai_lang_la_LDFLAGS = -module $(MODULE_LIBTOOL_OPTIONS) -pango_thai_lang_la_LIBADD = $(pangolibs) $(LIBTHAI_LIBS) -pango_thai_lang_la_SOURCES = $(lang_sources) -libpango_thai_lang_la_SOURCES = $(lang_sources) -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-uninstalled.pc.in b/pango-uninstalled.pc.in index fa2c02a5..20ad9de8 100644 --- a/pango-uninstalled.pc.in +++ b/pango-uninstalled.pc.in @@ -2,6 +2,5 @@ Name: Pango Uninstalled Description: Internationalized text handling, Not Installed Version: @VERSION@ Requires: glib-2.0 gobject-2.0 -Requires.private: gmodule-no-export-2.0 Libs: ${pc_top_builddir}/${pcfiledir}/pango/libpango-@PANGO_API_VERSION@.la @PKGCONFIG_MATH_LIBS@ Cflags: -I${pc_top_builddir}/${pcfiledir}/@srcdir@ diff --git a/pango-view/Makefile.am b/pango-view/Makefile.am index 7b6e568f..66a08815 100644 --- a/pango-view/Makefile.am +++ b/pango-view/Makefile.am @@ -26,8 +26,6 @@ TEST_TEXTS = \ EXTRA_DIST = \ $(TEST_TEXTS) -CLEANFILES = pangorc - INCLUDES = \ -I$(top_srcdir) \ $(PANGO_DEBUG_FLAGS) \ @@ -80,7 +78,7 @@ endif MAINTAINERCLEANFILES = pango-view.1.in EXTRA_DIST += pango-view.1.in -CLEANFILES += pango-view.1 +CLEANFILES = pango-view.1 nodist_man_MANS = pango-view.1 @@ -100,9 +98,4 @@ pango-view.1: pango-view$(EXEEXT) ######################################################### -BUILT_SOURCES = pangorc - -pangorc: $(srcdir)/../modules/pangorc - cp $(srcdir)/../modules/pangorc $@ - -include $(top_srcdir)/git.mk diff --git a/pango-view/viewer-render.c b/pango-view/viewer-render.c index 8e3cc7f8..f2de0aac 100644 --- a/pango-view/viewer-render.c +++ b/pango-view/viewer-render.c @@ -657,7 +657,6 @@ show_version(const char *name G_GNUC_UNUSED, GError **error G_GNUC_UNUSED) { g_printf("%s (%s) %s\n", g_get_prgname (), PACKAGE_NAME, PACKAGE_VERSION); - g_printf("\nPango module interface version: %s\n", MODULE_VERSION); if (PANGO_VERSION != pango_version()) g_printf("Linked Pango library has a different version: %s\n", pango_version_string ()); @@ -714,7 +713,7 @@ parse_options (int argc, char *argv[]) {"output", 'o', 0, G_OPTION_ARG_STRING, &opt_output, "Save rendered image to output file", "file"}, {"pangorc", 0, 0, G_OPTION_ARG_STRING, &opt_pangorc, - "pangorc file to use (default is ./pangorc)", "file"}, + "Deprecated", "file"}, {"pixels", 0, 0, G_OPTION_ARG_NONE, &opt_pixels, "Use pixel units instead of points (sets dpi to 72)", NULL}, {"rtl", 0, 0, G_OPTION_ARG_NONE, &opt_rtl, @@ -812,14 +811,6 @@ parse_options (int argc, char *argv[]) if (opt_markup && !pango_parse_markup (text, -1, 0, NULL, NULL, NULL, &error)) fail ("Cannot parse input as markup: %s", error->message); - - /* Setup PANGO_RC_FILE - */ - if (!opt_pangorc) - if (g_file_test ("./pangorc", G_FILE_TEST_IS_REGULAR)) - opt_pangorc = "./pangorc"; - if (opt_pangorc) - g_setenv ("PANGO_RC_FILE", opt_pangorc, TRUE); } diff --git a/pango-zip.sh.in b/pango-zip.sh.in deleted file mode 100755 index 58129c26..00000000 --- a/pango-zip.sh.in +++ /dev/null @@ -1,51 +0,0 @@ -#!/bin/sh - -# Build zipfiles for Pango on Win32: separate runtime and developer packages - -ZIP=/tmp/pango-@PANGO_VERSION@.zip -DEVZIP=/tmp/pango-dev-@PANGO_VERSION@.zip -cd @prefix@ - -mkdir -p share/doc/pango-@PANGO_VERSION@ -cp -p @abs_srcdir@/COPYING share/doc/pango-@PANGO_VERSION@ - -mkdir -p share/doc/pango-dev-@PANGO_VERSION@ -cp -p @abs_srcdir@/COPYING share/doc/pango-dev-@PANGO_VERSION@ - -rm $ZIP -zip $ZIP -@ <<EOF -bin/pango-querymodules.exe -etc/pango/pango.modules -bin/libpango-@PANGO_API_VERSION@-@PANGO_CURRENT_MINUS_AGE@.dll -bin/libpangoft2-@PANGO_API_VERSION@-@PANGO_CURRENT_MINUS_AGE@.dll -bin/libpangowin32-@PANGO_API_VERSION@-@PANGO_CURRENT_MINUS_AGE@.dll -bin/libpangocairo-@PANGO_API_VERSION@-@PANGO_CURRENT_MINUS_AGE@.dll -EOF - -zip $ZIP lib/pango/@PANGO_MODULE_VERSION@/modules/*.dll - -zip -r $ZIP share/doc/pango-@PANGO_VERSION@ - -rm $DEVZIP -zip -r $DEVZIP -@ <<EOF -include/pango-1.0 -lib/libpango-@PANGO_API_VERSION@.dll.a -lib/pango-@PANGO_API_VERSION@.lib -lib/pango-@PANGO_API_VERSION@.def -lib/libpangoft2-@PANGO_API_VERSION@.dll.a -lib/pangoft2-@PANGO_API_VERSION@.lib -lib/pangoft2-@PANGO_API_VERSION@.def -lib/libpangowin32-@PANGO_API_VERSION@.dll.a -lib/pangowin32-@PANGO_API_VERSION@.lib -lib/pangowin32-@PANGO_API_VERSION@.def -lib/libpangocairo-@PANGO_API_VERSION@.dll.a -lib/pangocairo-@PANGO_API_VERSION@.lib -lib/pangocairo-@PANGO_API_VERSION@.def -lib/pkgconfig/pango.pc -lib/pkgconfig/pangoft2.pc -lib/pkgconfig/pangowin32.pc -lib/pkgconfig/pangocairo.pc -share/gtk-doc/html/pango -EOF - -zip -r $DEVZIP share/doc/pango-dev-@PANGO_VERSION@ diff --git a/pango.pc.in b/pango.pc.in index 17a8b7a7..b181e486 100644 --- a/pango.pc.in +++ b/pango.pc.in @@ -3,12 +3,9 @@ exec_prefix=@exec_prefix@ libdir=@libdir@ includedir=@includedir@ -pango_module_version=@PANGO_MODULE_VERSION@ - Name: Pango Description: Internationalized text handling Version: @VERSION@ Requires: glib-2.0 gobject-2.0 -Requires.private: gmodule-no-export-2.0 Libs: -L${libdir} -lpango-@PANGO_API_VERSION@ @PKGCONFIG_MATH_LIBS@ Cflags: -I${includedir}/pango-1.0 diff --git a/pango/Makefile.am b/pango/Makefile.am index da086ed9..b2469ad5 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 \ @@ -183,23 +179,20 @@ pangoft2_public_sources = \ pangofc-font.c \ pangofc-fontmap.c \ pangofc-decoder.c \ + pangofc-shape.c \ pangoft2.c 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 \ @@ -321,8 +314,8 @@ pangocairo-win32-res.o: pangocairo.rc $(AM_V_GEN) $(WINDRES) $< $@ -libpangocairo_1_0_la_LIBADD += libpangowin32-$(PANGO_API_VERSION).la $(WIN32_LIBS) -libpangocairo_1_0_la_DEPENDENCIES += libpangowin32-$(PANGO_API_VERSION).la +libpangocairo_1_0_la_LIBADD += libpangowin32-$(PANGO_API_VERSION).la -lgdi32 +libpangocairo_1_0_la_DEPENDENCIES += libpangowin32-$(PANGO_API_VERSION).la libpangocairo_1_0_la_SOURCES += pangocairo-win32font.c pangocairo-win32fontmap.c pangocairo-win32.h endif @@ -341,12 +334,11 @@ endif 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 \ pangocoretext-fontmap.c \ + pangocoretext-shape.c \ pangocairo-coretext.h \ pangocairo-coretextfont.c \ pangocairo-coretextfont.h \ @@ -354,7 +346,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 @@ -389,20 +380,17 @@ endif libpangowin32_1_0_la_LDFLAGS = $(LIBRARY_LIBTOOL_OPTIONS) libpangowin32_1_0_la_LIBADD = \ libpango-$(PANGO_API_VERSION).la \ - $(INCLUDED_WIN32_MODULES) \ $(GLIB_LIBS) \ - $(WIN32_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 \ pangowin32-fontcache.c \ - pangowin32-fontmap.c + pangowin32-fontmap.c \ + pangowin32-shape.c if PLATFORM_WIN32 libpangowin32_1_0_la_LDFLAGS += -export-symbols $(srcdir)/pangowin32.def -Wl,pangowin32-win32-res.o @@ -424,34 +412,11 @@ typelibs_DATA = $(INTROSPECTION_GIRS:.gir=.typelib) endif # HAVE_INTROSPECTION -# ------------------- pango-querymodules ------------------- - -bin_PROGRAMS = pango-querymodules - -pango_querymodules_SOURCES = \ - querymodules.c - -pango_querymodules_LDADD = -if HAVE_XFT -pango_querymodules_LDADD += libpangoxft-$(PANGO_API_VERSION).la -endif -if HAVE_FREETYPE -pango_querymodules_LDADD += libpangoft2-$(PANGO_API_VERSION).la -endif -if HAVE_WIN32 -pango_querymodules_LDADD += libpangowin32-$(PANGO_API_VERSION).la -endif -pango_querymodules_LDADD += libpango-$(PANGO_API_VERSION).la $(GLIB_LIBS) 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 \ @@ -467,33 +432,11 @@ EXTRA_DIST = \ pangocairo.rc.in \ pangoxft.rc \ pangoxft.rc.in \ + break-arabic.c \ + break-indic.c \ + break-thai.c \ check.defs - -if HAVE_INCLUDED_MODULES -included-modules: - $(AM_V_GEN) cd $(top_builddir)/modules && $(MAKE) $(AM_MAKEFLAGS) included-modules - -$(INCLUDED_LANG_MODULES) $(INCLUDED_FC_MODULES) $(INCLUDED_WIN32_MODULES) $(INCLUDED_CORE_TEXT_MODULES): included-modules - $(AM_V_GEN) true - -.PHONY: included-modules -endif - -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) - CLEANFILES = \ pango-enum-types.h \ s-enum-types-h \ @@ -507,9 +450,7 @@ MOSTLYCLEANFILES = \ *.expected DISTCLEANFILES = \ - pango-features.h \ - $(MODULE_DEF_FILES) \ - $(pango_vcproj_stuff) + pango-features.h install-exec-hook: if DISABLE_EXPLICIT_DEPS 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 5b2e4895..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> @@ -1793,7 +1793,6 @@ pango_find_paragraph_boundary (const gchar *text, static int tailor_segment (const char *range_start, const char *range_end, - PangoEngineLang *range_engine, int chars_broken, PangoAnalysis *analysis, PangoLogAttr *log_attrs) @@ -1801,7 +1800,6 @@ tailor_segment (const char *range_start, int chars_in_range; PangoLogAttr attr_before = log_attrs[0]; - analysis->lang_engine = range_engine; chars_in_range = pango_utf8_strlen (range_start, range_end - range_start); @@ -1851,13 +1849,7 @@ pango_get_log_attrs (const char *text, PangoLogAttr *log_attrs, int attrs_len) { - PangoMap *lang_map; int chars_broken; - const char *range_start, *range_end; - PangoScript script; - PangoEngineLang *range_engine; - static guint engine_type_id = 0; /* MT-safe */ - static guint render_type_id = 0; /* MT-safe */ PangoAnalysis analysis = { NULL }; PangoScriptIter iter; @@ -1868,49 +1860,96 @@ 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); - pango_script_iter_get_range (&iter, &range_start, &range_end, &script); - range_engine = (PangoEngineLang*) pango_map_get_engine (lang_map, script); - g_assert (range_start == text); - while (pango_script_iter_next (&iter)) { const char *run_start, *run_end; - PangoEngineLang* run_engine; + PangoScript script; pango_script_iter_get_range (&iter, &run_start, &run_end, &script); - run_engine = (PangoEngineLang*) pango_map_get_engine (lang_map, script); - g_assert (range_end == run_start); + analysis.script = script; + analysis.lang_engine = _pango_get_language_engine (); - if (range_engine != run_engine) - { - /* Engine has changed; do the tailoring for the current range, - * then start a new range. - */ - chars_broken += tailor_segment (range_start, range_end, range_engine, chars_broken, &analysis, log_attrs); - - range_start = run_start; - range_engine = run_engine; - } - range_end = run_end; + chars_broken += tailor_segment (run_start, run_end, chars_broken, &analysis, log_attrs); } _pango_script_iter_fini (&iter); - g_assert (length < 0 || range_end == text + length); - - chars_broken += tailor_segment (range_start, range_end, range_engine, chars_broken, &analysis, log_attrs); - if (chars_broken + 1 > attrs_len) g_warning ("pango_get_log_attrs: attrs_len should have been at least %d, but was %d. Expect corrupted memory.", 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/modules.c b/pango/modules.c index d8ff79c1..4705979b 100644 --- a/pango/modules.c +++ b/pango/modules.c @@ -29,113 +29,7 @@ */ #include "config.h" -#include <string.h> -#include <limits.h> -#include <errno.h> - -#include <gmodule.h> -#include <glib/gstdio.h> - -#include "pango-enum-types.h" #include "pango-modules.h" -#include "pango-impl-utils.h" -#include "modules.h" - -typedef struct _PangoModule PangoModule; -typedef struct _PangoModuleClass PangoModuleClass; - -#define PANGO_TYPE_MODULE (pango_module_get_type ()) -#define PANGO_MODULE(module) (G_TYPE_CHECK_INSTANCE_CAST ((module), PANGO_TYPE_MODULE, PangoModule)) -#define PANGO_IS_MODULE(module) (G_TYPE_CHECK_INSTANCE_TYPE ((module), PANGO_TYPE_MODULE)) - -typedef struct _PangoMapInfo PangoMapInfo; -typedef struct _PangoEnginePair PangoEnginePair; -typedef struct _PangoSubmap PangoSubmap; - -/** - * PangoMap: - * - * A #PangoMap structure can be used to determine the engine to - * use for each character. - */ -struct _PangoMap -{ - GArray *entries; -}; - -/** - * PangoMapEntry: - * - * A #PangoMapEntry contains information about the engine that should be used - * for the codepoint to which this entry belongs and also whether the engine - * matches the language tag for this entry's map exactly or just approximately. - */ -struct _PangoMapEntry -{ - GSList *exact; - GSList *fallback; -}; - -struct _PangoMapInfo -{ - PangoLanguage *language; - guint engine_type_id; - guint render_type_id; - PangoMap *map; -}; - -struct _PangoEnginePair -{ - PangoEngineInfo info; - PangoModule *module; - PangoEngine *engine; -}; - -struct _PangoModule -{ - GTypeModule parent_instance; - - char *path; - GModule *library; - - void (*list) (PangoEngineInfo **engines, gint *n_engines); - void (*init) (GTypeModule *module); - void (*exit) (void); - PangoEngine *(*create) (const gchar *id); -}; - -struct _PangoModuleClass -{ - GTypeModuleClass parent_class; -}; - -G_LOCK_DEFINE_STATIC (maps); -static GList *maps = NULL; -/* the following are readonly after init_modules */ -static GSList *registered_engines = NULL; -static GSList *dlloaded_engines = NULL; -static GHashTable *dlloaded_modules; - -static void build_map (PangoMapInfo *info); -static void init_modules (void); - -static GType pango_module_get_type (void); - -/* If a module cannot be used, or does not create an engine - * correctly, we print out an error containing module name and id, - * but to not flood the terminal with zillions of the message, we - * set a flag on the module to only err once per module. - */ -static GQuark -get_warned_quark (void) -{ - static GQuark warned_quark = 0; /* MT-safe */ - - if (G_UNLIKELY (!warned_quark)) - warned_quark = g_quark_from_static_string ("pango-module-warned"); - - return warned_quark; -} /** * pango_find_map: @@ -143,588 +37,18 @@ get_warned_quark (void) * @engine_type_id: the engine type for the map to find * @render_type_id: the render type for the map to find * - * Locate a #PangoMap for a particular engine type and render - * type. The resulting map can be used to determine the engine - * for each character. + * Do not use. Does not do anything. * - * Return value: the suitable #PangoMap. + * Return value: %NULL. + * + * Deprecated: 1.37 **/ PangoMap * -pango_find_map (PangoLanguage *language, - guint engine_type_id, - guint render_type_id) -{ - GList *tmp_list; - PangoMapInfo *map_info = NULL; - gboolean found_earlier = FALSE; - - G_LOCK (maps); - - tmp_list = maps; - while (tmp_list) - { - map_info = tmp_list->data; - if (map_info->engine_type_id == engine_type_id && - map_info->render_type_id == render_type_id) - { - if (map_info->language == language) - break; - else - found_earlier = TRUE; - } - - tmp_list = tmp_list->next; - } - - if (!tmp_list) - { - map_info = g_slice_new (PangoMapInfo); - map_info->language = language; - map_info->engine_type_id = engine_type_id; - map_info->render_type_id = render_type_id; - - build_map (map_info); - - maps = g_list_prepend (maps, map_info); - } - else if (found_earlier) - { - /* Move the found map to the beginning of the list - * for speed next time around if we had to do - * any failing comparison. (No longer so important, - * since we don't strcmp.) - */ - maps = g_list_remove_link(maps, tmp_list); - maps = g_list_prepend(maps, tmp_list->data); - g_list_free_1(tmp_list); - } - - G_UNLOCK (maps); - - return map_info->map; -} - -G_DEFINE_TYPE (PangoModule, pango_module, G_TYPE_TYPE_MODULE); - -static gboolean -pango_module_load (GTypeModule *module) -{ - PangoModule *pango_module = PANGO_MODULE (module); - - if (pango_module->path) - { - pango_module->library = g_module_open (pango_module->path, G_MODULE_BIND_LOCAL); - if (!pango_module->library) - { - GQuark warned_quark = get_warned_quark (); - if (!g_object_get_qdata (G_OBJECT (pango_module), warned_quark)) - { - g_warning ("%s", g_module_error()); - g_object_set_qdata_full (G_OBJECT (pango_module), warned_quark, - GINT_TO_POINTER (1), NULL); - } - return FALSE; - } - - /* extract symbols from the lib */ - if (!g_module_symbol (pango_module->library, "script_engine_init", - (gpointer *)(void *)&pango_module->init) || - !g_module_symbol (pango_module->library, "script_engine_exit", - (gpointer *)(void *)&pango_module->exit) || - !g_module_symbol (pango_module->library, "script_engine_list", - (gpointer *)(void *)&pango_module->list) || - !g_module_symbol (pango_module->library, "script_engine_create", - (gpointer *)(void *)&pango_module->create)) - { - GQuark warned_quark = get_warned_quark (); - if (!g_object_get_qdata (G_OBJECT (pango_module), warned_quark)) - { - g_warning ("%s", g_module_error()); - g_object_set_qdata_full (G_OBJECT (pango_module), warned_quark, - GINT_TO_POINTER (1), NULL); - } - - g_module_close (pango_module->library); - - return FALSE; - } - } - - /* call the module's init function to let it */ - /* setup anything it needs to set up. */ - pango_module->init (module); - - return TRUE; -} - -static void -pango_module_unload (GTypeModule *module) -{ - PangoModule *pango_module = PANGO_MODULE (module); - - pango_module->exit(); - - if (pango_module->path) - { - g_module_close (pango_module->library); - pango_module->library = NULL; - - pango_module->init = NULL; - pango_module->exit = NULL; - pango_module->list = NULL; - pango_module->create = NULL; - } -} - -/* This only will ever be called if an error occurs during - * initialization - */ -static void -pango_module_finalize (GObject *object) -{ - PangoModule *module = PANGO_MODULE (object); - - g_free (module->path); - - G_OBJECT_CLASS (pango_module_parent_class)->finalize (object); -} - -static void -pango_module_init (PangoModule *self) +pango_find_map (PangoLanguage *language G_GNUC_UNUSED, + guint engine_type_id G_GNUC_UNUSED, + guint render_type_id G_GNUC_UNUSED) { -} - -static void -pango_module_class_init (PangoModuleClass *class) -{ - GTypeModuleClass *module_class = G_TYPE_MODULE_CLASS (class); - GObjectClass *gobject_class = G_OBJECT_CLASS (class); - - module_class->load = pango_module_load; - module_class->unload = pango_module_unload; - - gobject_class->finalize = pango_module_finalize; -} - -G_LOCK_DEFINE_STATIC (engine); - -static PangoEngine * -pango_engine_pair_get_engine (PangoEnginePair *pair) -{ - G_LOCK (engine); - - if (!pair->engine) - { - if (g_type_module_use (G_TYPE_MODULE (pair->module))) - { - pair->engine = pair->module->create (pair->info.id); - g_type_module_unuse (G_TYPE_MODULE (pair->module)); - } - - if (!pair->engine) - { - GQuark warned_quark = get_warned_quark (); - if (!g_object_get_qdata (G_OBJECT (pair->module), warned_quark)) - { - g_warning ("Failed to load Pango module '%s' for id '%s'", pair->module->path, pair->info.id); - - g_object_set_qdata_full (G_OBJECT (pair->module), warned_quark, - GINT_TO_POINTER (1), NULL); - } - } - } - - G_UNLOCK (engine); - - return pair->engine; -} - -static void -handle_included_module (PangoIncludedModule *included_module, - GSList **engine_list) -{ - PangoModule *module = g_object_new (PANGO_TYPE_MODULE, NULL); - PangoEngineInfo *engine_info; - int n_engines; - int i; - - module->list = included_module->list; - module->init = included_module->init; - module->exit = included_module->exit; - module->create = included_module->create; - - module->list (&engine_info, &n_engines); - - for (i = 0; i < n_engines; i++) - { - PangoEnginePair *pair = g_slice_new (PangoEnginePair); - - pair->info = engine_info[i]; - pair->module = module; - pair->engine = NULL; - - *engine_list = g_slist_prepend (*engine_list, pair); - } -} - -static PangoModule * -find_or_create_module (const char *raw_path) -{ - PangoModule *module; - char *path; - -#if defined(G_OS_WIN32) && defined(LIBDIR) - if (strncmp (raw_path, - LIBDIR "/pango/" MODULE_VERSION "/modules/", - strlen (LIBDIR "/pango/" MODULE_VERSION "/modules/")) == 0) - { - /* This is an entry put there by make install on the - * packager's system. On Windows a prebuilt Pango - * package can be installed in a random - * location. The pango.modules file distributed in - * such a package contains paths from the package - * builder's machine. Replace the path with the real - * one on this machine. */ - path = - g_strconcat (pango_get_lib_subdirectory (), - "\\" MODULE_VERSION "\\modules\\", - raw_path + strlen (LIBDIR "/pango/" MODULE_VERSION "/modules/"), - NULL); - } - else -#endif - { - path = g_strdup (raw_path); - } - - module = g_hash_table_lookup (dlloaded_modules, path); - if (module) - g_free (path); - else - { - module = g_object_new (PANGO_TYPE_MODULE, NULL); - module->path = path; - g_hash_table_insert (dlloaded_modules, path, module); - } - - return module; -} - -static PangoScript -script_from_string (const char *str) -{ - static GEnumClass *class = NULL; - GEnumValue *value; - if (g_once_init_enter (&class)) - g_once_init_leave (&class, g_type_class_ref (PANGO_TYPE_SCRIPT)); - - value = g_enum_get_value_by_nick (class, str); - if (!value) - return PANGO_SCRIPT_INVALID_CODE; - - return value->value; -} - -static void -script_info_free (PangoEngineScriptInfo *script_info, - gpointer data G_GNUC_UNUSED) -{ - g_slice_free (PangoEngineScriptInfo, script_info); -} - -static gboolean /* Returns true if succeeded, false if failed */ -process_module_file (FILE *module_file, const gchar *module_file_dir) -{ - GString *line_buf = g_string_new (NULL); - GString *tmp_buf = g_string_new (NULL); - gboolean have_error = FALSE; - - while (pango_read_line (module_file, line_buf)) - { - PangoEnginePair *pair = g_slice_new (PangoEnginePair); - PangoEngineScriptInfo *script_info; - PangoScript script; - GList *scripts = NULL; - GList *tmp_list; - - const char *p; - char *q; - int i; - - p = line_buf->str; - - if (!pango_skip_space (&p)) - { - g_slice_free (PangoEnginePair, pair); - continue; - } - - i = 0; - while (1) - { - if (!pango_scan_string (&p, tmp_buf)) - { - have_error = TRUE; - goto error; - } - - switch (i) - { - case 0: - if (!g_path_is_absolute (tmp_buf->str) -#ifdef __APPLE__ - && strncmp (tmp_buf->str, "@executable_path/", 17) - && strncmp (tmp_buf->str, "@loader_path/", 13) - && strncmp (tmp_buf->str, "@rpath/", 7) -#endif - ) - { - const gchar *lib_dir = pango_get_lib_subdirectory (); - const gchar *abs_file_name = g_build_filename (lib_dir, - MODULE_VERSION, - "modules", - tmp_buf->str, - NULL); - g_string_assign (tmp_buf, abs_file_name); - g_free ((gpointer) abs_file_name); - } - pair->module = find_or_create_module (tmp_buf->str); - break; - case 1: - pair->info.id = g_strdup (tmp_buf->str); - break; - case 2: - pair->info.engine_type = g_strdup (tmp_buf->str); - break; - case 3: - pair->info.render_type = g_strdup (tmp_buf->str); - break; - default: - q = strchr (tmp_buf->str, ':'); - if (!q) - { - have_error = TRUE; - goto error; - } - *q = '\0'; - script = script_from_string (tmp_buf->str); - if (script == PANGO_SCRIPT_INVALID_CODE) - { - have_error = TRUE; - goto error; - } - - script_info = g_slice_new (PangoEngineScriptInfo); - script_info->script = script; - script_info->langs = g_strdup (q + 1); - - scripts = g_list_prepend (scripts, script_info); - } - - if (!pango_skip_space (&p)) - break; - - i++; - } - - if (i<3) - { - have_error = TRUE; - goto error; - } - - scripts = g_list_reverse (scripts); - pair->info.n_scripts = g_list_length (scripts); - pair->info.scripts = g_new (PangoEngineScriptInfo, pair->info.n_scripts); - - tmp_list = scripts; - for (i=0; i<pair->info.n_scripts; i++) - { - pair->info.scripts[i] = *(PangoEngineScriptInfo *)tmp_list->data; - tmp_list = tmp_list->next; - } - - pair->engine = NULL; - - dlloaded_engines = g_slist_prepend (dlloaded_engines, pair); - - error: - g_list_foreach (scripts, (GFunc)script_info_free, NULL); - g_list_free (scripts); - - if (have_error) - { - g_printerr ("Error reading Pango modules file\n"); - g_slice_free(PangoEnginePair, pair); - break; - } - } - - g_string_free (line_buf, TRUE); - g_string_free (tmp_buf, TRUE); - - return !have_error; -} - -static void -read_modules (void) -{ - FILE *module_file; - - char *file_str = pango_config_key_get ("Pango/ModuleFiles"); - char **files; - int n; - - dlloaded_modules = g_hash_table_new (g_str_hash, g_str_equal); - - if (!file_str) - { - files = g_new (char *, 3); - - files[0] = g_build_filename (pango_get_sysconf_subdirectory (), - "pango.modules", - NULL); - files[1] = g_build_filename (pango_get_lib_subdirectory (), - MODULE_VERSION, - "modules.cache", - NULL); - files[2] = NULL; - } - else - files = pango_split_file_list (file_str); - - n = 0; - while (files[n]) - n++; - - while (n-- > 0) - { - module_file = g_fopen (files[n], "r"); - if (module_file) - { - const gchar *module_file_dir = g_path_get_dirname (files[n]); - process_module_file (module_file, module_file_dir); - g_free ((gpointer) module_file_dir); - fclose(module_file); - } - } - - g_strfreev (files); - g_free (file_str); - - dlloaded_engines = g_slist_reverse (dlloaded_engines); -} - -static void -init_modules (void) -{ - static gsize init = 0; - int i; - - if (g_once_init_enter (&init)) - { -#if !GLIB_CHECK_VERSION (2, 35, 3) - /* Make sure that the type system is initialized */ - g_type_init (); -#endif - - for (i = 0; _pango_included_lang_modules[i].list; i++) - pango_module_register (&_pango_included_lang_modules[i]); - read_modules (); - - g_once_init_leave (&init, 1); - } -} - -static void -map_add_engine (PangoMapInfo *info, - PangoEnginePair *pair) -{ - PangoMap *map = info->map; - int i; - - for (i=0; i<pair->info.n_scripts; i++) - { - PangoScript script; - PangoMapEntry *entry; - gboolean is_exact = FALSE; - - if (pair->info.scripts[i].langs) - { - if (pango_language_matches (info->language, pair->info.scripts[i].langs)) - is_exact = TRUE; - } - - script = pair->info.scripts[i].script; - if ((guint)script >= map->entries->len) - g_array_set_size (map->entries, script + 1); - - entry = &g_array_index (map->entries, PangoMapEntry, script); - - if (is_exact) - entry->exact = g_slist_prepend (entry->exact, pair); - else - entry->fallback = g_slist_prepend (entry->fallback, pair); - } -} - -static void -map_add_engine_list (PangoMapInfo *info, - GSList *engines, - const char *engine_type, - const char *render_type) -{ - GSList *tmp_list = engines; - - while (tmp_list) - { - PangoEnginePair *pair = tmp_list->data; - tmp_list = tmp_list->next; - - if (strcmp (pair->info.engine_type, engine_type) == 0 && - strcmp (pair->info.render_type, render_type) == 0) - { - map_add_engine (info, pair); - } - } -} - -static void -build_map (PangoMapInfo *info) -{ - const char *engine_type = g_quark_to_string (info->engine_type_id); - const char *render_type = g_quark_to_string (info->render_type_id); - - init_modules(); - - if (!dlloaded_engines && !registered_engines) - { - static gboolean no_module_warning = FALSE; /* MT-safe */ - if (!no_module_warning) - { - gchar *filename = g_build_filename (pango_get_sysconf_subdirectory (), - "pango.modules", - NULL); - g_critical ("No modules found:\n" - "No builtin or dynamically loaded modules were found.\n" - "PangoFc will not work correctly.\n" - "This probably means there was an error in the creation of:\n" - " '%s'\n" - "You should create this file by running:\n" - " pango-querymodules > '%s'", - filename, - filename); - g_free (filename); - - no_module_warning = TRUE; - } - } - - info->map = g_slice_new (PangoMap); - info->map->entries = g_array_new (FALSE, TRUE, sizeof (PangoMapEntry)); - - map_add_engine_list (info, dlloaded_engines, engine_type, render_type); - map_add_engine_list (info, registered_engines, engine_type, render_type); + return NULL; } /** @@ -732,51 +56,17 @@ build_map (PangoMapInfo *info) * @map: a #PangoMap * @script: a #PangoScript * - * Returns the best engine listed in the map for a given script + * Do not use. Does not do anything. + * + * Return value: %NULL. * - * Return value: (nullable): the best engine, if one is listed for the - * script, or %NULL. The lookup may cause the engine to be loaded; - * once an engine is loaded, it won't be unloaded. If multiple - * engines are exact for the script, the choice of which is - * returned is arbitrary. + * Deprecated: 1.37 **/ PangoEngine * -pango_map_get_engine (PangoMap *map, - PangoScript script) -{ - PangoMapEntry *entry = NULL; - PangoMapEntry *common_entry = NULL; - - if ((guint)script < map->entries->len) - entry = &g_array_index (map->entries, PangoMapEntry, script); - - if (PANGO_SCRIPT_COMMON < map->entries->len) - common_entry = &g_array_index (map->entries, PangoMapEntry, PANGO_SCRIPT_COMMON); - - if (entry && entry->exact) - return pango_engine_pair_get_engine (entry->exact->data); - else if (common_entry && common_entry->exact) - return pango_engine_pair_get_engine (common_entry->exact->data); - else if (entry && entry->fallback) - return pango_engine_pair_get_engine (entry->fallback->data); - else if (common_entry && common_entry->fallback) - return pango_engine_pair_get_engine (common_entry->fallback->data); - else - return NULL; -} - -static void -append_engines (GSList **engine_list, - GSList *pair_list) +pango_map_get_engine (PangoMap *map G_GNUC_UNUSED, + PangoScript script G_GNUC_UNUSED) { - GSList *l; - - for (l = pair_list; l; l = l->next) - { - PangoEngine *engine = pango_engine_pair_get_engine (l->data); - if (engine) - *engine_list = g_slist_append (*engine_list, engine); - } + return NULL; } /** @@ -788,63 +78,32 @@ append_engines (GSList **engine_list, * @fallback_engines: location to store list of engines that approximately * handle this script. * - * Finds engines in the map that handle the given script. The returned - * lists should be freed with g_slist_free, but the engines in the - * lists are owned by GLib and will be kept around permanently, so - * they should not be unref'ed. + * Do not use. Does not do anything. * * Since: 1.4 + * Deprecated: 1.37 **/ void -pango_map_get_engines (PangoMap *map, - PangoScript script, +pango_map_get_engines (PangoMap *map G_GNUC_UNUSED, + PangoScript script G_GNUC_UNUSED, GSList **exact_engines, GSList **fallback_engines) { - PangoMapEntry *entry = NULL; - PangoMapEntry *common_entry = NULL; - - if ((guint)script < map->entries->len) - entry = &g_array_index (map->entries, PangoMapEntry, script); - - if (PANGO_SCRIPT_COMMON < map->entries->len) - common_entry = &g_array_index (map->entries, PangoMapEntry, PANGO_SCRIPT_COMMON); - if (exact_engines) - { - *exact_engines = NULL; - if (entry && entry->exact) - append_engines (exact_engines, entry->exact); - else if (common_entry && common_entry->exact) - append_engines (exact_engines, common_entry->exact); - } - + *exact_engines = NULL; if (fallback_engines) - { - *fallback_engines = NULL; - if (entry && entry->fallback) - append_engines (fallback_engines, entry->fallback); - else if (common_entry && common_entry->fallback) - append_engines (fallback_engines, common_entry->fallback); - } + *fallback_engines = NULL; } /** * pango_module_register: * @module: a #PangoIncludedModule * - * Registers a statically linked module with Pango. The - * #PangoIncludedModule structure that is passed in contains the - * functions that would otherwise be loaded from a dynamically loaded - * module. + * Do not use. Does not do anything. + * + * Deprecated: 1.37 **/ void -pango_module_register (PangoIncludedModule *module) +pango_module_register (PangoIncludedModule *module G_GNUC_UNUSED) { - GSList *tmp_list = NULL; - - handle_included_module (module, &tmp_list); - - registered_engines = g_slist_concat (registered_engines, - g_slist_reverse (tmp_list)); } diff --git a/pango/modules.h b/pango/modules.h deleted file mode 100644 index 7eac8fb6..00000000 --- a/pango/modules.h +++ /dev/null @@ -1,35 +0,0 @@ -/* Pango - * modules.h: - * - * 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 <pango/pango-engine.h> -#include <pango/pango-modules.h> - -#ifndef __MODULES_H__ -#define __MODULES_H__ - -extern PangoIncludedModule _pango_included_lang_modules[]; -extern PangoIncludedModule _pango_included_x_modules[]; -extern PangoIncludedModule _pango_included_fc_modules[]; -extern PangoIncludedModule _pango_included_win32_modules[]; -extern PangoIncludedModule _pango_included_atsui_modules[]; -extern PangoIncludedModule _pango_included_core_text_modules[]; - -#endif /* __MODULES_H__ */ diff --git a/pango/pango-context.c b/pango/pango-context.c index 6f72653b..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" /** @@ -607,34 +605,31 @@ advance_attr_iterator_to (PangoAttrIterator *iterator, typedef struct { GHashTable *hash; -} ShaperFontCache; +} FontCache; typedef struct { - PangoEngineShape *shape_engine; PangoFont *font; -} ShaperFontElement; +} FontElement; static void -shaper_font_cache_destroy (ShaperFontCache *cache) +font_cache_destroy (FontCache *cache) { g_hash_table_destroy (cache->hash); - g_slice_free (ShaperFontCache, cache); + g_slice_free (FontCache, cache); } static void -shaper_font_element_destroy (ShaperFontElement *element) +font_element_destroy (FontElement *element) { - if (element->shape_engine) - g_object_unref (element->shape_engine); if (element->font) g_object_unref (element->font); - g_slice_free (ShaperFontElement, element); + g_slice_free (FontElement, element); } -static ShaperFontCache * -get_shaper_font_cache (PangoFontset *fontset) +static FontCache * +get_font_cache (PangoFontset *fontset) { - ShaperFontCache *cache; + FontCache *cache; static GQuark cache_quark = 0; /* MT-safe */ if (G_UNLIKELY (!cache_quark)) @@ -644,14 +639,14 @@ retry: cache = g_object_get_qdata (G_OBJECT (fontset), cache_quark); if (G_UNLIKELY (!cache)) { - cache = g_slice_new (ShaperFontCache); + cache = g_slice_new (FontCache); cache->hash = g_hash_table_new_full (g_direct_hash, NULL, - NULL, (GDestroyNotify)shaper_font_element_destroy); + NULL, (GDestroyNotify)font_element_destroy); if (!g_object_replace_qdata (G_OBJECT (fontset), cache_quark, NULL, - cache, (GDestroyNotify)shaper_font_cache_destroy, + cache, (GDestroyNotify)font_cache_destroy, NULL)) { - shaper_font_cache_destroy (cache); + font_cache_destroy (cache); goto retry; } } @@ -660,17 +655,15 @@ retry: } static gboolean -shaper_font_cache_get (ShaperFontCache *cache, - gunichar wc, - PangoEngineShape **shape_engine, - PangoFont **font) +font_cache_get (FontCache *cache, + gunichar wc, + PangoFont **font) { - ShaperFontElement *element; + FontElement *element; element = g_hash_table_lookup (cache->hash, GUINT_TO_POINTER (wc)); if (element) { - *shape_engine = element->shape_engine; *font = element->font; return TRUE; @@ -680,13 +673,11 @@ shaper_font_cache_get (ShaperFontCache *cache, } static void -shaper_font_cache_insert (ShaperFontCache *cache, - gunichar wc, - PangoEngineShape *shape_engine, - PangoFont *font) +font_cache_insert (FontCache *cache, + gunichar wc, + PangoFont *font) { - ShaperFontElement *element = g_slice_new (ShaperFontElement); - element->shape_engine = shape_engine ? g_object_ref (shape_engine) : NULL; + FontElement *element = g_slice_new (FontElement); element->font = font ? g_object_ref (font) : NULL; g_hash_table_insert (cache->hash, GUINT_TO_POINTER (wc), element); @@ -763,12 +754,9 @@ struct _ItemizeState PangoEngineLang *lang_engine; PangoFontset *current_fonts; - ShaperFontCache *cache; + FontCache *cache; PangoFont *base_font; gboolean enable_fallback; - - GSList *exact_engines; - GSList *fallback_engines; }; static void @@ -863,7 +851,7 @@ update_end (ItemizeState *state) * * https://bugzilla.gnome.org/show_bug.cgi?id=705727 */ -gboolean +static gboolean width_iter_iswide (gunichar ch) { if ((0x1100u <= ch && ch <= 0x11FFu) || @@ -995,8 +983,6 @@ itemize_state_init (ItemizeState *state, state->lang_engine = NULL; state->current_fonts = NULL; state->cache = NULL; - state->exact_engines = NULL; - state->fallback_engines = NULL; state->base_font = NULL; state->changed = EMBEDDING_CHANGED | SCRIPT_CHANGED | LANG_CHANGED | FONT_CHANGED | WIDTH_CHANGED; @@ -1167,60 +1153,34 @@ itemize_state_add_character (ItemizeState *state, state->result = g_list_prepend (state->result, state->item); } -static void -get_engines (PangoContext *context, - PangoLanguage *lang, - PangoScript script, - GSList **exact_engines, - GSList **fallback_engines) -{ - const char *engine_type = pango_font_map_get_shape_engine_type (context->font_map); - PangoMap *shaper_map = pango_find_map (lang, - g_quark_from_string (PANGO_ENGINE_TYPE_SHAPE), - g_quark_from_string (engine_type)); - pango_map_get_engines (shaper_map, script, - exact_engines, fallback_engines); -} - typedef struct { PangoLanguage *lang; gunichar wc; - GSList *engines; - PangoEngineShape *shape_engine; PangoFont *font; -} GetShaperFontInfo; +} GetFontInfo; static gboolean -get_shaper_and_font_foreach (PangoFontset *fontset, - PangoFont *font, - gpointer data) +get_font_foreach (PangoFontset *fontset, + PangoFont *font, + gpointer data) { - GetShaperFontInfo *info = data; - GSList *l; + GetFontInfo *info = data; + PangoEngineShape *engine; + PangoCoverageLevel level; if (G_UNLIKELY (!font)) return FALSE; - for (l = info->engines; l; l = l->next) + engine = pango_font_find_shaper (font, info->lang, info->wc), + level = _pango_engine_shape_covers (engine, font, info->lang, info->wc); + if (level != PANGO_COVERAGE_NONE) { - PangoEngineShape *engine = l->data; - PangoCoverageLevel level; - - level = _pango_engine_shape_covers (engine, font, - info->lang, info->wc); - if (level != PANGO_COVERAGE_NONE) - { - info->shape_engine = engine; - info->font = font; - return TRUE; - } + info->font = font; + return TRUE; } - if (!fontset && info->engines && info->engines->next == NULL) + if (!fontset) { - /* We are in no-fallback mode and there's only one engine, just - * return it. */ - info->shape_engine = (PangoEngineShape *) info->engines->data; info->font = font; return TRUE; } @@ -1259,69 +1219,33 @@ get_shaper_and_font (ItemizeState *state, PangoEngineShape **shape_engine, PangoFont **font) { - GetShaperFontInfo info; + GetFontInfo info; /* We'd need a separate cache when fallback is disabled, but since lookup * with fallback disabled is faster anyways, we just skip caching */ - if (state->enable_fallback && shaper_font_cache_get (state->cache, wc, shape_engine, font)) - return *shape_engine != NULL; - - if (!state->exact_engines && !state->fallback_engines) - get_engines (state->context, state->derived_lang, get_script (state), - &state->exact_engines, &state->fallback_engines); + if (state->enable_fallback && font_cache_get (state->cache, wc, font)) + { + *shape_engine = pango_font_find_shaper (*font, state->derived_lang, wc); + return TRUE; + } info.lang = state->derived_lang; info.wc = wc; - info.shape_engine = NULL; info.font = NULL; - info.engines = state->exact_engines; - if (info.engines) - { - if (state->enable_fallback) - pango_fontset_foreach (state->current_fonts, get_shaper_and_font_foreach, &info); - else - get_shaper_and_font_foreach (NULL, get_base_font (state), &info); - - if (info.shape_engine) - { - *shape_engine = info.shape_engine; - *font = info.font; - - /* skip caching if fallback disabled (see above) */ - if (state->enable_fallback) - shaper_font_cache_insert (state->cache, wc, *shape_engine, *font); - - return TRUE; - } - } - - info.engines = state->fallback_engines; - if (info.engines) - { - if (state->enable_fallback) - pango_fontset_foreach (state->current_fonts, get_shaper_and_font_foreach, &info); - else - get_shaper_and_font_foreach (NULL, get_base_font (state), &info); - } + if (state->enable_fallback) + pango_fontset_foreach (state->current_fonts, get_font_foreach, &info); + else + get_font_foreach (NULL, get_base_font (state), &info); - *shape_engine = info.shape_engine; *font = info.font; + *shape_engine = pango_font_find_shaper (*font, state->derived_lang, wc); /* skip caching if fallback disabled (see above) */ if (state->enable_fallback) - shaper_font_cache_insert (state->cache, wc, *shape_engine, *font); - - return *shape_engine != NULL; -} + font_cache_insert (state->cache, wc, *font); -static void -itemize_state_reset_shape_engines (ItemizeState *state) -{ - g_slist_free (state->exact_engines); - state->exact_engines = NULL; - g_slist_free (state->fallback_engines); - state->fallback_engines = NULL; + return TRUE; } static PangoLanguage * @@ -1353,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) { @@ -1412,13 +1322,9 @@ 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 & (SCRIPT_CHANGED | DERIVED_LANG_CHANGED)) - itemize_state_reset_shape_engines (state); - if (state->changed & (FONT_CHANGED | DERIVED_LANG_CHANGED) && state->current_fonts) { @@ -1433,7 +1339,7 @@ itemize_state_update_for_new_run (ItemizeState *state) state->context, state->font_desc, state->derived_lang); - state->cache = get_shaper_font_cache (state->current_fonts); + state->cache = get_font_cache (state->current_fonts); } if ((state->changed & FONT_CHANGED) && state->base_font) @@ -1554,7 +1460,6 @@ itemize_state_finish (ItemizeState *state) _pango_script_iter_fini (&state->script_iter); pango_font_description_free (state->font_desc); - itemize_state_reset_shape_engines (state); if (state->current_fonts) g_object_unref (state->current_fonts); if (state->base_font) 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 diff --git a/pango/pango-engine.c b/pango/pango-engine.c index 6634ff04..777132b7 100644 --- a/pango/pango-engine.c +++ b/pango/pango-engine.c @@ -37,6 +37,8 @@ * script_engine_create(). The latter three functions are used when * creating engines from the module at run time, while the first * function is used when building a catalog of all available modules. + * + * Deprecated: 1.37 */ /** * SECTION:pango-engine-lang @@ -47,6 +49,8 @@ * The <firstterm>language engines</firstterm> are rendering-system independent * engines that determine line, word, and character breaks for character strings. * These engines are used in pango_break(). + * + * Deprecated: 1.37 */ /** * SECTION:pango-engine-shape @@ -57,6 +61,8 @@ * The <firstterm>shape engines</firstterm> are rendering-system dependent * engines that convert character strings into glyph strings. * These engines are used in pango_shape(). + * + * Deprecated: 1.37 */ #include "config.h" @@ -97,7 +103,6 @@ pango_engine_shape_real_covers (PangoEngineShape *engine G_GNUC_UNUSED, PangoLanguage *language, gunichar wc) { - PangoCoverage *coverage = pango_font_get_coverage (font, language); PangoCoverageLevel result = pango_coverage_get (coverage, wc); diff --git a/pango/pango-engine.h b/pango/pango-engine.h index dc146c00..a06a6e2c 100644 --- a/pango/pango-engine.h +++ b/pango/pango-engine.h @@ -32,15 +32,13 @@ G_BEGIN_DECLS #ifdef PANGO_ENABLE_ENGINE -/* Module API */ - -#include <gmodule.h> - /** * PANGO_RENDER_TYPE_NONE: * * A string constant defining the render type * for engines that are not rendering-system specific. + * + * Deprecated: 1.37 */ #define PANGO_RENDER_TYPE_NONE "PangoRenderNone" @@ -59,6 +57,8 @@ typedef struct _PangoEngineClass PangoEngineClass; * * #PangoEngine is the base class for all types of language and * script specific engines. It has no functionality by itself. + * + * Deprecated: 1.37 **/ struct _PangoEngine { @@ -70,6 +70,8 @@ struct _PangoEngine * PangoEngineClass: * * Class structure for #PangoEngine + * + * Deprecated: 1.37 **/ struct _PangoEngineClass { @@ -84,6 +86,8 @@ GType pango_engine_get_type (void) G_GNUC_CONST; * * A string constant defining the engine type for language engines. * These engines derive from #PangoEngineLang. + * + * Deprecated: 1.37 */ #define PANGO_ENGINE_TYPE_LANG "PangoEngineLang" @@ -105,6 +109,8 @@ typedef struct _PangoEngineLangClass PangoEngineLangClass; * instance, a custom #PangoEngineLang could be provided for * Thai to implement the dictionary-based word boundary * lookups needed for that language. + * + * Deprecated: 1.37 **/ struct _PangoEngineLang { @@ -122,6 +128,8 @@ struct _PangoEngineLang * this is called after that to allow tailoring the breaking results. * * Class structure for #PangoEngineLang + * + * Deprecated: 1.37 **/ struct _PangoEngineLangClass { @@ -144,6 +152,8 @@ GType pango_engine_lang_get_type (void) G_GNUC_CONST; * * A string constant defining the engine type for shaping engines. * These engines derive from #PangoEngineShape. + * + * Deprecated: 1.37 */ #define PANGO_ENGINE_TYPE_SHAPE "PangoEngineShape" @@ -167,6 +177,8 @@ typedef struct _PangoEngineShapeClass PangoEngineShapeClass; * and to a particular script. For instance, there is one * #PangoEngineShape implementation to handle shaping Arabic * for Fontconfig-based backends. + * + * Deprecated: 1.37 **/ struct _PangoEngineShape { @@ -197,6 +209,8 @@ struct _PangoEngineShape * font itself unmodified. * * Class structure for #PangoEngineShape + * + * Deprecated: 1.37 **/ struct _PangoEngineShapeClass { @@ -239,6 +253,8 @@ typedef struct _PangoEngineScriptInfo PangoEngineScriptInfo; * * The #PangoEngineScriptInfo structure contains * information about how the shaper covers a particular script. + * + * Deprecated: 1.37 */ struct _PangoEngineScriptInfo { @@ -256,6 +272,8 @@ struct _PangoEngineScriptInfo * * The #PangoEngineInfo structure contains information about a particular * engine. It contains the following fields: + * + * Deprecated: 1.37 */ struct _PangoEngineInfo { @@ -271,14 +289,11 @@ struct _PangoEngineInfo * @engines: location to store a pointer to an array of engines. * @n_engines: location to store the number of elements in @engines. * - * Function to be provided by a module to list the engines that the - * module supplies. The function stores a pointer to an array - * of #PangoEngineInfo structures and the length of that array in - * the given location. + * Do not use. * - * Note that script_engine_init() will not be called before this - * function. + * Deprecated: 1.37 **/ +G_DEPRECATED void script_engine_list (PangoEngineInfo **engines, int *n_engines); @@ -287,33 +302,33 @@ void script_engine_list (PangoEngineInfo **engines, * @module: a #GTypeModule structure used to associate any * GObject types created in this module with the module. * - * Function to be provided by a module to register any - * GObject types in the module. + * Do not use. + * + * Deprecated: 1.37 **/ +G_DEPRECATED void script_engine_init (GTypeModule *module); /** * script_engine_exit: * - * Function to be provided by the module that is called - * when the module is unloading. Frequently does nothing. + * Do not use. + * + * Deprecated: 1.37 **/ +G_DEPRECATED void script_engine_exit (void); /** * script_engine_create: * @id: the ID of an engine as reported by script_engine_list. * - * Function to be provided by the module to create an instance - * of one of the engines implemented by the module. + * Do not use. * - * Return value: a newly created #PangoEngine of the specified - * type, or %NULL if an error occurred. (In normal operation, - * a module should not return %NULL. A %NULL return is only - * acceptable in the case where system misconfiguration or - * bugs in the driver routine are encountered.) + * Deprecated: 1.37 **/ +G_DEPRECATED PangoEngine *script_engine_create (const char *id); /* Utility macro used by PANGO_ENGINE_LANG_DEFINE_TYPE and @@ -367,6 +382,8 @@ prefix ## _register_type (GTypeModule *module) \ * <informalexample><programlisting> * PangoEngine *engine = g_object_new (<replaceable>prefix</replaceable>_type, NULL); * </programlisting></informalexample> + * + * Deprecated: 1.37 **/ #define PANGO_ENGINE_LANG_DEFINE_TYPE(name, prefix, class_init, instance_init) \ PANGO_ENGINE_DEFINE_TYPE (name, prefix, \ @@ -397,6 +414,8 @@ prefix ## _register_type (GTypeModule *module) \ * <informalexample><programlisting> * PangoEngine *engine = g_object_new (<replaceable>prefix</replaceable>_type, NULL); * </programlisting></informalexample> + * + * Deprecated: 1.37 **/ #define PANGO_ENGINE_SHAPE_DEFINE_TYPE(name, prefix, class_init, instance_init) \ PANGO_ENGINE_DEFINE_TYPE (name, prefix, \ diff --git a/pango/pango-fontmap.c b/pango/pango-fontmap.c index 2a2804b6..6272a159 100644 --- a/pango/pango-fontmap.c +++ b/pango/pango-fontmap.c @@ -275,6 +275,7 @@ pango_font_map_real_load_fontset (PangoFontMap *fontmap, * or freed. * * Since: 1.4 + * Deprecated: 1.37 **/ const char * pango_font_map_get_shape_engine_type (PangoFontMap *fontmap) diff --git a/pango/pango-modules.h b/pango/pango-modules.h index aec79e76..d1b2c8b3 100644 --- a/pango/pango-modules.h +++ b/pango/pango-modules.h @@ -43,6 +43,8 @@ typedef struct _PangoIncludedModule PangoIncludedModule; * The #PangoIncludedModule structure for a statically linked module * contains the functions that would otherwise be loaded from a dynamically * loaded module. + * + * Deprecated: 1.37 */ struct _PangoIncludedModule { @@ -53,15 +55,19 @@ struct _PangoIncludedModule PangoEngine *(*create) (const char *id); }; +G_DEPRECATED PangoMap * pango_find_map (PangoLanguage *language, guint engine_type_id, guint render_type_id); +G_DEPRECATED PangoEngine * pango_map_get_engine (PangoMap *map, PangoScript script); +G_DEPRECATED void pango_map_get_engines (PangoMap *map, PangoScript script, GSList **exact_engines, GSList **fallback_engines); +G_DEPRECATED void pango_module_register (PangoIncludedModule *module); #endif /* PANGO_ENABLE_BACKEND */ diff --git a/pango/pango-utils.c b/pango/pango-utils.c index 591ac5bd..e8f70906 100644 --- a/pango/pango-utils.c +++ b/pango/pango-utils.c @@ -540,125 +540,6 @@ pango_scan_int (const char **pos, int *out) } -static void -read_config_file (const char *filename, gboolean enoent_error, GHashTable *ht) -{ - GKeyFile *key_file = g_key_file_new(); - GError *key_file_error = NULL; - gchar **groups; - gsize groups_count = 0; - guint group_index; - - if (!g_key_file_load_from_file(key_file,filename, 0, &key_file_error)) - { - if (key_file_error) - { - if (key_file_error->domain != G_FILE_ERROR || key_file_error->code != G_FILE_ERROR_NOENT || enoent_error) - { - g_warning ("error opening config file '%s': %s\n", - filename, key_file_error->message); - } - g_error_free(key_file_error); - } - g_key_file_free(key_file); - return; - } - - groups = g_key_file_get_groups (key_file, &groups_count); - for (group_index = 0; group_index < groups_count; group_index++) - { - gsize keys_count = 0; - const gchar *group = groups[group_index]; - GError *keys_error = NULL; - gchar **keys; - - keys = g_key_file_get_keys(key_file, group, &keys_count, &keys_error); - - if (keys) - { - guint key_index; - - for (key_index = 0; key_index < keys_count; key_index++) - { - const gchar *key = keys[key_index]; - GError *key_error = NULL; - gchar *value = g_key_file_get_value(key_file, group, key, &key_error); - if (value != NULL) - { - g_hash_table_insert (ht, - g_strdup_printf ("%s/%s", group, key), - value); - } - if (key_error) - { - g_warning ("error getting key '%s/%s' in config file '%s'\n", - group, key, filename); - g_error_free(key_error); - } - } - g_strfreev(keys); - } - - if (keys_error) - { - g_warning ("error getting keys in group '%s' of config file '%s'\n", - filename, group); - g_error_free(keys_error); - } - } - g_strfreev(groups); - g_key_file_free(key_file); -} - -static GHashTable * -read_config_system (void) -{ - char *filename; - GHashTable *config_hash; - - config_hash = g_hash_table_new_full (g_str_hash, g_str_equal, - (GDestroyNotify)g_free, - (GDestroyNotify)g_free); - - filename = g_build_filename (pango_get_sysconf_subdirectory (), - "pangorc", - NULL); - read_config_file (filename, FALSE, config_hash); - g_free (filename); - - return config_hash; -} - -static GHashTable * -read_config (void) -{ - static GHashTable *config_hash = NULL; - - if (g_once_init_enter (&config_hash)) - { - GHashTable *tmp_hash; - char *filename; - const char *envvar; - - tmp_hash = read_config_system (); - - filename = g_build_filename (g_get_user_config_dir (), - "pango", - "pangorc", - NULL); - read_config_file (filename, FALSE, tmp_hash); - g_free (filename); - - envvar = g_getenv ("PANGO_RC_FILE"); - if (envvar) - read_config_file (envvar, TRUE, tmp_hash); - - g_once_init_leave (&config_hash, tmp_hash); - } - - return config_hash; -} - /** * pango_config_key_get_system: * @key: Key to look up, in the form "SECTION/KEY". @@ -668,20 +549,13 @@ read_config (void) * * Return value: (nullable): the value, if found, otherwise %NULL. The * value is a newly-allocated string and must be freed with g_free(). + * + * Deprecated: 1.37: **/ char * pango_config_key_get_system (const char *key) { - GHashTable *config_hash; - gchar *ret; - - g_return_val_if_fail (key != NULL, NULL); - - config_hash = read_config_system (); - ret = g_strdup (g_hash_table_lookup (config_hash, key)); - g_hash_table_unref (config_hash); - - return ret; + return NULL; } /** @@ -694,17 +568,13 @@ pango_config_key_get_system (const char *key) * * Return value: (nullable): the value, if found, otherwise %NULL. The * value is a newly-allocated string and must be freed with g_free(). + * + * Deprecated: 1.37: **/ char * pango_config_key_get (const char *key) { - GHashTable *config_hash; - - g_return_val_if_fail (key != NULL, NULL); - - config_hash = read_config (); - - return g_strdup (g_hash_table_lookup (config_hash, key)); + return NULL; } #ifdef G_OS_WIN32 diff --git a/pango/pango-utils.h b/pango/pango-utils.h index 9bac4f0c..ba8f9887 100644 --- a/pango/pango-utils.h +++ b/pango/pango-utils.h @@ -42,7 +42,9 @@ gboolean pango_scan_int (const char **pos, int *out); #ifdef PANGO_ENABLE_BACKEND +G_DEPRECATED char * pango_config_key_get_system (const char *key); +G_DEPRECATED char * pango_config_key_get (const char *key); G_DEPRECATED void pango_lookup_aliases (const char *fontname, diff --git a/pango/pangocoretext-fontmap.c b/pango/pangocoretext-fontmap.c index 168b47e9..159bedbb 100644 --- a/pango/pangocoretext-fontmap.c +++ b/pango/pangocoretext-fontmap.c @@ -26,7 +26,6 @@ #include "pango-fontmap.h" #include "pangocoretext-private.h" #include "pango-impl-utils.h" -#include "modules.h" #include <Carbon/Carbon.h> @@ -718,7 +717,6 @@ static void pango_core_text_family_class_init (PangoCoreTextFamilyClass *klass) { GObjectClass *object_class = (GObjectClass *)klass; - int i; PangoFontFamilyClass *pfclass = PANGO_FONT_FAMILY_CLASS(klass); object_class->finalize = pango_core_text_family_finalize; @@ -726,9 +724,6 @@ pango_core_text_family_class_init (PangoCoreTextFamilyClass *klass) pfclass->list_faces = pango_core_text_family_list_faces; pfclass->get_name = pango_core_text_family_get_name; pfclass->is_monospace = pango_core_text_family_is_monospace; - - for (i = 0; _pango_included_core_text_modules[i].list; i++) - pango_module_register (&_pango_included_core_text_modules[i]); } static void diff --git a/pango/pangocoretext-private.h b/pango/pangocoretext-private.h index 8076eaea..899cd09b 100644 --- a/pango/pangocoretext-private.h +++ b/pango/pangocoretext-private.h @@ -24,8 +24,6 @@ #ifndef __PANGOCORETEXT_PRIVATE_H__ #define __PANGOCORETEXT_PRIVATE_H__ -#include <pango/pango-fontmap.h> -#include <pango/pango-context.h> #include "pangocoretext.h" G_BEGIN_DECLS @@ -107,6 +105,15 @@ const PangoMatrix *pango_core_text_font_key_get_matrix (const Pango PangoGravity pango_core_text_font_key_get_gravity (const PangoCoreTextFontKey *key); CTFontDescriptorRef pango_core_text_font_key_get_ctfontdescriptor (const PangoCoreTextFontKey *key); +void +_pango_core_text_shape (PangoFont *font, + const char *text, + gint length, + const PangoAnalysis *analysis, + PangoGlyphString *glyphs, + const char *paragraph_text G_GNUC_UNUSED, + unsigned int paragraph_length G_GNUC_UNUSED); + G_END_DECLS #endif /* __PANGOCORETEXT_PRIVATE_H__ */ diff --git a/modules/basic/basic-coretext.c b/pango/pangocoretext-shape.c index 0e966cd9..ef066eea 100644 --- a/modules/basic/basic-coretext.c +++ b/pango/pangocoretext-shape.c @@ -1,5 +1,5 @@ /* Pango - * basic-coretext.c + * pangocoretext-shape.c * * Copyright (C) 2005 Imendio AB * Copyright (C) 2010 Kristian Rietveld <kris@gtk.org> @@ -25,32 +25,10 @@ #include <glib.h> #include <string.h> #include <Carbon/Carbon.h> -#include "pango-engine.h" #include "pango-utils.h" -#include "pango-fontmap.h" -#include "pangocoretext.h" +#include "pangocoretext-private.h" #include "pango-impl-utils.h" -/* No extra fields needed */ -typedef PangoEngineShape BasicEngineCoreText; -typedef PangoEngineShapeClass BasicEngineCoreTextClass ; - -#define SCRIPT_ENGINE_NAME "BasicScriptEngineCoreText" -#define RENDER_TYPE PANGO_RENDER_TYPE_CORE_TEXT - -static PangoEngineScriptInfo basic_scripts[] = { - { PANGO_SCRIPT_COMMON, "" } -}; - -static PangoEngineInfo script_engines[] = { - { - SCRIPT_ENGINE_NAME, - PANGO_ENGINE_TYPE_SHAPE, - RENDER_TYPE, - basic_scripts, G_N_ELEMENTS(basic_scripts) - } -}; - static void set_glyph (PangoFont *font, PangoGlyphString *glyphs, @@ -73,10 +51,10 @@ set_glyph (PangoFont *font, /* The "RunIterator" helps us to iterate over the array of runs that is obtained from * the CoreText type setter. Even though Pango considers the string that is passed to - * the shaping engine a single run, CoreText might consider it to consist out of + * the shape function a single run, CoreText might consider it to consist out of * multiple runs. Because of this, we have an interface around the CoreText array of - * runs that works like iterating a single array, which makes our job in the shaping - * engine function easier. + * runs that works like iterating a single array, which makes our job in the shape + * function easier. */ struct RunIterator @@ -155,7 +133,7 @@ run_iterator_get_glyph_count (struct RunIterator *iter) /* These functions are commented out to silence the compiler, but * kept around because they might be of use when fixing the more * intricate issues noted in the comment in the function - * basic_engine_shape() below. + * pangocoretext_shape() below. */ #if 0 static gboolean @@ -367,15 +345,14 @@ create_core_text_glyph_list (const char *text, } -static void -basic_engine_shape (PangoEngineShape *engine, - PangoFont *font, - const char *text, - gint length, - const PangoAnalysis *analysis, - PangoGlyphString *glyphs, - const char *paragraph_text G_GNUC_UNUSED, - unsigned int paragraph_length G_GNUC_UNUSED) +void +_pango_core_text_shape (PangoFont *font, + const char *text, + gint length, + const PangoAnalysis *analysis, + PangoGlyphString *glyphs, + const char *paragraph_text G_GNUC_UNUSED, + unsigned int paragraph_length G_GNUC_UNUSED) { const char *p; gulong n_chars, gs_i, gs_prev_i; @@ -507,41 +484,3 @@ basic_engine_shape (PangoEngineShape *engine, if (analysis->level & 1) pango_glyph_string_reverse_range (glyphs, 0, glyphs->num_glyphs); } - -static void -basic_engine_core_text_class_init (PangoEngineShapeClass *class) -{ - class->script_shape = basic_engine_shape; -} - -PANGO_ENGINE_SHAPE_DEFINE_TYPE (BasicEngineCoreText, basic_engine_core_text, - basic_engine_core_text_class_init, NULL); - -void -PANGO_MODULE_ENTRY(init) (GTypeModule *module) -{ - basic_engine_core_text_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 (basic_engine_core_text_type, NULL); - else - return NULL; -} - diff --git a/pango/pangocoretext.c b/pango/pangocoretext.c index d75b2e8d..0f5c1478 100644 --- a/pango/pangocoretext.c +++ b/pango/pangocoretext.c @@ -120,7 +120,7 @@ ct_font_descriptor_get_coverage (CTFontDescriptorRef desc) static PangoCoverage * pango_core_text_font_get_coverage (PangoFont *font, - PangoLanguage *language) + PangoLanguage *language G_GNUC_UNUSED) { PangoCoreTextFont *ctfont = (PangoCoreTextFont *)font; PangoCoreTextFontPrivate *priv = ctfont->priv; @@ -137,13 +137,44 @@ pango_core_text_font_get_coverage (PangoFont *font, return pango_coverage_ref (priv->coverage); } +/* Wrap shaper in PangoEngineShape to pass it through old API, + * from times when there were modules and engines. */ +typedef PangoEngineShape PangoCoreTextShapeEngine; +typedef PangoEngineShapeClass PangoCoreTextShapeEngineClass; +static GType pango_core_text_shape_engine_get_type (void) G_GNUC_CONST; +G_DEFINE_TYPE (PangoCoreTextShapeEngine, pango_core_text_shape_engine, PANGO_TYPE_ENGINE_SHAPE); +static void +_pango_core_text_shape_engine_shape (PangoEngineShape *engine G_GNUC_UNUSED, + PangoFont *font, + const char *item_text, + unsigned int item_length, + const PangoAnalysis *analysis, + PangoGlyphString *glyphs, + const char *paragraph_text, + unsigned int paragraph_length) +{ + _pango_core_text_shape (font, item_text, item_length, analysis, glyphs, + paragraph_text, paragraph_length); +} +static void +pango_core_text_shape_engine_class_init (PangoEngineShapeClass *class) +{ + class->script_shape = _pango_core_text_shape_engine_shape; +} +static void +pango_core_text_shape_engine_init (PangoEngineShape *object) +{ +} + static PangoEngineShape * pango_core_text_font_find_shaper (PangoFont *font, - PangoLanguage *language, + PangoLanguage *language G_GNUC_UNUSED, guint32 ch) { - /* FIXME: Implement */ - return NULL; + static PangoEngineShape *shaper; + if (g_once_init_enter (&shaper)) + g_once_init_leave (&shaper, g_object_new (pango_core_text_shape_engine_get_type(), NULL)); + return shaper; } static PangoFontMap * diff --git a/pango/pangocoretext.h b/pango/pangocoretext.h index 9449189a..a7444436 100644 --- a/pango/pangocoretext.h +++ b/pango/pangocoretext.h @@ -23,8 +23,7 @@ #ifndef __PANGOCORETEXT_H__ #define __PANGOCORETEXT_H__ -#include <pango/pango-context.h> -#include <pango/pango-font.h> +#include <pango/pango.h> #include <Carbon/Carbon.h> G_BEGIN_DECLS diff --git a/pango/pangofc-font.c b/pango/pangofc-font.c index 9ae2f56c..b463e90c 100644 --- a/pango/pangofc-font.c +++ b/pango/pangofc-font.c @@ -42,8 +42,8 @@ #include "pangofc-font.h" #include "pangofc-fontmap.h" #include "pangofc-private.h" +#include "pango-engine.h" #include "pango-layout.h" -#include "pango-modules.h" #include "pango-impl-utils.h" #include <fontconfig/fcfreetype.h> @@ -307,18 +307,33 @@ pango_fc_font_describe_absolute (PangoFont *font) return desc; } -static PangoMap * -pango_fc_get_shaper_map (PangoLanguage *language) +/* Wrap shaper in PangoEngineShape to pass it through old API, + * from times when there were modules and engines. */ +typedef PangoEngineShape PangoFcShapeEngine; +typedef PangoEngineShapeClass PangoFcShapeEngineClass; +static GType pango_fc_shape_engine_get_type (void) G_GNUC_CONST; +G_DEFINE_TYPE (PangoFcShapeEngine, pango_fc_shape_engine, PANGO_TYPE_ENGINE_SHAPE); +static void +_pango_fc_shape_engine_shape (PangoEngineShape *engine G_GNUC_UNUSED, + PangoFont *font, + const char *item_text, + unsigned int item_length, + const PangoAnalysis *analysis, + PangoGlyphString *glyphs, + const char *paragraph_text, + unsigned int paragraph_length) +{ + _pango_fc_shape (font, item_text, item_length, analysis, glyphs, + paragraph_text, paragraph_length); +} +static void +pango_fc_shape_engine_class_init (PangoEngineShapeClass *class) +{ + class->script_shape = _pango_fc_shape_engine_shape; +} +static void +pango_fc_shape_engine_init (PangoEngineShape *object) { - 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_SHAPE); - if (render_type_id == 0) - render_type_id = g_quark_from_static_string (PANGO_RENDER_TYPE_FC); - - return pango_find_map (language, engine_type_id, render_type_id); } static PangoEngineShape * @@ -326,12 +341,10 @@ pango_fc_font_find_shaper (PangoFont *font G_GNUC_UNUSED, PangoLanguage *language, guint32 ch) { - PangoMap *shaper_map = NULL; - PangoScript script; - - shaper_map = pango_fc_get_shaper_map (language); - script = pango_script_for_unichar (ch); - return (PangoEngineShape *)pango_map_get_engine (shaper_map, script); + static PangoEngineShape *shaper; + if (g_once_init_enter (&shaper)) + g_once_init_leave (&shaper, g_object_new (pango_fc_shape_engine_get_type(), NULL)); + return shaper; } static PangoCoverage * diff --git a/pango/pangofc-font.h b/pango/pangofc-font.h index 51a6e952..1189cfe3 100644 --- a/pango/pangofc-font.h +++ b/pango/pangofc-font.h @@ -22,12 +22,10 @@ #ifndef __PANGO_FC_FONT_H__ #define __PANGO_FC_FONT_H__ +#include <pango/pango.h> #include <ft2build.h> #include FT_FREETYPE_H #include <fontconfig/fontconfig.h> -#include <pango/pango-font.h> -#include <pango/pango-fontmap.h> -#include <pango/pango-glyph.h> G_BEGIN_DECLS diff --git a/pango/pangofc-fontmap.c b/pango/pangofc-fontmap.c index d12ead6c..3fcc0c51 100644 --- a/pango/pangofc-fontmap.c +++ b/pango/pangofc-fontmap.c @@ -49,7 +49,6 @@ #include "pangofc-fontmap.h" #include "pangofc-private.h" #include "pango-impl-utils.h" -#include "modules.h" #include "pango-enum-types.h" @@ -1054,23 +1053,12 @@ G_DEFINE_ABSTRACT_TYPE (PangoFcFontMap, pango_fc_font_map, PANGO_TYPE_FONT_MAP) static void pango_fc_font_map_init (PangoFcFontMap *fcfontmap) { - static gsize registered_modules = 0; /* MT-safe */ PangoFcFontMapPrivate *priv; priv = fcfontmap->priv = G_TYPE_INSTANCE_GET_PRIVATE (fcfontmap, PANGO_TYPE_FC_FONT_MAP, PangoFcFontMapPrivate); - if (g_once_init_enter (®istered_modules)) - { - int i; - - for (i = 0; _pango_included_fc_modules[i].list; i++) - pango_module_register (&_pango_included_fc_modules[i]); - - g_once_init_leave(®istered_modules, 1); - } - priv->n_families = -1; priv->font_hash = g_hash_table_new ((GHashFunc)pango_fc_font_key_hash, diff --git a/pango/pangofc-fontmap.h b/pango/pangofc-fontmap.h index 612996c8..fee5faa5 100644 --- a/pango/pangofc-fontmap.h +++ b/pango/pangofc-fontmap.h @@ -22,8 +22,8 @@ #ifndef __PANGO_FC_FONT_MAP_H__ #define __PANGO_FC_FONT_MAP_H__ +#include <pango/pango.h> #include <fontconfig/fontconfig.h> -#include <pango/pango-fontmap.h> #include <pango/pangofc-decoder.h> #include <pango/pangofc-font.h> diff --git a/pango/pangofc-private.h b/pango/pangofc-private.h index 32045670..5c993969 100644 --- a/pango/pangofc-private.h +++ b/pango/pangofc-private.h @@ -100,7 +100,14 @@ void pango_fc_font_get_raw_extents (PangoFcFont *font, PangoFontMetrics *pango_fc_font_create_base_metrics_for_context (PangoFcFont *font, PangoContext *context); - +void +_pango_fc_shape (PangoFont *font, + const char *item_text, + unsigned int item_length, + const PangoAnalysis *analysis, + PangoGlyphString *glyphs, + const char *paragraph_text, + unsigned int paragraph_length); /* To be made public at some point */ diff --git a/modules/basic/basic-fc.c b/pango/pangofc-shape.c index d77dacef..3a2cfa44 100644 --- a/modules/basic/basic-fc.c +++ b/pango/pangofc-shape.c @@ -1,5 +1,5 @@ /* Pango - * basic-fc.c: Basic shaper for FreeType-based backends + * pangofc-shape.c: Basic shaper for FreeType-based backends * * Copyright (C) 2000, 2007, 2009 Red Hat Software * Authors: @@ -27,37 +27,12 @@ #define PANGO_ENABLE_BACKEND 1 /* XXX */ -#include "pango-engine.h" -#include "pango-utils.h" -#include "pangofc-fontmap.h" -#include "pangofc-font.h" +#include "pangofc-private.h" #include <hb-ft.h> #include <hb-glib.h> #define PANGO_UNITS_26_6(d) ((d) << 4) - -/* No extra fields needed */ -typedef PangoEngineShape BasicEngineFc; -typedef PangoEngineShapeClass BasicEngineFcClass; - -#define SCRIPT_ENGINE_NAME "BasicScriptEngineFc" -#define RENDER_TYPE PANGO_RENDER_TYPE_FC - -static PangoEngineScriptInfo basic_scripts[] = { - { PANGO_SCRIPT_COMMON, "" } -}; - -static PangoEngineInfo script_engines[] = { - { - SCRIPT_ENGINE_NAME, - PANGO_ENGINE_TYPE_SHAPE, - RENDER_TYPE, - basic_scripts, G_N_ELEMENTS(basic_scripts) - } -}; - - /* cache a single hb_buffer_t */ static hb_buffer_t *cached_buffer = NULL; /* MT-safe */ G_LOCK_DEFINE_STATIC (cached_buffer); @@ -299,17 +274,14 @@ pango_fc_get_hb_font_funcs (void) } - - -static void -basic_engine_shape (PangoEngineShape *engine G_GNUC_UNUSED, - PangoFont *font, - const char *item_text, - unsigned int item_length, - const PangoAnalysis *analysis, - PangoGlyphString *glyphs, - const char *paragraph_text, - unsigned int paragraph_length) +void +_pango_fc_shape (PangoFont *font, + const char *item_text, + unsigned int item_length, + const PangoAnalysis *analysis, + PangoGlyphString *glyphs, + const char *paragraph_text, + unsigned int paragraph_length) { PangoFcHbContext context; PangoFcFont *fc_font; @@ -325,7 +297,7 @@ basic_engine_shape (PangoEngineShape *engine G_GNUC_UNUSED, int last_cluster; guint i, num_glyphs; unsigned int item_offset = item_text - paragraph_text; - hb_feature_t features[8]; + hb_feature_t features[32]; unsigned int num_features = 0; g_return_if_fail (font != NULL); @@ -444,40 +416,3 @@ basic_engine_shape (PangoEngineShape *engine G_GNUC_UNUSED, hb_face_destroy (hb_face); pango_fc_font_unlock_face (fc_font); } - -static void -basic_engine_fc_class_init (PangoEngineShapeClass *class) -{ - class->script_shape = basic_engine_shape; -} - -PANGO_ENGINE_SHAPE_DEFINE_TYPE (BasicEngineFc, basic_engine_fc, - basic_engine_fc_class_init, NULL) - -void -PANGO_MODULE_ENTRY(init) (GTypeModule *module) -{ - basic_engine_fc_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 (basic_engine_fc_type, NULL); - else - return NULL; -} diff --git a/pango/pangoft2-fontmap.c b/pango/pangoft2-fontmap.c index 1904f015..ee27f7f1 100644 --- a/pango/pangoft2-fontmap.c +++ b/pango/pangoft2-fontmap.c @@ -311,7 +311,7 @@ PangoFontMap * pango_ft2_font_map_for_display (void) { if (g_once_init_enter (&pango_ft2_global_fontmap)) - g_once_init_leave(&pango_ft2_global_fontmap, PANGO_FT2_FONT_MAP (pango_ft2_font_map_new ())); + g_once_init_leave (&pango_ft2_global_fontmap, PANGO_FT2_FONT_MAP (pango_ft2_font_map_new ())); return PANGO_FONT_MAP (pango_ft2_global_fontmap); } diff --git a/pango/pangowin32-fontmap.c b/pango/pangowin32-fontmap.c index 4cd9fa87..b4bfaa2f 100644 --- a/pango/pangowin32-fontmap.c +++ b/pango/pangowin32-fontmap.c @@ -34,7 +34,6 @@ #include "pango-fontmap.h" #include "pango-impl-utils.h" #include "pangowin32-private.h" -#include "modules.h" typedef struct _PangoWin32Family PangoWin32Family; typedef PangoFontFamilyClass PangoWin32FamilyClass; @@ -493,48 +492,9 @@ read_builtin_aliases (GHashTable *ht_aliases) #endif -static void -read_alias_file (const char *filename, GHashTable *ht_aliases) -{ - FILE *file; - - GString *line_buffer; - char *errstring = NULL; - int line = 0; - - file = g_fopen (filename, "r"); - if (!file) - return; - - line_buffer = g_string_new (NULL); - - while (pango_read_line (file, line_buffer) && - errstring == NULL) - { - line++; - handle_alias_line (line_buffer, &errstring, ht_aliases); - } - - if (errstring == NULL && ferror (file)) - errstring = g_strdup (g_strerror(errno)); - - if (errstring) - { - g_warning ("error reading alias file: %s:%d: %s\n", filename, line, errstring); - g_free (errstring); - } - - g_string_free (line_buffer, TRUE); - - fclose (file); -} - static GHashTable * load_aliases (void) { - char *filename; - const char *home; - GHashTable *ht_aliases = g_hash_table_new_full ((GHashFunc)alias_hash, (GEqualFunc)alias_equal, (GDestroyNotify)alias_free, @@ -544,21 +504,6 @@ load_aliases (void) read_builtin_aliases (ht_aliases); #endif - filename = g_strconcat (pango_get_sysconf_subdirectory (), - G_DIR_SEPARATOR_S "pango.aliases", - NULL); - read_alias_file (filename, ht_aliases); - g_free (filename); - - home = g_get_home_dir (); - if (home && *home) - { - filename = g_strconcat (home, - G_DIR_SEPARATOR_S ".pango.aliases", - NULL); - read_alias_file (filename, ht_aliases); - g_free (filename); - } return ht_aliases; } @@ -721,7 +666,6 @@ _pango_win32_font_map_class_init (PangoWin32FontMapClass *class) { GObjectClass *object_class = G_OBJECT_CLASS (class); PangoFontMapClass *fontmap_class = PANGO_FONT_MAP_CLASS (class); - int i; class->find_font = pango_win32_font_map_real_find_font; object_class->finalize = pango_win32_font_map_finalize; @@ -732,9 +676,6 @@ _pango_win32_font_map_class_init (PangoWin32FontMapClass *class) fontmap_class->shape_engine_type = PANGO_RENDER_TYPE_WIN32; pango_win32_get_dc (); - - for (i = 0; _pango_included_win32_modules[i].list; i++) - pango_module_register (&_pango_included_win32_modules[i]); } /** diff --git a/pango/pangowin32-private.h b/pango/pangowin32-private.h index ba95f9bc..ad6ce2a3 100644 --- a/pango/pangowin32-private.h +++ b/pango/pangowin32-private.h @@ -52,8 +52,7 @@ #define PING(printlist) #endif -#include <pango/pango-modules.h> -#include <pango/pangowin32.h> +#include "pangowin32.h" typedef enum { @@ -275,6 +274,15 @@ gboolean _pango_win32_get_name_record (HDC hdc, HFONT _pango_win32_font_get_hfont (PangoFont *font); +void +_pango_win32_shape (PangoFont *font, + const char *text, + unsigned int length, + const PangoAnalysis *analysis, + PangoGlyphString *glyphs, + const char *paragraph_text G_GNUC_UNUSED, + unsigned int paragraph_length G_GNUC_UNUSED); + extern HDC _pango_win32_hdc; extern OSVERSIONINFO _pango_win32_os_version_info; extern gboolean _pango_win32_debug; diff --git a/modules/basic/basic-win32.c b/pango/pangowin32-shape.c index e9d020da..aa69d2c7 100644 --- a/modules/basic/basic-win32.c +++ b/pango/pangowin32-shape.c @@ -1,5 +1,5 @@ /* Pango - * basic-win32.c: + * pangowin32-shape.c: * * Copyright (C) 1999 Red Hat Software * Copyright (C) 2001 Alexander Larsson @@ -22,88 +22,23 @@ #include "config.h" -#define BASIC_WIN32_DEBUGGING +/*#define BASIC_WIN32_DEBUGGING */ #include <math.h> #include <stdlib.h> #include <glib.h> -#include "pangowin32.h" +#include "pangowin32-private.h" extern HFONT _pango_win32_font_get_hfont (PangoFont *font); -#include "pango-engine.h" #include "pango-utils.h" -/* No extra fields needed */ -typedef PangoEngineShape BasicEngineWin32; -typedef PangoEngineShapeClass BasicEngineWin32Class ; - -#define SCRIPT_ENGINE_NAME "BasicScriptEngineWin32" - static gboolean pango_win32_debug = FALSE; #include <usp10.h> -static HDC hdc; - -#ifdef BASIC_WIN32_DEBUGGING -static const SCRIPT_PROPERTIES **scripts; -static int nscripts; -#endif - -static PangoEngineScriptInfo uniscribe_scripts[] = { - /* We claim to cover everything ;-) */ - { PANGO_SCRIPT_COMMON, "" }, -}; - -static PangoEngineScriptInfo basic_scripts[] = { - /* Those characters that can be rendered legibly without Uniscribe. - * I am not certain this list is correct. - */ - { PANGO_SCRIPT_ARMENIAN, "*" }, - { PANGO_SCRIPT_BOPOMOFO, "*" }, - { PANGO_SCRIPT_CHEROKEE, "*" }, - { PANGO_SCRIPT_COPTIC, "*" }, - { PANGO_SCRIPT_CYRILLIC, "*" }, - { PANGO_SCRIPT_DESERET, "*" }, - { PANGO_SCRIPT_ETHIOPIC, "*" }, - { PANGO_SCRIPT_GEORGIAN, "*" }, - { PANGO_SCRIPT_GOTHIC, "*" }, - { PANGO_SCRIPT_GREEK, "*" }, - { PANGO_SCRIPT_HAN, "*" }, - { PANGO_SCRIPT_HANGUL, "*" }, - { PANGO_SCRIPT_HIRAGANA, "*" }, - { PANGO_SCRIPT_KATAKANA, "*" }, - { PANGO_SCRIPT_LATIN, "*" }, - { PANGO_SCRIPT_OGHAM, "*" }, - { PANGO_SCRIPT_OLD_ITALIC, "*" }, - { PANGO_SCRIPT_RUNIC, "*" }, - { PANGO_SCRIPT_THAI, "*" }, - { PANGO_SCRIPT_CANADIAN_ABORIGINAL, "*" }, - { PANGO_SCRIPT_YI, "*" }, - { PANGO_SCRIPT_BRAILLE, "*" }, - { PANGO_SCRIPT_CYPRIOT, "*" }, - { PANGO_SCRIPT_LIMBU, "*" }, - { PANGO_SCRIPT_OSMANYA, "*" }, - { PANGO_SCRIPT_SHAVIAN, "*" }, - { PANGO_SCRIPT_LINEAR_B, "*" }, - { PANGO_SCRIPT_UGARITIC, "*" }, - - /* Claim to handle everything as a fallback */ - { PANGO_SCRIPT_COMMON, "" } -}; - -static PangoEngineInfo script_engines[] = { - { - SCRIPT_ENGINE_NAME, - PANGO_ENGINE_TYPE_SHAPE, - PANGO_RENDER_TYPE_WIN32, - NULL, 0 - } -}; - static PangoGlyph find_char (PangoFont *font, gunichar wc) @@ -520,6 +455,11 @@ itemize_shape_and_place (PangoFont *font, #ifdef BASIC_WIN32_DEBUGGING if (pango_win32_debug) + { + static const SCRIPT_PROPERTIES **scripts; + static int nscripts; + if (!nscripts) + ScriptGetProperties (&scripts, &nscripts); g_print (" Item %d: iCharPos=%d eScript=%d (%s) %s%s%s%s%s%s%s wchar_t %d--%d (%d)\n", item, items[item].iCharPos, script, lang_name (scripts[script]->langid), @@ -569,7 +509,7 @@ itemize_shape_and_place (PangoFont *font, { #ifdef BASIC_WIN32_DEBUGGING if (pango_win32_debug) - g_print ("pango-basic-win32: ScriptShape failed\n"); + g_print ("pangowin32-shape: ScriptShape failed\n"); #endif return FALSE; } @@ -594,7 +534,7 @@ itemize_shape_and_place (PangoFont *font, { #ifdef BASIC_WIN32_DEBUGGING if (pango_win32_debug) - g_print ("pango-basic-win32: ScriptPlace failed\n"); + g_print ("pangowin32-shape: ScriptPlace failed\n"); #endif return FALSE; } @@ -648,6 +588,7 @@ uniscribe_shape (PangoFont *font, { wchar_t *wtext; long wlen; + HDC hdc = _pango_win32_hdc; gboolean retval = TRUE; if (!pango_win32_font_select_font (font, hdc)) @@ -710,9 +651,8 @@ text_is_simple (const char *text, return retval; } -static void -basic_engine_shape (PangoEngineShape *engine, - PangoFont *font, +void +_pango_win32_shape (PangoFont *font, const char *text, unsigned int length, const PangoAnalysis *analysis, @@ -814,64 +754,3 @@ basic_engine_shape (PangoEngineShape *engine, } } } - -static void -init_uniscribe (void) -{ -#ifdef BASIC_WIN32_DEBUGGING - ScriptGetProperties (&scripts, &nscripts); -#endif - hdc = pango_win32_get_dc (); -} - -static void -basic_engine_win32_class_init (PangoEngineShapeClass *class) -{ - class->script_shape = basic_engine_shape; -} - -PANGO_ENGINE_SHAPE_DEFINE_TYPE (BasicEngineWin32, basic_engine_win32, - basic_engine_win32_class_init, NULL); - -void -PANGO_MODULE_ENTRY(init) (GTypeModule *module) -{ - init_uniscribe (); - - if (pango_win32_get_debug_flag ()) - pango_win32_debug = TRUE; - - basic_engine_win32_register_type (module); -} - -void -PANGO_MODULE_ENTRY(exit) (void) -{ -} - -void -PANGO_MODULE_ENTRY(list) (PangoEngineInfo **engines, - int *n_engines) -{ - init_uniscribe (); - - script_engines[0].scripts = basic_scripts; - script_engines[0].n_scripts = G_N_ELEMENTS (basic_scripts); - - /* This is stupid, we rewrite the previous two lines. Not - * going to touch it now. */ - script_engines[0].scripts = uniscribe_scripts; - script_engines[0].n_scripts = G_N_ELEMENTS (uniscribe_scripts); - - *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 (basic_engine_win32_type, NULL); - else - return NULL; -} diff --git a/pango/pangowin32.c b/pango/pangowin32.c index 89059178..b6634739 100644 --- a/pango/pangowin32.c +++ b/pango/pangowin32.c @@ -156,9 +156,9 @@ _pango_win32_font_init (PangoWin32Font *win32font) HDC pango_win32_get_dc (void) { - if (_pango_win32_hdc == NULL) + if (g_once_init_enter (&_pango_win32_hdc)) { - _pango_win32_hdc = CreateDC ("DISPLAY", NULL, NULL, NULL); + HDC hdc = CreateDC ("DISPLAY", NULL, NULL, NULL); memset (&_pango_win32_os_version_info, 0, sizeof (_pango_win32_os_version_info)); _pango_win32_os_version_info.dwOSVersionInfoSize = @@ -173,6 +173,7 @@ pango_win32_get_dc (void) if (getenv ("PANGO_WIN32_DEBUG") != NULL) _pango_win32_debug = TRUE; #endif + g_once_init_leave (&_pango_win32_hdc, hdc); } return _pango_win32_hdc; @@ -877,20 +878,6 @@ pango_win32_font_describe_absolute (PangoFont *font) return desc; } -static PangoMap * -pango_win32_get_shaper_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_SHAPE); - if (render_type_id == 0) - render_type_id = g_quark_from_static_string (PANGO_RENDER_TYPE_WIN32); - - return pango_find_map (lang, engine_type_id, render_type_id); -} - static gint pango_win32_coverage_language_classify (PangoLanguage *lang) { @@ -949,17 +936,44 @@ pango_win32_font_get_coverage (PangoFont *font, return coverage; } +/* Wrap shaper in PangoEngineShape to pass it through old API, + * from times when there were modules and engines. */ +typedef PangoEngineShape PangoWin32ShapeEngine; +typedef PangoEngineShapeClass PangoWin32ShapeEngineClass; +static GType pango_win32_shape_engine_get_type (void) G_GNUC_CONST; +G_DEFINE_TYPE (PangoWin32ShapeEngine, pango_win32_shape_engine, PANGO_TYPE_ENGINE_SHAPE); +static void +_pango_win32_shape_engine_shape (PangoEngineShape *engine G_GNUC_UNUSED, + PangoFont *font, + const char *item_text, + unsigned int item_length, + const PangoAnalysis *analysis, + PangoGlyphString *glyphs, + const char *paragraph_text, + unsigned int paragraph_length) +{ + _pango_win32_shape (font, item_text, item_length, analysis, glyphs, + paragraph_text, paragraph_length); +} +static void +pango_win32_shape_engine_class_init (PangoEngineShapeClass *class) +{ + class->script_shape = _pango_win32_shape_engine_shape; +} +static void +pango_win32_shape_engine_init (PangoEngineShape *object) +{ +} + static PangoEngineShape * pango_win32_font_find_shaper (PangoFont *font, PangoLanguage *lang, guint32 ch) { - PangoMap *shape_map = NULL; - PangoScript script; - - shape_map = pango_win32_get_shaper_map (lang); - script = pango_script_for_unichar (ch); - return (PangoEngineShape *)pango_map_get_engine (shape_map, script); + static PangoEngineShape *shaper; + if (g_once_init_enter (&shaper)) + g_once_init_leave (&shaper, g_object_new (pango_win32_shape_engine_get_type(), NULL)); + return shaper; } /* Utility functions */ diff --git a/pango/querymodules.c b/pango/querymodules.c deleted file mode 100644 index 0c86811e..00000000 --- a/pango/querymodules.c +++ /dev/null @@ -1,323 +0,0 @@ -/* Pango - * querymodules.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 <stdlib.h> -#include "config.h" - -#include <glib.h> -#include <gmodule.h> -#include "pango-break.h" -#include "pango-context.h" -#include "pango-impl-utils.h" -#include "pango-engine.h" -#include "pango-enum-types.h" - -#include <errno.h> -#include <string.h> -#ifdef HAVE_UNISTD_H -#include <unistd.h> -#endif -#include <glib/gprintf.h> - -#ifdef USE_LA_MODULES -#define SOEXT ".la" -#else -#define SOEXT ("." G_MODULE_SUFFIX) -#endif -#define SOEXT_LEN ((int) strlen (SOEXT)) - -static gboolean system_mode; /* MT-safe as we're single-threaded! */ - -static gboolean -string_needs_escape (const char *str) -{ - while (TRUE) - { - char c = *str++; - - if (!c) - return FALSE; - else if (c == '\"' || c == '\\' || g_ascii_isspace (c)) - return TRUE; - } -} - -static char * -escape_string (const char *str) -{ - GString *result = g_string_new (NULL); - - while (TRUE) - { - char c = *str++; - - switch (c) - { - case '\0': - goto done; - case '\n': - g_string_append (result, "\\n"); - break; - case '\"': - g_string_append (result, "\\\""); - break; - case '\\': - g_string_append (result, "\\\\"); - break; - default: - g_string_append_c (result, c); - } - } - - done: - return g_string_free (result, FALSE); -} - -#define GET_SYMBOL(module,name,location) \ - g_module_symbol (module, name, (gpointer *)(void *)&location) - -static const char * -string_from_script (PangoScript script) -{ - static GEnumClass *class = NULL; /* MT-safe as we're single-threaded! */ - GEnumValue *value; - if (!class) - class = g_type_class_ref (PANGO_TYPE_SCRIPT); - - value = g_enum_get_value (class, script); - if (!value) - { - g_warning ("Engine reported invalid script value %d\n", script); - return string_from_script (PANGO_SCRIPT_INVALID_CODE); - } - - return value->value_nick; -} - -static void -query_module (const char *dir, const char *name, GString *contents) -{ - void (*list) (PangoEngineInfo **engines, gint *n_engines); - void (*init) (GTypeModule *module); - void (*exit) (void); - PangoEngine *(*create) (const gchar *id); - - GModule *module; - gchar *path; - - if (g_path_is_absolute (name)) - path = g_strdup (name); - else - path = g_build_filename (dir, name, NULL); - - module = g_module_open (path, G_MODULE_BIND_LAZY | G_MODULE_BIND_LOCAL); - - if (!module) - g_printerr ("Cannot load module %s: %s\n", path, g_module_error ()); - - if (module && - GET_SYMBOL (module, "script_engine_list", list) && - GET_SYMBOL (module, "script_engine_init", init) && - GET_SYMBOL (module, "script_engine_exit", exit) && - GET_SYMBOL (module, "script_engine_create", create)) - { - gint i,j; - PangoEngineInfo *engines; - gint n_engines; - - (*list) (&engines, &n_engines); - - for (i=0; i<n_engines; i++) - { - const gchar *quote; - gchar *quoted_path; - - if (string_needs_escape (path)) - { - quote = "\""; - quoted_path = escape_string (path); - } - else - { - quote = ""; - quoted_path = g_strdup (path); - } - - g_string_append_printf (contents, - "%s%s%s %s %s %s", - quote, quoted_path, quote, - engines[i].id, engines[i].engine_type, - engines[i].render_type); - g_free (quoted_path); - - for (j=0; j < engines[i].n_scripts; j++) - { - g_string_append_printf (contents, - " %s:%s", - string_from_script (engines[i].scripts[j].script), - engines[i].scripts[j].langs); - } - g_string_append_c (contents, '\n'); - } - } - else - { - g_printerr ("%s does not export Pango module API\n", path); - } - - g_free (path); - if (module) - g_module_close (module); -} - -static G_GNUC_NORETURN gboolean -show_version(const char *name G_GNUC_UNUSED, - const char *arg G_GNUC_UNUSED, - gpointer data G_GNUC_UNUSED, - GError **error G_GNUC_UNUSED) -{ - g_printf("pango-querymodules (%s) %s\n", PACKAGE_NAME, PACKAGE_VERSION); - g_printf("module interface version: %s\n", MODULE_VERSION); - exit(0); -} - -int -main (int argc, char **argv) -{ - char *cwd; - int i; - char *path; - GOptionContext *context; - GError *parse_error = NULL; - gboolean update_cache = FALSE; - GString *contents; - GOptionEntry entries[] = - { - {"version", 0, G_OPTION_FLAG_NO_ARG, G_OPTION_ARG_CALLBACK, &show_version, - "Show version numbers", NULL}, - {"system", 0, 0, G_OPTION_ARG_NONE, &system_mode, - "Do not load configuration from home directory", NULL}, - {"update-cache", 0, 0, G_OPTION_ARG_NONE, &update_cache, - "Update the default cache file", NULL}, - {NULL} - }; - - context = g_option_context_new ("- [MODULE]..."); - g_option_context_add_main_entries (context, entries, NULL); - - if (!g_option_context_parse (context, &argc, &argv, &parse_error)) - { - if (parse_error != NULL) - { - g_printerr("Parse option error: %s\n", parse_error->message); - } - else - { - g_printerr("Parse option error\n"); - } - exit(1); - } - - g_option_context_free(context); - -#if !GLIB_CHECK_VERSION (2, 35, 3) - g_type_init (); -#endif - - contents = g_string_new (""); - g_string_append (contents, - "# Pango Modules file\n" - "# Automatically generated file, do not edit\n" - "#\n"); - - if (argc == 1) /* No arguments given */ - { - char **dirs; - int i; - - if (system_mode) - path = pango_config_key_get_system ("Pango/ModulesPath"); - else - path = pango_config_key_get ("Pango/ModulesPath"); - if (!path) - path = g_build_filename (pango_get_lib_subdirectory (), - MODULE_VERSION, - "modules", - NULL); - - g_string_append_printf (contents, "# ModulesPath = %s\n#\n", path); - - dirs = pango_split_file_list (path); - - g_free (path); - - for (i=0; dirs[i]; i++) - { - GDir *dir = g_dir_open (dirs[i], 0, NULL); - if (dir) - { - const char *dent; - - while ((dent = g_dir_read_name (dir))) - { - int len = strlen (dent); - if (len > SOEXT_LEN && strcmp (dent + len - SOEXT_LEN, SOEXT) == 0) - query_module (dirs[i], dent, contents); - } - - g_dir_close (dir); - } - } - - g_strfreev (dirs); - } - else - { - cwd = g_get_current_dir (); - - for (i=1; i<argc; i++) - query_module (cwd, argv[i], contents); - - g_free (cwd); - } - - if (update_cache) - { - gchar *cache_file; - GError *err; - - cache_file = g_build_filename (pango_get_lib_subdirectory (), - MODULE_VERSION, - "modules.cache", - NULL); - err = NULL; - if (!g_file_set_contents (cache_file, contents->str, -1, &err)) - { - g_fprintf (stderr, "%s\n", err->message); - exit(1); - } - g_free (cache_file); - } - else - g_print ("%s\n", contents->str); - - return 0; -} diff --git a/sanitize-la.sh b/sanitize-la.sh deleted file mode 100755 index 9bc0ba2b..00000000 --- a/sanitize-la.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -sed "s/dependency_libs=.*/dependency_libs=''/" < $1 > $1T && mv $1T $1 diff --git a/tests/Makefile.am b/tests/Makefile.am index 4043fb97..8f0f61f1 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -4,7 +4,6 @@ EXTRA_DIST = \ boundaries.utf8 \ GraphemeBreakTest.txt -CLEANFILES = pangorc DISTCLEANFILES = all-unicode.txt AM_CPPFLAGS = \ @@ -40,8 +39,7 @@ endif TESTS_ENVIRONMENT = \ srcdir=$(srcdir) \ G_TEST_SRCDIR=$(abs_srcdir) \ - G_TEST_BUILDDIR=$(abs_builddir) \ - PANGO_RC_FILE=./pangorc + G_TEST_BUILDDIR=$(abs_builddir) check_PROGRAMS = \ testboundaries \ @@ -99,11 +97,6 @@ cxx_test_SOURCES = cxx-test.C all-unicode.txt: gen-all-unicode$(EXEEXT) ./gen-all-unicode > all-unicode.txt -pangorc: $(srcdir)/../modules/pangorc - cp $(srcdir)/../modules/pangorc $@ - -$(noinst_PROGRAMS) $(check_PROGRAMS): pangorc - noinst_PROGRAMS = $(check_PROGRAMS) gen-all-unicode dump-boundaries markup_tests = \ diff --git a/tests/dump-boundaries.c b/tests/dump-boundaries.c index d71aa60f..8fd4ee74 100644 --- a/tests/dump-boundaries.c +++ b/tests/dump-boundaries.c @@ -112,8 +112,6 @@ main (int argc, { gchar *text; - g_setenv ("PANGO_RC_FILE", "./pangorc", TRUE); - if (argc < 2) fail ("must give a filename on the command line"); |