diff options
89 files changed, 7194 insertions, 2221 deletions
diff --git a/Build/source/libs/graphite-engine/Makefile.am b/Build/source/libs/graphite-engine/Makefile.am index 343db0df85c..de0430e084e 100644 --- a/Build/source/libs/graphite-engine/Makefile.am +++ b/Build/source/libs/graphite-engine/Makefile.am @@ -14,9 +14,16 @@ $(pkgconfig_DATA): config.status dist-hook: find $(distdir) -name .svn | xargs rm -rf -VC_VERSION = 2.1 +# VC_VERSION is the last released version of the software +VC_VERSION = 2.2.1 +# D_VERSION gets the number of the current svn revision D_VERSION = `svnversion ${top_srcdir}|sed -e "s/[0-9]*\://g"` -DEB_VERSION = $(VC_VERSION)+0$(D_VERSION)svn +SVNDEB_VERSION = $(VC_VERSION)+0$(D_VERSION)svn +SVNDEBPACKAGE = silgraphite2.0-$(SVNDEB_VERSION) +SVNORIGTAR = silgraphite2.0_$(SVNDEB_VERSION).orig.tar.gz +SVNWITH_EPOCH = 1:$(SVNDEB_VERSION)-1 + +DEB_VERSION = $(VC_VERSION) DEBPACKAGE = silgraphite2.0-$(DEB_VERSION) ORIGTAR = silgraphite2.0_$(DEB_VERSION).orig.tar.gz WITH_EPOCH = 1:$(DEB_VERSION)-1 @@ -28,24 +35,28 @@ showcodename: deb-base: dist rm -rf silgraphite2.0* - mkdir -p ${DEBPACKAGE} - cp ${PACKAGE}-${VERSION}.tar.gz $(DEBPACKAGE) - tar cfz $(ORIGTAR) $(DEBPACKAGE) - cp -a ${top_srcdir}/debian $(DEBPACKAGE) - cd ${DEBPACKAGE} && find . -name .svn | xargs rm -rf + mkdir -p ${SVNDEBPACKAGE} + cp ${PACKAGE}-${VERSION}.tar.gz $(SVNDEBPACKAGE) + tar cfz $(SVNORIGTAR) $(SVNDEBPACKAGE) + cp -a ${top_srcdir}/debian $(SVNDEBPACKAGE) + cd ${SVNDEBPACKAGE} && find . -name .svn | xargs rm -rf +# make deb builds an interim deb from svn source for release deb: deb-base - dch -D ${DISTRIB_CODENAME} -v ${WITH_EPOCH} -m -c${DEBPACKAGE}/debian/changelog "This is build direct from svn" - cd ${DEBPACKAGE} && pdebuild + dch -D ${DISTRIB_CODENAME} -v ${SVNWITH_EPOCH} -m -c${SVNDEBPACKAGE}/debian/changelog + cd ${SVNDEBPACKAGE} && pdebuild +# make deb-binary-only builds a binary only deb from svn source deb-binary-only: deb-base - dch -D ${DISTRIB_CODENAME} -v ${WITH_EPOCH} -m -c${DEBPACKAGE}/debian/changelog "This is build direct from svn" - cd ${DEBPACKAGE} && pdebuild --debbuildopts -i --debbuildopts -b + dch -D ${DISTRIB_CODENAME} -v ${SVNWITH_EPOCH} -m -c${SVNDEBPACKAGE}/debian/changelog "This is build direct from svn" + cd ${SVNDEBPACKAGE} && pdebuild --debbuildopts -i --debbuildopts -b +# make deb-release builds a deb for a released version number deb-release: deb-base - dch -D ${DISTRIB_CODENAME} -v ${WITH_EPOCH} -m -c${DEBPACKAGE}/debian/changelog "This is built direct from svn" + dch -D ${DISTRIB_CODENAME} -v ${WITH_EPOCH} -c${DEBPACKAGE}/debian/changelog cd ${DEBPACKAGE} && pdebuild +# make deb-local uses debuild to build a deb for local use only deb-local: deb-base - dch -D ${DISTRIB_CODENAME} -v ${WITH_EPOCH} -m -c${DEBPACKAGE}/debian/changelog "This is a debuild direct from svn" - cd ${DEBPACKAGE} && debuild -us -uc + dch -D ${DISTRIB_CODENAME} -v ${SVNWITH_EPOCH} -m -c${SVNDEBPACKAGE}/debian/changelog "This is a debuild direct from svn" + cd ${SVNDEBPACKAGE} && debuild -us -uc diff --git a/Build/source/libs/graphite-engine/Makefile.in b/Build/source/libs/graphite-engine/Makefile.in index 051982d4d92..a07fdc70a31 100644 --- a/Build/source/libs/graphite-engine/Makefile.in +++ b/Build/source/libs/graphite-engine/Makefile.in @@ -137,6 +137,7 @@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ REL_CODENAME = @REL_CODENAME@ +SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ SIZEOF_WCHAR_T = @SIZEOF_WCHAR_T@ @@ -197,9 +198,16 @@ EXTRA_DIST = doc license \ pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = silgraphite.pc -VC_VERSION = 2.1 + +# VC_VERSION is the last released version of the software +VC_VERSION = 2.2.1 +# D_VERSION gets the number of the current svn revision D_VERSION = `svnversion ${top_srcdir}|sed -e "s/[0-9]*\://g"` -DEB_VERSION = $(VC_VERSION)+0$(D_VERSION)svn +SVNDEB_VERSION = $(VC_VERSION)+0$(D_VERSION)svn +SVNDEBPACKAGE = silgraphite2.0-$(SVNDEB_VERSION) +SVNORIGTAR = silgraphite2.0_$(SVNDEB_VERSION).orig.tar.gz +SVNWITH_EPOCH = 1:$(SVNDEB_VERSION)-1 +DEB_VERSION = $(VC_VERSION) DEBPACKAGE = silgraphite2.0-$(DEB_VERSION) ORIGTAR = silgraphite2.0_$(DEB_VERSION).orig.tar.gz WITH_EPOCH = 1:$(DEB_VERSION)-1 @@ -661,27 +669,31 @@ showcodename: deb-base: dist rm -rf silgraphite2.0* - mkdir -p ${DEBPACKAGE} - cp ${PACKAGE}-${VERSION}.tar.gz $(DEBPACKAGE) - tar cfz $(ORIGTAR) $(DEBPACKAGE) - cp -a ${top_srcdir}/debian $(DEBPACKAGE) - cd ${DEBPACKAGE} && find . -name .svn | xargs rm -rf + mkdir -p ${SVNDEBPACKAGE} + cp ${PACKAGE}-${VERSION}.tar.gz $(SVNDEBPACKAGE) + tar cfz $(SVNORIGTAR) $(SVNDEBPACKAGE) + cp -a ${top_srcdir}/debian $(SVNDEBPACKAGE) + cd ${SVNDEBPACKAGE} && find . -name .svn | xargs rm -rf +# make deb builds an interim deb from svn source for release deb: deb-base - dch -D ${DISTRIB_CODENAME} -v ${WITH_EPOCH} -m -c${DEBPACKAGE}/debian/changelog "This is build direct from svn" - cd ${DEBPACKAGE} && pdebuild + dch -D ${DISTRIB_CODENAME} -v ${SVNWITH_EPOCH} -m -c${SVNDEBPACKAGE}/debian/changelog + cd ${SVNDEBPACKAGE} && pdebuild +# make deb-binary-only builds a binary only deb from svn source deb-binary-only: deb-base - dch -D ${DISTRIB_CODENAME} -v ${WITH_EPOCH} -m -c${DEBPACKAGE}/debian/changelog "This is build direct from svn" - cd ${DEBPACKAGE} && pdebuild --debbuildopts -i --debbuildopts -b + dch -D ${DISTRIB_CODENAME} -v ${SVNWITH_EPOCH} -m -c${SVNDEBPACKAGE}/debian/changelog "This is build direct from svn" + cd ${SVNDEBPACKAGE} && pdebuild --debbuildopts -i --debbuildopts -b +# make deb-release builds a deb for a released version number deb-release: deb-base - dch -D ${DISTRIB_CODENAME} -v ${WITH_EPOCH} -m -c${DEBPACKAGE}/debian/changelog "This is built direct from svn" + dch -D ${DISTRIB_CODENAME} -v ${WITH_EPOCH} -c${DEBPACKAGE}/debian/changelog cd ${DEBPACKAGE} && pdebuild +# make deb-local uses debuild to build a deb for local use only deb-local: deb-base - dch -D ${DISTRIB_CODENAME} -v ${WITH_EPOCH} -m -c${DEBPACKAGE}/debian/changelog "This is a debuild direct from svn" - cd ${DEBPACKAGE} && debuild -us -uc + dch -D ${DISTRIB_CODENAME} -v ${SVNWITH_EPOCH} -m -c${SVNDEBPACKAGE}/debian/changelog "This is a debuild direct from svn" + cd ${SVNDEBPACKAGE} && debuild -us -uc # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: diff --git a/Build/source/libs/graphite-engine/README b/Build/source/libs/graphite-engine/README index bebdb8e2481..41c9cc02b5e 100644 --- a/Build/source/libs/graphite-engine/README +++ b/Build/source/libs/graphite-engine/README @@ -1,19 +1,19 @@ GRAPHITE ENGINE -The Graphite smart font engine is the bit that takes a unicode string,font +The Graphite smart-font engine is the bit that takes a Unicode string, font formatting information (features, size, etc.) and a font and returns a set of positioned glyphs. Graphite also does more than this, in that it can handle cursor tracking and interaction with the application for string selection, etc. -In order to interact with the application or system Graphite is embedded in -an application may want to write a custom font and render backend or use one +In order to interact with the application or system, Graphite is embedded in +an application. You may want to write a custom font and render backend or use one of the provided backends in the wrappers project. The *nix build system uses autoconf and automake including all the conventions of those tools. This includes extended support for debug, -maintanence mode, etc. See the GNU autotools info pages for the appropriate -tools for help. See INSTALL for more information on using the build system. +maintenance mode, etc. See the GNU autotools info pages for the appropriate +tools for help. If you have checked this source out of the Graphite Subversion repository or a similar version control system you will need to generate the autotools diff --git a/Build/source/libs/graphite-engine/aclocal.m4 b/Build/source/libs/graphite-engine/aclocal.m4 index c6b83dae620..9857d38b325 100644 --- a/Build/source/libs/graphite-engine/aclocal.m4 +++ b/Build/source/libs/graphite-engine/aclocal.m4 @@ -13,7 +13,7 @@ # libtool.m4 - Configure libtool for the host system. -*-Autoconf-*- -# serial 48 AC_PROG_LIBTOOL +# serial 51 AC_PROG_LIBTOOL # AC_PROVIDE_IFELSE(MACRO-NAME, IF-PROVIDED, IF-NOT-PROVIDED) @@ -176,7 +176,7 @@ test -z "$STRIP" && STRIP=: test -z "$ac_objext" && ac_objext=o # Determine commands to create old-style static archives. -old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs' +old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs' old_postinstall_cmds='chmod 644 $oldlib' old_postuninstall_cmds= @@ -263,8 +263,9 @@ cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` # Check for compiler boilerplate output or warnings with # the simple compiler test code. AC_DEFUN([_LT_COMPILER_BOILERPLATE], -[ac_outfile=conftest.$ac_objext -printf "$lt_simple_compile_test_code" >conftest.$ac_ext +[AC_REQUIRE([LT_AC_PROG_SED])dnl +ac_outfile=conftest.$ac_objext +echo "$lt_simple_compile_test_code" >conftest.$ac_ext eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_compiler_boilerplate=`cat conftest.err` $rm conftest* @@ -276,8 +277,9 @@ $rm conftest* # Check for linker boilerplate output or warnings with # the simple link test code. AC_DEFUN([_LT_LINKER_BOILERPLATE], -[ac_outfile=conftest.$ac_objext -printf "$lt_simple_link_test_code" >conftest.$ac_ext +[AC_REQUIRE([LT_AC_PROG_SED])dnl +ac_outfile=conftest.$ac_objext +echo "$lt_simple_link_test_code" >conftest.$ac_ext eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_linker_boilerplate=`cat conftest.err` $rm conftest* @@ -293,12 +295,20 @@ $rm conftest* # If we don't find anything, use the default library path according # to the aix ld manual. AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX], -[AC_LINK_IFELSE(AC_LANG_PROGRAM,[ -aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'` +[AC_REQUIRE([LT_AC_PROG_SED])dnl +AC_LINK_IFELSE(AC_LANG_PROGRAM,[ +lt_aix_libpath_sed=' + /Import File Strings/,/^$/ { + /^0/ { + s/^0 *\(.*\)$/\1/ + p + } + }' +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. -if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'`; fi],[]) +if test -z "$aix_libpath"; then + aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` +fi],[]) if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ])# _LT_AC_SYS_LIBPATH_AIX @@ -529,13 +539,17 @@ ia64-*-hpux*) rm -rf conftest* ;; -x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*|s390*-*linux*|sparc*-*linux*) +x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \ +s390*-*linux*|sparc*-*linux*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then case `/usr/bin/file conftest.o` in *32-bit*) case $host in + x86_64-*kfreebsd*-gnu) + LD="${LD-ld} -m elf_i386_fbsd" + ;; x86_64-*linux*) LD="${LD-ld} -m elf_i386" ;; @@ -552,6 +566,9 @@ x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*|s390*-*linux*|sparc*-*linux*) ;; *64-bit*) case $host in + x86_64-*kfreebsd*-gnu) + LD="${LD-ld} -m elf_x86_64_fbsd" + ;; x86_64-*linux*) LD="${LD-ld} -m elf_x86_64" ;; @@ -623,7 +640,7 @@ AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION], AC_CACHE_CHECK([$1], [$2], [$2=no ifelse([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4]) - printf "$lt_simple_compile_test_code" > conftest.$ac_ext + echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="$3" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. @@ -664,11 +681,12 @@ fi # ------------------------------------------------------------ # Check whether the given compiler option works AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], -[AC_CACHE_CHECK([$1], [$2], +[AC_REQUIRE([LT_AC_PROG_SED])dnl +AC_CACHE_CHECK([$1], [$2], [$2=no save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS $3" - printf "$lt_simple_link_test_code" > conftest.$ac_ext + echo "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings @@ -782,24 +800,27 @@ AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl fi ;; *) - # If test is not a shell built-in, we'll probably end up computing a - # maximum length that is only half of the actual maximum length, but - # we can't tell. - SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} - while (test "X"`$SHELL [$]0 --fallback-echo "X$teststring" 2>/dev/null` \ + lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` + if test -n "$lt_cv_sys_max_cmd_len"; then + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` + else + SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} + while (test "X"`$SHELL [$]0 --fallback-echo "X$teststring" 2>/dev/null` \ = "XX$teststring") >/dev/null 2>&1 && - new_result=`expr "X$teststring" : ".*" 2>&1` && - lt_cv_sys_max_cmd_len=$new_result && - test $i != 17 # 1/2 MB should be enough - do - i=`expr $i + 1` - teststring=$teststring$teststring - done - teststring= - # Add a significant safety factor because C++ compilers can tack on massive - # amounts of additional arguments before passing them to the linker. - # It appears as though 1/2 is a usable value. - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` + new_result=`expr "X$teststring" : ".*" 2>&1` && + lt_cv_sys_max_cmd_len=$new_result && + test $i != 17 # 1/2 MB should be enough + do + i=`expr $i + 1` + teststring=$teststring$teststring + done + teststring= + # Add a significant safety factor because C++ compilers can tack on massive + # amounts of additional arguments before passing them to the linker. + # It appears as though 1/2 is a usable value. + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` + fi ;; esac ]) @@ -1026,7 +1047,8 @@ fi # --------------------------------- # Check to see if options -c and -o are simultaneously supported by compiler AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O], -[AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl +[AC_REQUIRE([LT_AC_PROG_SED])dnl +AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext], [_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)], [_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=no @@ -1034,7 +1056,7 @@ AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext], mkdir conftest cd conftest mkdir out - printf "$lt_simple_compile_test_code" > conftest.$ac_ext + echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or @@ -1174,6 +1196,7 @@ else darwin*) if test -n "$STRIP" ; then striplib="$STRIP -x" + old_striplib="$STRIP -S" AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) @@ -1191,7 +1214,8 @@ fi # ----------------------------- # PORTME Fill in your ld.so characteristics AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER], -[AC_MSG_CHECKING([dynamic linker characteristics]) +[AC_REQUIRE([LT_AC_PROG_SED])dnl +AC_MSG_CHECKING([dynamic linker characteristics]) library_names_spec= libname_spec='lib$name' soname_spec= @@ -1205,20 +1229,58 @@ shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" sys_lib_dlsearch_path_spec="/lib /usr/lib" +m4_if($1,[],[ if test "$GCC" = yes; then - sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` - if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then + case $host_os in + darwin*) lt_awk_arg="/^libraries:/,/LR/" ;; + *) lt_awk_arg="/^libraries:/" ;; + esac + lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e "s,=/,/,g"` + if echo "$lt_search_path_spec" | grep ';' >/dev/null ; then # if the path contains ";" then we assume it to be the separator # otherwise default to the standard path separator (i.e. ":") - it is # assumed that no part of a normal pathname contains ";" but that should # okay in the real world where ";" in dirpaths is itself problematic. - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + lt_search_path_spec=`echo "$lt_search_path_spec" | $SED -e 's/;/ /g'` else - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + lt_search_path_spec=`echo "$lt_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi + # Ok, now we have the path, separated by spaces, we can step through it + # and add multilib dir if necessary. + lt_tmp_lt_search_path_spec= + lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` + for lt_sys_path in $lt_search_path_spec; do + if test -d "$lt_sys_path/$lt_multi_os_dir"; then + lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir" + else + test -d "$lt_sys_path" && \ + lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" + fi + done + lt_search_path_spec=`echo $lt_tmp_lt_search_path_spec | awk ' +BEGIN {RS=" "; FS="/|\n";} { + lt_foo=""; + lt_count=0; + for (lt_i = NF; lt_i > 0; lt_i--) { + if ($lt_i != "" && $lt_i != ".") { + if ($lt_i == "..") { + lt_count++; + } else { + if (lt_count == 0) { + lt_foo="/" $lt_i lt_foo; + } else { + lt_count--; + } + } + } + } + if (lt_foo != "") { lt_freq[[lt_foo]]++; } + if (lt_freq[[lt_foo]] == 1) { print lt_foo; } +}'` + sys_lib_search_path_spec=`echo $lt_search_path_spec` else sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" -fi +fi]) need_lib_prefix=unknown hardcode_into_libs=no @@ -1375,12 +1437,8 @@ darwin* | rhapsody*) shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' - # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. - if test "$GCC" = yes; then - sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` - else - sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib' - fi + m4_if([$1], [],[ + sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib"]) sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' ;; @@ -1397,18 +1455,6 @@ freebsd1*) dynamic_linker=no ;; -kfreebsd*-gnu) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - dynamic_linker='GNU ld.so' - ;; - freebsd* | dragonfly*) # DragonFly does not have aout. When/if they implement a new # versioning mechanism, adjust this. @@ -1446,7 +1492,7 @@ freebsd* | dragonfly*) shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; - freebsd*) # from 4.6 on + *) # from 4.6 on, and DragonFly shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; @@ -1509,7 +1555,7 @@ hpux9* | hpux10* | hpux11*) postinstall_cmds='chmod 555 $lib' ;; -interix3*) +interix[[3-9]]*) version_type=linux need_lib_prefix=no need_version=no @@ -1564,7 +1610,7 @@ linux*oldld* | linux*aout* | linux*coff*) ;; # This must be Linux ELF. -linux*) +linux* | k*bsd*-gnu) version_type=linux need_lib_prefix=no need_version=no @@ -1580,7 +1626,7 @@ linux*) # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then - lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi @@ -1593,18 +1639,6 @@ linux*) dynamic_linker='GNU/Linux ld.so' ;; -knetbsd*-gnu) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - dynamic_linker='GNU ld.so' - ;; - netbsd*) version_type=sunos need_lib_prefix=no @@ -1686,6 +1720,10 @@ osf3* | osf4* | osf5*) sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" ;; +rdos*) + dynamic_linker=no + ;; + solaris*) version_type=linux need_lib_prefix=no @@ -1791,7 +1829,8 @@ fi # _LT_AC_TAGCONFIG # ---------------- AC_DEFUN([_LT_AC_TAGCONFIG], -[AC_ARG_WITH([tags], +[AC_REQUIRE([LT_AC_PROG_SED])dnl +AC_ARG_WITH([tags], [AC_HELP_STRING([--with-tags@<:@=TAGS@:>@], [include additional configurations @<:@automatic@:>@])], [tagnames="$withval"]) @@ -2052,7 +2091,7 @@ m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP], # AC_PATH_TOOL_PREFIX # ------------------- -# find a file program which can recognise shared library +# find a file program which can recognize shared library AC_DEFUN([AC_PATH_TOOL_PREFIX], [AC_REQUIRE([AC_PROG_EGREP])dnl AC_MSG_CHECKING([for $1]) @@ -2115,7 +2154,7 @@ fi # AC_PATH_MAGIC # ------------- -# find a file program which can recognise a shared library +# find a file program which can recognize a shared library AC_DEFUN([AC_PATH_MAGIC], [AC_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$PATH) if test -z "$lt_cv_path_MAGIC_CMD"; then @@ -2262,7 +2301,7 @@ esac # how to check for library dependencies # -- PORTME fill in with the dynamic library characteristics AC_DEFUN([AC_DEPLIBS_CHECK_METHOD], -[AC_CACHE_CHECK([how to recognise dependent libraries], +[AC_CACHE_CHECK([how to recognize dependent libraries], lt_cv_deplibs_check_method, [lt_cv_file_magic_cmd='$MAGIC_CMD' lt_cv_file_magic_test_file= @@ -2301,16 +2340,22 @@ cygwin*) mingw* | pw32*) # Base MSYS/MinGW do not provide the 'file' command needed by - # func_win32_libid shell function, so use a weaker test based on 'objdump'. - lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?' - lt_cv_file_magic_cmd='$OBJDUMP -f' + # func_win32_libid shell function, so use a weaker test based on 'objdump', + # unless we find 'file', for example because we are cross-compiling. + if ( file / ) >/dev/null 2>&1; then + lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' + lt_cv_file_magic_cmd='func_win32_libid' + else + lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?' + lt_cv_file_magic_cmd='$OBJDUMP -f' + fi ;; darwin* | rhapsody*) lt_cv_deplibs_check_method=pass_all ;; -freebsd* | kfreebsd*-gnu | dragonfly*) +freebsd* | dragonfly*) if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then case $host_cpu in i*86 ) @@ -2348,7 +2393,7 @@ hpux10.20* | hpux11*) esac ;; -interix3*) +interix[[3-9]]*) # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|\.a)$' ;; @@ -2364,7 +2409,7 @@ irix5* | irix6* | nonstopux*) ;; # This must be Linux ELF. -linux*) +linux* | k*bsd*-gnu) lt_cv_deplibs_check_method=pass_all ;; @@ -2398,6 +2443,10 @@ osf3* | osf4* | osf5*) lt_cv_deplibs_check_method=pass_all ;; +rdos*) + lt_cv_deplibs_check_method=pass_all + ;; + solaris*) lt_cv_deplibs_check_method=pass_all ;; @@ -2450,7 +2499,7 @@ AC_DEFUN([AC_PROG_NM], lt_cv_path_NM="$NM" else lt_nm_to_check="${ac_tool_prefix}nm" - if test -n "$ac_tool_prefix" && test "$build" = "$host"; then + if test -n "$ac_tool_prefix" && test "$build" = "$host"; then lt_nm_to_check="$lt_nm_to_check nm" fi for lt_tmp_nm in $lt_nm_to_check; do @@ -2666,10 +2715,10 @@ objext=o _LT_AC_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests -lt_simple_compile_test_code="int some_variable = 0;\n" +lt_simple_compile_test_code="int some_variable = 0;" # Code to be used in simple link tests -lt_simple_link_test_code='int main(){return(0);}\n' +lt_simple_link_test_code='int main(){return(0);}' _LT_AC_SYS_COMPILER @@ -2771,10 +2820,10 @@ objext=o _LT_AC_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests -lt_simple_compile_test_code="int some_variable = 0;\n" +lt_simple_compile_test_code="int some_variable = 0;" # Code to be used in simple link tests -lt_simple_link_test_code='int main(int, char *[[]]) { return(0); }\n' +lt_simple_link_test_code='int main(int, char *[[]]) { return(0); }' # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_AC_SYS_COMPILER @@ -2920,7 +2969,7 @@ case $host_os in strings "$collect2name" | grep resolve_lib_name >/dev/null then # We have reworked collect2 - _LT_AC_TAGVAR(hardcode_direct, $1)=yes + : else # We have old collect2 _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported @@ -3079,10 +3128,10 @@ case $host_os in case $cc_basename in xlc*) output_verbose_link_cmd='echo' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $xlcverstring' _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $xlcverstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' ;; *) @@ -3116,7 +3165,7 @@ case $host_os in freebsd-elf*) _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no ;; - freebsd* | kfreebsd*-gnu | dragonfly*) + freebsd* | dragonfly*) # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF # conventions _LT_AC_TAGVAR(ld_shlibs, $1)=yes @@ -3165,9 +3214,7 @@ case $host_os in _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: case $host_cpu in - hppa*64*|ia64*) - _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir' - ;; + hppa*64*|ia64*) ;; *) _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' ;; @@ -3235,7 +3282,7 @@ case $host_os in ;; esac ;; - interix3*) + interix[[3-9]]*) _LT_AC_TAGVAR(hardcode_direct, $1)=no _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' @@ -3275,7 +3322,7 @@ case $host_os in _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: ;; - linux*) + linux* | k*bsd*-gnu) case $cc_basename in KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler @@ -3355,6 +3402,29 @@ case $host_os in # dependencies. output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' ;; + *) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) + # Sun C++ 5.9 + _LT_AC_TAGVAR(no_undefined_flag, $1)=' -zdefs' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file ${wl}$export_symbols' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' + + # Not sure whether something based on + # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 + # would be better. + output_verbose_link_cmd='echo' + + # Archives containing C++ object files must be created using + # "CC -xar", where "CC" is the Sun C++ compiler. This is + # necessary to make sure instantiated templates are included + # in the archive. + _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' + ;; + esac + ;; esac ;; lynxos*) @@ -3393,16 +3463,20 @@ case $host_os in _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; openbsd*) - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib' - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + if test -f /usr/libexec/ld.so; then + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib' + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + fi + output_verbose_link_cmd='echo' + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no fi - output_verbose_link_cmd='echo' ;; osf3*) case $cc_basename in @@ -3564,15 +3638,10 @@ case $host_os in case $host_os in solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; *) - # The C++ compiler is used as linker so we must use $wl - # flag to pass the commands to the underlying system - # linker. We must also pass each convience library through - # to the system linker between allextract/defaultextract. - # The C++ compiler will combine linker options so we - # cannot just pass the convience library names through - # without $wl. + # The compiler driver will combine and reorder linker options, + # but understands `-z linker_flag'. # Supported since Solaris 2.6 (maybe 2.5.1?) - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' ;; esac _LT_AC_TAGVAR(link_all_deplibs, $1)=yes @@ -3619,6 +3688,12 @@ case $host_os in fi _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $wl$libdir' + case $host_os in + solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; + *) + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' + ;; + esac fi ;; esac @@ -3862,7 +3937,7 @@ $rm -f confest.$objext # PORTME: override above test on systems where it is broken ifelse([$1],[CXX], [case $host_os in -interix3*) +interix[[3-9]]*) # Interix 3.5 installs completely hosed .la files for C++, so rather than # hack all around it, let's just trust "g++" to DTRT. _LT_AC_TAGVAR(predep_objects,$1)= @@ -3870,13 +3945,46 @@ interix3*) _LT_AC_TAGVAR(postdeps,$1)= ;; +linux*) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) + # Sun C++ 5.9 + # + # The more standards-conforming stlport4 library is + # incompatible with the Cstd library. Avoid specifying + # it if it's in CXXFLAGS. Ignore libCrun as + # -library=stlport4 depends on it. + case " $CXX $CXXFLAGS " in + *" -library=stlport4 "*) + solaris_use_stlport4=yes + ;; + esac + if test "$solaris_use_stlport4" != yes; then + _LT_AC_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun' + fi + ;; + esac + ;; + solaris*) case $cc_basename in CC*) + # The more standards-conforming stlport4 library is + # incompatible with the Cstd library. Avoid specifying + # it if it's in CXXFLAGS. Ignore libCrun as + # -library=stlport4 depends on it. + case " $CXX $CXXFLAGS " in + *" -library=stlport4 "*) + solaris_use_stlport4=yes + ;; + esac + # Adding this requires a known-good setup of shared libraries for # Sun compiler versions before 5.6, else PIC objects from an old # archive will be linked into the output, leading to subtle bugs. - _LT_AC_TAGVAR(postdeps,$1)='-lCstd -lCrun' + if test "$solaris_use_stlport4" != yes; then + _LT_AC_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun' + fi ;; esac ;; @@ -3925,10 +4033,17 @@ objext=o _LT_AC_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests -lt_simple_compile_test_code=" subroutine t\n return\n end\n" +lt_simple_compile_test_code="\ + subroutine t + return + end +" # Code to be used in simple link tests -lt_simple_link_test_code=" program t\n end\n" +lt_simple_link_test_code="\ + program t + end +" # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_AC_SYS_COMPILER @@ -4007,10 +4122,10 @@ objext=o _LT_AC_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests -lt_simple_compile_test_code="class foo {}\n" +lt_simple_compile_test_code="class foo {}" # Code to be used in simple link tests -lt_simple_link_test_code='public class conftest { public static void main(String[[]] argv) {}; }\n' +lt_simple_link_test_code='public class conftest { public static void main(String[[]] argv) {}; }' # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_AC_SYS_COMPILER @@ -4063,7 +4178,7 @@ objext=o _LT_AC_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests -lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }\n' +lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }' # Code to be used in simple link tests lt_simple_link_test_code="$lt_simple_compile_test_code" @@ -4152,6 +4267,7 @@ if test -f "$ltmain"; then _LT_AC_TAGVAR(module_cmds, $1) \ _LT_AC_TAGVAR(module_expsym_cmds, $1) \ _LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1) \ + _LT_AC_TAGVAR(fix_srcfile_path, $1) \ _LT_AC_TAGVAR(exclude_expsyms, $1) \ _LT_AC_TAGVAR(include_expsyms, $1); do @@ -4198,7 +4314,7 @@ ifelse([$1], [], # Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP) # NOTE: Changes made to this file will be lost: look at ltmain.sh. # -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001 +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 # Free Software Foundation, Inc. # # This file is part of GNU Libtool: @@ -4523,7 +4639,7 @@ sys_lib_search_path_spec=$lt_sys_lib_search_path_spec sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec # Fix the shell variable \$srcfile for the compiler. -fix_srcfile_path="$_LT_AC_TAGVAR(fix_srcfile_path, $1)" +fix_srcfile_path=$lt_fix_srcfile_path # Set to yes if exported symbols are required. always_export_symbols=$_LT_AC_TAGVAR(always_export_symbols, $1) @@ -4606,6 +4722,7 @@ fi # --------------------------------- AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], [AC_REQUIRE([AC_CANONICAL_HOST]) +AC_REQUIRE([LT_AC_PROG_SED]) AC_REQUIRE([AC_PROG_NM]) AC_REQUIRE([AC_OBJEXT]) # Check for command to grab the raw symbol name followed by C symbol from nm. @@ -4642,7 +4759,7 @@ hpux*) # Its linker distinguishes data from code symbols lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" ;; -linux*) +linux* | k*bsd*-gnu) if test "$host_cpu" = ia64; then symcode='[[ABCDGIRSTW]]' lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" @@ -4832,12 +4949,14 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) # like `-m68040'. _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' ;; - beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; - mingw* | os2* | pw32*) + mingw* | cygwin* | os2* | pw32*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). + # Although the cygwin gcc ignores -fPIC, still need this for old-style + # (--disable-auto-import) libraries _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT' ;; darwin* | rhapsody*) @@ -4849,7 +4968,7 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) # DJGPP does not support shared libraries at all _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= ;; - interix3*) + interix[[3-9]]*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; @@ -4915,7 +5034,7 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) ;; esac ;; - freebsd* | kfreebsd*-gnu | dragonfly*) + freebsd* | dragonfly*) # FreeBSD uses GNU C++ ;; hpux9* | hpux10* | hpux11*) @@ -4958,7 +5077,7 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) ;; esac ;; - linux*) + linux* | k*bsd*-gnu) case $cc_basename in KCC*) # KAI C++ Compiler @@ -4985,6 +5104,14 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; *) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) + # Sun C++ 5.9 + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' + ;; + esac ;; esac ;; @@ -5105,13 +5232,15 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' ;; - beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; - mingw* | pw32* | os2*) + mingw* | cygwin* | pw32* | os2*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). + # Although the cygwin gcc ignores -fPIC, still need this for old-style + # (--disable-auto-import) libraries _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT' ;; @@ -5121,7 +5250,7 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' ;; - interix3*) + interix[[3-9]]*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; @@ -5179,7 +5308,7 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) esac ;; - mingw* | pw32* | os2*) + mingw* | cygwin* | pw32* | os2*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT' @@ -5212,7 +5341,7 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; - linux*) + linux* | k*bsd*-gnu) case $cc_basename in icc* | ecc*) _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' @@ -5231,6 +5360,22 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) # All Alpha code is PIC. _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; + *) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) + # Sun C 5.9 + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + ;; + *Sun\ F*) + # Sun Fortran 8.3 passes all unrecognized flags to the linker + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='' + ;; + esac + ;; esac ;; @@ -5240,6 +5385,10 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; + rdos*) + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + solaris*) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' @@ -5334,7 +5483,8 @@ AC_LIBTOOL_LINKER_OPTION([if $compiler static flag $lt_tmp_static_flag works], # ------------------------------------ # See if the linker supports building shared libraries. AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS], -[AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) +[AC_REQUIRE([LT_AC_PROG_SED])dnl +AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) ifelse([$1],[CXX],[ _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' case $host_os in @@ -5351,7 +5501,7 @@ ifelse([$1],[CXX],[ _LT_AC_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds" ;; cygwin* | mingw*) - _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]] /s/.* \([[^ ]]*\)/\1 DATA/;/^.* __nm__/s/^.* __nm__\([[^ ]]*\) [[^ ]]*/\1 DATA/;/^I /d;/^[[AITW]] /s/.* //'\'' | sort | uniq > $export_symbols' + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;/^.*[[ ]]__nm__/s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | uniq > $export_symbols' ;; *) _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' @@ -5490,7 +5640,7 @@ EOF _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_AC_TAGVAR(always_export_symbols, $1)=no _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes - _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]] /s/.* \([[^ ]]*\)/\1 DATA/'\'' | $SED -e '\''/^[[AITW]] /s/.* //'\'' | sort | uniq > $export_symbols' + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/'\'' -e '\''/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | uniq > $export_symbols' if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' @@ -5508,7 +5658,7 @@ EOF fi ;; - interix3*) + interix[[3-9]]*) _LT_AC_TAGVAR(hardcode_direct, $1)=no _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' @@ -5523,7 +5673,7 @@ EOF _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; - linux*) + gnu* | linux* | k*bsd*-gnu) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then tmp_addflag= case $cc_basename,$host_cpu in @@ -5541,13 +5691,22 @@ EOF ifc* | ifort*) # Intel Fortran compiler tmp_addflag=' -nofor_main' ;; esac - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) # Sun C 5.9 + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_sharedflag='-G' ;; + *Sun\ F*) # Sun Fortran 8.3 + tmp_sharedflag='-G' ;; + *) + tmp_sharedflag='-shared' ;; + esac + _LT_AC_TAGVAR(archive_cmds, $1)='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' if test $supports_anon_versioning = yes; then _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ $echo "local: *; };" >> $output_objdir/$libname.ver~ - $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' + $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' fi else _LT_AC_TAGVAR(ld_shlibs, $1)=no @@ -5587,7 +5746,7 @@ EOF sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) case `$LD -v 2>&1` in - *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.1[[0-5]].*) + *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.1[[0-5]].*) _LT_AC_TAGVAR(ld_shlibs, $1)=no cat <<_LT_EOF 1>&2 @@ -5706,7 +5865,7 @@ _LT_EOF strings "$collect2name" | grep resolve_lib_name >/dev/null then # We have reworked collect2 - _LT_AC_TAGVAR(hardcode_direct, $1)=yes + : else # We have old collect2 _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported @@ -5799,7 +5958,7 @@ _LT_EOF # The linker will automatically build a .lib file if we build a DLL. _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)='true' # FIXME: Should let the user specify the lib program. - _LT_AC_TAGVAR(old_archive_cmds, $1)='lib /OUT:$oldlib$oldobjs$old_deplibs' + _LT_AC_TAGVAR(old_archive_cmds, $1)='lib -OUT:$oldlib$oldobjs$old_deplibs' _LT_AC_TAGVAR(fix_srcfile_path, $1)='`cygpath -w "$srcfile"`' _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes ;; @@ -5841,10 +6000,10 @@ _LT_EOF case $cc_basename in xlc*) output_verbose_link_cmd='echo' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $xlcverstring' _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $xlcverstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' ;; *) @@ -5884,7 +6043,7 @@ _LT_EOF ;; # FreeBSD 3 and greater uses gcc -shared to do shared libraries. - freebsd* | kfreebsd*-gnu | dragonfly*) + freebsd* | dragonfly*) _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_AC_TAGVAR(hardcode_direct, $1)=yes @@ -6006,24 +6165,28 @@ _LT_EOF ;; openbsd*) - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + if test -f /usr/libexec/ld.so; then + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + else + case $host_os in + openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + ;; + *) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + ;; + esac + fi else - case $host_os in - openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - ;; - *) - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - ;; - esac + _LT_AC_TAGVAR(ld_shlibs, $1)=no fi ;; @@ -6082,17 +6245,16 @@ _LT_EOF case $host_os in solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; *) - # The compiler driver will combine linker options so we - # cannot just pass the convience library names through - # without $wl, iff we do not link with $LD. - # Luckily, gcc supports the same syntax we need for Sun Studio. + # The compiler driver will combine and reorder linker options, + # but understands `-z linker_flag'. GCC discards it without `$wl', + # but is careful enough not to reorder. # Supported since Solaris 2.6 (maybe 2.5.1?) - case $wlarc in - '') - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' ;; - *) - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' ;; - esac ;; + if test "$GCC" = yes; then + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' + else + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' + fi + ;; esac _LT_AC_TAGVAR(link_all_deplibs, $1)=yes ;; @@ -6149,7 +6311,7 @@ _LT_EOF fi ;; - sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7*) + sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*) _LT_AC_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no @@ -6224,7 +6386,7 @@ x|xyes) # to ld, don't add -lc before -lgcc. AC_MSG_CHECKING([whether -lc should be explicitly linked in]) $rm conftest* - printf "$lt_simple_compile_test_code" > conftest.$ac_ext + echo "$lt_simple_compile_test_code" > conftest.$ac_ext if AC_TRY_EVAL(ac_compile) 2>conftest.err; then soname=conftest @@ -6327,6 +6489,30 @@ AC_DEFUN([LT_AC_PROG_RC], [AC_CHECK_TOOL(RC, windres, no) ]) + +# Cheap backport of AS_EXECUTABLE_P and required macros +# from Autoconf 2.59; we should not use $as_executable_p directly. + +# _AS_TEST_PREPARE +# ---------------- +m4_ifndef([_AS_TEST_PREPARE], +[m4_defun([_AS_TEST_PREPARE], +[if test -x / >/dev/null 2>&1; then + as_executable_p='test -x' +else + as_executable_p='test -f' +fi +])])# _AS_TEST_PREPARE + +# AS_EXECUTABLE_P +# --------------- +# Check whether a file is executable. +m4_ifndef([AS_EXECUTABLE_P], +[m4_defun([AS_EXECUTABLE_P], +[AS_REQUIRE([_AS_TEST_PREPARE])dnl +$as_executable_p $1[]dnl +])])# AS_EXECUTABLE_P + # NOTE: This macro has been submitted for inclusion into # # GNU Autoconf as AC_PROG_SED. When it is available in # # a released version of Autoconf we should remove this # @@ -6347,12 +6533,13 @@ do test -z "$as_dir" && as_dir=. for lt_ac_prog in sed gsed; do for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then + if AS_EXECUTABLE_P(["$as_dir/$lt_ac_prog$ac_exec_ext"]); then lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext" fi done done done +IFS=$as_save_IFS lt_ac_max=0 lt_ac_count=0 # Add /usr/xpg4/bin/sed as it is typically found on Solaris @@ -6385,6 +6572,7 @@ for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do done ]) SED=$lt_cv_path_SED +AC_SUBST([SED]) AC_MSG_RESULT([$SED]) ]) diff --git a/Build/source/libs/graphite-engine/config/config.guess b/Build/source/libs/graphite-engine/config/config.guess index e3ef63f6cb4..951383e3554 100755 --- a/Build/source/libs/graphite-engine/config/config.guess +++ b/Build/source/libs/graphite-engine/config/config.guess @@ -1,9 +1,10 @@ #! /bin/sh # Attempt to guess a canonical system name. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -# 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. +# 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, +# Inc. -timestamp='2005-12-13' +timestamp='2007-05-17' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -106,7 +107,7 @@ set_cc_for_build=' trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; : ${TMPDIR=/tmp} ; - { tmp=`(umask 077 && mktemp -d -q "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || + { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; @@ -160,6 +161,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; + sh5el) machine=sh5le-unknown ;; *) machine=${UNAME_MACHINE_ARCH}-unknown ;; esac # The Operating System including object format, if it has switched @@ -206,8 +208,11 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in *:ekkoBSD:*:*) echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} exit ;; + *:SolidBSD:*:*) + echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} + exit ;; macppc:MirBSD:*:*) - echo powerppc-unknown-mirbsd${UNAME_RELEASE} + echo powerpc-unknown-mirbsd${UNAME_RELEASE} exit ;; *:MirBSD:*:*) echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} @@ -325,7 +330,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; - i86pc:SunOS:5.*:*) + i86pc:SunOS:5.*:* | ix86xen:SunOS:5.*:*) echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:6*:*) @@ -764,12 +769,19 @@ EOF echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} exit ;; *:FreeBSD:*:*) - echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` + case ${UNAME_MACHINE} in + pc98) + echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + amd64) + echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + *) + echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + esac exit ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin exit ;; - i*:MINGW*:*) + *:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit ;; i*:windows32*:*) @@ -779,9 +791,15 @@ EOF i*:PW*:*) echo ${UNAME_MACHINE}-pc-pw32 exit ;; - x86:Interix*:[345]*) - echo i586-pc-interix${UNAME_RELEASE}|sed -e 's/\..*//' - exit ;; + *:Interix*:[3456]*) + case ${UNAME_MACHINE} in + x86) + echo i586-pc-interix${UNAME_RELEASE} + exit ;; + EM64T | authenticamd) + echo x86_64-unknown-interix${UNAME_RELEASE} + exit ;; + esac ;; [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) echo i${UNAME_MACHINE}-pc-mks exit ;; @@ -817,6 +835,9 @@ EOF arm*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; + avr32*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; cris:Linux:*:*) echo cris-axis-linux-gnu exit ;; @@ -851,7 +872,11 @@ EOF #endif #endif EOF - eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '/^CPU/{s: ::g;p;}'`" + eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' + /^CPU/{ + s: ::g + p + }'`" test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } ;; mips64:Linux:*:*) @@ -870,7 +895,11 @@ EOF #endif #endif EOF - eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '/^CPU/{s: ::g;p;}'`" + eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' + /^CPU/{ + s: ::g + p + }'`" test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } ;; or32:Linux:*:*) @@ -925,6 +954,9 @@ EOF x86_64:Linux:*:*) echo x86_64-unknown-linux-gnu exit ;; + xtensa:Linux:*:*) + echo xtensa-unknown-linux-gnu + exit ;; i*86:Linux:*:*) # The BFD linker knows what the default object file format is, so # first see if it will tell us. cd to the root directory to prevent @@ -967,7 +999,7 @@ EOF LIBC=gnulibc1 # endif #else - #if defined(__INTEL_COMPILER) || defined(__PGI) + #if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__SUNPRO_C) || defined(__SUNPRO_CC) LIBC=gnu #else LIBC=gnuaout @@ -977,7 +1009,11 @@ EOF LIBC=dietlibc #endif EOF - eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '/^LIBC/{s: ::g;p;}'`" + eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' + /^LIBC/{ + s: ::g + p + }'`" test x"${LIBC}" != x && { echo "${UNAME_MACHINE}-pc-linux-${LIBC}" exit @@ -1179,6 +1215,15 @@ EOF SX-6:SUPER-UX:*:*) echo sx6-nec-superux${UNAME_RELEASE} exit ;; + SX-7:SUPER-UX:*:*) + echo sx7-nec-superux${UNAME_RELEASE} + exit ;; + SX-8:SUPER-UX:*:*) + echo sx8-nec-superux${UNAME_RELEASE} + exit ;; + SX-8R:SUPER-UX:*:*) + echo sx8r-nec-superux${UNAME_RELEASE} + exit ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody${UNAME_RELEASE} exit ;; diff --git a/Build/source/libs/graphite-engine/config/config.sub b/Build/source/libs/graphite-engine/config/config.sub index 285164700dd..c060f448339 100755 --- a/Build/source/libs/graphite-engine/config/config.sub +++ b/Build/source/libs/graphite-engine/config/config.sub @@ -1,9 +1,10 @@ #! /bin/sh # Configuration validation subroutine script. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -# 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. +# 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, +# Inc. -timestamp='2005-12-11' +timestamp='2007-04-29' # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software @@ -240,15 +241,16 @@ case $basic_machine in | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | am33_2.0 \ - | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \ + | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \ | bfin \ | c4x | clipper \ | d10v | d30v | dlx | dsp16xx \ - | fr30 | frv \ + | fido | fr30 | frv \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | i370 | i860 | i960 | ia64 \ | ip2k | iq2000 \ - | m32r | m32rle | m68000 | m68k | m88k | maxq | mcore \ + | m32c | m32r | m32rle | m68000 | m68k | m88k \ + | maxq | mb | microblaze | mcore | mep \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ @@ -268,26 +270,25 @@ case $basic_machine in | mn10200 | mn10300 \ | mt \ | msp430 \ + | nios | nios2 \ | ns16k | ns32k \ | or32 \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ | pyramid \ - | sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \ + | score \ + | sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ - | sparc | sparc64 | sparc64b | sparc86x | sparclet | sparclite \ - | sparcv8 | sparcv9 | sparcv9b \ - | strongarm \ + | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ + | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ + | spu | strongarm \ | tahoe | thumb | tic4x | tic80 | tron \ | v850 | v850e \ | we32k \ - | x86 | xscale | xscalee[bl] | xstormy16 | xtensa \ + | x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \ | z8k) basic_machine=$basic_machine-unknown ;; - m32c) - basic_machine=$basic_machine-unknown - ;; m6811 | m68hc11 | m6812 | m68hc12) # Motorola 68HC11/12. basic_machine=$basic_machine-unknown @@ -317,18 +318,18 @@ case $basic_machine in | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ - | avr-* \ + | avr-* | avr32-* \ | bfin-* | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ | clipper-* | craynv-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ | elxsi-* \ - | f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \ + | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | i*86-* | i860-* | i960-* | ia64-* \ | ip2k-* | iq2000-* \ - | m32r-* | m32rle-* \ + | m32c-* | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ | m88110-* | m88k-* | maxq-* | mcore-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ @@ -350,29 +351,28 @@ case $basic_machine in | mmix-* \ | mt-* \ | msp430-* \ + | nios-* | nios2-* \ | none-* | np1-* | ns16k-* | ns32k-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ | pyramid-* \ | romp-* | rs6000-* \ - | sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | shbe-* \ + | sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ - | sparc-* | sparc64-* | sparc64b-* | sparc86x-* | sparclet-* \ + | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ | sparclite-* \ - | sparcv8-* | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \ + | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \ | tahoe-* | thumb-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ | tron-* \ | v850-* | v850e-* | vax-* \ | we32k-* \ - | x86-* | x86_64-* | xps100-* | xscale-* | xscalee[bl]-* \ + | x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \ | xstormy16-* | xtensa-* \ | ymp-* \ | z8k-*) ;; - m32c-*) - ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. 386bsd) @@ -683,6 +683,10 @@ case $basic_machine in basic_machine=i386-pc os=-mingw32 ;; + mingw32ce) + basic_machine=arm-unknown + os=-mingw32ce + ;; miniframe) basic_machine=m68000-convergent ;; @@ -818,6 +822,12 @@ case $basic_machine in pc532 | pc532-*) basic_machine=ns32k-pc532 ;; + pc98) + basic_machine=i386-pc + ;; + pc98-*) + basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; pentium | p5 | k5 | k6 | nexgen | viac3) basic_machine=i586-pc ;; @@ -904,6 +914,10 @@ case $basic_machine in sb1el) basic_machine=mipsisa64sb1el-unknown ;; + sde) + basic_machine=mipsisa32-sde + os=-elf + ;; sei) basic_machine=mips-sei os=-seiux @@ -915,6 +929,9 @@ case $basic_machine in basic_machine=sh-hitachi os=-hms ;; + sh5el) + basic_machine=sh5le-unknown + ;; sh64) basic_machine=sh64-unknown ;; @@ -1120,7 +1137,7 @@ case $basic_machine in sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele) basic_machine=sh-unknown ;; - sparc | sparcv8 | sparcv9 | sparcv9b) + sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) basic_machine=sparc-sun ;; cydra) @@ -1193,7 +1210,8 @@ case $os in | -aos* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ - | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* | -openbsd* \ + | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ + | -openbsd* | -solidbsd* \ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ @@ -1208,7 +1226,7 @@ case $os in | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ - | -skyos* | -haiku* | -rdos*) + | -skyos* | -haiku* | -rdos* | -toppers* | -drops*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) @@ -1360,6 +1378,12 @@ else # system, and we'll never get to this point. case $basic_machine in + score-*) + os=-elf + ;; + spu-*) + os=-elf + ;; *-acorn) os=-riscix1.2 ;; @@ -1369,9 +1393,9 @@ case $basic_machine in arm*-semi) os=-aout ;; - c4x-* | tic4x-*) - os=-coff - ;; + c4x-* | tic4x-*) + os=-coff + ;; # This must come before the *-dec entry. pdp10-*) os=-tops20 @@ -1397,6 +1421,9 @@ case $basic_machine in m68*-cisco) os=-aout ;; + mep-*) + os=-elf + ;; mips*-cisco) os=-elf ;; diff --git a/Build/source/libs/graphite-engine/config/ltmain.sh b/Build/source/libs/graphite-engine/config/ltmain.sh index 06823e057a5..4598ec61ccf 100644 --- a/Build/source/libs/graphite-engine/config/ltmain.sh +++ b/Build/source/libs/graphite-engine/config/ltmain.sh @@ -1,8 +1,8 @@ # ltmain.sh - Provide generalized library-building support services. # NOTE: Changing this file will not affect anything until you rerun configure. # -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005 -# Free Software Foundation, Inc. +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, +# 2007 Free Software Foundation, Inc. # Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996 # # This program is free software; you can redistribute it and/or modify @@ -43,14 +43,22 @@ EXIT_FAILURE=1 PROGRAM=ltmain.sh PACKAGE=libtool -VERSION=1.5.22 -TIMESTAMP=" (1.1220.2.365 2005/12/18 22:14:06)" - -# See if we are running on zsh, and set the options which allow our -# commands through without removal of \ escapes. -if test -n "${ZSH_VERSION+set}" ; then +VERSION=1.5.24 +TIMESTAMP=" (1.1220.2.455 2007/06/24 02:13:29)" + +# Be Bourne compatible (taken from Autoconf:_AS_BOURNE_COMPATIBLE). +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac fi +BIN_SH=xpg4; export BIN_SH # for Tru64 +DUALCASE=1; export DUALCASE # for MKS sh # Check that we have a working $echo. if test "X$1" = X--no-reexec; then @@ -105,12 +113,14 @@ esac # These must not be set unconditionally because not all systems understand # e.g. LANG=C (notably SCO). # We save the old values to restore during execute mode. -if test "${LC_ALL+set}" = set; then - save_LC_ALL="$LC_ALL"; LC_ALL=C; export LC_ALL -fi -if test "${LANG+set}" = set; then - save_LANG="$LANG"; LANG=C; export LANG -fi +for lt_var in LANG LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES +do + eval "if test \"\${$lt_var+set}\" = set; then + save_$lt_var=\$$lt_var + $lt_var=C + export $lt_var + fi" +done # Make sure IFS has a sensible default lt_nl=' @@ -136,6 +146,8 @@ duplicate_deps=no preserve_args= lo2o="s/\\.lo\$/.${objext}/" o2lo="s/\\.${objext}\$/.lo/" +extracted_archives= +extracted_serial=0 ##################################### # Shell function definitions: @@ -196,7 +208,13 @@ func_win32_libid () if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \ $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then win32_nmres=`eval $NM -f posix -A $1 | \ - $SED -n -e '1,100{/ I /{s,.*,import,;p;q;};}'` + $SED -n -e '1,100{ + / I /{ + s,.*,import, + p + q + } + }'` case $win32_nmres in import*) win32_libid_type="x86 archive import";; *) win32_libid_type="x86 archive static";; @@ -327,7 +345,17 @@ func_extract_archives () *) my_xabs=`pwd`"/$my_xlib" ;; esac my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'` - my_xdir="$my_gentop/$my_xlib" + my_xlib_u=$my_xlib + while :; do + case " $extracted_archives " in + *" $my_xlib_u "*) + extracted_serial=`expr $extracted_serial + 1` + my_xlib_u=lt$extracted_serial-$my_xlib ;; + *) break ;; + esac + done + extracted_archives="$extracted_archives $my_xlib_u" + my_xdir="$my_gentop/$my_xlib_u" $show "${rm}r $my_xdir" $run ${rm}r "$my_xdir" @@ -454,11 +482,12 @@ do ;; --version) - $echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP" - $echo - $echo "Copyright (C) 2005 Free Software Foundation, Inc." - $echo "This is free software; see the source for copying conditions. There is NO" - $echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + echo "\ +$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP + +Copyright (C) 2007 Free Software Foundation, Inc. +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." exit $? ;; @@ -755,9 +784,10 @@ if test -z "$show_help"; then *.class) xform=class ;; *.cpp) xform=cpp ;; *.cxx) xform=cxx ;; - *.f90) xform=f90 ;; + *.[fF][09]?) xform=[fF][09]. ;; *.for) xform=for ;; *.java) xform=java ;; + *.obj) xform=obj ;; esac libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"` @@ -1138,8 +1168,9 @@ EOF for arg do case $arg in - -all-static | -static) - if test "X$arg" = "X-all-static"; then + -all-static | -static | -static-libtool-libs) + case $arg in + -all-static) if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2 fi @@ -1147,12 +1178,20 @@ EOF dlopen_self=$dlopen_self_static fi prefer_static_libs=yes - else + ;; + -static) if test -z "$pic_flag" && test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi prefer_static_libs=built - fi + ;; + -static-libtool-libs) + if test -z "$pic_flag" && test -n "$link_static_flag"; then + dlopen_self=$dlopen_self_static + fi + prefer_static_libs=yes + ;; + esac build_libtool_libs=no build_old_libs=yes break @@ -1600,7 +1639,7 @@ EOF continue ;; - -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe) + -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads) compiler_flags="$compiler_flags $arg" compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" @@ -1620,10 +1659,11 @@ EOF # -m* pass through architecture-specific compiler args for GCC # -m*, -t[45]*, -txscale* pass through architecture-specific # compiler args for GCC - # -pg pass through profiling flag for GCC + # -p, -pg, --coverage, -fprofile-* pass through profiling flag for GCC + # -F/path gives path to uninstalled frameworks, gcc on darwin # @file GCC response files - -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*|-pg| \ - -t[45]*|-txscale*|@*) + -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \ + -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*) # Unknown arguments in both finalize_command and compile_command need # to be aesthetically quoted because they are evaled later. @@ -1651,9 +1691,9 @@ EOF -no-install) case $host in - *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin*) # The PATH hackery in wrapper scripts is required on Windows - # in order for the loader to find any dlls it needs. + # and Darwin in order for the loader to find any dlls it needs. $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2 $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2 fast_install=no @@ -1712,7 +1752,7 @@ EOF continue ;; - -static) + -static | -static-libtool-libs) # The effects of -static are defined in a previous loop. # We used to do the same as -all-static on platforms that # didn't have a PIC flag, but the assumption that the effects @@ -2094,7 +2134,7 @@ EOF lib= found=no case $deplib in - -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe) + -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads) if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" @@ -2490,7 +2530,9 @@ EOF if test "$linkmode,$pass" = "prog,link"; then if test -n "$library_names" && - { test "$prefer_static_libs" = no || test -z "$old_library"; }; then + { { test "$prefer_static_libs" = no || + test "$prefer_static_libs,$installed" = "built,yes"; } || + test -z "$old_library"; }; then # We need to hardcode the library path if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then # Make sure the rpath contains only unique directories. @@ -3186,7 +3228,7 @@ EOF # which has an extra 1 added just for fun # case $version_type in - darwin|linux|osf|windows) + darwin|linux|osf|windows|none) current=`expr $number_major + $number_minor` age="$number_minor" revision="$number_revision" @@ -3197,9 +3239,10 @@ EOF age="0" ;; irix|nonstopux) - current=`expr $number_major + $number_minor - 1` + current=`expr $number_major + $number_minor` age="$number_minor" revision="$number_minor" + lt_irix_increment=no ;; esac ;; @@ -3258,7 +3301,8 @@ EOF versuffix="$major.$age.$revision" # Darwin ld doesn't like 0 for these options... minor_current=`expr $current + 1` - verstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision" + xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision" + verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" ;; freebsd-aout) @@ -3272,8 +3316,11 @@ EOF ;; irix | nonstopux) - major=`expr $current - $age + 1` - + if test "X$lt_irix_increment" = "Xno"; then + major=`expr $current - $age` + else + major=`expr $current - $age + 1` + fi case $version_type in nonstopux) verstring_prefix=nonstopux ;; *) verstring_prefix=sgi ;; @@ -3410,11 +3457,11 @@ EOF fi # Eliminate all temporary directories. - for path in $notinst_path; do - lib_search_path=`$echo "$lib_search_path " | ${SED} -e "s% $path % %g"` - deplibs=`$echo "$deplibs " | ${SED} -e "s% -L$path % %g"` - dependency_libs=`$echo "$dependency_libs " | ${SED} -e "s% -L$path % %g"` - done + #for path in $notinst_path; do + # lib_search_path=`$echo "$lib_search_path " | ${SED} -e "s% $path % %g"` + # deplibs=`$echo "$deplibs " | ${SED} -e "s% -L$path % %g"` + # dependency_libs=`$echo "$dependency_libs " | ${SED} -e "s% -L$path % %g"` + #done if test -n "$xrpath"; then # If the user specified any rpath flags, then add them. @@ -3515,13 +3562,12 @@ EOF int main() { return 0; } EOF $rm conftest - $LTCC $LTCFLAGS -o conftest conftest.c $deplibs - if test "$?" -eq 0 ; then + if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then ldd_output=`ldd conftest` for i in $deplibs; do name=`expr $i : '-l\(.*\)'` # If $name is empty we are operating on a -L argument. - if test "$name" != "" && test "$name" -ne "0"; then + if test "$name" != "" && test "$name" != "0"; then if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then case " $predeps $postdeps " in *" $i "*) @@ -3560,9 +3606,7 @@ EOF # If $name is empty we are operating on a -L argument. if test "$name" != "" && test "$name" != "0"; then $rm conftest - $LTCC $LTCFLAGS -o conftest conftest.c $i - # Did it work? - if test "$?" -eq 0 ; then + if $LTCC $LTCFLAGS -o conftest conftest.c $i; then ldd_output=`ldd conftest` if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then case " $predeps $postdeps " in @@ -3594,7 +3638,7 @@ EOF droppeddeps=yes $echo $echo "*** Warning! Library $i is needed by this library but I was not able to" - $echo "*** make it link in! You will probably need to install it or some" + $echo "*** make it link in! You will probably need to install it or some" $echo "*** library that it depends on before this library will be fully" $echo "*** functional. Installing it before continuing would be even better." fi @@ -3880,7 +3924,10 @@ EOF test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" if test -n "$hardcode_libdir_flag_spec_ld"; then - eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" + case $archive_cmds in + *\$LD*) eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" ;; + *) eval dep_rpath=\"$hardcode_libdir_flag_spec\" ;; + esac else eval dep_rpath=\"$hardcode_libdir_flag_spec\" fi @@ -4239,12 +4286,14 @@ EOF reload_conv_objs= gentop= # reload_cmds runs $LD directly, so let us get rid of - # -Wl from whole_archive_flag_spec + # -Wl from whole_archive_flag_spec and hope we can get by with + # turning comma into space.. wl= if test -n "$convenience"; then if test -n "$whole_archive_flag_spec"; then - eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\" + eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\" + reload_conv_objs=$reload_objs\ `$echo "X$tmp_whole_archive_flags" | $Xsed -e 's|,| |g'` else gentop="$output_objdir/${obj}x" generated="$generated $gentop" @@ -4692,16 +4741,16 @@ static const void *lt_preloaded_setup() { case $host in *cygwin* | *mingw* ) if test -f "$output_objdir/${outputname}.def" ; then - compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%"` - finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%"` + compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%" | $NL2SP` + finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%" | $NL2SP` else - compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` - finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` + compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP` + finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP` fi ;; * ) - compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` - finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` + compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP` + finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP` ;; esac ;; @@ -4716,13 +4765,13 @@ static const void *lt_preloaded_setup() { # really was required. # Nullify the symbol file. - compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"` - finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"` + compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s% @SYMFILE@%%" | $NL2SP` + finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s% @SYMFILE@%%" | $NL2SP` fi if test "$need_relink" = no || test "$build_libtool_libs" != yes; then # Replace the output file specification. - compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` + compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e 's%@OUTPUT@%'"$output"'%g' | $NL2SP` link_command="$compile_command$compile_rpath" # We have no uninstalled library dependencies, so finalize right now. @@ -4809,7 +4858,7 @@ static const void *lt_preloaded_setup() { if test "$fast_install" != no; then link_command="$finalize_var$compile_command$finalize_rpath" if test "$fast_install" = yes; then - relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'` + relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $SP2NL | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g' | $NL2SP` else # fast_install is set to needless relink_command= @@ -4846,7 +4895,7 @@ static const void *lt_preloaded_setup() { fi done relink_command="(cd `pwd`; $relink_command)" - relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` + relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e "$sed_quote_subst" | $NL2SP` fi # Quote $echo for shipping. @@ -5253,6 +5302,20 @@ EOF Xsed='${SED} -e 1s/^X//' sed_quote_subst='$sed_quote_subst' +# Be Bourne compatible (taken from Autoconf:_AS_BOURNE_COMPATIBLE). +if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which + # is contrary to our usage. Disable this feature. + alias -g '\${1+\"\$@\"}'='\"\$@\"' + setopt NO_GLOB_SUBST +else + case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac +fi +BIN_SH=xpg4; export BIN_SH # for Tru64 +DUALCASE=1; export DUALCASE # for MKS sh + # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH @@ -5395,7 +5458,7 @@ else ;; esac $echo >> $output "\ - \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\" + \$echo \"\$0: cannot exec \$program \$*\" exit $EXIT_FAILURE fi else @@ -5581,7 +5644,7 @@ fi\ done # Quote the link command for shipping. relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" - relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` + relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e "$sed_quote_subst" | $NL2SP` if test "$hardcode_automatic" = yes ; then relink_command= fi @@ -5926,9 +5989,9 @@ relink_command=\"$relink_command\"" if test -n "$inst_prefix_dir"; then # Stick the inst_prefix_dir data into the link command. - relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` + relink_command=`$echo "$relink_command" | $SP2NL | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%" | $NL2SP` else - relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%%"` + relink_command=`$echo "$relink_command" | $SP2NL | $SED "s%@inst_prefix_dir@%%" | $NL2SP` fi $echo "$modename: warning: relinking \`$file'" 1>&2 @@ -6137,7 +6200,7 @@ relink_command=\"$relink_command\"" file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'` outputname="$tmpdir/$file" # Replace the output file specification. - relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'` + relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g' | $NL2SP` $show "$relink_command" if $run eval "$relink_command"; then : @@ -6348,8 +6411,10 @@ relink_command=\"$relink_command\"" if test -f "$dir/$objdir/$dlname"; then dir="$dir/$objdir" else - $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2 - exit $EXIT_FAILURE + if test ! -f "$dir/$dlname"; then + $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2 + exit $EXIT_FAILURE + fi fi ;; @@ -6413,12 +6478,12 @@ relink_command=\"$relink_command\"" fi # Restore saved environment variables - if test "${save_LC_ALL+set}" = set; then - LC_ALL="$save_LC_ALL"; export LC_ALL - fi - if test "${save_LANG+set}" = set; then - LANG="$save_LANG"; export LANG - fi + for lt_var in LANG LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES + do + eval "if test \"\${save_$lt_var+set}\" = set; then + $lt_var=\$save_$lt_var; export $lt_var + fi" + done # Now prepare to actually exec the command. exec_cmd="\$cmd$args" @@ -6775,9 +6840,9 @@ The following components of LINK-COMMAND are treated specially: -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) -export-symbols SYMFILE - try to export only the symbols listed in SYMFILE + try to export only the symbols listed in SYMFILE -export-symbols-regex REGEX - try to export only the symbols matching REGEX + try to export only the symbols matching REGEX -LLIBDIR search LIBDIR for required installed libraries -lNAME OUTPUT-FILE requires the installed library libNAME -module build a library that can dlopened @@ -6791,9 +6856,11 @@ The following components of LINK-COMMAND are treated specially: -release RELEASE specify package release information -rpath LIBDIR the created library will eventually be installed in LIBDIR -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries - -static do not do any dynamic linking of libtool libraries + -static do not do any dynamic linking of uninstalled libtool libraries + -static-libtool-libs + do not do any dynamic linking of libtool libraries -version-info CURRENT[:REVISION[:AGE]] - specify library version info [each variable defaults to 0] + specify library version info [each variable defaults to 0] All other options (arguments beginning with \`-') are ignored. diff --git a/Build/source/libs/graphite-engine/configure b/Build/source/libs/graphite-engine/configure index 0ed3069b96f..97e5c3deed2 100755 --- a/Build/source/libs/graphite-engine/configure +++ b/Build/source/libs/graphite-engine/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.61 for silgraphite 2.2.0. +# Generated by GNU Autoconf 2.61 for silgraphite 2.2.1. # # Report bugs to <silgraphite-devel@lists.sourceforge.net>. # @@ -728,8 +728,8 @@ SHELL=${CONFIG_SHELL-/bin/sh} # Identity of this package. PACKAGE_NAME='silgraphite' PACKAGE_TARNAME='silgraphite' -PACKAGE_VERSION='2.2.0' -PACKAGE_STRING='silgraphite 2.2.0' +PACKAGE_VERSION='2.2.1' +PACKAGE_STRING='silgraphite 2.2.1' PACKAGE_BUGREPORT='silgraphite-devel@lists.sourceforge.net' ac_unique_file="src/segment/GrEngine.cpp" @@ -857,6 +857,7 @@ am__fastdepCC_FALSE CPP GREP EGREP +SED LN_S ECHO AR @@ -1395,7 +1396,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures silgraphite 2.2.0 to adapt to many kinds of systems. +\`configure' configures silgraphite 2.2.1 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1465,7 +1466,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of silgraphite 2.2.0:";; + short | recursive ) echo "Configuration of silgraphite 2.2.1:";; esac cat <<\_ACEOF @@ -1576,7 +1577,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -silgraphite configure 2.2.0 +silgraphite configure 2.2.1 generated by GNU Autoconf 2.61 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -1590,7 +1591,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by silgraphite $as_me 2.2.0, which was +It was created by silgraphite $as_me 2.2.1, which was generated by GNU Autoconf 2.61. Invocation command line was $ $0 $@ @@ -2263,7 +2264,7 @@ fi # Define the identity of the package. PACKAGE='silgraphite' - VERSION='2.2.0' + VERSION='2.2.1' cat >>confdefs.h <<_ACEOF @@ -4685,12 +4686,13 @@ do test -z "$as_dir" && as_dir=. for lt_ac_prog in sed gsed; do for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then + if { test -f "$as_dir/$lt_ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$lt_ac_prog$ac_exec_ext"; }; then lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext" fi done done done +IFS=$as_save_IFS lt_ac_max=0 lt_ac_count=0 # Add /usr/xpg4/bin/sed as it is typically found on Solaris @@ -4725,6 +4727,7 @@ done fi SED=$lt_cv_path_SED + { echo "$as_me:$LINENO: result: $SED" >&5 echo "${ECHO_T}$SED" >&6; } @@ -4924,8 +4927,8 @@ else echo "${ECHO_T}no, using $LN_S" >&6; } fi -{ echo "$as_me:$LINENO: checking how to recognise dependent libraries" >&5 -echo $ECHO_N "checking how to recognise dependent libraries... $ECHO_C" >&6; } +{ echo "$as_me:$LINENO: checking how to recognize dependent libraries" >&5 +echo $ECHO_N "checking how to recognize dependent libraries... $ECHO_C" >&6; } if test "${lt_cv_deplibs_check_method+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else @@ -4966,16 +4969,22 @@ cygwin*) mingw* | pw32*) # Base MSYS/MinGW do not provide the 'file' command needed by - # func_win32_libid shell function, so use a weaker test based on 'objdump'. - lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?' - lt_cv_file_magic_cmd='$OBJDUMP -f' + # func_win32_libid shell function, so use a weaker test based on 'objdump', + # unless we find 'file', for example because we are cross-compiling. + if ( file / ) >/dev/null 2>&1; then + lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' + lt_cv_file_magic_cmd='func_win32_libid' + else + lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?' + lt_cv_file_magic_cmd='$OBJDUMP -f' + fi ;; darwin* | rhapsody*) lt_cv_deplibs_check_method=pass_all ;; -freebsd* | kfreebsd*-gnu | dragonfly*) +freebsd* | dragonfly*) if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then case $host_cpu in i*86 ) @@ -5013,7 +5022,7 @@ hpux10.20* | hpux11*) esac ;; -interix3*) +interix[3-9]*) # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|\.a)$' ;; @@ -5029,7 +5038,7 @@ irix5* | irix6* | nonstopux*) ;; # This must be Linux ELF. -linux*) +linux* | k*bsd*-gnu) lt_cv_deplibs_check_method=pass_all ;; @@ -5063,6 +5072,10 @@ osf3* | osf4* | osf5*) lt_cv_deplibs_check_method=pass_all ;; +rdos*) + lt_cv_deplibs_check_method=pass_all + ;; + solaris*) lt_cv_deplibs_check_method=pass_all ;; @@ -5149,7 +5162,7 @@ ia64-*-hpux*) ;; *-*-irix6*) # Find out which ABI we are using. - echo '#line 5152 "configure"' > conftest.$ac_ext + echo '#line 5165 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -5184,7 +5197,8 @@ ia64-*-hpux*) rm -rf conftest* ;; -x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*|s390*-*linux*|sparc*-*linux*) +x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \ +s390*-*linux*|sparc*-*linux*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 @@ -5195,6 +5209,9 @@ x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*|s390*-*linux*|sparc*-*linux*) case `/usr/bin/file conftest.o` in *32-bit*) case $host in + x86_64-*kfreebsd*-gnu) + LD="${LD-ld} -m elf_i386_fbsd" + ;; x86_64-*linux*) LD="${LD-ld} -m elf_i386" ;; @@ -5211,6 +5228,9 @@ x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*|s390*-*linux*|sparc*-*linux*) ;; *64-bit*) case $host in + x86_64-*kfreebsd*-gnu) + LD="${LD-ld} -m elf_x86_64_fbsd" + ;; x86_64-*linux*) LD="${LD-ld} -m elf_x86_64" ;; @@ -6530,24 +6550,27 @@ else fi ;; *) - # If test is not a shell built-in, we'll probably end up computing a - # maximum length that is only half of the actual maximum length, but - # we can't tell. - SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} - while (test "X"`$SHELL $0 --fallback-echo "X$teststring" 2>/dev/null` \ + lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` + if test -n "$lt_cv_sys_max_cmd_len"; then + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` + else + SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} + while (test "X"`$SHELL $0 --fallback-echo "X$teststring" 2>/dev/null` \ = "XX$teststring") >/dev/null 2>&1 && - new_result=`expr "X$teststring" : ".*" 2>&1` && - lt_cv_sys_max_cmd_len=$new_result && - test $i != 17 # 1/2 MB should be enough - do - i=`expr $i + 1` - teststring=$teststring$teststring - done - teststring= - # Add a significant safety factor because C++ compilers can tack on massive - # amounts of additional arguments before passing them to the linker. - # It appears as though 1/2 is a usable value. - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` + new_result=`expr "X$teststring" : ".*" 2>&1` && + lt_cv_sys_max_cmd_len=$new_result && + test $i != 17 # 1/2 MB should be enough + do + i=`expr $i + 1` + teststring=$teststring$teststring + done + teststring= + # Add a significant safety factor because C++ compilers can tack on massive + # amounts of additional arguments before passing them to the linker. + # It appears as though 1/2 is a usable value. + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` + fi ;; esac @@ -6564,6 +6587,7 @@ fi + # Check for command to grab the raw symbol name followed by C symbol from nm. { echo "$as_me:$LINENO: checking command to parse $NM output from $compiler object" >&5 echo $ECHO_N "checking command to parse $NM output from $compiler object... $ECHO_C" >&6; } @@ -6601,7 +6625,7 @@ hpux*) # Its linker distinguishes data from code symbols lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" ;; -linux*) +linux* | k*bsd*-gnu) if test "$host_cpu" = ia64; then symcode='[ABCDGIRSTW]' lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" @@ -7152,7 +7176,7 @@ test -z "$STRIP" && STRIP=: test -z "$ac_objext" && ac_objext=o # Determine commands to create old-style static archives. -old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs' +old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs' old_postinstall_cmds='chmod 644 $oldlib' old_postuninstall_cmds= @@ -7352,10 +7376,10 @@ objext=o objext=$objext # Code to be used in simple compile tests -lt_simple_compile_test_code="int some_variable = 0;\n" +lt_simple_compile_test_code="int some_variable = 0;" # Code to be used in simple link tests -lt_simple_link_test_code='int main(){return(0);}\n' +lt_simple_link_test_code='int main(){return(0);}' # If no C compiler was specified, use CC. @@ -7370,13 +7394,13 @@ compiler=$CC # save warnings/boilerplate of simple test code ac_outfile=conftest.$ac_objext -printf "$lt_simple_compile_test_code" >conftest.$ac_ext +echo "$lt_simple_compile_test_code" >conftest.$ac_ext eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_compiler_boilerplate=`cat conftest.err` $rm conftest* ac_outfile=conftest.$ac_objext -printf "$lt_simple_link_test_code" >conftest.$ac_ext +echo "$lt_simple_link_test_code" >conftest.$ac_ext eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_linker_boilerplate=`cat conftest.err` $rm conftest* @@ -7396,7 +7420,7 @@ if test "${lt_cv_prog_compiler_rtti_exceptions+set}" = set; then else lt_cv_prog_compiler_rtti_exceptions=no ac_outfile=conftest.$ac_objext - printf "$lt_simple_compile_test_code" > conftest.$ac_ext + echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-fno-rtti -fno-exceptions" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. @@ -7407,11 +7431,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:7410: $lt_compile\"" >&5) + (eval echo "\"\$as_me:7434: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:7414: \$? = $ac_status" >&5 + echo "$as_me:7438: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -7462,13 +7486,15 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6; } lt_prog_compiler_pic='-m68020 -resident32 -malways-restore-a4' ;; - beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; - mingw* | pw32* | os2*) + mingw* | cygwin* | pw32* | os2*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). + # Although the cygwin gcc ignores -fPIC, still need this for old-style + # (--disable-auto-import) libraries lt_prog_compiler_pic='-DDLL_EXPORT' ;; @@ -7478,7 +7504,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6; } lt_prog_compiler_pic='-fno-common' ;; - interix3*) + interix[3-9]*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; @@ -7536,7 +7562,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6; } esac ;; - mingw* | pw32* | os2*) + mingw* | cygwin* | pw32* | os2*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). lt_prog_compiler_pic='-DDLL_EXPORT' @@ -7569,7 +7595,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6; } lt_prog_compiler_static='-Bstatic' ;; - linux*) + linux* | k*bsd*-gnu) case $cc_basename in icc* | ecc*) lt_prog_compiler_wl='-Wl,' @@ -7588,6 +7614,22 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6; } # All Alpha code is PIC. lt_prog_compiler_static='-non_shared' ;; + *) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) + # Sun C 5.9 + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + lt_prog_compiler_wl='-Wl,' + ;; + *Sun\ F*) + # Sun Fortran 8.3 passes all unrecognized flags to the linker + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + lt_prog_compiler_wl='' + ;; + esac + ;; esac ;; @@ -7597,6 +7639,10 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6; } lt_prog_compiler_static='-non_shared' ;; + rdos*) + lt_prog_compiler_static='-non_shared' + ;; + solaris*) lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' @@ -7664,7 +7710,7 @@ if test "${lt_prog_compiler_pic_works+set}" = set; then else lt_prog_compiler_pic_works=no ac_outfile=conftest.$ac_objext - printf "$lt_simple_compile_test_code" > conftest.$ac_ext + echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="$lt_prog_compiler_pic -DPIC" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. @@ -7675,11 +7721,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:7678: $lt_compile\"" >&5) + (eval echo "\"\$as_me:7724: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:7682: \$? = $ac_status" >&5 + echo "$as_me:7728: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -7728,7 +7774,7 @@ else lt_prog_compiler_static_works=no save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS $lt_tmp_static_flag" - printf "$lt_simple_link_test_code" > conftest.$ac_ext + echo "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings @@ -7768,7 +7814,7 @@ else mkdir conftest cd conftest mkdir out - printf "$lt_simple_compile_test_code" > conftest.$ac_ext + echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or @@ -7779,11 +7825,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:7782: $lt_compile\"" >&5) + (eval echo "\"\$as_me:7828: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:7786: \$? = $ac_status" >&5 + echo "$as_me:7832: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -7975,7 +8021,7 @@ EOF allow_undefined_flag=unsupported always_export_symbols=no enable_shared_with_static_runtimes=yes - export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS] /s/.* \([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols' + export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/'\'' -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols' if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' @@ -7993,7 +8039,7 @@ EOF fi ;; - interix3*) + interix[3-9]*) hardcode_direct=no hardcode_shlibpath_var=no hardcode_libdir_flag_spec='${wl}-rpath,$libdir' @@ -8008,7 +8054,7 @@ EOF archive_expsym_cmds='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; - linux*) + gnu* | linux* | k*bsd*-gnu) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then tmp_addflag= case $cc_basename,$host_cpu in @@ -8026,13 +8072,22 @@ EOF ifc* | ifort*) # Intel Fortran compiler tmp_addflag=' -nofor_main' ;; esac - archive_cmds='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) # Sun C 5.9 + whole_archive_flag_spec='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_sharedflag='-G' ;; + *Sun\ F*) # Sun Fortran 8.3 + tmp_sharedflag='-G' ;; + *) + tmp_sharedflag='-shared' ;; + esac + archive_cmds='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' if test $supports_anon_versioning = yes; then archive_expsym_cmds='$echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ $echo "local: *; };" >> $output_objdir/$libname.ver~ - $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' + $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' fi else ld_shlibs=no @@ -8191,7 +8246,7 @@ _LT_EOF strings "$collect2name" | grep resolve_lib_name >/dev/null then # We have reworked collect2 - hardcode_direct=yes + : else # We have old collect2 hardcode_direct=unsupported @@ -8265,11 +8320,18 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then -aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'` +lt_aix_libpath_sed=' + /Import File Strings/,/^$/ { + /^0/ { + s/^0 *\(.*\)$/\1/ + p + } + }' +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. -if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'`; fi +if test -z "$aix_libpath"; then + aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` +fi else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 @@ -8324,11 +8386,18 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then -aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'` +lt_aix_libpath_sed=' + /Import File Strings/,/^$/ { + /^0/ { + s/^0 *\(.*\)$/\1/ + p + } + }' +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. -if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'`; fi +if test -z "$aix_libpath"; then + aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` +fi else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 @@ -8382,7 +8451,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi # The linker will automatically build a .lib file if we build a DLL. old_archive_From_new_cmds='true' # FIXME: Should let the user specify the lib program. - old_archive_cmds='lib /OUT:$oldlib$oldobjs$old_deplibs' + old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs' fix_srcfile_path='`cygpath -w "$srcfile"`' enable_shared_with_static_runtimes=yes ;; @@ -8424,10 +8493,10 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi case $cc_basename in xlc*) output_verbose_link_cmd='echo' - archive_cmds='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' + archive_cmds='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $xlcverstring' module_cmds='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds - archive_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + archive_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $xlcverstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' module_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' ;; *) @@ -8467,7 +8536,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ;; # FreeBSD 3 and greater uses gcc -shared to do shared libraries. - freebsd* | kfreebsd*-gnu | dragonfly*) + freebsd* | dragonfly*) archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes @@ -8589,24 +8658,28 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ;; openbsd*) - hardcode_direct=yes - hardcode_shlibpath_var=no - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' - hardcode_libdir_flag_spec='${wl}-rpath,$libdir' - export_dynamic_flag_spec='${wl}-E' + if test -f /usr/libexec/ld.so; then + hardcode_direct=yes + hardcode_shlibpath_var=no + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + export_dynamic_flag_spec='${wl}-E' + else + case $host_os in + openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='-R$libdir' + ;; + *) + archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + ;; + esac + fi else - case $host_os in - openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) - archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec='-R$libdir' - ;; - *) - archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - hardcode_libdir_flag_spec='${wl}-rpath,$libdir' - ;; - esac + ld_shlibs=no fi ;; @@ -8665,17 +8738,16 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; *) - # The compiler driver will combine linker options so we - # cannot just pass the convience library names through - # without $wl, iff we do not link with $LD. - # Luckily, gcc supports the same syntax we need for Sun Studio. + # The compiler driver will combine and reorder linker options, + # but understands `-z linker_flag'. GCC discards it without `$wl', + # but is careful enough not to reorder. # Supported since Solaris 2.6 (maybe 2.5.1?) - case $wlarc in - '') - whole_archive_flag_spec='-z allextract$convenience -z defaultextract' ;; - *) - whole_archive_flag_spec='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' ;; - esac ;; + if test "$GCC" = yes; then + whole_archive_flag_spec='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' + else + whole_archive_flag_spec='-z allextract$convenience -z defaultextract' + fi + ;; esac link_all_deplibs=yes ;; @@ -8732,7 +8804,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi fi ;; - sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7*) + sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) no_undefined_flag='${wl}-z,text' archive_cmds_need_lc=no hardcode_shlibpath_var=no @@ -8809,7 +8881,7 @@ x|xyes) { echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5 echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6; } $rm conftest* - printf "$lt_simple_compile_test_code" > conftest.$ac_ext + echo "$lt_simple_compile_test_code" > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 @@ -8867,17 +8939,55 @@ shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" sys_lib_dlsearch_path_spec="/lib /usr/lib" + if test "$GCC" = yes; then - sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` - if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then + case $host_os in + darwin*) lt_awk_arg="/^libraries:/,/LR/" ;; + *) lt_awk_arg="/^libraries:/" ;; + esac + lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e "s,=/,/,g"` + if echo "$lt_search_path_spec" | grep ';' >/dev/null ; then # if the path contains ";" then we assume it to be the separator # otherwise default to the standard path separator (i.e. ":") - it is # assumed that no part of a normal pathname contains ";" but that should # okay in the real world where ";" in dirpaths is itself problematic. - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + lt_search_path_spec=`echo "$lt_search_path_spec" | $SED -e 's/;/ /g'` else - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + lt_search_path_spec=`echo "$lt_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi + # Ok, now we have the path, separated by spaces, we can step through it + # and add multilib dir if necessary. + lt_tmp_lt_search_path_spec= + lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` + for lt_sys_path in $lt_search_path_spec; do + if test -d "$lt_sys_path/$lt_multi_os_dir"; then + lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir" + else + test -d "$lt_sys_path" && \ + lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" + fi + done + lt_search_path_spec=`echo $lt_tmp_lt_search_path_spec | awk ' +BEGIN {RS=" "; FS="/|\n";} { + lt_foo=""; + lt_count=0; + for (lt_i = NF; lt_i > 0; lt_i--) { + if ($lt_i != "" && $lt_i != ".") { + if ($lt_i == "..") { + lt_count++; + } else { + if (lt_count == 0) { + lt_foo="/" $lt_i lt_foo; + } else { + lt_count--; + } + } + } + } + if (lt_foo != "") { lt_freq[lt_foo]++; } + if (lt_freq[lt_foo] == 1) { print lt_foo; } +}'` + sys_lib_search_path_spec=`echo $lt_search_path_spec` else sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" fi @@ -9037,12 +9147,8 @@ darwin* | rhapsody*) shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' - # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. - if test "$GCC" = yes; then - sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` - else - sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib' - fi + + sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib" sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' ;; @@ -9059,18 +9165,6 @@ freebsd1*) dynamic_linker=no ;; -kfreebsd*-gnu) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - dynamic_linker='GNU ld.so' - ;; - freebsd* | dragonfly*) # DragonFly does not have aout. When/if they implement a new # versioning mechanism, adjust this. @@ -9108,7 +9202,7 @@ freebsd* | dragonfly*) shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; - freebsd*) # from 4.6 on + *) # from 4.6 on, and DragonFly shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; @@ -9171,7 +9265,7 @@ hpux9* | hpux10* | hpux11*) postinstall_cmds='chmod 555 $lib' ;; -interix3*) +interix[3-9]*) version_type=linux need_lib_prefix=no need_version=no @@ -9226,7 +9320,7 @@ linux*oldld* | linux*aout* | linux*coff*) ;; # This must be Linux ELF. -linux*) +linux* | k*bsd*-gnu) version_type=linux need_lib_prefix=no need_version=no @@ -9242,7 +9336,7 @@ linux*) # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then - lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi @@ -9255,18 +9349,6 @@ linux*) dynamic_linker='GNU/Linux ld.so' ;; -knetbsd*-gnu) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - dynamic_linker='GNU ld.so' - ;; - netbsd*) version_type=sunos need_lib_prefix=no @@ -9348,6 +9430,10 @@ osf3* | osf4* | osf5*) sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" ;; +rdos*) + dynamic_linker=no + ;; + solaris*) version_type=linux need_lib_prefix=no @@ -9501,6 +9587,7 @@ else darwin*) if test -n "$STRIP" ; then striplib="$STRIP -x" + old_striplib="$STRIP -S" { echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6; } else @@ -10087,7 +10174,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<EOF -#line 10090 "configure" +#line 10177 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -10187,7 +10274,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<EOF -#line 10190 "configure" +#line 10277 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -10385,6 +10472,7 @@ if test -f "$ltmain"; then module_cmds \ module_expsym_cmds \ lt_cv_prog_compiler_c_o \ + fix_srcfile_path \ exclude_expsyms \ include_expsyms; do @@ -10429,7 +10517,7 @@ echo "$as_me: creating $ofile" >&6;} # Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP) # NOTE: Changes made to this file will be lost: look at ltmain.sh. # -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001 +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 # Free Software Foundation, Inc. # # This file is part of GNU Libtool: @@ -10753,7 +10841,7 @@ sys_lib_search_path_spec=$lt_sys_lib_search_path_spec sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec # Fix the shell variable \$srcfile for the compiler. -fix_srcfile_path="$fix_srcfile_path" +fix_srcfile_path=$lt_fix_srcfile_path # Set to yes if exported symbols are required. always_export_symbols=$always_export_symbols @@ -10922,10 +11010,10 @@ objext=o objext_CXX=$objext # Code to be used in simple compile tests -lt_simple_compile_test_code="int some_variable = 0;\n" +lt_simple_compile_test_code="int some_variable = 0;" # Code to be used in simple link tests -lt_simple_link_test_code='int main(int, char *[]) { return(0); }\n' +lt_simple_link_test_code='int main(int, char *[]) { return(0); }' # ltmain only uses $CC for tagged configurations so make sure $CC is set. @@ -10941,13 +11029,13 @@ compiler=$CC # save warnings/boilerplate of simple test code ac_outfile=conftest.$ac_objext -printf "$lt_simple_compile_test_code" >conftest.$ac_ext +echo "$lt_simple_compile_test_code" >conftest.$ac_ext eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_compiler_boilerplate=`cat conftest.err` $rm conftest* ac_outfile=conftest.$ac_objext -printf "$lt_simple_link_test_code" >conftest.$ac_ext +echo "$lt_simple_link_test_code" >conftest.$ac_ext eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_linker_boilerplate=`cat conftest.err` $rm conftest* @@ -11206,7 +11294,7 @@ case $host_os in strings "$collect2name" | grep resolve_lib_name >/dev/null then # We have reworked collect2 - hardcode_direct_CXX=yes + : else # We have old collect2 hardcode_direct_CXX=unsupported @@ -11280,11 +11368,18 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then -aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'` +lt_aix_libpath_sed=' + /Import File Strings/,/^$/ { + /^0/ { + s/^0 *\(.*\)$/\1/ + p + } + }' +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. -if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'`; fi +if test -z "$aix_libpath"; then + aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` +fi else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 @@ -11340,11 +11435,18 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then -aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'` +lt_aix_libpath_sed=' + /Import File Strings/,/^$/ { + /^0/ { + s/^0 *\(.*\)$/\1/ + p + } + }' +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. -if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'`; fi +if test -z "$aix_libpath"; then + aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` +fi else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 @@ -11463,10 +11565,10 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi case $cc_basename in xlc*) output_verbose_link_cmd='echo' - archive_cmds_CXX='$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' + archive_cmds_CXX='$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $xlcverstring' module_cmds_CXX='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds - archive_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + archive_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $xlcverstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' module_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' ;; *) @@ -11500,7 +11602,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi freebsd-elf*) archive_cmds_need_lc_CXX=no ;; - freebsd* | kfreebsd*-gnu | dragonfly*) + freebsd* | dragonfly*) # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF # conventions ld_shlibs_CXX=yes @@ -11549,9 +11651,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hardcode_libdir_separator_CXX=: case $host_cpu in - hppa*64*|ia64*) - hardcode_libdir_flag_spec_ld_CXX='+b $libdir' - ;; + hppa*64*|ia64*) ;; *) export_dynamic_flag_spec_CXX='${wl}-E' ;; @@ -11619,7 +11719,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ;; esac ;; - interix3*) + interix[3-9]*) hardcode_direct_CXX=no hardcode_shlibpath_var_CXX=no hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' @@ -11659,7 +11759,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator_CXX=: ;; - linux*) + linux* | k*bsd*-gnu) case $cc_basename in KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler @@ -11739,6 +11839,29 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi # dependencies. output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' ;; + *) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) + # Sun C++ 5.9 + no_undefined_flag_CXX=' -zdefs' + archive_cmds_CXX='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + archive_expsym_cmds_CXX='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file ${wl}$export_symbols' + hardcode_libdir_flag_spec_CXX='-R$libdir' + whole_archive_flag_spec_CXX='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' + + # Not sure whether something based on + # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 + # would be better. + output_verbose_link_cmd='echo' + + # Archives containing C++ object files must be created using + # "CC -xar", where "CC" is the Sun C++ compiler. This is + # necessary to make sure instantiated templates are included + # in the archive. + old_archive_cmds_CXX='$CC -xar -o $oldlib $oldobjs' + ;; + esac + ;; esac ;; lynxos*) @@ -11777,16 +11900,20 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ld_shlibs_CXX=no ;; openbsd*) - hardcode_direct_CXX=yes - hardcode_shlibpath_var_CXX=no - archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' - hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib' - export_dynamic_flag_spec_CXX='${wl}-E' - whole_archive_flag_spec_CXX="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + if test -f /usr/libexec/ld.so; then + hardcode_direct_CXX=yes + hardcode_shlibpath_var_CXX=no + archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' + hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib' + export_dynamic_flag_spec_CXX='${wl}-E' + whole_archive_flag_spec_CXX="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + fi + output_verbose_link_cmd='echo' + else + ld_shlibs_CXX=no fi - output_verbose_link_cmd='echo' ;; osf3*) case $cc_basename in @@ -11948,15 +12075,10 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; *) - # The C++ compiler is used as linker so we must use $wl - # flag to pass the commands to the underlying system - # linker. We must also pass each convience library through - # to the system linker between allextract/defaultextract. - # The C++ compiler will combine linker options so we - # cannot just pass the convience library names through - # without $wl. + # The compiler driver will combine and reorder linker options, + # but understands `-z linker_flag'. # Supported since Solaris 2.6 (maybe 2.5.1?) - whole_archive_flag_spec_CXX='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' + whole_archive_flag_spec_CXX='-z allextract$convenience -z defaultextract' ;; esac link_all_deplibs_CXX=yes @@ -12003,6 +12125,12 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi fi hardcode_libdir_flag_spec_CXX='${wl}-R $wl$libdir' + case $host_os in + solaris2.[0-5] | solaris2.[0-5].*) ;; + *) + whole_archive_flag_spec_CXX='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' + ;; + esac fi ;; esac @@ -12194,7 +12322,7 @@ $rm -f confest.$objext # PORTME: override above test on systems where it is broken case $host_os in -interix3*) +interix[3-9]*) # Interix 3.5 installs completely hosed .la files for C++, so rather than # hack all around it, let's just trust "g++" to DTRT. predep_objects_CXX= @@ -12202,13 +12330,46 @@ interix3*) postdeps_CXX= ;; +linux*) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) + # Sun C++ 5.9 + # + # The more standards-conforming stlport4 library is + # incompatible with the Cstd library. Avoid specifying + # it if it's in CXXFLAGS. Ignore libCrun as + # -library=stlport4 depends on it. + case " $CXX $CXXFLAGS " in + *" -library=stlport4 "*) + solaris_use_stlport4=yes + ;; + esac + if test "$solaris_use_stlport4" != yes; then + postdeps_CXX='-library=Cstd -library=Crun' + fi + ;; + esac + ;; + solaris*) case $cc_basename in CC*) + # The more standards-conforming stlport4 library is + # incompatible with the Cstd library. Avoid specifying + # it if it's in CXXFLAGS. Ignore libCrun as + # -library=stlport4 depends on it. + case " $CXX $CXXFLAGS " in + *" -library=stlport4 "*) + solaris_use_stlport4=yes + ;; + esac + # Adding this requires a known-good setup of shared libraries for # Sun compiler versions before 5.6, else PIC objects from an old # archive will be linked into the output, leading to subtle bugs. - postdeps_CXX='-lCstd -lCrun' + if test "$solaris_use_stlport4" != yes; then + postdeps_CXX='-library=Cstd -library=Crun' + fi ;; esac ;; @@ -12245,12 +12406,14 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6; } # like `-m68040'. lt_prog_compiler_pic_CXX='-m68020 -resident32 -malways-restore-a4' ;; - beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; - mingw* | os2* | pw32*) + mingw* | cygwin* | os2* | pw32*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). + # Although the cygwin gcc ignores -fPIC, still need this for old-style + # (--disable-auto-import) libraries lt_prog_compiler_pic_CXX='-DDLL_EXPORT' ;; darwin* | rhapsody*) @@ -12262,7 +12425,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6; } # DJGPP does not support shared libraries at all lt_prog_compiler_pic_CXX= ;; - interix3*) + interix[3-9]*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; @@ -12328,7 +12491,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6; } ;; esac ;; - freebsd* | kfreebsd*-gnu | dragonfly*) + freebsd* | dragonfly*) # FreeBSD uses GNU C++ ;; hpux9* | hpux10* | hpux11*) @@ -12371,7 +12534,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6; } ;; esac ;; - linux*) + linux* | k*bsd*-gnu) case $cc_basename in KCC*) # KAI C++ Compiler @@ -12398,6 +12561,14 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6; } lt_prog_compiler_static_CXX='-non_shared' ;; *) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) + # Sun C++ 5.9 + lt_prog_compiler_pic_CXX='-KPIC' + lt_prog_compiler_static_CXX='-Bstatic' + lt_prog_compiler_wl_CXX='-Qoption ld ' + ;; + esac ;; esac ;; @@ -12512,7 +12683,7 @@ if test "${lt_prog_compiler_pic_works_CXX+set}" = set; then else lt_prog_compiler_pic_works_CXX=no ac_outfile=conftest.$ac_objext - printf "$lt_simple_compile_test_code" > conftest.$ac_ext + echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="$lt_prog_compiler_pic_CXX -DPIC" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. @@ -12523,11 +12694,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:12526: $lt_compile\"" >&5) + (eval echo "\"\$as_me:12697: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:12530: \$? = $ac_status" >&5 + echo "$as_me:12701: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -12576,7 +12747,7 @@ else lt_prog_compiler_static_works_CXX=no save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS $lt_tmp_static_flag" - printf "$lt_simple_link_test_code" > conftest.$ac_ext + echo "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings @@ -12616,7 +12787,7 @@ else mkdir conftest cd conftest mkdir out - printf "$lt_simple_compile_test_code" > conftest.$ac_ext + echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or @@ -12627,11 +12798,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:12630: $lt_compile\"" >&5) + (eval echo "\"\$as_me:12801: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:12634: \$? = $ac_status" >&5 + echo "$as_me:12805: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -12697,7 +12868,7 @@ echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared librar export_symbols_cmds_CXX="$ltdll_cmds" ;; cygwin* | mingw*) - export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS] /s/.* \([^ ]*\)/\1 DATA/;/^.* __nm__/s/^.* __nm__\([^ ]*\) [^ ]*/\1 DATA/;/^I /d;/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols' + export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;/^.*[ ]__nm__/s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols' ;; *) export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' @@ -12728,7 +12899,7 @@ x|xyes) { echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5 echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6; } $rm conftest* - printf "$lt_simple_compile_test_code" > conftest.$ac_ext + echo "$lt_simple_compile_test_code" > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 @@ -12786,20 +12957,7 @@ shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" sys_lib_dlsearch_path_spec="/lib /usr/lib" -if test "$GCC" = yes; then - sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` - if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then - # if the path contains ";" then we assume it to be the separator - # otherwise default to the standard path separator (i.e. ":") - it is - # assumed that no part of a normal pathname contains ";" but that should - # okay in the real world where ";" in dirpaths is itself problematic. - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` - else - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - fi -else - sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" -fi + need_lib_prefix=unknown hardcode_into_libs=no @@ -12956,12 +13114,7 @@ darwin* | rhapsody*) shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' - # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. - if test "$GCC" = yes; then - sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` - else - sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib' - fi + sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' ;; @@ -12978,18 +13131,6 @@ freebsd1*) dynamic_linker=no ;; -kfreebsd*-gnu) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - dynamic_linker='GNU ld.so' - ;; - freebsd* | dragonfly*) # DragonFly does not have aout. When/if they implement a new # versioning mechanism, adjust this. @@ -13027,7 +13168,7 @@ freebsd* | dragonfly*) shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; - freebsd*) # from 4.6 on + *) # from 4.6 on, and DragonFly shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; @@ -13090,7 +13231,7 @@ hpux9* | hpux10* | hpux11*) postinstall_cmds='chmod 555 $lib' ;; -interix3*) +interix[3-9]*) version_type=linux need_lib_prefix=no need_version=no @@ -13145,7 +13286,7 @@ linux*oldld* | linux*aout* | linux*coff*) ;; # This must be Linux ELF. -linux*) +linux* | k*bsd*-gnu) version_type=linux need_lib_prefix=no need_version=no @@ -13161,7 +13302,7 @@ linux*) # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then - lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi @@ -13174,18 +13315,6 @@ linux*) dynamic_linker='GNU/Linux ld.so' ;; -knetbsd*-gnu) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - dynamic_linker='GNU ld.so' - ;; - netbsd*) version_type=sunos need_lib_prefix=no @@ -13267,6 +13396,10 @@ osf3* | osf4* | osf5*) sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" ;; +rdos*) + dynamic_linker=no + ;; + solaris*) version_type=linux need_lib_prefix=no @@ -13461,6 +13594,7 @@ if test -f "$ltmain"; then module_cmds_CXX \ module_expsym_cmds_CXX \ lt_cv_prog_compiler_c_o_CXX \ + fix_srcfile_path_CXX \ exclude_expsyms_CXX \ include_expsyms_CXX; do @@ -13781,7 +13915,7 @@ sys_lib_search_path_spec=$lt_sys_lib_search_path_spec sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec # Fix the shell variable \$srcfile for the compiler. -fix_srcfile_path="$fix_srcfile_path_CXX" +fix_srcfile_path=$lt_fix_srcfile_path # Set to yes if exported symbols are required. always_export_symbols=$always_export_symbols_CXX @@ -13872,10 +14006,17 @@ objext=o objext_F77=$objext # Code to be used in simple compile tests -lt_simple_compile_test_code=" subroutine t\n return\n end\n" +lt_simple_compile_test_code="\ + subroutine t + return + end +" # Code to be used in simple link tests -lt_simple_link_test_code=" program t\n end\n" +lt_simple_link_test_code="\ + program t + end +" # ltmain only uses $CC for tagged configurations so make sure $CC is set. @@ -13891,13 +14032,13 @@ compiler=$CC # save warnings/boilerplate of simple test code ac_outfile=conftest.$ac_objext -printf "$lt_simple_compile_test_code" >conftest.$ac_ext +echo "$lt_simple_compile_test_code" >conftest.$ac_ext eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_compiler_boilerplate=`cat conftest.err` $rm conftest* ac_outfile=conftest.$ac_objext -printf "$lt_simple_link_test_code" >conftest.$ac_ext +echo "$lt_simple_link_test_code" >conftest.$ac_ext eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_linker_boilerplate=`cat conftest.err` $rm conftest* @@ -13984,13 +14125,15 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6; } lt_prog_compiler_pic_F77='-m68020 -resident32 -malways-restore-a4' ;; - beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; - mingw* | pw32* | os2*) + mingw* | cygwin* | pw32* | os2*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). + # Although the cygwin gcc ignores -fPIC, still need this for old-style + # (--disable-auto-import) libraries lt_prog_compiler_pic_F77='-DDLL_EXPORT' ;; @@ -14000,7 +14143,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6; } lt_prog_compiler_pic_F77='-fno-common' ;; - interix3*) + interix[3-9]*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; @@ -14058,7 +14201,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6; } esac ;; - mingw* | pw32* | os2*) + mingw* | cygwin* | pw32* | os2*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). lt_prog_compiler_pic_F77='-DDLL_EXPORT' @@ -14091,7 +14234,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6; } lt_prog_compiler_static_F77='-Bstatic' ;; - linux*) + linux* | k*bsd*-gnu) case $cc_basename in icc* | ecc*) lt_prog_compiler_wl_F77='-Wl,' @@ -14110,6 +14253,22 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6; } # All Alpha code is PIC. lt_prog_compiler_static_F77='-non_shared' ;; + *) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) + # Sun C 5.9 + lt_prog_compiler_pic_F77='-KPIC' + lt_prog_compiler_static_F77='-Bstatic' + lt_prog_compiler_wl_F77='-Wl,' + ;; + *Sun\ F*) + # Sun Fortran 8.3 passes all unrecognized flags to the linker + lt_prog_compiler_pic_F77='-KPIC' + lt_prog_compiler_static_F77='-Bstatic' + lt_prog_compiler_wl_F77='' + ;; + esac + ;; esac ;; @@ -14119,6 +14278,10 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6; } lt_prog_compiler_static_F77='-non_shared' ;; + rdos*) + lt_prog_compiler_static_F77='-non_shared' + ;; + solaris*) lt_prog_compiler_pic_F77='-KPIC' lt_prog_compiler_static_F77='-Bstatic' @@ -14186,7 +14349,7 @@ if test "${lt_prog_compiler_pic_works_F77+set}" = set; then else lt_prog_compiler_pic_works_F77=no ac_outfile=conftest.$ac_objext - printf "$lt_simple_compile_test_code" > conftest.$ac_ext + echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="$lt_prog_compiler_pic_F77" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. @@ -14197,11 +14360,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:14200: $lt_compile\"" >&5) + (eval echo "\"\$as_me:14363: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:14204: \$? = $ac_status" >&5 + echo "$as_me:14367: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -14250,7 +14413,7 @@ else lt_prog_compiler_static_works_F77=no save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS $lt_tmp_static_flag" - printf "$lt_simple_link_test_code" > conftest.$ac_ext + echo "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings @@ -14290,7 +14453,7 @@ else mkdir conftest cd conftest mkdir out - printf "$lt_simple_compile_test_code" > conftest.$ac_ext + echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or @@ -14301,11 +14464,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:14304: $lt_compile\"" >&5) + (eval echo "\"\$as_me:14467: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:14308: \$? = $ac_status" >&5 + echo "$as_me:14471: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -14497,7 +14660,7 @@ EOF allow_undefined_flag_F77=unsupported always_export_symbols_F77=no enable_shared_with_static_runtimes_F77=yes - export_symbols_cmds_F77='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS] /s/.* \([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols' + export_symbols_cmds_F77='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/'\'' -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols' if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' @@ -14515,7 +14678,7 @@ EOF fi ;; - interix3*) + interix[3-9]*) hardcode_direct_F77=no hardcode_shlibpath_var_F77=no hardcode_libdir_flag_spec_F77='${wl}-rpath,$libdir' @@ -14530,7 +14693,7 @@ EOF archive_expsym_cmds_F77='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; - linux*) + gnu* | linux* | k*bsd*-gnu) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then tmp_addflag= case $cc_basename,$host_cpu in @@ -14548,13 +14711,22 @@ EOF ifc* | ifort*) # Intel Fortran compiler tmp_addflag=' -nofor_main' ;; esac - archive_cmds_F77='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) # Sun C 5.9 + whole_archive_flag_spec_F77='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_sharedflag='-G' ;; + *Sun\ F*) # Sun Fortran 8.3 + tmp_sharedflag='-G' ;; + *) + tmp_sharedflag='-shared' ;; + esac + archive_cmds_F77='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' if test $supports_anon_versioning = yes; then archive_expsym_cmds_F77='$echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ $echo "local: *; };" >> $output_objdir/$libname.ver~ - $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' + $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' fi else ld_shlibs_F77=no @@ -14713,7 +14885,7 @@ _LT_EOF strings "$collect2name" | grep resolve_lib_name >/dev/null then # We have reworked collect2 - hardcode_direct_F77=yes + : else # We have old collect2 hardcode_direct_F77=unsupported @@ -14777,11 +14949,18 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then -aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'` +lt_aix_libpath_sed=' + /Import File Strings/,/^$/ { + /^0/ { + s/^0 *\(.*\)$/\1/ + p + } + }' +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. -if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'`; fi +if test -z "$aix_libpath"; then + aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` +fi else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 @@ -14826,11 +15005,18 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then -aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'` +lt_aix_libpath_sed=' + /Import File Strings/,/^$/ { + /^0/ { + s/^0 *\(.*\)$/\1/ + p + } + }' +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. -if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'`; fi +if test -z "$aix_libpath"; then + aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` +fi else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 @@ -14884,7 +15070,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi # The linker will automatically build a .lib file if we build a DLL. old_archive_From_new_cmds_F77='true' # FIXME: Should let the user specify the lib program. - old_archive_cmds_F77='lib /OUT:$oldlib$oldobjs$old_deplibs' + old_archive_cmds_F77='lib -OUT:$oldlib$oldobjs$old_deplibs' fix_srcfile_path_F77='`cygpath -w "$srcfile"`' enable_shared_with_static_runtimes_F77=yes ;; @@ -14926,10 +15112,10 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi case $cc_basename in xlc*) output_verbose_link_cmd='echo' - archive_cmds_F77='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' + archive_cmds_F77='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $xlcverstring' module_cmds_F77='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds - archive_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + archive_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $xlcverstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' module_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' ;; *) @@ -14969,7 +15155,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ;; # FreeBSD 3 and greater uses gcc -shared to do shared libraries. - freebsd* | kfreebsd*-gnu | dragonfly*) + freebsd* | dragonfly*) archive_cmds_F77='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec_F77='-R$libdir' hardcode_direct_F77=yes @@ -15091,24 +15277,28 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ;; openbsd*) - hardcode_direct_F77=yes - hardcode_shlibpath_var_F77=no - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - archive_cmds_F77='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds_F77='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' - hardcode_libdir_flag_spec_F77='${wl}-rpath,$libdir' - export_dynamic_flag_spec_F77='${wl}-E' + if test -f /usr/libexec/ld.so; then + hardcode_direct_F77=yes + hardcode_shlibpath_var_F77=no + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + archive_cmds_F77='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds_F77='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' + hardcode_libdir_flag_spec_F77='${wl}-rpath,$libdir' + export_dynamic_flag_spec_F77='${wl}-E' + else + case $host_os in + openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) + archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec_F77='-R$libdir' + ;; + *) + archive_cmds_F77='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec_F77='${wl}-rpath,$libdir' + ;; + esac + fi else - case $host_os in - openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) - archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec_F77='-R$libdir' - ;; - *) - archive_cmds_F77='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - hardcode_libdir_flag_spec_F77='${wl}-rpath,$libdir' - ;; - esac + ld_shlibs_F77=no fi ;; @@ -15167,17 +15357,16 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; *) - # The compiler driver will combine linker options so we - # cannot just pass the convience library names through - # without $wl, iff we do not link with $LD. - # Luckily, gcc supports the same syntax we need for Sun Studio. + # The compiler driver will combine and reorder linker options, + # but understands `-z linker_flag'. GCC discards it without `$wl', + # but is careful enough not to reorder. # Supported since Solaris 2.6 (maybe 2.5.1?) - case $wlarc in - '') - whole_archive_flag_spec_F77='-z allextract$convenience -z defaultextract' ;; - *) - whole_archive_flag_spec_F77='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' ;; - esac ;; + if test "$GCC" = yes; then + whole_archive_flag_spec_F77='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' + else + whole_archive_flag_spec_F77='-z allextract$convenience -z defaultextract' + fi + ;; esac link_all_deplibs_F77=yes ;; @@ -15234,7 +15423,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi fi ;; - sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7*) + sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) no_undefined_flag_F77='${wl}-z,text' archive_cmds_need_lc_F77=no hardcode_shlibpath_var_F77=no @@ -15311,7 +15500,7 @@ x|xyes) { echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5 echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6; } $rm conftest* - printf "$lt_simple_compile_test_code" > conftest.$ac_ext + echo "$lt_simple_compile_test_code" > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 @@ -15369,20 +15558,7 @@ shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" sys_lib_dlsearch_path_spec="/lib /usr/lib" -if test "$GCC" = yes; then - sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` - if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then - # if the path contains ";" then we assume it to be the separator - # otherwise default to the standard path separator (i.e. ":") - it is - # assumed that no part of a normal pathname contains ";" but that should - # okay in the real world where ";" in dirpaths is itself problematic. - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` - else - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - fi -else - sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" -fi + need_lib_prefix=unknown hardcode_into_libs=no @@ -15539,12 +15715,7 @@ darwin* | rhapsody*) shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' - # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. - if test "$GCC" = yes; then - sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` - else - sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib' - fi + sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' ;; @@ -15561,18 +15732,6 @@ freebsd1*) dynamic_linker=no ;; -kfreebsd*-gnu) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - dynamic_linker='GNU ld.so' - ;; - freebsd* | dragonfly*) # DragonFly does not have aout. When/if they implement a new # versioning mechanism, adjust this. @@ -15610,7 +15769,7 @@ freebsd* | dragonfly*) shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; - freebsd*) # from 4.6 on + *) # from 4.6 on, and DragonFly shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; @@ -15673,7 +15832,7 @@ hpux9* | hpux10* | hpux11*) postinstall_cmds='chmod 555 $lib' ;; -interix3*) +interix[3-9]*) version_type=linux need_lib_prefix=no need_version=no @@ -15728,7 +15887,7 @@ linux*oldld* | linux*aout* | linux*coff*) ;; # This must be Linux ELF. -linux*) +linux* | k*bsd*-gnu) version_type=linux need_lib_prefix=no need_version=no @@ -15744,7 +15903,7 @@ linux*) # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then - lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi @@ -15757,18 +15916,6 @@ linux*) dynamic_linker='GNU/Linux ld.so' ;; -knetbsd*-gnu) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - dynamic_linker='GNU ld.so' - ;; - netbsd*) version_type=sunos need_lib_prefix=no @@ -15850,6 +15997,10 @@ osf3* | osf4* | osf5*) sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" ;; +rdos*) + dynamic_linker=no + ;; + solaris*) version_type=linux need_lib_prefix=no @@ -16044,6 +16195,7 @@ if test -f "$ltmain"; then module_cmds_F77 \ module_expsym_cmds_F77 \ lt_cv_prog_compiler_c_o_F77 \ + fix_srcfile_path_F77 \ exclude_expsyms_F77 \ include_expsyms_F77; do @@ -16364,7 +16516,7 @@ sys_lib_search_path_spec=$lt_sys_lib_search_path_spec sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec # Fix the shell variable \$srcfile for the compiler. -fix_srcfile_path="$fix_srcfile_path_F77" +fix_srcfile_path=$lt_fix_srcfile_path # Set to yes if exported symbols are required. always_export_symbols=$always_export_symbols_F77 @@ -16422,10 +16574,10 @@ objext=o objext_GCJ=$objext # Code to be used in simple compile tests -lt_simple_compile_test_code="class foo {}\n" +lt_simple_compile_test_code="class foo {}" # Code to be used in simple link tests -lt_simple_link_test_code='public class conftest { public static void main(String[] argv) {}; }\n' +lt_simple_link_test_code='public class conftest { public static void main(String[] argv) {}; }' # ltmain only uses $CC for tagged configurations so make sure $CC is set. @@ -16441,13 +16593,13 @@ compiler=$CC # save warnings/boilerplate of simple test code ac_outfile=conftest.$ac_objext -printf "$lt_simple_compile_test_code" >conftest.$ac_ext +echo "$lt_simple_compile_test_code" >conftest.$ac_ext eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_compiler_boilerplate=`cat conftest.err` $rm conftest* ac_outfile=conftest.$ac_objext -printf "$lt_simple_link_test_code" >conftest.$ac_ext +echo "$lt_simple_link_test_code" >conftest.$ac_ext eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_linker_boilerplate=`cat conftest.err` $rm conftest* @@ -16488,7 +16640,7 @@ if test "${lt_cv_prog_compiler_rtti_exceptions+set}" = set; then else lt_cv_prog_compiler_rtti_exceptions=no ac_outfile=conftest.$ac_objext - printf "$lt_simple_compile_test_code" > conftest.$ac_ext + echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-fno-rtti -fno-exceptions" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. @@ -16499,11 +16651,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:16502: $lt_compile\"" >&5) + (eval echo "\"\$as_me:16654: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:16506: \$? = $ac_status" >&5 + echo "$as_me:16658: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -16554,13 +16706,15 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6; } lt_prog_compiler_pic_GCJ='-m68020 -resident32 -malways-restore-a4' ;; - beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; - mingw* | pw32* | os2*) + mingw* | cygwin* | pw32* | os2*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). + # Although the cygwin gcc ignores -fPIC, still need this for old-style + # (--disable-auto-import) libraries lt_prog_compiler_pic_GCJ='-DDLL_EXPORT' ;; @@ -16570,7 +16724,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6; } lt_prog_compiler_pic_GCJ='-fno-common' ;; - interix3*) + interix[3-9]*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; @@ -16628,7 +16782,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6; } esac ;; - mingw* | pw32* | os2*) + mingw* | cygwin* | pw32* | os2*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). lt_prog_compiler_pic_GCJ='-DDLL_EXPORT' @@ -16661,7 +16815,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6; } lt_prog_compiler_static_GCJ='-Bstatic' ;; - linux*) + linux* | k*bsd*-gnu) case $cc_basename in icc* | ecc*) lt_prog_compiler_wl_GCJ='-Wl,' @@ -16680,6 +16834,22 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6; } # All Alpha code is PIC. lt_prog_compiler_static_GCJ='-non_shared' ;; + *) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) + # Sun C 5.9 + lt_prog_compiler_pic_GCJ='-KPIC' + lt_prog_compiler_static_GCJ='-Bstatic' + lt_prog_compiler_wl_GCJ='-Wl,' + ;; + *Sun\ F*) + # Sun Fortran 8.3 passes all unrecognized flags to the linker + lt_prog_compiler_pic_GCJ='-KPIC' + lt_prog_compiler_static_GCJ='-Bstatic' + lt_prog_compiler_wl_GCJ='' + ;; + esac + ;; esac ;; @@ -16689,6 +16859,10 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6; } lt_prog_compiler_static_GCJ='-non_shared' ;; + rdos*) + lt_prog_compiler_static_GCJ='-non_shared' + ;; + solaris*) lt_prog_compiler_pic_GCJ='-KPIC' lt_prog_compiler_static_GCJ='-Bstatic' @@ -16756,7 +16930,7 @@ if test "${lt_prog_compiler_pic_works_GCJ+set}" = set; then else lt_prog_compiler_pic_works_GCJ=no ac_outfile=conftest.$ac_objext - printf "$lt_simple_compile_test_code" > conftest.$ac_ext + echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="$lt_prog_compiler_pic_GCJ" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. @@ -16767,11 +16941,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:16770: $lt_compile\"" >&5) + (eval echo "\"\$as_me:16944: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:16774: \$? = $ac_status" >&5 + echo "$as_me:16948: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -16820,7 +16994,7 @@ else lt_prog_compiler_static_works_GCJ=no save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS $lt_tmp_static_flag" - printf "$lt_simple_link_test_code" > conftest.$ac_ext + echo "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings @@ -16860,7 +17034,7 @@ else mkdir conftest cd conftest mkdir out - printf "$lt_simple_compile_test_code" > conftest.$ac_ext + echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or @@ -16871,11 +17045,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:16874: $lt_compile\"" >&5) + (eval echo "\"\$as_me:17048: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:16878: \$? = $ac_status" >&5 + echo "$as_me:17052: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -17067,7 +17241,7 @@ EOF allow_undefined_flag_GCJ=unsupported always_export_symbols_GCJ=no enable_shared_with_static_runtimes_GCJ=yes - export_symbols_cmds_GCJ='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS] /s/.* \([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols' + export_symbols_cmds_GCJ='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/'\'' -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols' if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' @@ -17085,7 +17259,7 @@ EOF fi ;; - interix3*) + interix[3-9]*) hardcode_direct_GCJ=no hardcode_shlibpath_var_GCJ=no hardcode_libdir_flag_spec_GCJ='${wl}-rpath,$libdir' @@ -17100,7 +17274,7 @@ EOF archive_expsym_cmds_GCJ='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; - linux*) + gnu* | linux* | k*bsd*-gnu) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then tmp_addflag= case $cc_basename,$host_cpu in @@ -17118,13 +17292,22 @@ EOF ifc* | ifort*) # Intel Fortran compiler tmp_addflag=' -nofor_main' ;; esac - archive_cmds_GCJ='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) # Sun C 5.9 + whole_archive_flag_spec_GCJ='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_sharedflag='-G' ;; + *Sun\ F*) # Sun Fortran 8.3 + tmp_sharedflag='-G' ;; + *) + tmp_sharedflag='-shared' ;; + esac + archive_cmds_GCJ='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' if test $supports_anon_versioning = yes; then archive_expsym_cmds_GCJ='$echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ $echo "local: *; };" >> $output_objdir/$libname.ver~ - $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' + $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' fi else ld_shlibs_GCJ=no @@ -17283,7 +17466,7 @@ _LT_EOF strings "$collect2name" | grep resolve_lib_name >/dev/null then # We have reworked collect2 - hardcode_direct_GCJ=yes + : else # We have old collect2 hardcode_direct_GCJ=unsupported @@ -17357,11 +17540,18 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then -aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'` +lt_aix_libpath_sed=' + /Import File Strings/,/^$/ { + /^0/ { + s/^0 *\(.*\)$/\1/ + p + } + }' +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. -if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'`; fi +if test -z "$aix_libpath"; then + aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` +fi else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 @@ -17416,11 +17606,18 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then -aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'` +lt_aix_libpath_sed=' + /Import File Strings/,/^$/ { + /^0/ { + s/^0 *\(.*\)$/\1/ + p + } + }' +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. -if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'`; fi +if test -z "$aix_libpath"; then + aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` +fi else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 @@ -17474,7 +17671,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi # The linker will automatically build a .lib file if we build a DLL. old_archive_From_new_cmds_GCJ='true' # FIXME: Should let the user specify the lib program. - old_archive_cmds_GCJ='lib /OUT:$oldlib$oldobjs$old_deplibs' + old_archive_cmds_GCJ='lib -OUT:$oldlib$oldobjs$old_deplibs' fix_srcfile_path_GCJ='`cygpath -w "$srcfile"`' enable_shared_with_static_runtimes_GCJ=yes ;; @@ -17516,10 +17713,10 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi case $cc_basename in xlc*) output_verbose_link_cmd='echo' - archive_cmds_GCJ='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' + archive_cmds_GCJ='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $xlcverstring' module_cmds_GCJ='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds - archive_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + archive_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $xlcverstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' module_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' ;; *) @@ -17559,7 +17756,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ;; # FreeBSD 3 and greater uses gcc -shared to do shared libraries. - freebsd* | kfreebsd*-gnu | dragonfly*) + freebsd* | dragonfly*) archive_cmds_GCJ='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec_GCJ='-R$libdir' hardcode_direct_GCJ=yes @@ -17681,24 +17878,28 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ;; openbsd*) - hardcode_direct_GCJ=yes - hardcode_shlibpath_var_GCJ=no - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - archive_cmds_GCJ='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds_GCJ='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' - hardcode_libdir_flag_spec_GCJ='${wl}-rpath,$libdir' - export_dynamic_flag_spec_GCJ='${wl}-E' + if test -f /usr/libexec/ld.so; then + hardcode_direct_GCJ=yes + hardcode_shlibpath_var_GCJ=no + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + archive_cmds_GCJ='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds_GCJ='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' + hardcode_libdir_flag_spec_GCJ='${wl}-rpath,$libdir' + export_dynamic_flag_spec_GCJ='${wl}-E' + else + case $host_os in + openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) + archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec_GCJ='-R$libdir' + ;; + *) + archive_cmds_GCJ='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec_GCJ='${wl}-rpath,$libdir' + ;; + esac + fi else - case $host_os in - openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) - archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec_GCJ='-R$libdir' - ;; - *) - archive_cmds_GCJ='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - hardcode_libdir_flag_spec_GCJ='${wl}-rpath,$libdir' - ;; - esac + ld_shlibs_GCJ=no fi ;; @@ -17757,17 +17958,16 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; *) - # The compiler driver will combine linker options so we - # cannot just pass the convience library names through - # without $wl, iff we do not link with $LD. - # Luckily, gcc supports the same syntax we need for Sun Studio. + # The compiler driver will combine and reorder linker options, + # but understands `-z linker_flag'. GCC discards it without `$wl', + # but is careful enough not to reorder. # Supported since Solaris 2.6 (maybe 2.5.1?) - case $wlarc in - '') - whole_archive_flag_spec_GCJ='-z allextract$convenience -z defaultextract' ;; - *) - whole_archive_flag_spec_GCJ='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' ;; - esac ;; + if test "$GCC" = yes; then + whole_archive_flag_spec_GCJ='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' + else + whole_archive_flag_spec_GCJ='-z allextract$convenience -z defaultextract' + fi + ;; esac link_all_deplibs_GCJ=yes ;; @@ -17824,7 +18024,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi fi ;; - sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7*) + sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) no_undefined_flag_GCJ='${wl}-z,text' archive_cmds_need_lc_GCJ=no hardcode_shlibpath_var_GCJ=no @@ -17901,7 +18101,7 @@ x|xyes) { echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5 echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6; } $rm conftest* - printf "$lt_simple_compile_test_code" > conftest.$ac_ext + echo "$lt_simple_compile_test_code" > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 @@ -17959,20 +18159,7 @@ shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" sys_lib_dlsearch_path_spec="/lib /usr/lib" -if test "$GCC" = yes; then - sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` - if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then - # if the path contains ";" then we assume it to be the separator - # otherwise default to the standard path separator (i.e. ":") - it is - # assumed that no part of a normal pathname contains ";" but that should - # okay in the real world where ";" in dirpaths is itself problematic. - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` - else - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - fi -else - sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" -fi + need_lib_prefix=unknown hardcode_into_libs=no @@ -18129,12 +18316,7 @@ darwin* | rhapsody*) shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' - # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. - if test "$GCC" = yes; then - sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` - else - sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib' - fi + sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' ;; @@ -18151,18 +18333,6 @@ freebsd1*) dynamic_linker=no ;; -kfreebsd*-gnu) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - dynamic_linker='GNU ld.so' - ;; - freebsd* | dragonfly*) # DragonFly does not have aout. When/if they implement a new # versioning mechanism, adjust this. @@ -18200,7 +18370,7 @@ freebsd* | dragonfly*) shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; - freebsd*) # from 4.6 on + *) # from 4.6 on, and DragonFly shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; @@ -18263,7 +18433,7 @@ hpux9* | hpux10* | hpux11*) postinstall_cmds='chmod 555 $lib' ;; -interix3*) +interix[3-9]*) version_type=linux need_lib_prefix=no need_version=no @@ -18318,7 +18488,7 @@ linux*oldld* | linux*aout* | linux*coff*) ;; # This must be Linux ELF. -linux*) +linux* | k*bsd*-gnu) version_type=linux need_lib_prefix=no need_version=no @@ -18334,7 +18504,7 @@ linux*) # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then - lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi @@ -18347,18 +18517,6 @@ linux*) dynamic_linker='GNU/Linux ld.so' ;; -knetbsd*-gnu) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - dynamic_linker='GNU ld.so' - ;; - netbsd*) version_type=sunos need_lib_prefix=no @@ -18440,6 +18598,10 @@ osf3* | osf4* | osf5*) sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" ;; +rdos*) + dynamic_linker=no + ;; + solaris*) version_type=linux need_lib_prefix=no @@ -18634,6 +18796,7 @@ if test -f "$ltmain"; then module_cmds_GCJ \ module_expsym_cmds_GCJ \ lt_cv_prog_compiler_c_o_GCJ \ + fix_srcfile_path_GCJ \ exclude_expsyms_GCJ \ include_expsyms_GCJ; do @@ -18954,7 +19117,7 @@ sys_lib_search_path_spec=$lt_sys_lib_search_path_spec sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec # Fix the shell variable \$srcfile for the compiler. -fix_srcfile_path="$fix_srcfile_path_GCJ" +fix_srcfile_path=$lt_fix_srcfile_path # Set to yes if exported symbols are required. always_export_symbols=$always_export_symbols_GCJ @@ -19011,7 +19174,7 @@ objext=o objext_RC=$objext # Code to be used in simple compile tests -lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }\n' +lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }' # Code to be used in simple link tests lt_simple_link_test_code="$lt_simple_compile_test_code" @@ -19030,13 +19193,13 @@ compiler=$CC # save warnings/boilerplate of simple test code ac_outfile=conftest.$ac_objext -printf "$lt_simple_compile_test_code" >conftest.$ac_ext +echo "$lt_simple_compile_test_code" >conftest.$ac_ext eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_compiler_boilerplate=`cat conftest.err` $rm conftest* ac_outfile=conftest.$ac_objext -printf "$lt_simple_link_test_code" >conftest.$ac_ext +echo "$lt_simple_link_test_code" >conftest.$ac_ext eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_linker_boilerplate=`cat conftest.err` $rm conftest* @@ -19114,6 +19277,7 @@ if test -f "$ltmain"; then module_cmds_RC \ module_expsym_cmds_RC \ lt_cv_prog_compiler_c_o_RC \ + fix_srcfile_path_RC \ exclude_expsyms_RC \ include_expsyms_RC; do @@ -19434,7 +19598,7 @@ sys_lib_search_path_spec=$lt_sys_lib_search_path_spec sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec # Fix the shell variable \$srcfile for the compiler. -fix_srcfile_path="$fix_srcfile_path_RC" +fix_srcfile_path=$lt_fix_srcfile_path # Set to yes if exported symbols are required. always_export_symbols=$always_export_symbols_RC @@ -20306,7 +20470,7 @@ fi CFLAGS="$CFLAGS $build_flags" CXXFLAGS="$CXXFLAGS $build_flags" -ac_config_files="$ac_config_files Makefile silgraphite.pc:installed-top.pc.in:silgraphite.pc.in silgraphite-uninstalled.pc:uninstalled-top.pc.in:silgraphite.pc.in src/Makefile test/Makefile test/RegressionTest/Makefile" +ac_config_files="$ac_config_files Makefile silgraphite.pc:installed-top.pc.in:silgraphite.pc.in silgraphite-uninstalled.pc:uninstalled-top.pc.in:silgraphite.pc.in src/Makefile test/Makefile test/RegressionTest/Makefile test/ProfileHarness/Makefile" cat >confcache <<\_ACEOF @@ -20763,7 +20927,7 @@ exec 6>&1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by silgraphite $as_me 2.2.0, which was +This file was extended by silgraphite $as_me 2.2.1, which was generated by GNU Autoconf 2.61. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -20810,7 +20974,7 @@ Report bugs to <bug-autoconf@gnu.org>." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ -silgraphite config.status 2.2.0 +silgraphite config.status 2.2.1 configured by $0, generated by GNU Autoconf 2.61, with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" @@ -20921,6 +21085,7 @@ do "src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;; "test/Makefile") CONFIG_FILES="$CONFIG_FILES test/Makefile" ;; "test/RegressionTest/Makefile") CONFIG_FILES="$CONFIG_FILES test/RegressionTest/Makefile" ;; + "test/ProfileHarness/Makefile") CONFIG_FILES="$CONFIG_FILES test/ProfileHarness/Makefile" ;; *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 echo "$as_me: error: invalid argument: $ac_config_target" >&2;} @@ -21070,6 +21235,7 @@ am__fastdepCC_FALSE!$am__fastdepCC_FALSE$ac_delim CPP!$CPP$ac_delim GREP!$GREP$ac_delim EGREP!$EGREP$ac_delim +SED!$SED$ac_delim LN_S!$LN_S$ac_delim ECHO!$ECHO$ac_delim AR!$AR$ac_delim @@ -21078,7 +21244,6 @@ CXX!$CXX$ac_delim CXXFLAGS!$CXXFLAGS$ac_delim ac_ct_CXX!$ac_ct_CXX$ac_delim CXXDEPMODE!$CXXDEPMODE$ac_delim -am__fastdepCXX_TRUE!$am__fastdepCXX_TRUE$ac_delim _ACEOF if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; then @@ -21120,6 +21285,7 @@ _ACEOF ac_delim='%!_!# ' for ac_last_try in false false false false false :; do cat >conf$$subs.sed <<_ACEOF +am__fastdepCXX_TRUE!$am__fastdepCXX_TRUE$ac_delim am__fastdepCXX_FALSE!$am__fastdepCXX_FALSE$ac_delim CXXCPP!$CXXCPP$ac_delim F77!$F77$ac_delim @@ -21133,7 +21299,7 @@ LIBOBJS!$LIBOBJS$ac_delim LTLIBOBJS!$LTLIBOBJS$ac_delim _ACEOF - if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 11; then + if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 12; then break elif $ac_last_try; then { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 diff --git a/Build/source/libs/graphite-engine/configure.ac b/Build/source/libs/graphite-engine/configure.ac index 9d69e1ec8d0..bf9ae416f14 100644 --- a/Build/source/libs/graphite-engine/configure.ac +++ b/Build/source/libs/graphite-engine/configure.ac @@ -1,6 +1,6 @@ AC_PREREQ(2.54) -AC_INIT(silgraphite, 2.2.0, silgraphite-devel@lists.sourceforge.net) +AC_INIT(silgraphite, 2.2.1, silgraphite-devel@lists.sourceforge.net) AC_CONFIG_SRCDIR(src/segment/GrEngine.cpp) AC_CONFIG_AUX_DIR(config) @@ -119,6 +119,7 @@ AC_CONFIG_FILES(Makefile \ silgraphite-uninstalled.pc:uninstalled-top.pc.in:silgraphite.pc.in \ src/Makefile \ test/Makefile \ - test/RegressionTest/Makefile) + test/RegressionTest/Makefile \ + test/ProfileHarness/Makefile) AC_OUTPUT diff --git a/Build/source/libs/graphite-engine/debian/changelog b/Build/source/libs/graphite-engine/debian/changelog index 75b367b15ba..88b5fd7d7f6 100644 --- a/Build/source/libs/graphite-engine/debian/changelog +++ b/Build/source/libs/graphite-engine/debian/changelog @@ -1,3 +1,28 @@ +silgraphite2.0 (1:2.2.1-1) feisty; urgency=low + + * 30% speedup + * various bug fixes + + -- Martin Hosken <martin_hosken@sil.org> Mon, 27 Aug 2007 16:47:26 +0100 + +silgraphite2.0 (1:2.2.0-1.1) unstable; urgency=low + + * Non-maintainer upload. + * Fix the broken graphite.pc file (Closes: #433225): + - debian/rules: + Added an include of cdbs's simple-patchsys.mk. + - debian/patches/fix_cflags_in_graphite.pc.diff + Added this patch to fix the graphite.pc file by appending the missing + ``graphite'' directory to the Cflags in graphite.pc.in. + + -- Cyril Brulebois <cyril.brulebois@enst-bretagne.fr> Mon, 20 Aug 2007 01:20:35 +0000 + +silgraphite2.0 (1:2.2.0-1) unstable; urgency=low + + * Release 2.2.0 + + -- Daniel Glassey <wdg@debian.org> Thu, 28 Jun 2007 10:56:17 +0100 + silgraphite2.0 (1:2.1+0447svn-1) unstable; urgency=low * Update svn diff --git a/Build/source/libs/graphite-engine/debian/control b/Build/source/libs/graphite-engine/debian/control index d59c92f6f85..fbcdb63a66a 100644 --- a/Build/source/libs/graphite-engine/debian/control +++ b/Build/source/libs/graphite-engine/debian/control @@ -56,6 +56,7 @@ Description: SILGraphite - a "smart font" rendering engine This package contains the shared library. Package: libgraphite3-dbg +Priority: extra Section: libdevel Architecture: any Depends: libgraphite3 (= ${Source-Version}) diff --git a/Build/source/libs/graphite-engine/debian/libgraphite-dev.docs b/Build/source/libs/graphite-engine/debian/libgraphite-dev.docs index 4206678e7e2..2a85e0b4b5b 100644 --- a/Build/source/libs/graphite-engine/debian/libgraphite-dev.docs +++ b/Build/source/libs/graphite-engine/debian/libgraphite-dev.docs @@ -1,5 +1,5 @@ -build-tree/silgraphite-2.2.0/doc/GTF_3_0.odt -build-tree/silgraphite-2.2.0/doc/V2_Engine_Interface.odt -build-tree/silgraphite-2.2.0/doc/V2_Segment_Interface.odt -build-tree/silgraphite-2.2.0/doc/V2_TextSource_Interface.odt +build-tree/silgraphite-2.2.1/doc/GTF_3_0.odt +build-tree/silgraphite-2.2.1/doc/V2_Engine_Interface.odt +build-tree/silgraphite-2.2.1/doc/V2_Segment_Interface.odt +build-tree/silgraphite-2.2.1/doc/V2_TextSource_Interface.odt diff --git a/Build/source/libs/graphite-engine/debian/rules b/Build/source/libs/graphite-engine/debian/rules index 5872b5e748e..cc3842b871e 100755 --- a/Build/source/libs/graphite-engine/debian/rules +++ b/Build/source/libs/graphite-engine/debian/rules @@ -1,7 +1,7 @@ #!/usr/bin/make -f #DEB_AUTO_UPDATE_DEBIAN_CONTROL:=yes -DEB_TAR_SRCDIR := silgraphite-2.2.0 +DEB_TAR_SRCDIR := silgraphite-2.2.1 include /usr/share/cdbs/1/rules/tarball.mk include /usr/share/cdbs/1/rules/debhelper.mk diff --git a/Build/source/libs/graphite-engine/doc/V2_Engine_Interface.odt b/Build/source/libs/graphite-engine/doc/V2_Engine_Interface.odt Binary files differindex bee0b29b174..c69511535a6 100644 --- a/Build/source/libs/graphite-engine/doc/V2_Engine_Interface.odt +++ b/Build/source/libs/graphite-engine/doc/V2_Engine_Interface.odt diff --git a/Build/source/libs/graphite-engine/doc/V2_Segment_Interface.odt b/Build/source/libs/graphite-engine/doc/V2_Segment_Interface.odt Binary files differindex 170d0bd6360..b9028cfb379 100644 --- a/Build/source/libs/graphite-engine/doc/V2_Segment_Interface.odt +++ b/Build/source/libs/graphite-engine/doc/V2_Segment_Interface.odt diff --git a/Build/source/libs/graphite-engine/doc/hungarian.txt b/Build/source/libs/graphite-engine/doc/hungarian.txt index 580fe19414b..946c9a4bc97 100644 --- a/Build/source/libs/graphite-engine/doc/hungarian.txt +++ b/Build/source/libs/graphite-engine/doc/hungarian.txt @@ -1,123 +1,126 @@ -GRAPHITE HUNGARIAN NOTATION
-
-General rules for variable names:
-
-* Syntax is:
- scope indicator (if any)
- combining prefix (zero or more)
- type/class indicator (required)
- usage labels (optional)
-
-* The only places underscores are used are after the scoping prefixes. Uppercase is used to separate the prefixes from the main label, if any; eg: strName, m_psegNew.
-
-* If you are creating a new class, make up a short indicator for it and use it consistently. Class indicators should be 3-6 characters long.
-
-* An appropriate way to indicate method arguments where necessary is with an "Arg" usage label, eg: nValueArg. Generally method arguments have no special indication.
-
-* Usage labels can be made up arbitrarily, but the ones listed below should be used if they apply.
-
-
-*** Scope indicators:
-
-m_ member variable
-s_ static (global) variable
-
-
-*** Combining prefixes:
-
-i index
-c counter
-p pointer
-pp double pointer
-rg range (array, especially stack-allocated)
-prg pointer to the start of an array (often used for method arguments)
-v vector
-d delta or difference
-k constant (combines with an enumeration identifier: eg, klb, kest, kgmet, etc)
-
-
-*** Basic type indicators:
-
-f boolean (flag)
-n integer (simple numerical value--not a counter, index, glyph id, char, measurement, etc.)
-b byte
-l long integer (whatever that means)
-ch character (width irrelevant)
-chs short character (8-bit)
-chw wide character (16-bit)
-chl 32-bit character
-str string (char-width irrelevant)
-sta ANSI string (8-bit)
-stu Unicode string (16-bit)
-fxd fixed-field integer
-v void (yes, this duplicates vector)
-
-Graphite specific integer types:
-
-gid glyph id
-m em-units
-xs logical units, x-coordinates (source)
-ys logical units, y-coordinates (source)
-xys logical units, x- or y-coordinates (source)
-
-
-*** Common Graphite-specific class prefixes (not a complete list)
-
-seg Segment
-font Font
-txsrc TextSource
-fface FontFace
-pass GrPass
-greng GrEngine
-tman GrTableManager
-sstrm GrSlotStream
-slot GrSlotState
-slout GrSlotOutput
-chstrm GrCharStream
-gbb glyph bounding box
-
-
-*** Enumeration prefixes (see the GrConstants.h and GrData.h files for a more complete list)
-
-lb line break (breakweight)
-twsh trailing whitespace handling
-est end-segment type (why the segment was terminated)
-dm draw mode (for insertion points)
-dirc directionality code
-slat slot attribute name
-clr color
-op operator in Graphite's stack machine
-
-
-*** Usage labels (somewhat optional, depending on context)
-
-Min first in a sequence or array (used with Lim); minimum (used with Max)
-Lim 1 + last in a sequence or array
-Max maximum
-First first in a sequence (used with Last)
-Last last in a sequence
-Prev previous
-Next next
-Ret return value
-In input
-Out output
-New newly created object
-Arg method argument
-
------------------
-
-EXAMPLES
-
-pf pointer to boolean
-cch character count
-ipassPrev index of previous pass
-pppass pointer to a pointer to a pass
-iislot index to an index to a GrSlotState
-vichw vector of character indices
-prgchw pointer to the start of a wide-char buffer
-dislot delta to apply to an index of a GrSlotState
-m_ipass index of pass (member variable)
-ppassNew newly created pass
-clrBack background color
-m_igbbFirst index to the first glyph bounding box (member variable)
+GRAPHITE HUNGARIAN NOTATION + +General rules for variable names: + +* Syntax is: + scope indicator (if any) + combining prefix (zero or more) + type/class indicator (required) + usage labels (optional) + +* The only places underscores are used are after the scoping prefixes. Uppercase is used to separate the prefixes from the main label, if any; eg: strName, m_psegNew. + +* If you are creating a new class, make up a short indicator for it and use it consistently. Class indicators should be 3-6 characters long. + +* An appropriate way to indicate method arguments where necessary is with an "Arg" usage label, eg: nValueArg. Generally method arguments have no special indication. + +* Usage labels can be made up arbitrarily, but the ones listed below should be used if they apply. + + +*** Scope indicators: + +m_ member variable +s_ static (global) variable + + +*** Combining prefixes: + +i index +c counter +p pointer +pp double pointer +rg range (array, especially stack-allocated) +prg pointer to the start of an array (often used for method arguments) +v vector +d delta or difference +k constant (combines with an enumeration identifier: eg, klb, kest, kgmet, etc) + + +*** Basic type indicators: + +f boolean (flag) +n integer (simple numerical value--not a counter, index, glyph id, char, measurement, etc.) +b byte +l long integer (whatever that means) +ch character (width irrelevant) +chs short character (8-bit) +chw wide character (16-bit) +chl long (32-bit) character +str string (char-width irrelevant) +sta ANSI string (8-bit) +stu Unicode string (16-bit) +fxd fixed-field integer +v void (yes, this duplicates vector) + +Graphite specific integer types: + +gid glyph id +m em-units +xs logical units, x-coordinates (source) +ys logical units, y-coordinates (source) +xys logical units, x- or y-coordinates (source) +xd display units, x-coordinates +yd display units, y-coordinates +xyd display units, x- or y-coordinates + + +*** Common Graphite-specific class prefixes (not a complete list) + +seg Segment +font Font +txsrc TextSource +fface FontFace +pass GrPass +greng GrEngine +tman GrTableManager +sstrm GrSlotStream +slot GrSlotState +slout GrSlotOutput +chstrm GrCharStream +gbb glyph bounding box + + +*** Enumeration prefixes (see the GrConstants.h and GrData.h files for a more complete list) + +lb line break (breakweight) +twsh trailing whitespace handling +est end-segment type (why the segment was terminated) +dm draw mode (for insertion points) +dirc directionality code +slat slot attribute name +clr color +op operator in Graphite's stack machine + + +*** Usage labels (somewhat optional, depending on context) + +Min first in a sequence or array (used with Lim); minimum (used with Max) +Lim 1 + last in a sequence or array +Max maximum +First first in a sequence (used with Last) +Last last in a sequence +Prev previous +Next next +Ret return value +In input +Out output +New newly created object +Arg method argument + +----------------- + +EXAMPLES + +pf pointer to boolean +cch character count +ipassPrev index of previous pass +pppass pointer to a pointer to a pass +iislot index to an index to a GrSlotState +vich vector of character indices +prgchw pointer to the start of a wide-char buffer +dislot delta to apply to an index of a GrSlotState +m_ipass index of pass (member variable) +ppassNew pointer to a newly created pass +clrBack background color +m_igbbFirst index to the first glyph bounding box (member variable) islotLim 1 + index of the last slot
\ No newline at end of file diff --git a/Build/source/libs/graphite-engine/doc/policy.txt b/Build/source/libs/graphite-engine/doc/policy.txt index db88b076519..e3acbb4bcec 100644 --- a/Build/source/libs/graphite-engine/doc/policy.txt +++ b/Build/source/libs/graphite-engine/doc/policy.txt @@ -1,4 +1,4 @@ -POLCIES +POLICIES This document keeps a dated list of policy changes that we may come up with or recind or generally do whatever we want with. There's no carefully worked @@ -8,8 +8,9 @@ to keep and break when we need to! 2007-04-02 API Changes Policy + Any changes to the public API will be documented on the developers' list along -with a branch into which the code changes corresponding will be placed. +with a branch into which the corresponding code changes will be placed. Following the announcement, the branch will not be merged into the trunk for at least 1 week. After which, depending on how the development has gone and the comments or otherwise, the merge may: take place unannounced, be delayed diff --git a/Build/source/libs/graphite-engine/include/Makefile.am b/Build/source/libs/graphite-engine/include/Makefile.am index cba5cff10eb..83286118d8d 100644 --- a/Build/source/libs/graphite-engine/include/Makefile.am +++ b/Build/source/libs/graphite-engine/include/Makefile.am @@ -18,6 +18,7 @@ graphiteinclude_HEADERS += $(top_srcdir)/include/graphite/IGraphiteProcess.h graphiteinclude_HEADERS += $(top_srcdir)/include/graphite/IGrEngine.h graphiteinclude_HEADERS += $(top_srcdir)/include/graphite/IGrJustifier.h graphiteinclude_HEADERS += $(top_srcdir)/include/graphite/ITextSource.h +graphiteinclude_HEADERS += $(top_srcdir)/include/graphite/MemoryUsage.h graphiteinclude_HEADERS += $(top_srcdir)/include/graphite/SegmentAux.h graphiteinclude_HEADERS += $(top_srcdir)/include/graphite/Segment.h graphiteinclude_HEADERS += $(top_srcdir)/include/graphite/SegmentPainter.h diff --git a/Build/source/libs/graphite-engine/include/graphite/FileFont.h b/Build/source/libs/graphite-engine/include/graphite/FileFont.h index cffef0b79bc..bbb26266c71 100644 --- a/Build/source/libs/graphite-engine/include/graphite/FileFont.h +++ b/Build/source/libs/graphite-engine/include/graphite/FileFont.h @@ -209,7 +209,7 @@ public: m_yScale = scaleFromDpi(dpi); } - bool isValid() { return m_isValid; }; + bool isValid() { return m_fIsValid; }; protected: /** Default constructor is not used */ FileFont(); @@ -225,10 +225,11 @@ protected: // pixel-coord = design-coord * pixels-per-em / font-em-square float scaleFromDpi(int dpi) { - return (dpi * m_pointSize) / (72.0f * m_emSquare); + return (dpi * m_pointSize) / (72.0f * m_mEmSquare); } + // Member variables: - FILE *m_file; + FILE * m_pfile; unsigned long m_clrFore; unsigned long m_clrBack; @@ -238,14 +239,14 @@ protected: FontTableCache * m_pTableCache; // KRS: I think these should be cached otherwise Segment::LineContextSegment doesn't work - float m_ascent; - float m_descent; - float m_emSquare; + float m_mAscent; + float m_mDescent; + float m_mEmSquare; float m_pointSize; int m_dpiX; int m_dpiY; - bool m_isValid; - std::wstring m_faceName; + bool m_fIsValid; + std::wstring m_stuFaceName; byte * m_pHeader; byte * m_pTableDir; float m_xScale; diff --git a/Build/source/libs/graphite-engine/include/graphite/Font.h b/Build/source/libs/graphite-engine/include/graphite/Font.h index ef8fead89ec..64f62b3ff62 100644 --- a/Build/source/libs/graphite-engine/include/graphite/Font.h +++ b/Build/source/libs/graphite-engine/include/graphite/Font.h @@ -30,6 +30,7 @@ class FeatureSettingIterator; class Segment; class LayoutEnvironment; class ITextSource; +class FontMemoryUsage; typedef struct tagFontProps { @@ -211,6 +212,7 @@ class Font { friend class FeatureSettingIterator; friend class FeatLabelLangIterator; friend class LanguageIterator; + friend class FontMemoryUsage; public: virtual ~Font(); @@ -342,6 +344,9 @@ public: // Debugging: //static bool DbgCheckFontCache(); + static FontMemoryUsage calculateMemoryUsage(); + ///FontMemoryUsage calculateMemoryUsage(bool fBold = false, bool fItalic = false); + public: // For use in segment creation: void RenderLineFillSegment(Segment * pseg, ITextSource * pts, LayoutEnvironment & layout, @@ -355,7 +360,7 @@ protected: Font(); Font(const Font &); - FontFace & fontFace(); + FontFace & fontFace(bool fDumbFallback = false); // Feature access: FeatureIterator BeginFeature(); @@ -388,10 +393,22 @@ protected: private: FontFace * m_pfface; // set up with Graphite tables - void initialiseFontFace(); + + // Cache of common tables: + const void * m_pHead; + const void * m_pHmtx; + const void * m_pLoca; + const void * m_pGlyf; + size_t m_cbHmtxSize; + size_t m_cbLocaSize; + bool m_fTablesCached; + + void initialiseFontFace(bool fDumbFallback); + void EnsureTablesCached(); }; -inline Font::Font() : m_pfface(0) { } +inline Font::Font() : m_pfface(0), m_fTablesCached(false) +{ } } // namespace gr diff --git a/Build/source/libs/graphite-engine/include/graphite/GrFeature.h b/Build/source/libs/graphite-engine/include/graphite/GrFeature.h index ee7376fe1c4..4cc396a11d9 100644 --- a/Build/source/libs/graphite-engine/include/graphite/GrFeature.h +++ b/Build/source/libs/graphite-engine/include/graphite/GrFeature.h @@ -135,6 +135,8 @@ class GrIStream; class GrLangTable { + friend class FontMemoryUsage; + public: GrLangTable() { @@ -185,6 +187,7 @@ protected: data16 padBIG; }; FeatSet * m_prgfset; + int m_cfset; // needed for memory instrumentation only int FindIndex(isocode lgcode); }; diff --git a/Build/source/libs/graphite-engine/include/graphite/MemoryUsage.h b/Build/source/libs/graphite-engine/include/graphite/MemoryUsage.h new file mode 100644 index 00000000000..d59ff165f75 --- /dev/null +++ b/Build/source/libs/graphite-engine/include/graphite/MemoryUsage.h @@ -0,0 +1,156 @@ +/*--------------------------------------------------------------------*//*:Ignore this sentence. +Copyright (C) 2007 SIL International. All rights reserved. + +Distributable under the terms of either the Common Public License or the +GNU Lesser General Public License, as specified in the LICENSING.txt file. + +File: MemoryUsage.h +Responsibility: Sharon Correll +Last reviewed: not yet + +Description: + Data structures to hold the calculations for memory usage. +----------------------------------------------------------------------------------------------*/ + +#ifdef _MSC_VER +#pragma once +#endif +#ifndef MEMORYUSAGE_INCLUDED +#define MEMORYUSAGE_INCLUDED + +//:End Ignore + + +namespace gr +{ + +/*---------------------------------------------------------------------------------------------- + A data structure that holds information about the memory usage for font/engine objects +----------------------------------------------------------------------------------------------*/ +class FontMemoryUsage +{ + friend class FontCache; + friend class FontFace; + +public: + FontMemoryUsage() + { + initialize(); + } + void addEngine(GrEngine * pgreng); + void prettyPrint(std::ostream & strm); + +protected: + // member variables: + std::vector<size_t> vFontTotalsReg; + std::vector<size_t> vFontTotalsBold; + std::vector<size_t> vFontTotalsItalic; + std::vector<size_t> vFontTotalsBI; + std::vector<std::string> vstrFontNames; + std::vector<size_t> vFaceCount; + + size_t font; + size_t fontCache; + size_t fontFace; + + size_t eng_count; + size_t eng_overhead; + size_t eng_scalars; + size_t eng_strings; + size_t eng_pointers; + size_t eng_cmap; + size_t eng_nameTable; + + size_t pseudoMap; + + size_t clstbl_counters; + size_t clstbl_offsets; + size_t clstbl_glyphList; + + size_t glftbl_general; + size_t glftbl_compDefns; + size_t glftbl_attrTable; + size_t glftbl_attrOffsets; + + size_t lngtbl_general; + size_t lngtbl_entries; + size_t lngtbl_featureSets; + + size_t tman_general; + + size_t pass_count; + size_t pass_general; + size_t pass_fsm; + size_t pass_ruleExtras; + size_t pass_constraintOffsets; + size_t pass_constraintCode; + size_t pass_actionOffsets; + size_t pass_actionCode; + + size_t engst_general; + size_t engst_passState; + + size_t sstrm_count; + size_t sstrm_general; + size_t sstrm_chunkMapsUsed; + size_t sstrm_chunkMapsAlloc; + size_t sstrm_reprocBuf; + + size_t slot_count; + size_t slot_general; + size_t slot_abstract; + size_t slot_varLenBuf; + size_t slot_assocsUsed; + size_t slot_assocsAlloc; + size_t slot_attachUsed; + size_t slot_attachAlloc; + + // methods: + void initialize(); + int total(); + void add(FontMemoryUsage & fmu); +}; + +/*---------------------------------------------------------------------------------------------- + A data structure that holds information about the memory usage for segment objects. +----------------------------------------------------------------------------------------------*/ +class SegmentMemoryUsage +{ +public: + SegmentMemoryUsage() + { + initialize(); + } + void addSegment(Segment & seg); + void prettyPrint(std::ostream & strm); + +protected: + // member variables: + size_t seg_count; + size_t overhead; + size_t pointers; + size_t scalars; + size_t strings; + size_t metrics; + size_t associations; + size_t init; + size_t obsolete; + + size_t slot_count; + size_t slot_abstract; + size_t slot_varLenBuf; + size_t slot_scalars; + size_t slot_clusterMembers; + + size_t glyphInfo_count; + size_t glyphInfo; + + size_t wastedVector; // allocated space that is not used in vectors + + // methods: + void initialize(); +}; + +} // namespace gr + +#endif // !MEMORYUSAGE_INCLUDED diff --git a/Build/source/libs/graphite-engine/include/graphite/Segment.h b/Build/source/libs/graphite-engine/include/graphite/Segment.h index 4730db6b086..04c510e3488 100644 --- a/Build/source/libs/graphite-engine/include/graphite/Segment.h +++ b/Build/source/libs/graphite-engine/include/graphite/Segment.h @@ -26,11 +26,10 @@ Description: //:End Ignore -class GrEngine; - namespace gr { - +class GrEngine; +class SegmentMemoryUsage; class IGrJustifier; class GrTableManager; @@ -51,6 +50,7 @@ class Segment friend class GlyphInfo; friend class GlyphIterator; friend class GlyphSetIterator; + friend class SegmentMemoryUsage; public: // Static methods @@ -155,7 +155,7 @@ public: m_cslotRestartBackup = cslotRestartBackup; m_vnSkipOffsets.resize(vnSkipOffsets.size()); for (size_t i = 0; i < vnSkipOffsets.size(); i++) - m_vnSkipOffsets[i] = vnSkipOffsets[i]; + m_vnSkipOffsets[i] = sdata8(vnSkipOffsets[i]); } int NextRestartBackup() { @@ -163,11 +163,12 @@ public: } int RestartBackup() { - return (m_psegPrev)? m_psegPrev->NextRestartBackup(): 0; + //return (m_psegPrev)? m_psegPrev->NextRestartBackup(): 0; + return 0; } int SkipOffset(int ipass) { - return m_vnSkipOffsets[ipass]; + return int(m_vnSkipOffsets[ipass]); } DirCode PreviousStrongDir() { @@ -204,9 +205,9 @@ public: void SetFaceName(std::wstring stu, std::wstring stuBase) { - m_stuFaceName = stu; - m_stuBaseFaceName = stuBase; - m_fUseSepBase = (m_stuBaseFaceName.size() > 0); +// m_stuFaceName = stu; +// m_stuBaseFaceName = stuBase; +// m_fUseSepBase = (m_stuBaseFaceName.size() > 0); } void SetEngine(GrEngine * pgreng); @@ -239,6 +240,19 @@ public: void MarkSlotInPrevSeg(int ichw, int islot); void MarkSlotInNextSeg(int ichw, int islot); + void CleanUpAssocsVectors() + { + for (int iv = 0; iv < m_ichwAssocsLim - m_ichwAssocsMin; iv++) + { + std::vector<int> * pvislout = m_prgpvisloutAssocs[iv]; + if (pvislout->size() <= 1) + { + delete pvislout; + *(m_prgpvisloutAssocs + iv) = NULL; + } + } + } + GrSlotOutput * OutputSlot(int islout); void RecordInitializationForNextSeg(int cbNextSegDat, byte * pbNextSegDat) @@ -302,12 +316,17 @@ public: Rect ComponentRect(GrSlotOutput * pslout, int icomp); + void ClusterMembersForGlyph(int islout, int disloutCluster, std::vector<int> & visloutRet); + // for transduction logging: // implementations are empty unless TRACING is defined void LogUnderlyingToSurface(GrTableManager * ptman, std::ostream & strmOut, GrCharStream * pchstrm); void LogSurfaceToUnderlying(GrTableManager * ptman, std::ostream & strmOut); + // calculate memory usage + void calculateMemoryUsage(SegmentMemoryUsage & smu); + protected: // Member variables: long m_cref; // standard COM ref count @@ -340,17 +359,17 @@ protected: int m_dichPreContext; // what part of this segment affects the previous; // not really used for anything right now - Segment * m_psegPrev; // OBSOLETE - Segment * m_psegNext; +// Segment * m_psegPrev; // OBSOLETE +// Segment * m_psegNext; // Font information: - std::wstring m_stuFaceName; - std::wstring m_stuBaseFaceName; - bool m_fUseSepBase; +// std::wstring m_stuFaceName; +// std::wstring m_stuBaseFaceName; +// bool m_fUseSepBase; - float m_pixHeight; // character height of font in pixels (NOT = ascent + descent) - bool m_fBold; - bool m_fItalic; +// float m_pixHeight; // character height of font in pixels (NOT = ascent + descent) +// bool m_fBold; +// bool m_fItalic; LineBrk m_lbStart; LineBrk m_lbEnd; @@ -366,8 +385,8 @@ protected: float m_dysFontAscent; float m_dysFontDescent; float m_xysEmSquare; // em-square of the font in display units - float m_xsDPI; // DPI of device on which segment was measured - float m_ysDPI; +// float m_xsDPI; // DPI of device on which segment was measured +// float m_ysDPI; float m_dxsStretch; // difference between actual and natural width float m_dxsWidth; // width in absence of any stretch. -1 if not computed. @@ -404,23 +423,23 @@ protected: // Underlying-to-surface associations: int * m_prgisloutBefore; // logical first int * m_prgisloutAfter; // logical last - std::vector<int> * m_prgvisloutAssocs; // all; used by range selections + std::vector<int> ** m_prgpvisloutAssocs; // all; used by range selections int * m_prgisloutLigature; // similar to above, index of associated ligature, or kNegInfinity - int * m_prgiComponent; // component of the ligature that the corresponding character + sdata8 * m_prgiComponent; // component of the ligature that the corresponding character // represents; only meaningful if corresponding item in // m_prgisloutLigature is set - GrSlotStream * m_psstrm; // TODO: rework to remove this +// GrSlotStream * m_psstrm; // TODO: rework to remove this int m_cslout; GrSlotOutput * m_prgslout; // final output slots u_intslot * m_prgnSlotVarLenBuf; // var-length buffer for slots--one big buffer managed by the // segment, but pointed to by the slots - int m_cnUserDefn; +// int m_cnUserDefn; // this information is not stored in the segment itself int m_cnCompPerLig; - int m_cnFeat; +// int m_cnFeat; // this information is not stored in the segment itself int m_cginf; int m_isloutGinf0; // islout index for m_prgginf[0]; @@ -434,7 +453,7 @@ protected: // input that need to be reprocessed when starting // the next segment - std::vector<int> m_vnSkipOffsets; // skip offset for each pass when restarting + std::vector<sdata8> m_vnSkipOffsets; // skip offset for each pass when restarting DirCode m_dircPrevStrong; // previous strong directionality code DirCode m_dircPrevTerm; // previous terminator code, if any @@ -447,8 +466,8 @@ protected: void ComputeDimensions(); - void SetUpGlyphInfo(GrTableManager * ptman, gid16 chwLB, int nDirDepth, - int islotMin, int cslot); + void SetUpGlyphInfo(GrTableManager * ptman, GrSlotStream * psstrmFinal, + gid16 chwLB, int nDirDepth, int islotMin, int cslot); void SetUpLigInfo(GrTableManager * ptman, GlyphInfo & ginf, GrSlotOutput * pslout); void InitBeforeArrayFromPrevSeg(); // obsolete @@ -468,7 +487,7 @@ protected: int UnderlyingToPhysicalSurface(int ichw, bool fBefore); int LogicalToPhysicalSurface(int islout); void UnderlyingToPhysicalAssocs(int ichw, std::vector<int> & viginf); - std::vector<int> * UnderlyingToLogicalAssocs(int ichw); + std::vector<int> UnderlyingToLogicalAssocs(int ichw); int UnderlyingToLogicalInThisSeg(int ichw); bool SameSurfaceGlyphs(int ichw1, int ichw2); diff --git a/Build/source/libs/graphite-engine/include/graphite/SegmentAux.h b/Build/source/libs/graphite-engine/include/graphite/SegmentAux.h index 0b07d8b3e32..293ba291436 100644 --- a/Build/source/libs/graphite-engine/include/graphite/SegmentAux.h +++ b/Build/source/libs/graphite-engine/include/graphite/SegmentAux.h @@ -105,11 +105,11 @@ protected: }; inline Segment & GlyphInfo::segment() throw () { - return *m_pseg; + return * m_pseg; } inline const Segment & GlyphInfo::segment() const throw () { - return *m_pseg; + return * m_pseg; } @@ -123,8 +123,8 @@ class GlyphIterator friend class GlyphInfo; friend class Segment; - // Pointers into the glyph infor store - GlyphInfo * _itr; + // Pointers into the glyph info store + GlyphInfo * m_pginf; protected: // Constructor @@ -132,39 +132,39 @@ protected: public: // Default constructor. - GlyphIterator() throw (): _itr(0) {} + GlyphIterator() throw (): m_pginf(0) {} explicit GlyphIterator(const GlyphSetIterator &); // Forward iterator requirements. - reference operator*() const { assert(_itr); return *_itr; } - pointer operator->() const { return _itr; } - GlyphIterator & operator++() throw() { ++_itr; return *this; } - GlyphIterator operator++(int) throw() { GlyphIterator tmp = *this; operator++(); return tmp; } + reference operator*() const { assert(m_pginf != 0); return *m_pginf; } + pointer operator->() const { return m_pginf; } + GlyphIterator & operator++() throw() { ++m_pginf; return *this; } + GlyphIterator operator++(int) throw() { GlyphIterator tmp = *this; operator++(); return tmp; } // Bidirectional iterator requirements - GlyphIterator & operator--() throw() { --_itr; return *this; } - GlyphIterator operator--(int) throw() { GlyphIterator tmp = *this; operator--(); return tmp; } + GlyphIterator & operator--() throw() { --m_pginf; return *this; } + GlyphIterator operator--(int) throw() { GlyphIterator tmp = *this; operator--(); return tmp; } // Random access iterator requirements - reference operator[](difference_type n) const { return _itr[n]; } - GlyphIterator & operator+=(difference_type n) throw() { _itr += n; return *this; } - GlyphIterator operator+(difference_type n) const throw() { GlyphIterator r = *this; return r += n; } - GlyphIterator & operator-=(difference_type n) throw() { _itr -= n; return *this; } - GlyphIterator operator-(difference_type n) const throw() { GlyphIterator r = *this; return r += -n; } + reference operator[](difference_type n) const { return m_pginf[n]; } + GlyphIterator & operator+=(difference_type n) throw() { m_pginf += n; return *this; } + GlyphIterator operator+(difference_type n) const throw() { GlyphIterator r = *this; return r += n; } + GlyphIterator & operator-=(difference_type n) throw() { m_pginf -= n; return *this; } + GlyphIterator operator-(difference_type n) const throw() { GlyphIterator r = *this; return r += -n; } // Relational operators. // Forward iterator requirements - bool operator==(const GlyphIterator & rhs) const throw() { return _itr == rhs._itr; } - bool operator!=(const GlyphIterator & rhs) const throw() { return !(*this == rhs); } + bool operator==(const GlyphIterator & rhs) const throw() { return m_pginf == rhs.m_pginf; } + bool operator!=(const GlyphIterator & rhs) const throw() { return !(*this == rhs); } // Random access iterator requirements - bool operator<(const GlyphIterator & rhs) const throw() { return _itr < rhs._itr; } - bool operator>(const GlyphIterator & rhs) const throw() { return _itr > rhs._itr; } - bool operator<=(const GlyphIterator & rhs) const throw() { return !(*this > rhs); } - bool operator>=(const GlyphIterator & rhs) const throw() { return !(*this < rhs); } + bool operator<(const GlyphIterator & rhs) const throw() { return m_pginf < rhs.m_pginf; } + bool operator>(const GlyphIterator & rhs) const throw() { return m_pginf > rhs.m_pginf; } + bool operator<=(const GlyphIterator & rhs) const throw() { return !(*this > rhs); } + bool operator>=(const GlyphIterator & rhs) const throw() { return !(*this < rhs); } - difference_type operator-(const GlyphIterator & rhs) const throw() { return _itr - rhs._itr; } + difference_type operator-(const GlyphIterator & rhs) const throw() { return m_pginf - rhs.m_pginf; } }; inline GlyphIterator operator+(const GlyphIterator::difference_type n, const GlyphIterator & rhs) @@ -174,6 +174,40 @@ inline GlyphIterator operator+(const GlyphIterator::difference_type n, const Gly /*---------------------------------------------------------------------------------------------- + This reference-counted vector is used as the basis of GlyphSetIterator. This is because + multiple iterators are based on the same vector, so it needs to hang around appropriately. +----------------------------------------------------------------------------------------------*/ +class RcVector +{ + friend class GlyphSetIterator; + +public: + RcVector(std::vector<int> & vn) + { + m_vn = vn; + m_cref = 0; + } + +protected: + void IncRefCount() const + { + m_cref++; + } + void DecRefCount() const + { + m_cref--; + if (m_cref <= 0) + delete this; + } + + const std::vector<int> & Vector() const { return m_vn; }; + + // member variables: + mutable int m_cref; + std::vector<int> m_vn; +}; + +/*---------------------------------------------------------------------------------------------- The GlyphSetIterator class allows the Graphite client to iterate over a non-contiguous set of glyphs for the segment, this is almost always the set of glyphs for a character. ----------------------------------------------------------------------------------------------*/ @@ -184,54 +218,87 @@ class GlyphSetIterator friend class Segment; // Segment containing the glyphs being iterated over. - const Segment * _seg_ptr; + const Segment * m_pseg; // Sometimes, in the case of character-to-glyph look-ups or attached // children, we need to represent a non-contiguous list; in these cases // we first map through a vector of output-slot objects into the actual // glyph-info store. - std::vector<int>::const_iterator _itr; + std::vector<int>::const_iterator m_vit; + + // Store a reliable copy of the vector we are iterating over: + const RcVector * m_qvislout; protected: // Constructor that includes output-slot mapping list, used for non-contiguous lists: - GlyphSetIterator(Segment & seg, size_t islout, const std::vector<int> & vislout) - : _seg_ptr(&seg), _itr(vislout.begin() + islout) - {} - + GlyphSetIterator(Segment & seg, size_t islout, RcVector * qvislout) + : m_pseg(&seg), m_vit(qvislout->Vector().begin() + islout) + { + m_qvislout = qvislout; + m_qvislout->IncRefCount(); + } public: // Default constructor--no output-slot mapping: - GlyphSetIterator() throw (): _seg_ptr(0), _itr(std::vector<int>::const_iterator()) - {} + GlyphSetIterator() throw() : m_pseg(0), m_vit(std::vector<int>::const_iterator()) + { + m_qvislout = NULL; + } + + // Copy constructor: + GlyphSetIterator(const GlyphSetIterator & sit) throw() + { + m_pseg = sit.m_pseg; + m_vit = sit.m_vit; + m_qvislout = sit.m_qvislout; + if (m_qvislout) + m_qvislout->IncRefCount(); + } + // Assignment operator: + GlyphSetIterator & operator=(const GlyphSetIterator & sit) throw() + { + m_pseg = sit.m_pseg; + m_vit = sit.m_vit; + m_qvislout = sit.m_qvislout; + if (m_qvislout) + m_qvislout->IncRefCount(); + return *this; + } + // Destructor: + ~GlyphSetIterator() + { + if (m_qvislout) + m_qvislout->DecRefCount(); + } // Forward iterator requirements. - reference operator*() const; - pointer operator->() const { return &(operator*()); } - GlyphSetIterator & operator++() throw() { ++_itr; return *this; } - GlyphSetIterator operator++(int) throw() { GlyphSetIterator tmp = *this; operator++(); return tmp; } + reference operator*() const; + pointer operator->() const { return &(operator*()); } + GlyphSetIterator & operator++() throw() { ++m_vit; return *this; } + GlyphSetIterator operator++(int) throw() { GlyphSetIterator tmp = *this; operator++(); return tmp; } // Bidirectional iterator requirements - GlyphSetIterator & operator--() throw() { --_itr; return *this; } - GlyphSetIterator operator--(int) throw() { GlyphSetIterator tmp = *this; operator--(); return tmp; } + GlyphSetIterator & operator--() throw() { --m_vit; return *this; } + GlyphSetIterator operator--(int) throw() { GlyphSetIterator tmp = *this; operator--(); return tmp; } // Random access iterator requirements - reference operator[](difference_type n) const { return *operator+(n); } - GlyphSetIterator & operator+=(difference_type n) throw() { _itr += n; return *this; } - GlyphSetIterator operator+(difference_type n) const throw() { GlyphSetIterator r = *this; return r += n; } - GlyphSetIterator & operator-=(difference_type n) throw() { operator+=(-n); return *this; } - GlyphSetIterator operator-(difference_type n) const throw() { GlyphSetIterator r = *this; return r += -n; } + reference operator[](difference_type n) const { return *operator+(n); } + GlyphSetIterator & operator+=(difference_type n) throw() { m_vit += n; return *this; } + GlyphSetIterator operator+(difference_type n) const throw() { GlyphSetIterator r = *this; return r += n; } + GlyphSetIterator & operator-=(difference_type n) throw() { operator+=(-n); return *this; } + GlyphSetIterator operator-(difference_type n) const throw() { GlyphSetIterator r = *this; return r += -n; } // Relational operators. // Forward iterator requirements - bool operator==(const GlyphSetIterator & rhs) const throw() { return _itr == rhs._itr; } - bool operator!=(const GlyphSetIterator & rhs) const throw() { return !(*this == rhs); } + bool operator==(const GlyphSetIterator & rhs) const throw() { return m_vit == rhs.m_vit; } + bool operator!=(const GlyphSetIterator & rhs) const throw() { return !(*this == rhs); } // Random access iterator requirements - bool operator<(const GlyphSetIterator & rhs) const throw() { return _itr < rhs._itr; } - bool operator>(const GlyphSetIterator & rhs) const throw() { return _itr > rhs._itr; } - bool operator<=(const GlyphSetIterator & rhs) const throw() { return !(*this > rhs); } - bool operator>=(const GlyphSetIterator & rhs) const throw() { return !(*this < rhs); } + bool operator<(const GlyphSetIterator & rhs) const throw() { return m_vit < rhs.m_vit; } + bool operator>(const GlyphSetIterator & rhs) const throw() { return m_vit > rhs.m_vit; } + bool operator<=(const GlyphSetIterator & rhs) const throw() { return !(*this > rhs); } + bool operator>=(const GlyphSetIterator & rhs) const throw() { return !(*this < rhs); } - difference_type operator-(const GlyphSetIterator & rhs) const throw() { return _itr - rhs._itr; } + difference_type operator-(const GlyphSetIterator & rhs) const throw() { return m_vit - rhs.m_vit; } }; inline GlyphSetIterator operator+(const GlyphSetIterator::difference_type n, const GlyphSetIterator & rhs) @@ -285,7 +352,7 @@ public: inline void setTrailingWs(TrWsHandling twsh) { m_twsh = twsh; } inline void setLoggingStream(std::ostream * pstrm) { m_pstrmLog = pstrm; } inline void setDumbFallback(bool f) { m_fDumbFallback = f; } - inline void setPrevSegment(Segment * pseg) { m_psegPrev = pseg; } + inline void setPrevSegment(Segment * pseg) { m_psegPrev = pseg; } inline void setSegmentForInit(Segment * pseg) { m_psegInit = pseg; } inline void setJustifier(IGrJustifier * pjust) { m_pjust = pjust; } diff --git a/Build/source/libs/graphite-engine/include/graphite/SegmentPainter.h b/Build/source/libs/graphite-engine/include/graphite/SegmentPainter.h index caa7d445690..29564a6c63d 100644 --- a/Build/source/libs/graphite-engine/include/graphite/SegmentPainter.h +++ b/Build/source/libs/graphite-engine/include/graphite/SegmentPainter.h @@ -26,7 +26,8 @@ Description: namespace gr { - class Segment; +class Segment; + /*---------------------------------------------------------------------------------------------- A SegmentPainter handles the UI-related operations on for segment. @@ -82,14 +83,12 @@ public: int charIndex, bool assocPrevMatch, bool assocPrevNeeded, int anchorIndex, bool movingRight, bool * inThisSeg); - // For calculating underlines: struct LineSeg { // hungarian: ls float left; float right; }; - static float ScaleX(float xs, Rect rs, Rect rd); static float ScaleY(float ys, Rect rs, Rect rd); @@ -157,6 +156,8 @@ protected: float * pxsBefore, float ysBeforeTop, float ysBeforeBottom, float * pxsAfter, float ysAfterTop, float ysAfterBottom); bool AtEdgeOfCluster(GrSlotOutput * pslout, int islout, bool fBefore); + bool AtEdgeOfCluster(GrSlotOutput * psloutBase, int isloutBase, + GrSlotOutput * pslout, int islout, bool fBefore); bool CanInsertIntoCluster(GrSlotOutput * pslout, int islout); void CalcPartialLigatures(bool * prgfAllSelected, diff --git a/Build/source/libs/graphite-engine/license/LICENSING.txt b/Build/source/libs/graphite-engine/license/LICENSING.txt index 9047eed9a04..33a150a94d6 100644 --- a/Build/source/libs/graphite-engine/license/LICENSING.txt +++ b/Build/source/libs/graphite-engine/license/LICENSING.txt @@ -1,7 +1,7 @@ - Graphite 2.1 and WorldPad 0.8 Licensing + Graphite 2.1 Licensing Copyright 1999-2006, SIL International - All rights reserved. + All rights reserved. This library is free software; you can redistribute it and/or modify it under the terms of either: diff --git a/Build/source/libs/graphite-engine/makefile.vc b/Build/source/libs/graphite-engine/makefile.vc index cf3cb23a746..9cc824becc2 100644 --- a/Build/source/libs/graphite-engine/makefile.vc +++ b/Build/source/libs/graphite-engine/makefile.vc @@ -66,7 +66,6 @@ LINK_OBJS=\ # "$(INTDIR)\HashMap_i$(OBJEXT)"\ "$(INTDIR)\Debug$(OBJEXT)"\ "$(INTDIR)\Util$(OBJEXT)"\ - "$(INTDIR)\explicit_instantiations$(OBJEXT)"\ "$(INTDIR)\Font$(OBJEXT)"\ "$(INTDIR)\FileFont$(OBJEXT)"\ "$(INTDIR)\FontCache$(OBJEXT)"\ @@ -83,6 +82,7 @@ LINK_OBJS=\ "$(INTDIR)\GrSlotState$(OBJEXT)"\ "$(INTDIR)\GrSlotStream$(OBJEXT)"\ "$(INTDIR)\GrTableManager$(OBJEXT)"\ + "$(INTDIR)\MemoryUsage$(OBJEXT)"\ "$(INTDIR)\Segment$(OBJEXT)"\ "$(INTDIR)\SegmentAux$(OBJEXT)"\ "$(INTDIR)\SegmentPainter$(OBJEXT)"\ @@ -99,7 +99,6 @@ LINK_DLL_OBJS=\ # "$(INTDIR)\HashMap_i_dll$(OBJEXT)"\ "$(INTDIR)\Debug_dll$(OBJEXT)"\ "$(INTDIR)\Util_dll$(OBJEXT)"\ - "$(INTDIR)\explicit_instantiations_dll$(OBJEXT)"\ "$(INTDIR)\Font_dll$(OBJEXT)"\ "$(INTDIR)\WinFont_dll$(OBJEXT)"\ "$(INTDIR)\FileFont_dll$(OBJEXT)"\ @@ -117,6 +116,7 @@ LINK_DLL_OBJS=\ "$(INTDIR)\GrSlotState_dll$(OBJEXT)"\ "$(INTDIR)\GrSlotStream_dll$(OBJEXT)"\ "$(INTDIR)\GrTableManager_dll$(OBJEXT)"\ + "$(INTDIR)\MemoryUsage_dll$(OBJEXT)"\ "$(INTDIR)\Segment_dll$(OBJEXT)"\ "$(INTDIR)\SegmentAux_dll$(OBJEXT)"\ "$(INTDIR)\SegmentPainter_dll$(OBJEXT)"\ @@ -135,7 +135,6 @@ BSC32_SBRS=\ # "$(INTDIR)\HashMap_i$(SBREXT)"\ "$(INTDIR)\Debug$(SBREXT)"\ "$(INTDIR)\Util$(SBREXT)"\ - "$(INTDIR)\explicit_instantiations$(SBREXT)"\ "$(INTDIR)\Font$(SBREXT)"\ "$(INTDIR)\WinFont$(SBREXT)"\ "$(INTDIR)\FileFont$(SBREXT)"\ @@ -153,6 +152,7 @@ BSC32_SBRS=\ "$(INTDIR)\GrSlotState$(SBREXT)"\ "$(INTDIR)\GrSlotStream$(SBREXT)"\ "$(INTDIR)\GrTableManager$(SBREXT)"\ + "$(INTDIR)\MemoryUsage$(SBREXT)"\ "$(INTDIR)\Segment$(SBREXT)"\ "$(INTDIR)\SegmentAux$(SBREXT)"\ "$(INTDIR)\SegmentPainter$(SBREXT)"\ @@ -362,22 +362,6 @@ lib_dll : "$(OUTDIR)/$(TARGET)_dll.lib" !ENDIF !IF "$(CFG)" == "DEBUG" -"$(INTDIR)\explicit_instantiations$(OBJEXT)" "$(INTDIR)\explicit_instantiations$(SBREXT)" : "src/segment/explicit_instantiations.cpp" - @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\explicit_instantiations$(OBJEXT)" $? - -"$(INTDIR)\explicit_instantiations_dll$(OBJEXT)" "$(INTDIR)\explicit_instantiations_dll$(SBREXT)" : "src/segment/explicit_instantiations.cpp" - @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\explicit_instantiations_dll$(OBJEXT)" $? - -!ELSE -"$(INTDIR)\explicit_instantiations$(OBJEXT)" : "src/segment/explicit_instantiations.cpp" - @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\explicit_instantiations$(OBJEXT)" $? - -"$(INTDIR)\explicit_instantiations_dll$(OBJEXT)" : "src/segment/explicit_instantiations.cpp" - @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\explicit_instantiations_dll$(OBJEXT)" $? - -!ENDIF - -!IF "$(CFG)" == "DEBUG" "$(INTDIR)\FontCache$(OBJEXT)" "$(INTDIR)\FontCache$(SBREXT)" : "src/segment/FontCache.cpp" @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\FontCache$(OBJEXT)" $? @@ -602,6 +586,22 @@ lib_dll : "$(OUTDIR)/$(TARGET)_dll.lib" !ENDIF !IF "$(CFG)" == "DEBUG" +"$(INTDIR)\MemoryUsage$(OBJEXT)" "$(INTDIR)\MemoryUsage$(SBREXT)" : "src/segment/MemoryUsage.cpp" + @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\MemoryUsage$(OBJEXT)" $? + +"$(INTDIR)\MemoryUsage_dll$(OBJEXT)" "$(INTDIR)\MemoryUsage_dll$(SBREXT)" : "src/segment/MemoryUsage.cpp" + @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\MemoryUsage_dll$(OBJEXT)" $? + +!ELSE +"$(INTDIR)\MemoryUsage$(OBJEXT)" : "src/segment/MemoryUsage.cpp" + @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\MemoryUsage$(OBJEXT)" $? + +"$(INTDIR)\MemoryUsage_dll$(OBJEXT)" : "src/segment/MemoryUsage.cpp" + @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\MemoryUsage_dll$(OBJEXT)" $? + +!ENDIF + +!IF "$(CFG)" == "DEBUG" "$(INTDIR)\Segment$(OBJEXT)" "$(INTDIR)\Segment$(SBREXT)" : "src/segment/Segment.cpp" @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\Segment$(OBJEXT)" $? diff --git a/Build/source/libs/graphite-engine/src/Makefile.in b/Build/source/libs/graphite-engine/src/Makefile.in index c626cb160ce..e84ac5e7e29 100644 --- a/Build/source/libs/graphite-engine/src/Makefile.in +++ b/Build/source/libs/graphite-engine/src/Makefile.in @@ -64,9 +64,9 @@ am_libgraphite_la_OBJECTS = Debug.lo Util.lo Font.lo TtfUtil.lo \ FileFont.lo FileInput.lo FontCache.lo FontFace.lo \ GrCharStream.lo GrClassTable.lo GrEngine.lo GrFeature.lo \ GrFSM.lo GrGlyphTable.lo GrPassActionCode.lo GrPass.lo \ - GrSlotState.lo GrSlotStream.lo GrTableManager.lo Platform.lo \ - SegmentAux.lo Segment.lo TestFSM.lo TestPasses.lo \ - TransductionLog.lo SegmentPainter.lo + GrSlotState.lo GrSlotStream.lo GrTableManager.lo \ + MemoryUsage.lo Platform.lo SegmentAux.lo Segment.lo TestFSM.lo \ + TestPasses.lo TransductionLog.lo SegmentPainter.lo libgraphite_la_OBJECTS = $(am_libgraphite_la_OBJECTS) DEFAULT_INCLUDES = -I. -I$(srcdir) depcomp = $(SHELL) $(top_srcdir)/config/depcomp @@ -141,6 +141,7 @@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ REL_CODENAME = @REL_CODENAME@ +SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ SIZEOF_WCHAR_T = @SIZEOF_WCHAR_T@ @@ -207,8 +208,7 @@ EXTRA_DIST = $(top_srcdir)/include/graphite/BinTree.h \ $(top_srcdir)/include/graphite/GenericResource.h \ $(top_srcdir)/include/graphite/HashMap.h $(genericdir)/*.h \ $(genericdir)/BinTree_i.cpp $(genericdir)/HashMap_i.cpp \ - $(fontdir)/*.h $(segmentdir)/*.h \ - $(segmentdir)/explicit_instantiations.cpp + $(fontdir)/*.h $(segmentdir)/*.h graphiteinclude_HEADERS = $(top_srcdir)/include/graphite/FileFont.h \ $(top_srcdir)/include/graphite/Font.h \ $(top_srcdir)/include/graphite/GraphiteProcess.h \ @@ -229,6 +229,7 @@ graphiteinclude_HEADERS = $(top_srcdir)/include/graphite/FileFont.h \ $(top_srcdir)/include/graphite/IGrEngine.h \ $(top_srcdir)/include/graphite/IGrJustifier.h \ $(top_srcdir)/include/graphite/ITextSource.h \ + $(top_srcdir)/include/graphite/MemoryUsage.h \ $(top_srcdir)/include/graphite/SegmentAux.h \ $(top_srcdir)/include/graphite/Segment.h \ $(top_srcdir)/include/graphite/SegmentPainter.h @@ -243,10 +244,10 @@ libgraphite_la_SOURCES = $(genericdir)/Debug.cpp \ $(segmentdir)/GrGlyphTable.cpp \ $(segmentdir)/GrPassActionCode.cpp $(segmentdir)/GrPass.cpp \ $(segmentdir)/GrSlotState.cpp $(segmentdir)/GrSlotStream.cpp \ - $(segmentdir)/GrTableManager.cpp $(segmentdir)/Platform.cpp \ - $(segmentdir)/SegmentAux.cpp $(segmentdir)/Segment.cpp \ - $(segmentdir)/TestFSM.cpp $(segmentdir)/TestPasses.cpp \ - $(segmentdir)/TransductionLog.cpp \ + $(segmentdir)/GrTableManager.cpp $(segmentdir)/MemoryUsage.cpp \ + $(segmentdir)/Platform.cpp $(segmentdir)/SegmentAux.cpp \ + $(segmentdir)/Segment.cpp $(segmentdir)/TestFSM.cpp \ + $(segmentdir)/TestPasses.cpp $(segmentdir)/TransductionLog.cpp \ $(painterdir)/SegmentPainter.cpp genericdir = $(top_srcdir)/src/generic fontdir = $(top_srcdir)/src/font @@ -338,6 +339,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GrSlotState.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GrSlotStream.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GrTableManager.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/MemoryUsage.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Platform.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Segment.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SegmentAux.Plo@am__quote@ @@ -502,6 +504,13 @@ GrTableManager.lo: $(segmentdir)/GrTableManager.cpp @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o GrTableManager.lo `test -f '$(segmentdir)/GrTableManager.cpp' || echo '$(srcdir)/'`$(segmentdir)/GrTableManager.cpp +MemoryUsage.lo: $(segmentdir)/MemoryUsage.cpp +@am__fastdepCXX_TRUE@ if $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT MemoryUsage.lo -MD -MP -MF "$(DEPDIR)/MemoryUsage.Tpo" -c -o MemoryUsage.lo `test -f '$(segmentdir)/MemoryUsage.cpp' || echo '$(srcdir)/'`$(segmentdir)/MemoryUsage.cpp; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/MemoryUsage.Tpo" "$(DEPDIR)/MemoryUsage.Plo"; else rm -f "$(DEPDIR)/MemoryUsage.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(segmentdir)/MemoryUsage.cpp' object='MemoryUsage.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o MemoryUsage.lo `test -f '$(segmentdir)/MemoryUsage.cpp' || echo '$(srcdir)/'`$(segmentdir)/MemoryUsage.cpp + Platform.lo: $(segmentdir)/Platform.cpp @am__fastdepCXX_TRUE@ if $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT Platform.lo -MD -MP -MF "$(DEPDIR)/Platform.Tpo" -c -o Platform.lo `test -f '$(segmentdir)/Platform.cpp' || echo '$(srcdir)/'`$(segmentdir)/Platform.cpp; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/Platform.Tpo" "$(DEPDIR)/Platform.Plo"; else rm -f "$(DEPDIR)/Platform.Tpo"; exit 1; fi diff --git a/Build/source/libs/graphite-engine/src/font/FileFont.cpp b/Build/source/libs/graphite-engine/src/font/FileFont.cpp index 66d1ea757e5..122a904063f 100755 --- a/Build/source/libs/graphite-engine/src/font/FileFont.cpp +++ b/Build/source/libs/graphite-engine/src/font/FileFont.cpp @@ -30,15 +30,15 @@ namespace gr FileFont::FileFont() : Font(), - m_file(NULL), + m_pfile(NULL), m_pTableCache(NULL), - m_ascent(0), - m_descent(0), - m_emSquare(0), + m_mAscent(0), + m_mDescent(0), + m_mEmSquare(0), m_pointSize(0), m_dpiX(FUDGE_FACTOR), m_dpiY(FUDGE_FACTOR), - m_isValid(false), + m_fIsValid(false), m_pHeader(NULL), m_pTableDir(NULL), m_xScale(1.0f), @@ -51,24 +51,24 @@ FileFont::FileFont() m_clrBack = (unsigned long)kclrTransparent; } -FileFont::FileFont(FILE * file, float pointSize, +FileFont::FileFont(FILE * pfile, float pointSize, unsigned int dpiX, unsigned int dpiY) : Font(), - m_file(file), + m_pfile(pfile), m_pTableCache(NULL), - m_ascent(0), - m_descent(0), - m_emSquare(0), + m_mAscent(0), + m_mDescent(0), + m_mEmSquare(0), m_pointSize(pointSize), m_dpiX(dpiX), m_dpiY(dpiY), - m_isValid(false), + m_fIsValid(false), m_pHeader(NULL), m_pTableDir(NULL), m_xScale(1.0f), m_yScale(1.0f) { - Assert(m_file); // shouldn't be null + Assert(m_pfile); // shouldn't be null initializeFromFace(); } @@ -76,22 +76,22 @@ FileFont::FileFont(FILE * file, float pointSize, FileFont::FileFont(char * fileName, float pointSize, unsigned int dpiX, unsigned int dpiY) : Font(), - m_file(NULL), + m_pfile(NULL), m_pTableCache(NULL), - m_ascent(0), - m_descent(0), - m_emSquare(0), + m_mAscent(0), + m_mDescent(0), + m_mEmSquare(0), m_pointSize(pointSize), m_dpiX(dpiX), m_dpiY(dpiY), - m_isValid(false), + m_fIsValid(false), m_pHeader(NULL), m_pTableDir(NULL), m_xScale(1.0f), m_yScale(1.0f) { Assert(fileName); // shouldn't be null but we play safe anyway - m_file = fopen(fileName, "rb"); + m_pfile = fopen(fileName, "rb"); initializeFromFace(); } @@ -99,22 +99,22 @@ FileFont::FileFont(char * fileName, float pointSize, FileFont::FileFont(std::string fileName, float pointSize, unsigned int dpiX, unsigned int dpiY) : Font(), - m_file(NULL), + m_pfile(NULL), m_pTableCache(NULL), - m_ascent(0), - m_descent(0), - m_emSquare(0), + m_mAscent(0), + m_mDescent(0), + m_mEmSquare(0), m_pointSize(pointSize), m_dpiX(dpiX), m_dpiY(dpiY), - m_isValid(false), + m_fIsValid(false), m_pHeader(NULL), m_pTableDir(NULL), m_xScale(1.0f), m_yScale(1.0f) { Assert(fileName.length()); // shouldn't be null but we play safe anyway - m_file = fopen(fileName.c_str(), "rb"); + m_pfile = fopen(fileName.c_str(), "rb"); initializeFromFace(); } @@ -130,61 +130,61 @@ FileFont::initializeFromFace() m_clrFore = (unsigned long)kclrBlack; m_clrBack = (unsigned long)kclrTransparent; - if (m_file) + if (m_pfile) { size_t lOffset, lSize; TtfUtil::GetHeaderInfo(lOffset, lSize); m_pHeader = new byte [lSize]; - m_isValid = true; + m_fIsValid = true; if (!m_pHeader) { - m_isValid = false; + m_fIsValid = false; return; } - m_isValid = (fseek(m_file, lOffset, SEEK_SET) == 0); - size_t bytesRead = fread(m_pHeader, 1, lSize, m_file); + m_fIsValid = (fseek(m_pfile, lOffset, SEEK_SET) == 0); + size_t bytesRead = fread(m_pHeader, 1, lSize, m_pfile); Assert(bytesRead == lSize); - m_isValid = TtfUtil::CheckHeader(m_pHeader); + m_fIsValid = TtfUtil::CheckHeader(m_pHeader); - if (!m_isValid) return; - m_isValid = TtfUtil::GetTableDirInfo(m_pHeader, lOffset, lSize); + if (!m_fIsValid) return; + m_fIsValid = TtfUtil::GetTableDirInfo(m_pHeader, lOffset, lSize); m_pTableDir = new byte[lSize]; if (!m_pTableDir) { - m_isValid = false; + m_fIsValid = false; return; } // if lOffset hasn't changed this isn't needed - fseek(m_file, lOffset, SEEK_SET); - bytesRead = fread(m_pTableDir, 1, lSize, m_file); + fseek(m_pfile, lOffset, SEEK_SET); + bytesRead = fread(m_pTableDir, 1, lSize, m_pfile); Assert(bytesRead == lSize); // now read head tables - m_isValid = TtfUtil::GetTableInfo(ktiOs2, m_pHeader, m_pTableDir, + m_fIsValid = TtfUtil::GetTableInfo(ktiOs2, m_pHeader, m_pTableDir, lOffset, lSize); - if (!m_isValid) + if (!m_fIsValid) { return; } byte * pTable = readTable(ktiOs2, lSize); // get ascent, descent, style while we have the OS2 table loaded - if (!m_isValid || !pTable) + if (!m_fIsValid || !pTable) { return; } - m_isValid = TtfUtil::FontOs2Style(pTable, m_fBold, m_fItalic); - m_ascent = static_cast<float>(TtfUtil::FontAscent(pTable)); - m_descent = static_cast<float>(TtfUtil::FontDescent(pTable)); + m_fIsValid = TtfUtil::FontOs2Style(pTable, m_fBold, m_fItalic); + m_mAscent = static_cast<float>(TtfUtil::FontAscent(pTable)); + m_mDescent = static_cast<float>(TtfUtil::FontDescent(pTable)); pTable = readTable(ktiName, lSize); - if (!m_isValid || !pTable) + if (!m_fIsValid || !pTable) { return; } if (!TtfUtil::Get31EngFamilyInfo(pTable, lOffset, lSize)) { // not English name - m_isValid = false; + m_fIsValid = false; return; } Assert(lSize %2 == 0);// should be utf16 @@ -195,37 +195,34 @@ FileFont::initializeFromFace() std::copy(pTable16, pTable16 + cchw - 1, rgchwFace); rgchwFace[cchw - 1] = 0; // zero terminate TtfUtil::SwapWString(rgchwFace, cchw - 1); +// We could use something like "if (sizeof(std::wstring::value_type) == 4)" here, +// but a compile-time switch is preferable. #if SIZEOF_WCHAR_T == 4 -// if (sizeof(std::wstring::value_type) == 4) -// { for (int c16 = 0; c16 < cchw; ) { int charUsed = 0; utf32 cch32 = GrCharStream::Utf16ToUtf32(&(rgchwFace[c16]), cchw - c16, &charUsed); - m_faceName.push_back(cch32); + m_stuFaceName.push_back(cch32); c16 += charUsed; } // } #else -// else -// { - m_faceName.assign(rgchwFace); -// } + m_stuFaceName.assign(rgchwFace); #endif pTable = readTable(ktiHead, lSize); - if (!m_isValid || !pTable) + if (!m_fIsValid || !pTable) { return; } - m_emSquare = static_cast<float>(TtfUtil::DesignUnits(pTable)); + m_mEmSquare = static_cast<float>(TtfUtil::DesignUnits(pTable)); // can now set the scale m_xScale = scaleFromDpi(m_dpiX); m_yScale = scaleFromDpi(m_dpiY); } else { - m_isValid = false; + m_fIsValid = false; } } @@ -249,7 +246,7 @@ FileFont::readTable(int /*TableId*/ tid, size_t & size) lOffset, lSize); if (!isValid) return NULL; - fseek(m_file, lOffset, SEEK_SET); + fseek(m_pfile, lOffset, SEEK_SET); // only allocate if needed pTable = m_pTableCache->allocateTable(tableId, lSize); @@ -258,7 +255,7 @@ FileFont::readTable(int /*TableId*/ tid, size_t & size) isValid = false; return NULL; } - size_t bytesRead = fread(pTable, 1, lSize, m_file); + size_t bytesRead = fread(pTable, 1, lSize, m_pfile); isValid = bytesRead == lSize; if (isValid) { @@ -287,14 +284,16 @@ FileFont::~FileFont() delete [] m_pTableDir; delete m_pTableCache; m_pTableCache = NULL; - if (m_file) fclose(m_file); + if (m_pfile) + fclose(m_pfile); } } else { delete [] m_pHeader; delete [] m_pTableDir; - if (m_file) fclose(m_file); + if (m_pfile) + fclose(m_pfile); } // note the DecFontCount(); is done in the Font base class } @@ -313,14 +312,14 @@ Font * FileFont::copyThis() FileFont::FileFont(const FileFont & font, float pointSize, unsigned int dpiX, unsigned int dpiY) : Font(font), - m_file(font.m_file), - m_ascent(font.m_ascent), - m_descent(font.m_descent), - m_emSquare(font.m_emSquare), + m_pfile(font.m_pfile), + m_mAscent(font.m_mAscent), + m_mDescent(font.m_mDescent), + m_mEmSquare(font.m_mEmSquare), m_pointSize(font.m_pointSize), m_dpiX(font.m_dpiX), m_dpiY(font.m_dpiY), - m_isValid(font.m_isValid), + m_fIsValid(font.m_fIsValid), m_pHeader(font.m_pHeader), m_pTableDir(font.m_pTableDir), m_xScale(font.m_xScale), @@ -343,7 +342,7 @@ FileFont::FileFont(const FileFont & font, float pointSize, // colors are not used m_clrFore = font.m_clrFore; m_clrBack = font.m_clrBack; - m_faceName.assign(font.m_faceName); + m_stuFaceName.assign(font.m_stuFaceName); m_pTableCache = font.m_pTableCache; // use the same table cache between instances @@ -353,7 +352,7 @@ FileFont::FileFont(const FileFont & font, float pointSize, // I dont' see why we need to reget the face, but WinFont does //m_pfface = FontFace::GetFontFace(this, m_fpropDef.szFaceName, - // m_fpropDef.fBold, m_fpropDef.fItalic); + // m_fpropDef.fBold, m_fpropDef.fItalic); } @@ -398,9 +397,9 @@ FileFont::getTable(fontTableId32 tableID, size_t * pcbSize) void FileFont::getFontMetrics(float * pAscent, float * pDescent, float * pEmSquare) { - if (pEmSquare) *pEmSquare = m_emSquare * m_xScale; - if (pAscent) *pAscent = m_ascent * m_yScale; - if (pDescent) *pDescent = m_descent * m_yScale; + if (pEmSquare) *pEmSquare = m_mEmSquare * m_xScale; + if (pAscent) *pAscent = m_mAscent * m_yScale; + if (pDescent) *pDescent = m_mDescent * m_yScale; } @@ -419,7 +418,7 @@ bool FileFont::FontHasGraphiteTables(char * fileName) bool FileFont::fontHasGraphiteTables() { size_t tableSize; - bool isGraphiteFont = m_isValid; + bool isGraphiteFont = m_fIsValid; isGraphiteFont &= (readTable(ktiSilf, tableSize) != NULL); return isGraphiteFont; } diff --git a/Build/source/libs/graphite-engine/src/font/Font.cpp b/Build/source/libs/graphite-engine/src/font/Font.cpp index c0b91ce5d22..7a7d071763e 100644 --- a/Build/source/libs/graphite-engine/src/font/Font.cpp +++ b/Build/source/libs/graphite-engine/src/font/Font.cpp @@ -45,7 +45,7 @@ namespace gr /*---------------------------------------------------------------------------------------------- Constructor. ----------------------------------------------------------------------------------------------*/ -Font::Font(const Font & fontSrc) : m_pfface(fontSrc.m_pfface) +Font::Font(const Font & fontSrc) : m_pfface(fontSrc.m_pfface), m_fTablesCached(false) { if (m_pfface) m_pfface->IncFontCount(); @@ -69,6 +69,28 @@ void Font::SetFlushMode(int flush) } /*---------------------------------------------------------------------------------------------- + Cache the common tables if necessary. +----------------------------------------------------------------------------------------------*/ +void Font::EnsureTablesCached() +{ + if (m_fTablesCached) + return; + + size_t cbBogus; + m_pHead = getTable(TtfUtil::TableIdTag(ktiHead), &cbBogus); + m_pHmtx = getTable(TtfUtil::TableIdTag(ktiHmtx), &m_cbHmtxSize); + m_pGlyf = getTable(TtfUtil::TableIdTag(ktiGlyf), &cbBogus); + m_pLoca = getTable(TtfUtil::TableIdTag(ktiLoca), &m_cbLocaSize); + + // getTable can return 0 for the lengths if it is hard to calculate them, but it should + // never do that for hmtx or loca. + Assert(m_cbHmtxSize > 0); + Assert(m_cbLocaSize > 0); + + m_fTablesCached = true; +} + +/*---------------------------------------------------------------------------------------------- Return the flush mode of the font-cache. ----------------------------------------------------------------------------------------------*/ int Font::GetFlushMode() @@ -80,25 +102,34 @@ int Font::GetFlushMode() Return the internal object representing the font-face. This is the object that is stored in Graphite's internal cache. ----------------------------------------------------------------------------------------------*/ -inline FontFace & Font::fontFace() +inline FontFace & Font::fontFace(bool fDumbFallback) { if (m_pfface == 0) - initialiseFontFace(); + initialiseFontFace(fDumbFallback); return *m_pfface; } -void Font::initialiseFontFace() +void Font::initialiseFontFace(bool fDumbFallback) { std::wstring stuFaceName; bool fBold, fItalic; UniqueCacheInfo(stuFaceName, fBold, fItalic); - m_pfface = FontFace::GetFontFace(this, stuFaceName, fBold, fItalic); + m_pfface = FontFace::GetFontFace(this, stuFaceName, fBold, fItalic, fDumbFallback); Assert(m_pfface != 0); m_pfface->IncFontCount(); + + FontException fexptn; + fexptn.version = -1; + fexptn.subVersion = -1; + if (m_pfface->BadFont(&fexptn.errorCode) + || (!fDumbFallback && m_pfface->DumbFallback(&fexptn.errorCode))) + { + throw fexptn; + } } /*---------------------------------------------------------------------------------------------- @@ -137,38 +168,60 @@ void Font::UniqueCacheInfo(std::wstring & stuFace, bool & fBold, bool & fItalic) ----------------------------------------------------------------------------------------------*/ void Font::getGlyphPoint(gid16 glyphID, unsigned int pointNum, Point & pointReturn) { + EnsureTablesCached(); + // Default values pointReturn.x = 0; pointReturn.y = 0; - // this isn't used very often, so don't bother caching - size_t cbLocaSize = 0; - const void * pGlyf = getTable(TtfUtil::TableIdTag(ktiGlyf), &cbLocaSize); - if (pGlyf == 0) return; + if (m_pGlyf == 0) return; + if (m_pHead == 0) return; + if (m_pLoca == 0) return; - const void * pHead = getTable(TtfUtil::TableIdTag(ktiHead), &cbLocaSize); - if (pHead == 0) return; + size_t cContours; + size_t cPoints; - const void * pLoca = getTable(TtfUtil::TableIdTag(ktiLoca), &cbLocaSize); - if (pLoca == 0) return; + const size_t CONTOUR_BUF_SIZE = 16; + const size_t POINT_BUF_SIZE = 64; + // Fixed-size buffers that will be used in most cases: + bool rgfOnCurveFixedBuf[POINT_BUF_SIZE], *rgfOnCurveHeapBuf=0; + int rgnEndPtFixedBuf[CONTOUR_BUF_SIZE], *rgnEndPtHeapBuf=0, + rgnXFixedBuf[POINT_BUF_SIZE], *rgnXHeapBuf=0, + rgnYFixedBuf[POINT_BUF_SIZE], *rgnYHeapBuf=0; - const size_t MAX_CONTOURS = 32; - int cnPoints = MAX_CONTOURS; - bool rgfOnCurve[MAX_CONTOURS]; - int prgnX[MAX_CONTOURS]; - int prgnY[MAX_CONTOURS]; - - if (TtfUtil::GlyfPoints(glyphID, pGlyf, pLoca, - cbLocaSize, pHead, 0, 0, - prgnX, prgnY, rgfOnCurve, cnPoints)) + if (!TtfUtil::GlyfContourCount(glyphID, m_pGlyf, m_pLoca, m_cbLocaSize, m_pHead, cContours)) + return; // can't figure it out + + int * prgnEndPt = (cContours > CONTOUR_BUF_SIZE) ? + rgnEndPtHeapBuf = new int[cContours] : + rgnEndPtFixedBuf; + + if (!TtfUtil::GlyfContourEndPoints(glyphID, m_pGlyf, m_pLoca, m_cbLocaSize, m_pHead, + prgnEndPt, cContours)) + { + return; // should have been caught above + } + cPoints = prgnEndPt[cContours - 1] + 1; + + bool* prgfOnCurve = (cPoints > POINT_BUF_SIZE) ? rgfOnCurveHeapBuf= new bool[cPoints] : rgfOnCurveFixedBuf; + int * prgnX = (cPoints > POINT_BUF_SIZE) ? rgnXHeapBuf= new int[cPoints] : rgnXFixedBuf; + int * prgnY = (cPoints > POINT_BUF_SIZE) ? rgnYHeapBuf= new int[cPoints] : rgnYFixedBuf; + + if (TtfUtil::GlyfPoints(glyphID, m_pGlyf, m_pLoca, m_cbLocaSize, m_pHead, 0, 0, + prgnX, prgnY, prgfOnCurve, cPoints)) { float nPixEmSquare; getFontMetrics(0, 0, &nPixEmSquare); - const float nDesignUnitsPerPixel = float(TtfUtil::DesignUnits(pHead)) / nPixEmSquare; + const float nDesignUnitsPerPixel = float(TtfUtil::DesignUnits(m_pHead)) / nPixEmSquare; pointReturn.x = prgnX[pointNum] / nDesignUnitsPerPixel; pointReturn.y = prgnY[pointNum] / nDesignUnitsPerPixel; } + + delete[] rgnEndPtHeapBuf; + delete[] rgfOnCurveHeapBuf; + delete[] rgnXHeapBuf; + delete[] rgnYHeapBuf; } @@ -177,6 +230,8 @@ void Font::getGlyphPoint(gid16 glyphID, unsigned int pointNum, Point & pointRetu ----------------------------------------------------------------------------------------------*/ void Font::getGlyphMetrics(gid16 glyphID, gr::Rect & boundingBox, gr::Point & advances) { + EnsureTablesCached(); + // Setup default return values in case of failiure. boundingBox.left = 0; boundingBox.right = 0; @@ -185,51 +240,43 @@ void Font::getGlyphMetrics(gid16 glyphID, gr::Rect & boundingBox, gr::Point & ad advances.x = 0; advances.y = 0; - // get the necessary tables. - size_t locaSize, hmtxSize; - const void * pHead = getTable(TtfUtil::TableIdTag(ktiHead), &locaSize); - if (pHead == 0) return; - - const void * pHmtx = getTable(TtfUtil::TableIdTag(ktiHmtx), &hmtxSize); - if (pHmtx == 0) return; + if (m_pHead == 0) return; // Calculate the number of design units per pixel. float pixelEmSquare; getFontMetrics(0, 0, &pixelEmSquare); - const float designUnitsPerPixel = - float(TtfUtil::DesignUnits(pHead)) / pixelEmSquare; + const float pixelsPerDesignUnit = + pixelEmSquare / float(TtfUtil::DesignUnits(m_pHead)); + + // getTable can return 0 for the lengths if it is hard to calculate them, but it should + // never do that for hmtx or loca. + Assert(m_cbHmtxSize > 0); // Use the Hmtx and Head tables to find the glyph advances. int lsb; unsigned int advance = 0; - if (TtfUtil::HorMetrics(glyphID, pHmtx, hmtxSize, pHead, + if (TtfUtil::HorMetrics(glyphID, m_pHmtx, m_cbHmtxSize, m_pHead, lsb, advance)) { - advances.x = (advance / designUnitsPerPixel); + advances.x = (advance * pixelsPerDesignUnit); advances.y = 0.0f; } - const void * pGlyf = getTable(TtfUtil::TableIdTag(ktiGlyf), &locaSize); - if (pGlyf == 0) return; - -// const void * pHhea = getTable(TtfUtil::TableIdTag(ktiHhea), &locaSize); -// if (pHhea == 0) return; - - const void * pLoca = getTable(TtfUtil::TableIdTag(ktiLoca), &locaSize); - if (pLoca == 0) return; + if (m_pGlyf == 0) return; + if (m_pLoca == 0) return; + Assert(m_cbLocaSize > 0); - // Fetch the glyph bounding box, GlyphBox may return false for a - // whitespace glyph. + // Fetch the glyph bounding box. GlyphBox may return false for a whitespace glyph. // Note that using GlyfBox here allows attachment points (ie, points lying outside // the glyph's outline) to affect the bounding box, which might not be what we want. int xMin, xMax, yMin, yMax; - if (TtfUtil::GlyfBox(glyphID, pGlyf, pLoca, locaSize, pHead, + if (TtfUtil::GlyfBox(glyphID, m_pGlyf, m_pLoca, m_cbLocaSize, m_pHead, xMin, yMin, xMax, yMax)) { - boundingBox.left = (xMin / designUnitsPerPixel); - boundingBox.bottom = (yMin / designUnitsPerPixel); - boundingBox.right = (xMax / designUnitsPerPixel); - boundingBox.top = (yMax / designUnitsPerPixel); + boundingBox.left = (xMin * pixelsPerDesignUnit); + boundingBox.bottom = (yMin * pixelsPerDesignUnit); + boundingBox.right = (xMax * pixelsPerDesignUnit); + boundingBox.top = (yMax * pixelsPerDesignUnit); } } @@ -308,51 +355,100 @@ bool Font::getFeatureSettingLabel(FeatureSettingIterator fsit, lgid nLanguage, u ----------------------------------------------------------------------------------------------*/ size_t Font::NumberOfFeatures() { - return fontFace().NumberOfFeatures(); + try { + return fontFace().NumberOfFeatures(); + } + catch (...) { return 0; } } featid Font::FeatureID(size_t ifeat) { - return fontFace().FeatureID(ifeat); + try { + return fontFace().FeatureID(ifeat); + } + catch (...) { return 0; } } size_t Font::FeatureWithID(featid id) { - return fontFace().FeatureWithID(id); + try { + return fontFace().FeatureWithID(id); + } + catch (...) { return 0; } } bool Font::GetFeatureLabel(size_t ifeat, lgid language, utf16 * label) { - return fontFace().GetFeatureLabel(ifeat, language, label); + try { + return fontFace().GetFeatureLabel(ifeat, language, label); + } + catch (...) + { + *label = 0; + return false; + } } int Font::GetFeatureDefault(size_t ifeat) // index of default setting { - return fontFace().GetFeatureDefault(ifeat); + try { + return fontFace().GetFeatureDefault(ifeat); + } + catch (...) { return 0; } } size_t Font::NumberOfSettings(size_t ifeat) { - return fontFace().NumberOfSettings(ifeat); + try { + return fontFace().NumberOfSettings(ifeat); + } + catch (...) { return 0; } } int Font::GetFeatureSettingValue(size_t ifeat, size_t ifset) { - return fontFace().GetFeatureSettingValue(ifeat, ifset); + try { + return fontFace().GetFeatureSettingValue(ifeat, ifset); + } + catch (...) { return 0; } } bool Font::GetFeatureSettingLabel(size_t ifeat, size_t ifset, lgid language, utf16 * label) { - return fontFace().GetFeatureSettingLabel(ifeat, ifset, language, label); + try { + return fontFace().GetFeatureSettingLabel(ifeat, ifset, language, label); + } + catch (...) + { + *label = 0; + return false; + } } size_t Font::NumberOfFeatLangs() { - return fontFace().NumberOfFeatLangs(); + try { + return fontFace().NumberOfFeatLangs(); + } + catch (...) { return 0; } } short Font::FeatLabelLang(size_t ilang) { - return fontFace().FeatLabelLang(ilang); + try { + return fontFace().FeatLabelLang(ilang); + } + catch (...) { return 0; } } size_t Font::NumberOfLanguages() { - return fontFace().NumberOfLanguages(); + try { + return fontFace().NumberOfLanguages(); + } + catch (...) { return 0; } } isocode Font::LanguageCode(size_t ilang) { - return fontFace().LanguageCode(ilang); + try { + return fontFace().LanguageCode(ilang); + } + catch (...) + { + isocode ret; + std::fill_n(ret.rgch, sizeof(ret.rgch), '\0'); + return ret; + } } /*---------------------------------------------------------------------------------------------- @@ -383,7 +479,14 @@ std::pair<LanguageIterator, LanguageIterator> Font::getSupportedLanguages() ----------------------------------------------------------------------------------------------*/ ScriptDirCode Font::getSupportedScriptDirections() const throw() { - return m_pfface->ScriptDirection(); + try { + Font * pfontThis = const_cast<Font *>(this); + FontFace & fface = pfontThis->fontFace(); + return fface.ScriptDirection(); + } + catch (...) { + return kfsdcHorizLtr; + } } /*---------------------------------------------------------------------------------------------- @@ -392,22 +495,22 @@ ScriptDirCode Font::getSupportedScriptDirections() const throw() void Font::RenderLineFillSegment(Segment * pseg, ITextSource * pts, LayoutEnvironment & layout, toffset ichStart, toffset ichStop, float xsMaxWidth, bool fBacktracking) { - fontFace().RenderLineFillSegment(pseg, this, pts, layout, ichStart, ichStop, xsMaxWidth, - fBacktracking); + fontFace(layout.dumbFallback()).RenderLineFillSegment(pseg, this, pts, layout, + ichStart, ichStop, xsMaxWidth, fBacktracking); } void Font::RenderRangeSegment(Segment * pseg, ITextSource * pts, LayoutEnvironment & layout, toffset ichStart, toffset ichStop) { - fontFace().RenderRangeSegment(pseg, this, pts, layout, ichStart, ichStop); + fontFace(layout.dumbFallback()).RenderRangeSegment(pseg, this, pts, layout, ichStart, ichStop); } void Font::RenderJustifiedSegment(Segment * pseg, ITextSource * pts, LayoutEnvironment & layout, toffset ichStart, toffset ichStop, float xsCurrentWidth, float xsDesiredWidth) { - fontFace().RenderJustifiedSegment(pseg, this, pts, layout, ichStart, ichStop, - xsCurrentWidth, xsDesiredWidth); + fontFace(layout.dumbFallback()).RenderJustifiedSegment(pseg, this, pts, layout, + ichStart, ichStop, xsCurrentWidth, xsDesiredWidth); } /*---------------------------------------------------------------------------------------------- diff --git a/Build/source/libs/graphite-engine/src/font/FontTableCache.h b/Build/source/libs/graphite-engine/src/font/FontTableCache.h index bc3ac76215f..461b00d745f 100644 --- a/Build/source/libs/graphite-engine/src/font/FontTableCache.h +++ b/Build/source/libs/graphite-engine/src/font/FontTableCache.h @@ -5,7 +5,7 @@ namespace gr { -// used to allow table sharing between font copies +// used to allow table sharing among font copies // TBD: should this be a real class or is it acceptable to // make the attributes public class FontTableCache diff --git a/Build/source/libs/graphite-engine/src/font/TtfUtil.cpp b/Build/source/libs/graphite-engine/src/font/TtfUtil.cpp index e55948e0f13..0015ccf003d 100644 --- a/Build/source/libs/graphite-engine/src/font/TtfUtil.cpp +++ b/Build/source/libs/graphite-engine/src/font/TtfUtil.cpp @@ -18,6 +18,7 @@ Description: Include files ***********************************************************************************************/ // Language headers +#include <algorithm> #include <cassert> #include <cstddef> #include <stdexcept> @@ -78,12 +79,34 @@ namespace return float(f)/float(2^R); } - const char id_to_tag_map[][5] = { - "cmap", "cvt ", "cryp", "head", "fpgm", "gdir", "glyf", - "hdmx", "hhea", "hmtx", "loca", "kern", "LTSH", "maxp", - "name", "OS/2", "post", "prep", "Feat", "Glat", "Gloc", - "Silf", "Sile", "Sill" - }; +#define MAKE_TAG(a,b,c,d) ((a << 24UL) + (b << 16UL) + (c << 8UL) + (d)) + const gr::fontTableId32 mapIdToTag[] = { + MAKE_TAG('c','m','a','p'), + MAKE_TAG('c','v','t',' '), + MAKE_TAG('c','r','y','p'), + MAKE_TAG('h','e','a','d'), + MAKE_TAG('f','p','g','m'), + MAKE_TAG('g','d','i','r'), + MAKE_TAG('g','l','y','f'), + MAKE_TAG('h','d','m','x'), + MAKE_TAG('h','h','e','a'), + MAKE_TAG('h','m','t','x'), + MAKE_TAG('l','o','c','a'), + MAKE_TAG('k','e','r','n'), + MAKE_TAG('L','T','S','H'), + MAKE_TAG('m','a','x','p'), + MAKE_TAG('n','a','m','e'), + MAKE_TAG('O','S','/','2'), + MAKE_TAG('p','o','s','t'), + MAKE_TAG('p','r','e','p'), + MAKE_TAG('F','e','a','t'), + MAKE_TAG('G','l','a','t'), + MAKE_TAG('G','l','o','c'), + MAKE_TAG('S','i','l','f'), + MAKE_TAG('S','i','l','e'), + MAKE_TAG('S','i','l','l') + }; + /*---------------------------------------------------------------------------------------------- Table of standard Postscript glyph names. From Martin Hosken. Disagress with ttfdump.exe @@ -157,6 +180,7 @@ level GlyfPoints method. */ namespace TtfUtil { + /*---------------------------------------------------------------------------------------------- Get offset and size of the offset table needed to find table directory Return true if success, false otherwise @@ -1080,7 +1104,7 @@ size_t LocaLookup(gr::gid16 nGlyphId, // CheckTable verifies the index_to_loc_format is valid if (read(pTable->index_to_loc_format) == Sfnt::FontHeader::ShortIndexLocFormat) { // loca entries are two bytes and have been divided by two - if (nGlyphId < (lLocaSize >> 1) - 1) + if (nGlyphId <= (lLocaSize >> 1) - 1) // allow sentinel value to be accessed { const uint16 * pTable = reinterpret_cast<const uint16 *>(pLoca); return (read(pTable[nGlyphId]) << 1); @@ -1089,7 +1113,7 @@ size_t LocaLookup(gr::gid16 nGlyphId, if (read(pTable->index_to_loc_format) == Sfnt::FontHeader::LongIndexLocFormat) { // loca entries are four bytes - if (nGlyphId < (lLocaSize >> 2) - 1) + if (nGlyphId <= (lLocaSize >> 2) - 1) { const uint32 * pTable = reinterpret_cast<const uint32 *>(pLoca); return read(pTable[nGlyphId]); @@ -1500,6 +1524,23 @@ bool GetComponentTransform(const void * pSimpleGlyf, int nCompId, void * GlyfLookup(gr::gid16 nGlyphId, const void * pGlyf, const void * pLoca, size_t lLocaSize, const void * pHead) { + // test for valid glyph id + // CheckTable verifies the index_to_loc_format is valid + + const Sfnt::FontHeader * pTable + = reinterpret_cast<const Sfnt::FontHeader *>(pHead); + + if (read(pTable->index_to_loc_format) == Sfnt::FontHeader::ShortIndexLocFormat) + { // loca entries are two bytes (and have been divided by two) + if (nGlyphId >= (lLocaSize >> 1) - 1) // don't allow nGlyphId to access sentinel + throw std::out_of_range("glyph id out of range for font"); + } + if (read(pTable->index_to_loc_format) == Sfnt::FontHeader::LongIndexLocFormat) + { // loca entries are four bytes + if (nGlyphId >= (lLocaSize >> 2) - 1) + throw std::out_of_range("glyph id out of range for font"); + } + long lGlyfOffset = LocaLookup(nGlyphId, pLoca, lLocaSize, pHead); void * pSimpleGlyf = GlyfLookup(pGlyf, lGlyfOffset); // invalid loca offset returns null return pSimpleGlyf; @@ -1580,7 +1621,7 @@ bool GlyfBox(gr::gid16 nGlyphId, const void * pGlyf, const void * pLoca, False may indicate a white space glyph or a multi-level composite glyph. ----------------------------------------------------------------------------------------------*/ bool GlyfContourCount(gr::gid16 nGlyphId, const void * pGlyf, const void * pLoca, - long lLocaSize, const void * pHead, size_t & cnContours) + size_t lLocaSize, const void * pHead, size_t & cnContours) { cnContours = static_cast<size_t>(INT_MIN); @@ -1633,8 +1674,8 @@ bool GlyfContourCount(gr::gid16 nGlyphId, const void * pGlyf, const void * pLoca False may indicate a white space glyph or a multi-level composite glyph. ----------------------------------------------------------------------------------------------*/ bool GlyfContourEndPoints(gr::gid16 nGlyphId, const void * pGlyf, const void * pLoca, - long lLocaSize, const void * pHead, - int * prgnContourEndPoint, size_t cnPoints) + size_t lLocaSize, const void * pHead, + int * prgnContourEndPoint, size_t cnPoints) { std::fill_n(prgnContourEndPoint, cnPoints, INT_MIN); @@ -1851,18 +1892,42 @@ bool CalcAbsolutePoints(int * prgnX, int * prgnY, int cnPoints) return true; } -// returns native order unsigned long +/*---------------------------------------------------------------------------------------------- + Convert a numerical table ID to a string containing the actual name of the table. + Returns native order unsigned long. +---------------------------------------------------------------------------------------------*/ gr::fontTableId32 TableIdTag(const TableId tid) { - assert(sizeof id_to_tag_map == 5*ktiLast); + assert(sizeof(mapIdToTag) == sizeof(gr::fontTableId32) * ktiLast); assert(tid < ktiLast); - const char *table_tag = id_to_tag_map[tid]; - gr::fontTableId32 r = table_tag[0] << 24; - r |= table_tag[1] << 16; - r |= table_tag[2] << 8; - r |= table_tag[3]; - return r; + return mapIdToTag[tid]; } +/*---------------------------------------------------------------------------------------------- + Return the length of the 'name' table in bytes. + Currently used. +---------------------------------------------------------------------------------------------*/ +#if 0 +size_t NameTableLength(const gr::byte * pTable) +{ + gr::byte * pb = (const_cast<gr::byte *>(pTable)) + 2; // skip format + size_t cRecords = *pb++ << 8; cRecords += *pb++; + int dbStringOffset0 = (*pb++) << 8; dbStringOffset0 += *pb++; + int dbMaxStringOffset = 0; + for (size_t irec = 0; irec < cRecords; irec++) + { + int nPlatform = (*pb++) << 8; nPlatform += *pb++; + int nEncoding = (*pb++) << 8; nEncoding += *pb++; + int nLanguage = (*pb++) << 8; nLanguage += *pb++; + int nName = (*pb++) << 8; nName += *pb++; + int cbStringLen = (*pb++) << 8; cbStringLen += *pb++; + int dbStringOffset = (*pb++) << 8; dbStringOffset += *pb++; + if (dbMaxStringOffset < dbStringOffset + cbStringLen) + dbMaxStringOffset = dbStringOffset + cbStringLen; + } + return dbStringOffset0 + dbMaxStringOffset; +} +#endif + } // end of namespace TtfUtil diff --git a/Build/source/libs/graphite-engine/src/font/TtfUtil.h b/Build/source/libs/graphite-engine/src/font/TtfUtil.h index df914638c25..bf437ff3475 100644 --- a/Build/source/libs/graphite-engine/src/font/TtfUtil.h +++ b/Build/source/libs/graphite-engine/src/font/TtfUtil.h @@ -70,6 +70,7 @@ namespace TtfUtil ////////////////////////////////// utility methods helpful for name table bool GetNameInfo(const void * pName, int nPlatformId, int nEncodingId, int nLangId, int nNameId, size_t & lOffset, size_t & lSize); + //size_t NameTableLength(const gr::byte * pTable); int GetLangsForNames(const void * pName, int nPlatformId, int nEncodingId, int *nameIdList, int cNameIds, short *langIdList); void SwapWString(void * pWStr, size_t nSize = 0) throw (std::invalid_argument); @@ -130,7 +131,7 @@ namespace TtfUtil bool GlyfBox(gr::gid16 nGlyphId, const void * pGlyf, const void * pLoca, size_t lLocaSize, const void * pHead, int & xMin, int & yMin, int & xMax, int & yMax); bool GlyfContourCount(gr::gid16 nGlyphId, const void * pGlyf, const void * pLoca, - size_t lLocaSize, const void *pHead, int & cnContours); + size_t lLocaSize, const void *pHead, size_t & cnContours); bool GlyfContourEndPoints(gr::gid16 nGlyphId, const void * pGlyf, const void * pLoca, size_t lLocaSize, const void * pHead, int * prgnContourEndPoint, size_t cnPoints); bool GlyfPoints(gr::gid16 nGlyphId, const void * pGlyf, const void * pLoca, @@ -141,10 +142,6 @@ namespace TtfUtil bool SimplifyFlags(char * prgbFlags, int cnPoints); bool CalcAbsolutePoints(int * prgnX, int * prgnY, int cnPoints); - /*---------------------------------------------------------------------------------------------- - Return standard TTF tag for the given TableId enumeration constant - If requested ktiTableId doesn't exist, return 0; - ----------------------------------------------------------------------------------------------*/ } // end of namespace TtfUtil #endif diff --git a/Build/source/libs/graphite-engine/src/painter/SegmentPainter.cpp b/Build/source/libs/graphite-engine/src/painter/SegmentPainter.cpp index 4e6a730cf21..559f72fb887 100644 --- a/Build/source/libs/graphite-engine/src/painter/SegmentPainter.cpp +++ b/Build/source/libs/graphite-engine/src/painter/SegmentPainter.cpp @@ -520,7 +520,7 @@ void SegmentPainter::pointToChar(Point zptdClickPosition, int * pichw, bool * pf if (m_pseg->m_dysAscent < 0 || m_pseg->m_dxsWidth < 0) m_pseg->ComputeDimensions(); - if (m_pseg->m_dichwLim == 0) + if (m_pseg->m_dichwLim == 0 || m_pseg->m_cginf == 0) { *pichw = m_pseg->m_ichwMin; *pfAssocPrev = false; @@ -1435,6 +1435,8 @@ void SegmentPainter::InvertSplitIP(float xs, float ysTop, float ysBottom, void SegmentPainter::CalcIP(int ichwSel, bool fBefore, float * pxs, float * pysTop, float * pysBottom, bool * pfRtl) { + Font & font = this->m_pseg->getFont(); + int ichw = (fBefore) ? ichwSel : ichwSel - 1; int iginfOutput; @@ -1508,77 +1510,89 @@ void SegmentPainter::CalcIP(int ichwSel, bool fBefore, if (kPosInfinity == iginfOutput || kNegInfinity == iginfOutput) *pxs = kPosInfFloat; - else if (psloutTmp->IsPartOfCluster()) + else { - // Cluster member. - - if (AtEdgeOfCluster(psloutTmp, islout, fBefore) && - !CanInsertIntoCluster(psloutTmp, islout)) + bool fCluster = (psloutTmp->IsPartOfCluster()); + bool fHighlightBB = fCluster; + // Test below should match the one in CalcHighlightRect: + if ((psloutTmp->ClusterAdvance() == 0 + || psloutTmp->GlyphMetricLogUnits(&font, kgmetAdvWidth) == 0) + && !psloutTmp->IsSpace()) { - // Place the IP at the edge of the whole cluster. - - int isloutBase = psloutTmp->ClusterBase(); - GrSlotOutput * psloutBase = m_pseg->OutputSlot(isloutBase); - //int igbbBase = psloutBase->GlyphBbIndex(); - int iginfBase = m_pseg->LogicalToPhysicalSurface(isloutBase); - - float xsBase = m_pseg->GlyphLeftEdge(iginfBase); - - float xsLeft = xsBase + psloutBase->ClusterXOffset(); - float xsRight = xsBase + psloutBase->ClusterAdvance(); - - if (fBefore == *pfRtl) - // Position of interest is to the right - *pxs = xsRight; - else - // Position of interest is to the left. - *pxs = xsLeft; + fHighlightBB = true; // use bounding box for zero-advance glyph } - else + if (fHighlightBB) { - // Place the IP on the perimeter of the bounding box of the cluster member. + // Cluster member or zero-width glyph. - float xsGlyphStart = m_pseg->GlyphLeftEdge(iginfOutput); + if (fCluster && AtEdgeOfCluster(psloutTmp, islout, fBefore) && + !CanInsertIntoCluster(psloutTmp, islout)) + { + // Place the IP at the edge of the whole cluster. + + int isloutBase = psloutTmp->ClusterBase(); + GrSlotOutput * psloutBase = m_pseg->OutputSlot(isloutBase); + //int igbbBase = psloutBase->GlyphBbIndex(); + int iginfBase = m_pseg->LogicalToPhysicalSurface(isloutBase); + + float xsBase = m_pseg->GlyphLeftEdge(iginfBase); + + float xsLeft = xsBase + psloutBase->ClusterXOffset(); + float xsRight = xsBase + psloutBase->ClusterAdvance(); + + if (fBefore == *pfRtl) + // Position of interest is to the right + *pxs = xsRight; + else + // Position of interest is to the left. + *pxs = xsLeft; + } + else + { + // Place the IP on the perimeter of the bounding box of the cluster member. -// float dysFontAscent; -// res = GetFontAscentSourceUnits(pgg, &dysFontAscent); -// if (ResultFailed(res)) THROW(WARN(res)); -// dysFontAscent += m_dysXAscent; + float xsGlyphStart = m_pseg->GlyphLeftEdge(iginfOutput); - float ysBbTop = psloutTmp->GlyphMetricLogUnits(kgmetBbTop); - float ysBbBottom = psloutTmp->GlyphMetricLogUnits(kgmetBbBottom); - float xsBbLeft = psloutTmp->GlyphMetricLogUnits(kgmetBbLeft); - float xsBbRight = psloutTmp->GlyphMetricLogUnits(kgmetBbRight); +// float dysFontAscent; +// res = GetFontAscentSourceUnits(pgg, &dysFontAscent); +// if (ResultFailed(res)) THROW(WARN(res)); +// dysFontAscent += m_dysXAscent; - int twoPixels = 2; // assume dest coords are in pixels + float ysBbTop = psloutTmp->GlyphMetricLogUnits(&font, kgmetBbTop); + float ysBbBottom = psloutTmp->GlyphMetricLogUnits(&font, kgmetBbBottom); + float xsBbLeft = psloutTmp->GlyphMetricLogUnits(&font, kgmetBbLeft); + float xsBbRight = psloutTmp->GlyphMetricLogUnits(&font, kgmetBbRight); - if (fBefore == *pfRtl) - // Position of interest is to the right - *pxs = xsGlyphStart + xsBbRight + twoPixels; - else - // Position of interest is to the left. - *pxs = xsGlyphStart + xsBbLeft - twoPixels; + int twoPixels = 2; // assume dest coords are in pixels - GlyphInfo * pginf = m_pseg->m_prgginf + iginfOutput; - float ysGlyph = pginf->yOffset(); - float ysGlyphBaseline = m_pseg->m_dysAscent - ysGlyph; // relative to top + if (fBefore == *pfRtl) + // Position of interest is to the right + *pxs = xsGlyphStart + xsBbRight + twoPixels; + else + // Position of interest is to the left. + *pxs = xsGlyphStart + xsBbLeft - twoPixels; - *pysTop = ysGlyphBaseline - ysBbTop - twoPixels; - *pysBottom = ysGlyphBaseline - ysBbBottom + twoPixels; - } - } - else - { - // Insertion point goes at origin or advance width of glyph. + GlyphInfo * pginf = m_pseg->m_prgginf + iginfOutput; + float ysGlyph = pginf->yOffset(); + float ysGlyphBaseline = m_pseg->m_dysAscent - ysGlyph; // relative to top - *pxs = m_pseg->GlyphLeftEdge(iginfOutput); - if (fBefore == *pfRtl) + *pysTop = ysGlyphBaseline - ysBbTop - twoPixels; + *pysBottom = ysGlyphBaseline - ysBbBottom + twoPixels; + } + } + else { - // Position of interest is to the right - //*pxs += psloutTmp->GlyphMetricLogUnits(kgmetAdvWidth); - *pxs += psloutTmp->ClusterAdvance(); + // Insertion point goes at origin or advance width of glyph. + + *pxs = m_pseg->GlyphLeftEdge(iginfOutput); + if (fBefore == *pfRtl) + { + // Position of interest is to the right + //*pxs += psloutTmp->GlyphMetricLogUnits(&font, kgmetAdvWidth); + *pxs += psloutTmp->ClusterAdvance(); + } + // else position of interest is to the left } - // else position of interest is to the left } } } @@ -1635,11 +1649,40 @@ bool SegmentPainter::AtEdgeOfCluster(GrSlotOutput * pslout, int islout, bool fBe // If the adjacent slot in whatever direction we're interested in has the same // cluster base, this slot is not on the edge of the cluster. - int isloutAdjacentBase = (fBefore) ? - m_pseg->OutputSlot(islout - 1)->ClusterBase() : - m_pseg->OutputSlot(islout + 1)->ClusterBase(); + // -- NO, because you could have an intervening glyph that is not part of the + // cluster. + //int isloutAdjacentBase = (fBefore) ? + // m_pseg->OutputSlot(islout - 1)->ClusterBase() : + // m_pseg->OutputSlot(islout + 1)->ClusterBase(); + //return (isloutAdjacentBase != m_pseg->OutputSlot(islout)->ClusterBase()); + + // Ask the cluster base. + return AtEdgeOfCluster(m_pseg->OutputSlot(pslout->ClusterBase()), pslout->ClusterBase(), + pslout, islout, fBefore); +} + +bool SegmentPainter::AtEdgeOfCluster(GrSlotOutput * psloutBase, int isloutBase, + GrSlotOutput * pslout, int islout, bool fBefore) +{ + // Compare pslout to all the members of the cluster. If it is the minimum or maximum, it + // is at an edge. + if (fBefore && isloutBase < islout) + return false; + if (!fBefore && isloutBase > islout) + return false; - return (isloutAdjacentBase != m_pseg->OutputSlot(islout)->ClusterBase()); + std::vector<int> visloutCluster; + m_pseg->ClusterMembersForGlyph(isloutBase, psloutBase->ClusterRange(), visloutCluster); + + for (size_t iislout = 0; iislout < visloutCluster.size(); iislout++) + { + int isloutMember = visloutCluster[iislout]; + if (fBefore && isloutMember < islout) + return false; + if (!fBefore && isloutMember > islout) + return false; + } + return true; } /*---------------------------------------------------------------------------------------------- @@ -1655,16 +1698,19 @@ bool SegmentPainter::CanInsertIntoCluster(GrSlotOutput * pslout, int islout) if (islout != isloutBase) { // Ask the cluster base. - Assert(pslout->NumClusterMembers() == 0); + Assert(pslout->ClusterRange() == 0); return CanInsertIntoCluster(m_pseg->OutputSlot(isloutBase), isloutBase); } if (!AtEdgeOfCluster(pslout, islout, true) && pslout->InsertBefore()) return true; - for (int iislout = 0; iislout < pslout->NumClusterMembers(); iislout++) + std::vector<int> visloutCluster; + m_pseg->ClusterMembersForGlyph(isloutBase, pslout->ClusterRange(), visloutCluster); + + for (size_t iislout = 0; iislout < visloutCluster.size(); iislout++) { - int isloutMember = pslout->ClusterMember(iislout); + int isloutMember = visloutCluster[iislout]; if (AtEdgeOfCluster(m_pseg->OutputSlot(isloutMember), isloutMember, true)) // Inserting before the first member of the cluster doesn't count. continue; @@ -1752,6 +1798,8 @@ void SegmentPainter::CalcHighlightRect(int ichw, GrGlyphTable * pgtbl = (pgreng) ? pgreng->GlyphTable() : NULL; //bool fRtl = m_pseg->rightToLeft(); + Font & font = m_pseg->getFont(); + if (!GrCharStream::AtUnicodeCharBoundary(m_pseg->GetString(), ichw)) // Second half of a surrogate pair, or UTF-8: ignore. return; @@ -1802,26 +1850,40 @@ void SegmentPainter::CalcHighlightRect(int ichw, } else { - std::vector<int> * pvislout = m_pseg->UnderlyingToLogicalAssocs(ichw); - if (!pvislout) + std::vector<int> vislout = m_pseg->UnderlyingToLogicalAssocs(ichw); + if (vislout.size() == 0) return; float xsGlyphLeft, xsGlyphRight; res = kresOk; - for (size_t iislout = 0; iislout < pvislout->size(); iislout++) + for (size_t iislout = 0; iislout < vislout.size(); iislout++) { - int islout = (*pvislout)[iislout]; + int islout = vislout[iislout]; + if (islout == kNegInfinity || islout == kPosInfinity) + continue; int iginfTmp = m_pseg->LogicalToPhysicalSurface(islout); + Assert(iginfTmp != kNegInfinity); + Assert(iginfTmp != kPosInfinity); if (fSkipTrSpace && islout >= m_pseg->m_isloutVisLim) continue; Rect rsNew; GrSlotOutput * psloutTmp = m_pseg->OutputSlot(islout); + bool fHighlightBB = psloutTmp->IsPartOfCluster(); + // Test below should match the one in CalcIP-- + // If the glyph has no advance width but does have a real bounding box, + // highlight the bounding box. Review: do we want this??? + if ((psloutTmp->ClusterAdvance() == 0 + || psloutTmp->GlyphMetricLogUnits(&font, kgmetAdvWidth) == 0) + && !psloutTmp->IsSpace()) + { + fHighlightBB = true; + } xsGlyphLeft = m_pseg->GlyphLeftEdge(iginfTmp); - if (psloutTmp->IsPartOfCluster()) + if (fHighlightBB) { // For now, highlight just the bounding box of this glyph. After we finish // highlighting all glyphs individually, we'll go back and highlight @@ -1836,10 +1898,10 @@ void SegmentPainter::CalcHighlightRect(int ichw, float ysForGlyph = pginf->yOffset(); float ysGlyphBaseline = m_pseg->m_dysAscent - ysForGlyph; // relative to top - float ysBbTop = psloutTmp->GlyphMetricLogUnits(kgmetBbTop); - float ysBbBottom = psloutTmp->GlyphMetricLogUnits(kgmetBbBottom); - float xsBbLeft = psloutTmp->GlyphMetricLogUnits(kgmetBbLeft); - float xsBbRight = psloutTmp->GlyphMetricLogUnits(kgmetBbRight); + float ysBbTop = psloutTmp->GlyphMetricLogUnits(&font, kgmetBbTop); + float ysBbBottom = psloutTmp->GlyphMetricLogUnits(&font, kgmetBbBottom); + float xsBbLeft = psloutTmp->GlyphMetricLogUnits(&font, kgmetBbLeft); + float xsBbRight = psloutTmp->GlyphMetricLogUnits(&font, kgmetBbRight); rsNew.top = ysGlyphBaseline - ysBbTop - 2; rsNew.bottom = ysGlyphBaseline - ysBbBottom + 2; @@ -1853,9 +1915,12 @@ void SegmentPainter::CalcHighlightRect(int ichw, // Highlight entire width of the glyph from the top of the line to the bottom. // Horizontally, highlight from the origin of the glyph to the advance width. - //xsGlyphRight = xsGlyphLeft + psloutTmp->GlyphMetricLogUnits(kgmetAdvWidth); + //xsGlyphRight = xsGlyphLeft + psloutTmp->GlyphMetricLogUnits(&font kgmetAdvWidth); xsGlyphRight = xsGlyphLeft + psloutTmp->ClusterAdvance(); + if (xsGlyphLeft > xsGlyphRight) + std::swap(xsGlyphLeft, xsGlyphRight); + rsNew.top = 0; rsNew.bottom = m_pseg->m_dysHeight; rsNew.left = xsGlyphLeft; @@ -1889,7 +1954,7 @@ void SegmentPainter::CalcCompleteCluster(int islout, //GrEngine * pgreng = m_pseg->EngineImpl(); GrSlotOutput * pslout = m_pseg->OutputSlot(islout); - if (pslout->NumClusterMembers() == 0) + if (pslout->ClusterRange() == 0) return; int iginfDraw = m_pseg->LogicalToPhysicalSurface(islout); @@ -1898,9 +1963,11 @@ void SegmentPainter::CalcCompleteCluster(int islout, bool fAllHighlighted = true; - for (int i = 0; i < pslout->NumClusterMembers(); i++) + std::vector<int> visloutCluster; + m_pseg->ClusterMembersForGlyph(islout, pslout->ClusterRange(), visloutCluster); + for (size_t i = 0; i < visloutCluster.size(); i++) { - int iginfMemberDraw = m_pseg->LogicalToPhysicalSurface(pslout->ClusterMember(i)); + int iginfMemberDraw = m_pseg->LogicalToPhysicalSurface(visloutCluster[i]); if (!prgfHighlighted[iginfMemberDraw]) { fAllHighlighted = false; diff --git a/Build/source/libs/graphite-engine/src/segment/FileInput.cpp b/Build/source/libs/graphite-engine/src/segment/FileInput.cpp index abd4fb800c3..52969532cd3 100644 --- a/Build/source/libs/graphite-engine/src/segment/FileInput.cpp +++ b/Build/source/libs/graphite-engine/src/segment/FileInput.cpp @@ -98,7 +98,7 @@ bool GrBufferIStream::OpenBuffer(byte * pbBuffer, int cb) m_pbStart = pbBuffer; m_pbNext = pbBuffer; - if (cb >= 0) + if (cb > 0) m_pbLim = m_pbStart + cb; // otherwise we don't know the length diff --git a/Build/source/libs/graphite-engine/src/segment/FontCache.cpp b/Build/source/libs/graphite-engine/src/segment/FontCache.cpp index 041f449a401..f0540463e3b 100644 --- a/Build/source/libs/graphite-engine/src/segment/FontCache.cpp +++ b/Build/source/libs/graphite-engine/src/segment/FontCache.cpp @@ -171,11 +171,9 @@ bool FontCache::RemoveFontFace(std::wstring strFaceName, bool fBold, bool fItali Assert(m_cfface >= 0); - if (m_cfface <= 0 && m_flush == kflushAuto && fZapCache) + if (m_flush == kflushAuto && fZapCache) { - // All items are NULL; delete this cache. Probably this is because - // the program is exiting. - FontFace::ZapFontCache(); + DeleteIfEmpty(); } return fPrevVal; @@ -250,6 +248,17 @@ void FontCache::InsertCacheItem(int ifci) } /*---------------------------------------------------------------------------------------------- + Delete the cache if it is empty. +----------------------------------------------------------------------------------------------*/ +void FontCache::DeleteIfEmpty() +{ + if (m_cfface <= 0) + // All items are NULL; delete this cache. Probably this is because + // the program is exiting. + FontFace::ZapFontCache(); +} + +/*---------------------------------------------------------------------------------------------- Check that the cache is indeed empty. ----------------------------------------------------------------------------------------------*/ void FontCache::AssertEmpty() diff --git a/Build/source/libs/graphite-engine/src/segment/FontCache.h b/Build/source/libs/graphite-engine/src/segment/FontCache.h index 7159ea35d98..56da5ab26b8 100644 --- a/Build/source/libs/graphite-engine/src/segment/FontCache.h +++ b/Build/source/libs/graphite-engine/src/segment/FontCache.h @@ -24,11 +24,13 @@ namespace gr { class FontFace; +class FontMemoryUsage; /*---------------------------------------------------------------------------------------------- TODO: change from a sorted list to a hash table, if performance so requires. ----------------------------------------------------------------------------------------------*/ class FontCache { + friend class FontMemoryUsage; public: FontCache() @@ -69,6 +71,7 @@ public: void GetFontFace(std::wstring strFaceName, bool fBold, bool fItalic, FontFace ** ppfface); void CacheFontFace(std::wstring strFaceName, bool fBold, bool fItalic, FontFace * pfface); bool RemoveFontFace(std::wstring strFaceName, bool fBold, bool fItalic, bool fZapCache = true); + void DeleteIfEmpty(); void AssertEmpty(); int GetFlushMode() @@ -80,6 +83,8 @@ public: // Debugging: //bool DbgCheckFontCache(); + void calculateMemoryUsage(FontMemoryUsage & fmu); + protected: int FindCacheItem(std::wstring strFaceName); void InsertCacheItem(int ifci); diff --git a/Build/source/libs/graphite-engine/src/segment/FontFace.cpp b/Build/source/libs/graphite-engine/src/segment/FontFace.cpp index 838685ebc65..45461fe63ac 100644 --- a/Build/source/libs/graphite-engine/src/segment/FontFace.cpp +++ b/Build/source/libs/graphite-engine/src/segment/FontFace.cpp @@ -47,7 +47,8 @@ FontCache * FontFace::s_pFontCache = 0; Called from the font constructor. ----------------------------------------------------------------------------------------------*/ FontFace * FontFace::GetFontFace(Font * pfont, - std::wstring strFaceName, bool fBold, bool fItalic) + std::wstring strFaceName, bool fBold, bool fItalic, + bool fDumbFallback) { if (s_pFontCache == NULL) s_pFontCache = new FontCache; @@ -59,7 +60,7 @@ FontFace * FontFace::GetFontFace(Font * pfont, // Create a new font face. pfface = new FontFace(); - pfface->InitFontFace(pfont, strFaceName, fBold, fItalic); + pfface->InitFontFace(pfont, strFaceName, fBold, fItalic, fDumbFallback); return pfface; } @@ -67,7 +68,8 @@ FontFace * FontFace::GetFontFace(Font * pfont, Initialize the engine using the given Graphite font. ----------------------------------------------------------------------------------------------*/ GrResult FontFace::InitFontFace(Font * pfont, - std::wstring stuFaceName, bool fBold, bool fItalic) + std::wstring stuFaceName, bool fBold, bool fItalic, + bool fDumbFallback) { AssertPtrN(pfont); @@ -96,20 +98,42 @@ GrResult FontFace::InitFontFace(Font * pfont, // res = InitFromControlFile(pfont, stuFaceName.c_str(), fBold, fItalic); //#endif // GR_FW - //if (ResultFailed(res)) - //{ - - // Read directly from the font. m_pgreng->DestroyContents(); - GrResult res = m_pgreng->ReadFontTables(pfont, fItalic); - - //} + GrResult res = kresUnexpected; + try { + res = m_pgreng->ReadFontTables(pfont, fItalic); + } + catch (...) + { + if (fDumbFallback && m_pgreng->DumbFallback() && !m_pgreng->BadFont()) + { + // If we have a basically good font but can't do Graphite, + // just go with empty tables, which should be set up. + res = m_pgreng->m_resFontRead; + } + else + { + if (m_cfonts == 0) + { + //s_pFontCache->DeleteIfEmpty(); + //Assert(s_pFontCache == 0); + delete this; // will also delete GrEngine + } + else + { + delete m_pgreng; + } + m_pgreng = NULL; + throw; // throw original exception + } + } m_pgreng->m_resFontValid = res; m_pgreng->m_fBold = fBold; m_pgreng->m_fItalic = fItalic; + s_pFontCache->CacheFontFace(m_pgreng->FaceName(), fBold, fItalic, this); return m_pgreng->m_resFontValid; @@ -120,9 +144,11 @@ GrResult FontFace::InitFontFace(Font * pfont, device. @return A GrResult indicating whether we were successful in loading the Graphite font: - kresOk means success, kresFail means the Graphite font could not be found, - kresUnexpected means the Graphite tables could not be loaded; kresFalse means it is - not a Graphite font at all (has no Silf table). + - kresOk means success + - kresFail means the Graphite font could not be found or the basic font tables + (head, name, cmap) could not be loaded + - kresUnexpected means the Graphite tables could not be loaded + - kresFalse means it is not a Graphite font at all (has no Silf table). ----------------------------------------------------------------------------------------------*/ GrResult GrEngine::ReadFontTables(Font * pfont, bool fItalic) { @@ -136,12 +162,15 @@ GrResult GrEngine::ReadFontTables(Font * pfont, bool fItalic) bool fOk = false; - const void * pHeadTbl; const void * pCmapTbl; const void * pSileTbl; const void * pSilfTbl; - const void * pFeatTbl; const void * pGlatTbl; const void * pGlocTbl; const void * pNameTbl; const void * pSillTbl; - size_t cbHeadSz, cbCmapSz, /*cbSileSz,*/ cbSilfSz, cbFeatSz, cbGlatSz, cbGlocSz, cbNameSz, cbSillSz; + const void * pHeadTbl; const void * pSileTbl; const void * pSilfTbl; + const void * pFeatTbl; const void * pGlatTbl; const void * pGlocTbl; const void * pSillTbl; + //const void * pCmapTbl; const void * pNameTbl; + size_t cbHeadSz, cbSilfSz, cbFeatSz, cbGlatSz, cbGlocSz, cbSillSz; + //size_t cbCmapSz, cbSileSz, cbNameSz; m_fFakeItalic = false; + bool fBasicTables = false; bool fSilf = false; // does the font have some sort of Silf table? int nCheckSum = 0; @@ -199,7 +228,7 @@ GrResult GrEngine::ReadFontTables(Font * pfont, bool fItalic) //if (pSileTbl) //{ // pgg->get_FontCharProperties(&chrpOriginal); - // grstrm.OpenBuffer(sile_tbl, sile_tbl.size()); + // grstrm.OpenBuffer(pSileTbl, sile_tbl.size()); // m_fUseSepBase = ReadSileTable(pgg, grstrm, 0, &m_mFontEmUnits, &fMismatchedBase); // grstrm.Close(); @@ -216,64 +245,21 @@ GrResult GrEngine::ReadFontTables(Font * pfont, bool fItalic) // We don't need the offset table, and there's no way to get it anyway // without a font file. - // cmap - res = (pCmapTbl = pfont->getTable(TtfUtil::TableIdTag(ktiCmap), &cbCmapSz)) ? kresOk : kresFail; - fOk = pCmapTbl && (cbCmapSz == 0 || TtfUtil::CheckTable(ktiCmap, pCmapTbl, cbCmapSz)); + // cmap and name + Assert(!m_fCmapTblCopy); + Assert(!m_fNameTblCopy); + fOk = SetCmapAndNameTables(pfont); if (!fOk) { - m_stuInitError = L"could not locate cmap table"; - m_ferr = kferrFindCmapTable; - ReturnResult(kresFail); + goto LUnexpected; } - // Make a private copy of the cmap for the engine's use. - m_pCmapTbl = new byte[cbCmapSz]; - std::copy(reinterpret_cast<const byte*>(pCmapTbl), - reinterpret_cast<const byte*>(pCmapTbl) + cbCmapSz, m_pCmapTbl); - - // MS Unicode cmap - m_pCmap_3_1 = TtfUtil::FindCmapSubtable(m_pCmapTbl, 3, 1); - m_pCmap_3_10 = TtfUtil::FindCmapSubtable(m_pCmapTbl, 3, 10); - if (!m_pCmap_3_1) - m_pCmap_3_1 = TtfUtil::FindCmapSubtable(m_pCmapTbl, 3, 0); - if (!m_pCmap_3_1) - { - m_stuInitError = L"failure to load cmap subtable"; - m_ferr = kferrLoadCmapSubtable; - ReturnResult(kresFail); - } - if (!TtfUtil::CheckCmap31Subtable(m_pCmap_3_1)) - { - m_stuInitError = L"checking cmap subtable failed"; - m_ferr = kferrCheckCmapSubtable; - ReturnResult(kresFail); - } + fBasicTables = true; // If we have a bad base file, don't do Graphite stuff. if (fBadBase || fMismatchedBase) goto LUnexpected; - // name - - // Currently the only stuff we're getting from the name table are our feature names, - // so use the version from the Graphite font (not the base font if any). - //////if (m_fUseSepBase) - ////// pgg->SetupGraphics(&chrpOriginal); - - // name - need feature names later - res = (pNameTbl = (byte *)pfont->getTable(TtfUtil::TableIdTag(ktiName), &cbNameSz)) ? kresOk : kresFail; - fOk = pNameTbl && (cbNameSz == 0 || TtfUtil::CheckTable(ktiName, pNameTbl, cbNameSz)); - if (!fOk) - { - m_stuInitError = L"could not locate name table"; - m_ferr = kferrFindNameTable; - ReturnResult(kresFail); - } - // Make a private copy of the name table for the engine's use. - m_pNameTbl = new byte[cbNameSz]; - std::copy(reinterpret_cast<const byte*>(pNameTbl), - reinterpret_cast<const byte*>(pNameTbl) + cbNameSz, m_pNameTbl); - /**** Obtain font name from InitNew() now instead of reading from font file. InitNew should should have a correct font name passed to it since it should come from a font registered @@ -360,13 +346,27 @@ GrResult GrEngine::ReadFontTables(Font * pfont, bool fItalic) &m_fxdBadVersion); if (!fOk) { - wchar_t rgch[20]; - swprintf(rgch, 20, L"%d", m_fxdBadVersion >> 16); +// wchar_t rgch1[50]; +// wchar_t rgch2[50]; +//#if defined(_WIN32) +// // This version does not work in Windows, in spite of being documented: +// // swprintf(rgch, 50, L"%d", (m_fxdBadVersion >> 16)); +// // Removing the size argument make it work. +// swprintf(rgch1, L"%d", (m_fxdBadVersion >> 16)); +// swprintf(rgch2, L"%d", (m_fxdBadVersion & 0x0000FFFF)); +//#else +// swprintf(rgch1, 50, L"%d", (m_fxdBadVersion >> 16)); +// swprintf(rgch2, 50, L"%d", (m_fxdBadVersion & 0x0000FFFF)); +//#endif + char rgch[50]; // more than enough space to print two 16-bit ints + char *pch = &rgch[0]; + sprintf(rgch, "%d.%d", (m_fxdBadVersion >> 16), (m_fxdBadVersion & 0x0000FFFF)); std::wstring stu = L"unsupported version ("; - stu.append(rgch); - swprintf(rgch, 20, L"%d", m_fxdBadVersion & 0x0000FFFF); - stu.append(L"."); - stu.append(rgch); + //stu.append(rgch1); + //stu.append(L"."); + //stu.append(rgch2); + while (*pch != 0) + stu.push_back((wchar_t)*pch++); stu.append(L") of Graphite tables"); m_stuInitError.assign(stu.c_str()); m_ferr = kferrBadVersion; @@ -461,7 +461,12 @@ LUnexpected: CreateEmpty(); m_nFontCheckSum = nCheckSum; - m_resFontRead = (fSilf) ? kresUnexpected : kresFalse; + if (!fBasicTables) + m_resFontRead = kresFail; // bad font + else if (!fSilf) + m_resFontRead = kresFalse; // no Silf table--not a Graphite font + else + m_resFontRead = kresUnexpected; // couldn't read the Graphite tables fexptn.errorCode = m_ferr; fexptn.version = m_fxdBadVersion >> 16; @@ -471,6 +476,113 @@ LUnexpected: ReturnResult(m_resFontRead); } +/*---------------------------------------------------------------------------------------------- + Read the cmap and name tables. + + This is called from two places. One is when we first initialize the engine. Also, if the + font tables have not been actually copied from the font, they may have been deleted + when the font was deleted. So when reusing the engine, set them to something valid based + on the current font. +----------------------------------------------------------------------------------------------*/ +bool GrEngine::SetCmapAndNameTables(Font * pfont) +{ + GrResult res = kresOk; + bool fOk; + const void * pCmapTbl; + const void * pNameTbl; + size_t cbCmapSz, cbNameSz; + + // cmap + if (!m_fCmapTblCopy) + { + res = (pCmapTbl = pfont->getTable(TtfUtil::TableIdTag(ktiCmap), &cbCmapSz)) ? kresOk : kresFail; + fOk = pCmapTbl && (cbCmapSz == 0 || TtfUtil::CheckTable(ktiCmap, pCmapTbl, cbCmapSz)); + if (!fOk) + { + m_stuInitError = L"could not locate cmap table"; + m_ferr = kferrFindCmapTable; + return false; + } + + if (pCmapTbl && cbCmapSz > 0) + { + // Make a private copy of the cmap for the engine's use. + m_pCmapTbl = new byte[cbCmapSz]; + std::copy(reinterpret_cast<const byte*>(pCmapTbl), + reinterpret_cast<const byte*>(pCmapTbl) + cbCmapSz, m_pCmapTbl); + m_fCmapTblCopy = true; + m_cbCmapTbl = cbCmapSz; + } + else + { + m_pCmapTbl = const_cast<byte*>(reinterpret_cast<const byte*>(pCmapTbl)); + m_fCmapTblCopy = false; + } + + // MS Unicode cmap + m_pCmap_3_1 = TtfUtil::FindCmapSubtable(m_pCmapTbl, 3, 1); + m_pCmap_3_10 = TtfUtil::FindCmapSubtable(m_pCmapTbl, 3, 10); + if (!m_pCmap_3_1) + m_pCmap_3_1 = TtfUtil::FindCmapSubtable(m_pCmapTbl, 3, 0); + if (!m_pCmap_3_1) + { + m_stuInitError = L"failure to load cmap subtable"; + m_ferr = kferrLoadCmapSubtable; + return false; + } + if (!TtfUtil::CheckCmap31Subtable(m_pCmap_3_1)) + { + m_stuInitError = L"checking cmap subtable failed"; + m_ferr = kferrCheckCmapSubtable; + return false; + } + } + else + { + Assert(m_pCmapTbl); + } + + // name table - eventually need feature label strings + + // Currently the only stuff we're getting from the name table are our feature names, + // so use the version from the Graphite font (not the base font if any). + //////if (m_fUseSepBase) + ////// pgg->SetupGraphics(&chrpOriginal); + + if (!m_fNameTblCopy) + { + res = (pNameTbl = (byte *)pfont->getTable(TtfUtil::TableIdTag(ktiName), &cbNameSz)) ? kresOk : kresFail; + fOk = pNameTbl && (cbNameSz == 0 || TtfUtil::CheckTable(ktiName, pNameTbl, cbNameSz)); + if (!fOk) + { + m_stuInitError = L"could not locate name table"; + m_ferr = kferrFindNameTable; + return false; + } + + if (pNameTbl && cbNameSz > 0) + { + // Make a private copy of the name table for the engine's use. + m_pNameTbl = new byte[cbNameSz]; + std::copy(reinterpret_cast<const byte*>(pNameTbl), + reinterpret_cast<const byte*>(pNameTbl) + cbNameSz, m_pNameTbl); + m_fNameTblCopy = true; + m_cbNameTbl = cbNameSz; + } + else + { + m_pNameTbl = const_cast<byte*>(reinterpret_cast<const byte*>(pNameTbl)); + m_fNameTblCopy = false; + } + } + else + { + Assert(m_pNameTbl); + } + + return true; +} + //void FontFace::DbgCheckFontFace() //{ @@ -481,7 +593,6 @@ LUnexpected: // Assert(chw0 <= 0x007A); // z //} - } // namespace gr //:End Ignore diff --git a/Build/source/libs/graphite-engine/src/segment/FontFace.h b/Build/source/libs/graphite-engine/src/segment/FontFace.h index 70be57d5cd2..7f2684a5908 100644 --- a/Build/source/libs/graphite-engine/src/segment/FontFace.h +++ b/Build/source/libs/graphite-engine/src/segment/FontFace.h @@ -44,6 +44,8 @@ class Segment; ----------------------------------------------------------------------------------------------*/ class FontFace { + friend class gr::FontMemoryUsage; + public: FontFace() { @@ -52,7 +54,8 @@ public: ~FontFace() { - s_pFontCache->RemoveFontFace(m_pgreng->FaceName(), m_pgreng->Bold(), m_pgreng->Italic()); + if (s_pFontCache) + s_pFontCache->RemoveFontFace(m_pgreng->FaceName(), m_pgreng->Bold(), m_pgreng->Italic()); delete m_pgreng; } @@ -63,7 +66,7 @@ public: void DecFontCount() { m_cfonts--; - if (m_cfonts <= 0 && s_pFontCache->GetFlushMode() == kflushAuto) + if (m_cfonts <= 0 && (s_pFontCache == NULL || s_pFontCache->GetFlushMode() == kflushAuto)) delete this; } @@ -73,10 +76,12 @@ public: } static FontFace * GetFontFace(Font * pfont, - std::wstring strFaceName, bool fBold, bool fItalic); + std::wstring strFaceName, bool fBold, bool fItalic, + bool fDumbFallback = false); GrResult InitFontFace(Font * pfont, - std::wstring stuFaceName, bool fBold, bool fItalic); + std::wstring stuFaceName, bool fBold, bool fItalic, + bool fDumbLayout); FontErrorCode IsValidForGraphite(int * pnVersion, int * pnSubVersion) { @@ -172,6 +177,16 @@ public: m_pgreng->get_ScriptDirection(&script_dirs, &err_dummy, 1); return ScriptDirCode(script_dirs); } + + bool BadFont(FontErrorCode * pferr = NULL) + { + return m_pgreng->BadFont(pferr); + } + bool DumbFallback(FontErrorCode * pferr = NULL) + { + return m_pgreng->DumbFallback(pferr); + } + public: // For use in segment creation: void RenderLineFillSegment(Segment * pseg, Font * pfont, ITextSource * pts, @@ -206,6 +221,9 @@ public: //} //void DbgCheckFontFace(); + static void calculateAllMemoryUsage(FontMemoryUsage & fmu); + void calculateMemoryUsage(FontMemoryUsage & fmu); + protected: // Number of fonts in existence that use this face; when it goes to zero, delete. int m_cfonts; diff --git a/Build/source/libs/graphite-engine/src/segment/GrCharStream.h b/Build/source/libs/graphite-engine/src/segment/GrCharStream.h index 7a49b8fa030..fa9d8b40785 100644 --- a/Build/source/libs/graphite-engine/src/segment/GrCharStream.h +++ b/Build/source/libs/graphite-engine/src/segment/GrCharStream.h @@ -42,7 +42,7 @@ public: } // Getters: - ITextSource * String() { return m_pgts; } + ITextSource * TextSrc() { return m_pgts; } int Min() { return m_ichrMin; } int Pos() { return m_ichrPos; } int Lim() { return m_ichrLim; } diff --git a/Build/source/libs/graphite-engine/src/segment/GrClassTable.h b/Build/source/libs/graphite-engine/src/segment/GrClassTable.h index 5677fdfd21b..67d6940862c 100644 --- a/Build/source/libs/graphite-engine/src/segment/GrClassTable.h +++ b/Build/source/libs/graphite-engine/src/segment/GrClassTable.h @@ -110,6 +110,8 @@ protected: class GrClassTable { + friend class FontMemoryUsage; + public: // Constructor & destructor: GrClassTable() diff --git a/Build/source/libs/graphite-engine/src/segment/GrEngine.cpp b/Build/source/libs/graphite-engine/src/segment/GrEngine.cpp index d7c2aaf320c..62a33b6a4ed 100644 --- a/Build/source/libs/graphite-engine/src/segment/GrEngine.cpp +++ b/Build/source/libs/graphite-engine/src/segment/GrEngine.cpp @@ -119,6 +119,8 @@ void GrEngine::BasicInit() // new interface stuff: m_pCmapTbl = NULL; m_pNameTbl = NULL; + m_fCmapTblCopy = false; + m_fNameTblCopy = false; m_fLogXductn = false; @@ -203,10 +205,14 @@ void GrEngine::DestroyContents(bool fDestroyCmap) m_pCmap_3_1 = NULL; m_pCmap_3_10 = NULL; - delete[] m_pCmapTbl; - delete[] m_pNameTbl; + if (m_fCmapTblCopy) + delete[] m_pCmapTbl; + if (m_fNameTblCopy) + delete[] m_pNameTbl; m_pCmapTbl = NULL; m_pNameTbl = NULL; + m_fCmapTblCopy = false; + m_fNameTblCopy = false; } delete m_ptman; @@ -573,6 +579,8 @@ void GrEngine::MakeSegment( // Uninitialized. return; // ReturnResult(kresUnexpected); + SetCmapAndNameTables(pfont); + int segmode = ksegmodeRange; // segment from range if (fJust) segmode = ksegmodeJust; // justified segment @@ -597,7 +605,9 @@ void GrEngine::MakeSegment( // Find the end of the range to render with the current font. int nDirDepth; - int ichFontLim, ichStrmLim, ichSegLim; + int ichFontLim; + int ichStrmLim = 0; + int ichSegLim = 0; switch (segmode) { case ksegmodeBreak: // find break point @@ -653,9 +663,9 @@ void GrEngine::MakeSegment( // Run the tables and get back a segment. - bool fMoreText; - int ichCallerBtLim; - bool fInfiniteWidth; + bool fMoreText = false; + int ichCallerBtLim = -1; + bool fInfiniteWidth = false; switch (segmode) { //case ksegmodeMms: @@ -886,26 +896,26 @@ int GrEngine::FindFontLim(ITextSource * pgts, int ichwMinFont, int * pnDirDepth) implementation of the engine can't handle. ----------------------------------------------------------------------------------------------*/ bool GrEngine::CheckTableVersions(GrIStream * pgrstrm, - byte *silf_tbl, int lSilfStart, - byte *gloc_tbl, int lGlocStart, - byte *feat_tbl, int lFeatStart, + byte *pSilfTbl, int lSilfStart, + byte *pGlobTbl, int lGlocStart, + byte *pFeatTbl, int lFeatStart, int * pfxdBadVersion) { - pgrstrm->OpenBuffer(silf_tbl, isizeof(int)); + pgrstrm->OpenBuffer(pSilfTbl, isizeof(int)); pgrstrm->SetPositionInFont(lSilfStart); *pfxdBadVersion = ReadVersion(*pgrstrm); pgrstrm->CloseBuffer(); if (*pfxdBadVersion > kSilfVersion) return false; - pgrstrm->OpenBuffer(gloc_tbl, lGlocStart + isizeof(int)); + pgrstrm->OpenBuffer(pGlobTbl, lGlocStart + isizeof(int)); pgrstrm->SetPositionInFont(lGlocStart); *pfxdBadVersion = ReadVersion(*pgrstrm); pgrstrm->CloseBuffer(); if (*pfxdBadVersion > kGlocVersion) return false; - pgrstrm->OpenBuffer(feat_tbl, isizeof(int)); + pgrstrm->OpenBuffer(pFeatTbl, isizeof(int)); pgrstrm->SetPositionInFont(lFeatStart); *pfxdBadVersion = ReadVersion(*pgrstrm); pgrstrm->CloseBuffer(); @@ -1062,7 +1072,7 @@ bool GrEngine::ReadSilfTable(GrIStream & grstrm, long lTableStart, int iSubTable data16 chwTmp; *pchwMaxGlyphID = grstrm.ReadUShortFromFont(); - // extra ascent + // extra ascent and descent m_mXAscent = grstrm.ReadShortFromFont(); m_mXDescent = grstrm.ReadShortFromFont(); @@ -1111,9 +1121,9 @@ bool GrEngine::ReadSilfTable(GrIStream & grstrm, long lTableStart, int iSubTable bTmp = grstrm.ReadByteFromFont(); m_chwDirAttr = bTmp; - // Sanity checks. - if (m_chwPseudoAttr > 100 || m_chwBWAttr > 100 || m_chwDirAttr > 100) - return false; // bad table + // Sanity checks--don't bother with these, I don't seem to be able to know what are reasonable values. + //if (m_chwPseudoAttr > 200 || m_chwBWAttr > 200 || m_chwDirAttr > 200) + // return false; // bad table if (*pfxdSilfVersion >= 0x00020000) { @@ -1824,7 +1834,7 @@ void GrEngine::InitSlot(GrSlotState * pslot, int nUnicode) LDefaults: // Otherwise, in fill defaults for some basic values. - if (pslot->BreakWeight() == GrSlotState::kNotYetSet) + if (pslot->BreakWeight() == GrSlotState::kNotYetSet8) { switch (nUnicode) { @@ -1839,7 +1849,7 @@ LDefaults: } } - if ((int)pslot->Directionality() == GrSlotState::kNotYetSet) + if ((int)pslot->Directionality() == GrSlotState::kNotYetSet8) { switch (nUnicode) { diff --git a/Build/source/libs/graphite-engine/src/segment/GrEngine.h b/Build/source/libs/graphite-engine/src/segment/GrEngine.h index ee7d8de0e77..81b54e805bc 100644 --- a/Build/source/libs/graphite-engine/src/segment/GrEngine.h +++ b/Build/source/libs/graphite-engine/src/segment/GrEngine.h @@ -43,6 +43,7 @@ class Segment; class GrEngine : public GraphiteProcess { friend class FontFace; + friend class FontMemoryUsage; public: // Constructors & destructors: @@ -405,14 +406,16 @@ protected: // control file GrResult m_resFontRead; // kresOk if the Graphite font was loaded successfully; - // kresFail if the Graphite font could not be found; + // kresFail if the font could not be found or basic tables couldn't be read; + // kresFalse if the Silf table is not present; // kresUnexpected if the Graphite tables could not be loaded - GrResult m_resFontValid; // kresOk if Graphite font & dc font match cmaps - // kresUnexpected if dumb rendering - // kresFail if dumb rendering with no cmap - // kresInvalidArg if the engine is not yet initialized - + GrResult m_resFontValid; // kresInvalidArg if the engine is not yet initialized + // Originally: + // kresOk if Graphite font & dc font match cmaps + // kresUnexpected/kresFalse if dumb rendering + // kresFail if dumb rendering with no cmap + // But now it is apparently just = to m_resFontRead otherwise. FontErrorCode m_ferr; int m_fxdBadVersion; @@ -475,14 +478,14 @@ protected: int m_mFontEmUnits; // number of design units in the Em square for the font // for pseudo-glyph mappings - int m_cpsd; // number of psuedo-glyphs - GrPseudoMap * m_prgpsd; - int m_dipsdInit; // (max power of 2 <= m_cpsd); - // size of initial range to consider - int m_cPsdLoop; // log2(max power of 2 <= m_cpsd); - // indicates how many iterations are necessary - int m_ipsdStart; // m_cpsd - m_dipsdInit; - // where to start search + int m_cpsd; // number of psuedo-glyphs + GrPseudoMap * m_prgpsd; + int m_dipsdInit; // (max power of 2 <= m_cpsd); + // size of initial range to consider + int m_cPsdLoop; // log2(max power of 2 <= m_cpsd); + // indicates how many iterations are necessary + int m_ipsdStart; // m_cpsd - m_dipsdInit; + // where to start search // for Unicode to glyph ID mapping ////TableBuffer m_tbufCmap; // hold the full cmap table @@ -491,10 +494,14 @@ protected: // use for Unicode to Glyph ID conversion void * m_pCmap_3_10; byte * m_pCmapTbl; + bool m_fCmapTblCopy; + int m_cbCmapTbl; // needed only for memory instrumentation // for feature names and maybe other strings from font later ////TableBuffer m_tbufNameTbl; // hold full name table; use Name() method to access byte * m_pNameTbl; + bool m_fNameTblCopy; + int m_cbNameTbl; // needed only for memory instrumentation bool m_fLogXductn; // true if we want to log the transduction process @@ -546,9 +553,23 @@ protected: int chwMaxGlyphID, int fxdSilfVersion); bool ReadFeatTable(GrIStream & grstrm, long lTableStart); bool ReadSillTable(GrIStream & grstrm, long lTableStart); + bool SetCmapAndNameTables(Font * pfont); void CreateEmpty(); + bool BadFont(FontErrorCode * pferr = NULL) + { + if (pferr) + *pferr = m_ferr; + return (m_resFontValid == kresFail || m_resFontRead == kresFail); + } + bool DumbFallback(FontErrorCode * pferr = NULL) + { + if (pferr) + *pferr = m_ferr; + return (m_resFontValid != kresOk || m_resFontRead != kresOk); + } + gid16 MapToPseudo(int nUnicode); // NEW interface diff --git a/Build/source/libs/graphite-engine/src/segment/GrFSM.cpp b/Build/source/libs/graphite-engine/src/segment/GrFSM.cpp index bd4d13a24d0..c36670c9634 100644 --- a/Build/source/libs/graphite-engine/src/segment/GrFSM.cpp +++ b/Build/source/libs/graphite-engine/src/segment/GrFSM.cpp @@ -102,8 +102,8 @@ bool GrFSM::ReadFromFont(GrIStream & grstrm, int fxdVersion) // rules in the pass; some rules may be listed multiply, if they are matched by more // than one state. int crulInMap = m_prgirulnMin[crowSuccess]; - m_prgrulnMatched = new data16[crulInMap]; + m_crulnMatched = crulInMap; pchw = m_prgrulnMatched; for (i = 0; i < crulInMap; i++, pchw++) { @@ -167,7 +167,7 @@ int GrFSM::GetRuleToApply(GrTableManager * ptman, GrPass * ppass, int prgcslotMatched[kMaxSlotsPerRule]; // Run the transition table until it jams. - int crowAccepting = RunTransitionTable(psstrmIn, psstrmOut, + int crowAccepting = RunTransitionTable(ppass, psstrmIn, psstrmOut, prgrowAccepting, prgcslotMatched); // Nothing matched; fail quickly. @@ -274,9 +274,11 @@ int GrFSM::GetRuleToApply(GrTableManager * ptman, GrPass * ppass, @param prgrowAccepting - array to fill in with accepting rows @param prgcslotMatched - corresponding array with number of slots matched ----------------------------------------------------------------------------------------------*/ -int GrFSM::RunTransitionTable(GrSlotStream * psstrmIn, GrSlotStream * psstrmOut, +int GrFSM::RunTransitionTable(GrPass * ppass, GrSlotStream * psstrmIn, GrSlotStream * psstrmOut, int * prgrowAccepting, int * prgcslotMatched) { + int ipass = ppass->PassNumber(); + // Remember we're reading the pre-context items from the output stream, not the input. int cslotPreContextAvail = psstrmOut->WritePos(); @@ -305,12 +307,24 @@ int GrFSM::RunTransitionTable(GrSlotStream * psstrmIn, GrSlotStream * psstrmOut, // no more input return (prowTop - prgrowAccepting); - // Get next glyph. - gid16 chwGlyphID = (cslot < 0) ? - psstrmOut->PeekBack(cslot)->GlyphID() : - psstrmIn->Peek(cslot)->GlyphID(); - - int col = FindColumn(chwGlyphID); + // Figure out what column the input glyph belong in. + // Since this is a time-critical routine, we cache the results for the current pass. + GrSlotState * pslot = (cslot < 0) ? + psstrmOut->PeekBack(cslot) : + psstrmIn->Peek(cslot); + int col; + if (pslot->PassNumberForColumn() == ipass) + { + col = pslot->FsmColumn(); + } + else + { + gid16 chwGlyphID = (cslot < 0) ? + psstrmOut->PeekBack(cslot)->GlyphID() : + psstrmIn->Peek(cslot)->GlyphID(); + col = FindColumn(chwGlyphID); + pslot->CacheFsmColumn(ipass, col); + } int rowNext; if (col < 0) rowNext = 0; @@ -488,8 +502,10 @@ int GrFSM::FindColumn(gid16 chwGlyphID) else { nTest = pmcrCurr->m_chwFirst - chwGlyphID; - if (nTest < 0) - nTest = (chwGlyphID <= pmcrCurr->m_chwLast) ? 0 : nTest; + if (nTest < 0 && chwGlyphID <= pmcrCurr->m_chwLast) + //nTest = 0; + // This is a tiny bit more efficient: + return pmcrCurr->m_col; } if (nTest == 0) diff --git a/Build/source/libs/graphite-engine/src/segment/GrFSM.h b/Build/source/libs/graphite-engine/src/segment/GrFSM.h index 483d7bc2be8..b1909553daa 100644 --- a/Build/source/libs/graphite-engine/src/segment/GrFSM.h +++ b/Build/source/libs/graphite-engine/src/segment/GrFSM.h @@ -107,7 +107,9 @@ protected: Do these seem to be worth the inconvenience of added complexity in understanding and debugging? ----------------------------------------------------------------------------------------------*/ -class GrFSM { +class GrFSM +{ + friend class FontMemoryUsage; public: GrFSM() : @@ -140,7 +142,7 @@ public: int GetRuleToApply(GrTableManager *, GrPass * ppass, GrSlotStream * psstrmIn, GrSlotStream * psstrmOut); - int RunTransitionTable(GrSlotStream * psstrmIn, GrSlotStream * psstrmOut, + int RunTransitionTable(GrPass * ppass, GrSlotStream * psstrmIn, GrSlotStream * psstrmOut, int * prgrowAccepting, int * prgcslotMatched); int RunTransitionTableOptimized(GrSlotStream * psstrmIn, GrSlotStream * psstrmOut, int * prgrowAccepting, int * prgcslotMatched); @@ -182,6 +184,7 @@ protected: data16 * m_prgrulnMatched; // long ordered list of rule indices matched by // subsequent states; total length is sum of number // of rules matched for each accepting state + int m_crulnMatched; // needed only for memory instrumentation // Transition matrix--for optimized version: // short ** m_prgprgrowXitions; // ((m_crow-m_crowFinal) * m_ccol) of these; diff --git a/Build/source/libs/graphite-engine/src/segment/GrFeature.cpp b/Build/source/libs/graphite-engine/src/segment/GrFeature.cpp index 3e488462a74..7863220b80a 100644 --- a/Build/source/libs/graphite-engine/src/segment/GrFeature.cpp +++ b/Build/source/libs/graphite-engine/src/segment/GrFeature.cpp @@ -210,6 +210,7 @@ bool GrLangTable::ReadFromFont(GrIStream * pgrstrm, int fxdVersion) Assert(cb % sizeof(FeatSet) == 0); // # of bytes fits nicely into FeatSet class int cfset = cb / sizeof(FeatSet); m_prgfset = new FeatSet[cfset]; + m_cfset = cfset; grstrm.ReadBlockFromFont(m_prgfset, cb); return true; diff --git a/Build/source/libs/graphite-engine/src/segment/GrGlyphTable.h b/Build/source/libs/graphite-engine/src/segment/GrGlyphTable.h index b2a558ebfbd..bec0e518dee 100644 --- a/Build/source/libs/graphite-engine/src/segment/GrGlyphTable.h +++ b/Build/source/libs/graphite-engine/src/segment/GrGlyphTable.h @@ -93,7 +93,7 @@ protected: /*---------------------------------------------------------------------------------------------- Contains runs of attribute values for all the glyphs in the font; corresponds to - the "Glat" table in the ECF file. + the "Glat" table in the font. Hungarian: gatbl ----------------------------------------------------------------------------------------------*/ @@ -102,6 +102,7 @@ class GrGlyphAttrTable { friend class GrGlyphTable; friend class GrGlyphSubTable; + friend class FontMemoryUsage; protected: // Constructor: @@ -129,17 +130,17 @@ protected: int GlyphAttr16BitValue(int ibMin, int ibLim, byte bAttrID); protected: - int m_fxdSilfVersion; // version number of the Silf table, which is used - // to interpret the attribute values + int m_fxdSilfVersion; // version number of the Silf table, which is used + // to interpret the attribute values // Block of variable-length glyph attribute runs, matching the format of // GrGlyphAttrRun. We don't store instances of that class here because they // are variable length, and it would be too slow to read them individually from the - // ECF file. Instead, we set up a single instance in the method that accesses the values; + // font. Instead, we set up a single instance in the method that accesses the values; // having this instance will help debugging. Eventually we may want to do without it, // if it would help efficiency. - int m_cbEntryBufLen; // do we really need this? - byte * m_prgbBIGEntries; + int m_cbEntryBufLen; // needed only for memory instrumentation + byte * m_prgbBIGEntries; //:Ignore #ifdef OLD_TEST_STUFF @@ -155,19 +156,20 @@ public: }; /*---------------------------------------------------------------------------------------------- - One glyph table per font (style) file; corresponds to the "Gloc" table in the ECF. + One glyph table per font (style) file; corresponds to the "Gloc" table in the font. Currently there is only considered to be one style per file, so there is only one of these. It holds the (non-zero) glyph attribute values for every glyph in the font. Hungarian: gstbl - Review: Eventually we may need to make a subclass that uses 32-values for the offsets, + Review: Eventually we may need to make a subclass that uses 32-bit values for the offsets, or just use a separate array pointer in this class. Which would be preferable? ----------------------------------------------------------------------------------------------*/ class GrGlyphSubTable { friend class GrGlyphTable; + friend class FontMemoryUsage; public: // Constructor: @@ -246,27 +248,27 @@ public: } protected: - int m_fxdSilfVersion; // version number of the Silf table, which is used - // to interpret the attribute values - bool m_fHasDebugStrings; // are debugging strings loaded into memory? + int m_fxdSilfVersion; // version number of the Silf table, which is used + // to interpret the attribute values + bool m_fHasDebugStrings; // are debugging strings loaded into memory? - int m_nAttrIDLim; // number of glyph attributes - int m_cComponents; // number of initial glyph attributes that - // represent ligature components - int m_cnCompPerLig; + int m_nAttrIDLim; // number of glyph attributes + int m_cComponents; // number of initial glyph attributes that + // represent ligature components + int m_cnCompPerLig; - GrGlyphAttrTable * m_pgatbl; - byte * m_prgibBIGAttrValues; // byte offsets for glyph attr values - bool m_fGlocShort; // flag for Gloc table format - data16 * m_prgibBIGGlyphAttrDebug; // byte offsets for glyph attr debug strings + GrGlyphAttrTable * m_pgatbl; + byte * m_prgibBIGAttrValues; // byte offsets for glyph attr values - BIG endian + bool m_fGlocShort; // flag for Gloc table format + data16 * m_prgibBIGGlyphAttrDebug; // byte offsets for glyph attr debug strings - BIG endian - data16 m_chwBWAttr; // breakweight attr ID; needed for converting - // between versions + data16 m_chwBWAttr; // breakweight attr ID; needed for converting + // between versions // Attr IDs for justify.0.stretch and justify.0.stretchHW; these must always be looked // up in tandem. - data16 m_chwJStrAttr; - data16 m_chwJStrHWAttr; + data16 m_chwJStrAttr; + data16 m_chwJStrHWAttr; int * m_prgnDefinedComponents; // for each glyph, cache list of component attributes that // are defined @@ -292,6 +294,7 @@ public: class GrGlyphTable { friend class GrGlyphSubTable; + friend class FontMemoryUsage; public: // Constructor: diff --git a/Build/source/libs/graphite-engine/src/segment/GrPass.cpp b/Build/source/libs/graphite-engine/src/segment/GrPass.cpp index 96e88ac150e..8e2048f0f6f 100644 --- a/Build/source/libs/graphite-engine/src/segment/GrPass.cpp +++ b/Build/source/libs/graphite-engine/src/segment/GrPass.cpp @@ -44,11 +44,12 @@ namespace gr ----------------------------------------------------------------------------------------------*/ GrPass::GrPass(int i) : m_ipass(i), - vnStack(128), + m_fxdVersion(0), m_nMaxRuleContext(0), m_pfsm(NULL), m_nMaxRuleLoop(0), m_nMaxBackup(0), + m_crul(0), m_prgchwRuleSortKeys(NULL), m_prgcritRulePreModContext(NULL), m_cbPassConstraint(0), @@ -57,10 +58,14 @@ GrPass::GrPass(int i) m_prgbPConstraintBlock(NULL), m_prgbConstraintBlock(NULL), m_prgbActionBlock(NULL), + m_cbConstraints(0), + m_cbActions(0), m_prgibConstraintDebug(NULL), m_prgibRuleDebug(NULL), m_fCheckRules(false), - m_prgfRuleOkay(NULL) + m_prgfRuleOkay(NULL), + m_vnStack(128), + m_pzpst(NULL) { } @@ -227,14 +232,17 @@ bool GrPass::ReadFromFont(GrIStream & grstrm, int fxdSilfVersion, int fxdRuleVer int cb = m_cbPassConstraint; m_prgbPConstraintBlock = new byte[cb]; grstrm.ReadBlockFromFont(m_prgbPConstraintBlock, cb); + m_cbConstraints = cb; cb = m_prgibConstraintStart[m_crul]; m_prgbConstraintBlock = new byte[cb]; grstrm.ReadBlockFromFont(m_prgbConstraintBlock, cb); + m_cbConstraints += cb; cb = m_prgibActionStart[m_crul]; m_prgbActionBlock = new byte[cb]; grstrm.ReadBlockFromFont(m_prgbActionBlock, cb); + m_cbActions = cb; // Rule-validity flags m_prgfRuleOkay = new bool[m_crul]; @@ -773,7 +781,8 @@ int GrPass::ExtendFinalOutput(GrTableManager * ptman, // Assert(m_cslotSkipToResync == 0); int islotOutputLB = -1; - int islotInitWritePos = psstrmOutput->WritePos(); + //int islotInitWritePos = psstrmOutput->WritePos(); + int islotNoLbUpTo = psstrmOutput->WritePos();; while (true) { @@ -859,9 +868,12 @@ int GrPass::ExtendFinalOutput(GrTableManager * ptman, RunRule(ptman, ruln, psstrmInput, psstrmOutput); if (fHaveLineBreak) + { islotOutputLB = psstrmOutput->FindFinalLineBreak(ptman->LBGlyphID(), - islotInitWritePos, psstrmOutput->WritePos()); + islotNoLbUpTo, psstrmOutput->WritePos()); + islotNoLbUpTo = psstrmOutput->WritePos(); + } psstrmOutput->CalcIndexOffset(ptman); } @@ -1715,7 +1727,7 @@ int GrPass::Unwind(GrTableManager * ptman, if (!psstrmIn->NoReproc()) islotIn = min(islotIn, psstrmIn->ReprocMin()); psstrmIn->ClearReprocBuffer(); - int islotOut; + int islotOut = 0; if (islotIn < psstrmIn->SlotsSkippedToResync() || islotIn == 0 || psstrmIn->ReadPos() == 0) diff --git a/Build/source/libs/graphite-engine/src/segment/GrPass.h b/Build/source/libs/graphite-engine/src/segment/GrPass.h index 9afaf8ac518..aad6b3425b8 100644 --- a/Build/source/libs/graphite-engine/src/segment/GrPass.h +++ b/Build/source/libs/graphite-engine/src/segment/GrPass.h @@ -35,6 +35,7 @@ class PassState { friend class GrSubPass; friend class GrBidiPass; friend class GrPosPass; + friend class FontMemoryUsage; public: PassState() @@ -135,6 +136,7 @@ protected: Hungarian: pass ----------------------------------------------------------------------------------------------*/ class GrPass { + friend class FontMemoryUsage; protected: // Action command codes; these MUST match the corresponding definitions in the compiler: @@ -190,6 +192,8 @@ public: // Destructor: virtual ~GrPass(); + int PassNumber() { return m_ipass; } + bool ReadFromFont(GrIStream & grstrm, int fxdSilfVersion, int fxdRuleVersion, int nOffset); void InitializeWithNoRules(); @@ -392,7 +396,6 @@ protected: int m_fxdVersion; - std::vector<int> vnStack; // number of items required from previous pass; don't access directly, use the getter // method, because GrBidiPass overrides to always use 1. int m_nMaxRuleContext; @@ -425,6 +428,9 @@ protected: byte * m_prgbConstraintBlock; // rule constraints byte * m_prgbActionBlock; + int m_cbConstraints; // needed for memory instrumentation only + int m_cbActions; // needed for memory instrumentation only + bool m_fHasDebugStrings; data16 * m_prgibConstraintDebug; // m_crul+1 of these data16 * m_prgibRuleDebug; // m_crul+1 of these @@ -432,6 +438,9 @@ protected: bool m_fCheckRules; bool * m_prgfRuleOkay; + std::vector<int> m_vnStack; // for stack machine processing (more efficient than creating the + // vector each time) + // state of process for this pass PassState * m_pzpst; @@ -470,7 +479,10 @@ public: Hungarian: pass ----------------------------------------------------------------------------------------------*/ -class GrGlyphGenPass : public GrPass { +class GrGlyphGenPass : public GrPass +{ + friend class FontMemoryUsage; + public: GrGlyphGenPass(int ipass) : GrPass(ipass) { @@ -497,7 +509,10 @@ protected: Hungarian: pass ----------------------------------------------------------------------------------------------*/ -class GrLineBreakPass : public GrPass { +class GrLineBreakPass : public GrPass +{ + friend class FontMemoryUsage; + public: GrLineBreakPass(int ipass) : GrPass(ipass) { @@ -538,7 +553,10 @@ public: Hungarian: pass ----------------------------------------------------------------------------------------------*/ -class GrSubPass : public GrPass { +class GrSubPass : public GrPass +{ + friend class FontMemoryUsage; + public: GrSubPass(int ipass) : GrPass(ipass) { @@ -615,6 +633,8 @@ public: ----------------------------------------------------------------------------------------------*/ class GrBidiPass : public GrSubPass { + friend class FontMemoryUsage; + public: // Constructor: GrBidiPass(int ipass) @@ -677,7 +697,10 @@ public: Hungarian: pass ----------------------------------------------------------------------------------------------*/ -class GrPosPass : public GrPass { +class GrPosPass : public GrPass +{ + friend class FontMemoryUsage; + public: GrPosPass(int ipass) : GrPass(ipass) { diff --git a/Build/source/libs/graphite-engine/src/segment/GrPassActionCode.cpp b/Build/source/libs/graphite-engine/src/segment/GrPassActionCode.cpp index 7c85aabf398..83c58b27e48 100644 --- a/Build/source/libs/graphite-engine/src/segment/GrPassActionCode.cpp +++ b/Build/source/libs/graphite-engine/src/segment/GrPassActionCode.cpp @@ -10,6 +10,8 @@ Last reviewed: Not yet. Description: A continution of the GrPass file, including functions to run the action commands. + +This comment could create a merge conflict. It can be removed. ----------------------------------------------------------------------------------------------*/ //:>******************************************************************************************** @@ -64,8 +66,9 @@ int GrPass::RunCommandCode(GrTableManager * ptman, { byte * pbNext = pbStart; - std::vector<int> vnStack; +// std::vector<int> vnStack; // vnStack.EnsureSpace(128); // make it nice and big + m_vnStack.clear(); gAssert(fConstraints || islot == 0); @@ -85,7 +88,7 @@ int GrPass::RunCommandCode(GrTableManager * ptman, nRet = RunOneCommand(ptman, fConstraints, op, &pbNext, &fMustGet, &fInserting, psstrmIn, psstrmOut, islot, - vnStack, &smf); + m_vnStack, &smf); if (smf == ksmfDone) return nRet; diff --git a/Build/source/libs/graphite-engine/src/segment/GrSlotState.cpp b/Build/source/libs/graphite-engine/src/segment/GrSlotState.cpp index 892318912e1..b18ae95a63f 100644 --- a/Build/source/libs/graphite-engine/src/segment/GrSlotState.cpp +++ b/Build/source/libs/graphite-engine/src/segment/GrSlotState.cpp @@ -58,6 +58,8 @@ void GrSlotState::Initialize(gid16 chw, GrEngine * pgreng, u_intslot * pFeatBuf = PFeatureBuf(); for (size_t i = 0; i < m_cnFeat; i++) pFeatBuf[i].nValue = fval.m_rgnFValues[i]; + m_ipassFsmCol = -1; + m_colFsm = -1; m_ipassModified = ipass; m_ichwSegOffset = ichwSegOffset; @@ -100,6 +102,8 @@ void GrSlotState::Initialize(gid16 chw, GrEngine * pgreng, m_vpslotAssoc.clear(); pgreng->InitSlot(this); // Caller is responsible for setting m_spsl. + m_ipassFsmCol = -1; + m_colFsm = -1; } // for inserting new slots after pass 0 (under-pos and unicode are irrelevant) @@ -121,6 +125,8 @@ void GrSlotState::Initialize(gid16 chw, GrEngine * pgreng, m_vpslotAssoc.clear(); pgreng->InitSlot(this); m_spsl = kspslNone; + m_ipassFsmCol = -1; + m_colFsm = -1; } /*---------------------------------------------------------------------------------------------- @@ -129,18 +135,17 @@ void GrSlotState::Initialize(gid16 chw, GrEngine * pgreng, ----------------------------------------------------------------------------------------------*/ void GrSlotState::InitializeFrom(GrSlotState * pslotOld, int ipass) { + CopyFrom(pslotOld, false); + m_ipassModified = ipass; m_pslotPrevState = pslotOld; m_ichwSegOffset = kInvalid; m_vpslotAssoc.clear(); m_vpslotAssoc.push_back(pslotOld); - m_dislotRootFixed = pslotOld->m_dislotRootFixed; - m_vdislotAttLeaves.resize(pslotOld->m_vdislotAttLeaves.size()); - for (size_t i = 0; i < pslotOld->m_vdislotAttLeaves.size(); i++) - m_vdislotAttLeaves[i] = pslotOld->m_vdislotAttLeaves[i]; - - GrSlotAbstract::CopyFrom(pslotOld); + // Since we're going on to a new pass, no point in copying these: + m_ipassFsmCol = -1; + m_colFsm = -1; ////FixAttachmentTree(pslotOld); } @@ -157,17 +162,85 @@ void GrSlotState::CopyFeaturesFrom(GrSlotState * pslotSrc) /*---------------------------------------------------------------------------------------------- Copy the basic information. - Warning: this function will break if GrSlotState and subclasses are given virtual + Warning: the functions below will break if GrSlotState and subclasses are given virtual methods. In that case, we will need to copy from the address of the first variable in GrSlotAbstract. ----------------------------------------------------------------------------------------------*/ -void GrSlotAbstract::CopyFrom(GrSlotState * pslot) +void GrSlotState::CopyFrom(GrSlotState * pslot, bool fCopyEverything) +{ + GrSlotAbstract::CopyAbstractFrom(pslot); + std::copy(pslot->m_prgnVarLenBuf, pslot->m_prgnVarLenBuf + CExtraSpace(), m_prgnVarLenBuf); + + if (fCopyEverything) + { + Assert(false); + m_ipassModified = pslot->m_ipassModified; + m_pslotPrevState = pslot->m_pslotPrevState; + m_ichwSegOffset = pslot->m_ichwSegOffset; + m_colFsm = pslot->m_colFsm; + m_ipassFsmCol = pslot->m_ipassFsmCol; + // TODO: copy m_vpslotAssocs. + m_fNeutralAssocs = pslot->m_fNeutralAssocs; + } + + m_dislotRootFixed = pslot->m_dislotRootFixed; + + m_vdislotAttLeaves.resize(pslot->m_vdislotAttLeaves.size()); + for (size_t i = 0; i < pslot->m_vdislotAttLeaves.size(); i++) + m_vdislotAttLeaves[i] = pslot->m_vdislotAttLeaves[i]; + + m_islotPosPass = pslot->m_islotPosPass; + m_nUnicode = pslot->m_nUnicode; + m_dircProc = pslot->m_dircProc; + m_fDirProcessed = pslot->m_fDirProcessed; + m_cnUserDefn = pslot->m_cnUserDefn; + m_cnFeat = pslot->m_cnFeat; + m_bStyleIndex = pslot->m_bStyleIndex; + m_mAdvanceX = pslot->m_mAdvanceX; + m_mAdvanceY = pslot->m_mAdvanceY; + m_mShiftX = pslot->m_mShiftX; + m_mShiftY = pslot->m_mShiftY; + m_srAttachTo = pslot->m_srAttachTo; + m_nAttachLevel = pslot->m_nAttachLevel; + m_mAttachAtX = pslot->m_mAttachAtX; + m_mAttachAtY = pslot->m_mAttachAtY; + m_mAttachAtXOffset = pslot->m_mAttachAtXOffset; + m_mAttachAtYOffset = pslot->m_mAttachAtYOffset; + m_mAttachWithX = pslot->m_mAttachWithX; + m_mAttachWithY = pslot->m_mAttachWithY; + m_mAttachWithXOffset = pslot->m_mAttachWithXOffset; + m_mAttachWithYOffset = pslot->m_mAttachWithYOffset; + m_nAttachAtGpoint = pslot->m_nAttachAtGpoint; + m_nAttachWithGpoint = pslot->m_nAttachWithGpoint; + m_fAttachMod = pslot->m_fAttachMod; + m_fShiftMod = pslot->m_fShiftMod; + m_fIgnoreAdvance = pslot->m_fIgnoreAdvance; + + m_nCompositeLevel = kNegInfinity; // uncalculated, so don't need to copy the positions?? +} + +void GrSlotAbstract::CopyAbstractFrom(GrSlotState * pslot) { u_intslot * pnBufSave = m_prgnVarLenBuf; *this = *pslot; m_prgnVarLenBuf = pnBufSave; Assert(m_prgnVarLenBuf); - std::copy(pslot->m_prgnVarLenBuf, pslot->m_prgnVarLenBuf + CExtraSpace(), m_prgnVarLenBuf); +} + +/*---------------------------------------------------------------------------------------------- + Initialize the output slot from the one use within the passes, with the basic information. + Warning: this function will break if GrSlotState and subclasses are given virtual + methods. In that case, we will need to copy from the address of the first variable in + GrSlotAbstract. +----------------------------------------------------------------------------------------------*/ +void GrSlotOutput::InitializeOutputFrom(GrSlotState * pslot) +{ + CopyAbstractFrom(pslot); + + // Copy just the component information, which is of length (m_cnCompPerLig * 2) + //std::copy(pslot->PCompRefBuf(), + // pslot->PCompRefBuf() + (m_cnCompPerLig * 2), + // this->PCompRefBufSlout()); } /*---------------------------------------------------------------------------------------------- @@ -232,7 +305,7 @@ void GrSlotState::EnsureCacheForOutput(GrTableManager * ptman) m_xysGlyphWidth = 0; m_xysAdvX = 0; m_xysAdvY = 0; - m_fIsSpace = true; + m_bIsSpace = true; } else { @@ -478,7 +551,7 @@ void GrSlotState::AllComponentRefs(std::vector<int> & vichw) Get the value of the component.???.ref attribute for the slot. Note that 'i' is the local index for the component as defined for this glyph. ----------------------------------------------------------------------------------------------*/ -GrSlotState * GrSlotAbstract::CompRefSlot(int i) +GrSlotState * GrSlotState::CompRefSlot(int i) { Assert(i < m_cnCompPerLig); if (i < m_cnCompPerLig) @@ -624,45 +697,42 @@ float GrSlotOutput::GlyphMetricLogUnits(Font * pfont, int nMetricID) return GetGlyphMetric(pfont, nMetricID, m_chwActual); } -float GrSlotOutput::GlyphMetricLogUnits(int gmet) -{ - // When the font is not passed as an argument, the values better be cached! - - switch (gmet) - { // There may be off by one errors below, depending on what width and height mean - case kgmetLsb: - return m_xysGlyphX; - case kgmetRsb: - return (m_xysAdvX - m_xysGlyphX - m_xysGlyphWidth); - case kgmetBbTop: - return m_xysGlyphY; - case kgmetBbBottom: - return (m_xysGlyphY - m_xysGlyphHeight); - case kgmetBbLeft: - return m_xysGlyphX; - case kgmetBbRight: - return (m_xysGlyphX + m_xysGlyphWidth); - case kgmetBbHeight: - return m_xysGlyphHeight; - case kgmetBbWidth: - return m_xysGlyphWidth; - case kgmetAdvWidth: - return m_xysAdvX; - case kgmetAdvHeight: - return m_xysAdvY; - default: - Warn("GetGlyphMetric was asked for an illegal metric."); - }; - - return 0; -} +//float GrSlotOutput::GlyphMetricLogUnits(int gmet) -- obsolete: no longer caching these values +//{ +// // When the font is not passed as an argument, the values better be cached! +// +// switch (gmet) +// { // There may be off by one errors below, depending on what width and height mean +// case kgmetLsb: +// return m_xysGlyphX; +// case kgmetRsb: +// return (m_xysAdvX - m_xysGlyphX - m_xysGlyphWidth); +// case kgmetBbTop: +// return m_xysGlyphY; +// case kgmetBbBottom: +// return (m_xysGlyphY - m_xysGlyphHeight); +// case kgmetBbLeft: +// return m_xysGlyphX; +// case kgmetBbRight: +// return (m_xysGlyphX + m_xysGlyphWidth); +// case kgmetBbHeight: +// return m_xysGlyphHeight; +// case kgmetBbWidth: +// return m_xysGlyphWidth; +// case kgmetAdvWidth: +// return m_xysAdvX; +// case kgmetAdvHeight: +// return m_xysAdvY; +// default: +// Warn("GetGlyphMetric was asked for an illegal metric."); +// }; +// +// return 0; +//} float GrSlotAbstract::GetGlyphMetric(Font * pfont, int nMetricID, gid16 chwGlyphID) { - //GrResult res; - float xysRet = 0; - GlyphMetric gmet = GlyphMetric(nMetricID); float yAscent, yDescent; @@ -671,91 +741,70 @@ float GrSlotAbstract::GetGlyphMetric(Font * pfont, int nMetricID, gid16 chwGlyph if (kgmetAscent == gmet) { - if (m_xysFontAscent != -1) - return m_xysFontAscent; - //GrResult res = pgg->get_FontAscent(&xysRet); - //if (ResultFailed(res)) - //{ - // WARN(res); - // return 0; - //} + //if (m_xysFontAscent != -1) + // return m_xysFontAscent; pfont->getFontMetrics(&yAscent); - m_xysFontAscent = xysRet; - if (pfont) - m_xysFontAscent = yAscent; - return xysRet; + //m_xysFontAscent = xysRet; + //if (pfont) + // m_xysFontAscent = yAscent; + return yAscent; } if (kgmetDescent == gmet) { - if (m_xysFontDescent != -1) - return m_xysFontDescent; - //GrResult res = pgg->get_FontDescent(&xysRet); - //if (ResultFailed(res)) - //{ - // WARN(res); - // return 0; - // m_xysFontDescent = xysRet; - //} + //if (m_xysFontDescent != -1) + // return m_xysFontDescent; pfont->getFontMetrics(NULL, &yDescent); - m_xysFontDescent = xysRet; - if (pfont) - m_xysFontDescent = yDescent; - return xysRet; + //m_xysFontDescent = xysRet; + //if (pfont) + // m_xysFontDescent = yDescent; + return yDescent; } - if (m_xysGlyphWidth == -1) - { - //res = pgg->GetGlyphMetrics(chwGlyphID, &m_xysGlyphWidth, &m_xysGlyphHeight, - // &m_xysGlyphX, &m_xysGlyphY, &m_xysAdvX, &m_xysAdvY); - //if (ResultFailed(res)) - //{ - // //WARN(res); - // //return 0; - // ThrowHr(WarnHr(res)); - //} - + float xysGlyphX, xysGlyphY, xysGlyphWidth, xysGlyphHeight, xysAdvX, xysAdvY; + //if (m_xysGlyphWidth == -1) + //{ pfont->getGlyphMetrics(chwGlyphID, rectBb, ptAdvances); - m_xysGlyphX = rectBb.left; - m_xysGlyphY = rectBb.top; - m_xysGlyphWidth = (rectBb.right - rectBb.left); - m_xysGlyphHeight = (rectBb.top - rectBb.bottom); - m_xysAdvX = ptAdvances.x; - m_xysAdvY = ptAdvances.y; + xysGlyphX = rectBb.left; + xysGlyphY = rectBb.top; + xysGlyphWidth = (rectBb.right - rectBb.left); + xysGlyphHeight = (rectBb.top - rectBb.bottom); + xysAdvX = ptAdvances.x; + xysAdvY = ptAdvances.y; - m_fIsSpace = (0 == m_xysGlyphX && 0 == m_xysGlyphY); // should agree with test done in IsSpace() below + m_bIsSpace = (0 == xysGlyphX && 0 == xysGlyphY); // should agree with test done in IsSpace() below - if (m_fIsSpace) + if (m_bIsSpace == 1) { // White space glyph - only case where nGlyphX == nGlyphY == 0 // nGlyphWidth & nGlyphHeight are always set to 16 for unknown reasons, so correct. - m_xysGlyphWidth = m_xysGlyphHeight = 0; + xysGlyphWidth = xysGlyphHeight = 0; } - } + //} switch (gmet) - { // There may be off by one errors below, depending on what width and height mean + { // There may be off-by-one errors below, depending on what width and height mean case kgmetLsb: - return m_xysGlyphX; + return xysGlyphX; case kgmetRsb: - return (m_xysAdvX - m_xysGlyphX - m_xysGlyphWidth); + return (xysAdvX - xysGlyphX - xysGlyphWidth); case kgmetBbTop: - return m_xysGlyphY; + return xysGlyphY; case kgmetBbBottom: - return (m_xysGlyphY - m_xysGlyphHeight); + return (xysGlyphY - xysGlyphHeight); case kgmetBbLeft: - return m_xysGlyphX; + return xysGlyphX; case kgmetBbRight: - return (m_xysGlyphX + m_xysGlyphWidth); + return (xysGlyphX + xysGlyphWidth); case kgmetBbHeight: - return m_xysGlyphHeight; + return xysGlyphHeight; case kgmetBbWidth: - return m_xysGlyphWidth; + return xysGlyphWidth; case kgmetAdvWidth: - return m_xysAdvX; + return xysAdvX; case kgmetAdvHeight: - return m_xysAdvY; + return xysAdvY; default: Warn("GetGlyphMetric was asked for an illegal metric."); }; @@ -786,19 +835,23 @@ int GrSlotState::IsSpace(GrTableManager * ptman) //// ptman->State()->Font()->getGlyphMetrics(gidActual, rectBb, ptAdvances); ////} - GetGlyphMetric(ptman->State()->GetFont(), kgmetBbLeft, gidActual); + if (m_bIsSpace == -1) + GetGlyphMetric(ptman->State()->GetFont(), kgmetBbLeft, gidActual); // One call is enough to cache the information. //GetGlyphMetric(ptman->State()->Font(), kgmetBbBottom, gidActual); // should agree with test done in GetGlyphMetric() above - //////m_fIsSpace = (0 == m_xysGlyphX && 0 == m_xysGlyphY); + //////m_bIsSpace = (0 == m_xysGlyphX && 0 == m_xysGlyphY); - return m_fIsSpace; + Assert(m_bIsSpace == 0 || m_bIsSpace == 1); + + return m_bIsSpace; } bool GrSlotOutput::IsSpace() { - return m_fIsSpace; + Assert(m_bIsSpace == 0 || m_bIsSpace == 1); + return m_bIsSpace; } /*---------------------------------------------------------------------------------------------- @@ -1059,9 +1112,9 @@ void GrSlotState::InitLeafMetrics(GrTableManager * ptman, GrSlotState * pslotRoo if (IsBase()) { - // These two are actually meaningless numbers, for the base, but set them - // to something reasonable. - m_xsOffsetX = xsShiftX; + // The x-value below has to be zero because the shift is incorporated into + // m_xsRootShiftX. (m_ysRootShiftY, on the other hand, isn't used anywhere.) + m_xsOffsetX = 0; m_ysOffsetY = ysShiftY; m_xsRootShiftX = xsShiftX; @@ -1383,16 +1436,14 @@ void GrSlotOutput::ExactCopyFrom(GrSlotOutput * pslout, u_intslot * pnVarLenBuf, m_ichwAfterAssoc = pslout->m_ichwAfterAssoc; m_cComponents = pslout->m_cComponents; - for (size_t iislout = 0; iislout < pslout->m_visloutClusterMembers.size(); iislout++) - m_visloutClusterMembers.push_back(pslout->m_visloutClusterMembers[iislout]); - m_isloutClusterBase = pslout->m_isloutClusterBase; + m_disloutCluster = pslout->m_disloutCluster; m_xsClusterXOffset = pslout->m_xsClusterXOffset; m_xsClusterAdvance = pslout->m_xsClusterAdvance; m_igbb = pslout->m_igbb; m_xsAdvanceX = pslout->m_xsAdvanceX; - m_ysAdvanceY = pslout->m_ysAdvanceY; - m_rectBB = pslout->m_rectBB; +// m_ysAdvanceY = pslout->m_ysAdvanceY; +// m_rectBB = pslout->m_rectBB; } /*---------------------------------------------------------------------------------------------- @@ -1404,8 +1455,24 @@ void GrSlotOutput::ShiftForDirDepthChange(float dxsSegWidth) float dxsShift = dxsSegWidth - m_xsAdvanceX - (2 * m_xsPositionX); int tmp; tmp = (int) dxsShift; m_xsPositionX += dxsShift; - m_rectBB.left += dxsShift; - m_rectBB.right += dxsShift; +// m_rectBB.left += dxsShift; +// m_rectBB.right += dxsShift; +} + +/*---------------------------------------------------------------------------------------------- + Return the indices of all the glyphs attached to this cluster, in logical order. + Return an empty vector if this glyph is not the base glyph or if there are no + attached glyphs. + This method return glyph indices, not slot indices. +----------------------------------------------------------------------------------------------*/ +void GrSlotOutput::ClusterMembers(Segment * pseg, int isloutThis, std::vector<int> & visloutRet) +{ + if (m_isloutClusterBase == -1 || m_isloutClusterBase == isloutThis) // yes, a base + pseg->ClusterMembersForGlyph(isloutThis, m_disloutCluster, visloutRet); + else + { + Assert(visloutRet.size() == 0); + } } } // namespace gr diff --git a/Build/source/libs/graphite-engine/src/segment/GrSlotState.h b/Build/source/libs/graphite-engine/src/segment/GrSlotState.h index f9110d7b68c..400f21d5800 100644 --- a/Build/source/libs/graphite-engine/src/segment/GrSlotState.h +++ b/Build/source/libs/graphite-engine/src/segment/GrSlotState.h @@ -11,7 +11,7 @@ Last reviewed: Not yet. Copyright (C) 1999 by SIL International. All rights reserved. Description: - Class GrSlotAbstract, GrSlotState, and GrSlotOutput + Classes GrSlotAbstract, GrSlotState, and GrSlotOutput ----------------------------------------------------------------------------------------------*/ #ifdef _MSC_VER #pragma once @@ -53,36 +53,14 @@ public: // the table manager is responsible for destroying the contents of m_prgnVarLenBuf } - void BasicInitialize(int cnUserDefn, int cnCompPerLig, int cnFeat, u_intslot * pnBuf) + void BasicInitializeAbstract(int cnCompPerLig, u_intslot * pnBuf) { - m_dirc = kNotYetSet; - m_lb = kNotYetSet; + m_dirc = kNotYetSet8; + m_lb = kNotYetSet8; m_fInsertBefore = true; m_nDirLevel = -1; - m_fHasComponents = false; - - m_xysGlyphWidth = -1; - m_xysFontAscent = -1; - m_xysFontDescent = -1; - - m_mAdvanceX = kNotYetSet; - m_mAdvanceY = kNotYetSet; - m_mShiftX = 0; - m_mShiftY = 0; - m_srAttachTo = 0; - m_nAttachLevel = 0; - - m_mAttachAtX = kNotYetSet; - m_mAttachAtY = 0; - m_nAttachAtGpoint = kNotYetSet; - m_mAttachAtXOffset = 0; - m_mAttachAtYOffset = 0; - m_mAttachWithX = kNotYetSet; - m_mAttachWithY = 0; - m_nAttachWithGpoint = kNotYetSet; - m_mAttachWithXOffset = 0; - m_mAttachWithYOffset = 0; + m_bIsSpace = -1; // unknown m_fInsertBefore = true; @@ -95,16 +73,11 @@ public: m_nJWeight0 = 0; m_mJWidth0 = 0; - m_islotPosPass = kNotYetSet; - - m_cnUserDefn = byte(cnUserDefn); m_cnCompPerLig = byte(cnCompPerLig); - m_cnFeat = byte(cnFeat); m_prgnVarLenBuf = pnBuf; - - m_fAdvXSet = false; // for transduction logging - m_fAdvYSet = false; } + + void CopyAbstractFrom(GrSlotState * pslot); void SetBufferPtr(u_intslot * pn) { @@ -115,55 +88,15 @@ public: gid16 RawActualGlyph() { return m_chwActual; } float GetGlyphMetric(Font * pfont, int nGlyphMetricID, gid16 chwGlyphID); - int StyleIndex() { return m_bStyleIndex; } - void GetFeatureValues(GrFeatureValues * pfval) - { - pfval->m_nStyleIndex = m_bStyleIndex; - std::fill(pfval->m_rgnFValues, pfval->m_rgnFValues + kMaxFeatures, 0); - for (size_t i = 0; i < m_cnFeat; i++) - pfval->m_rgnFValues[i] = PFeatureBuf()[i].nValue; - } - - int RawAdvanceX() { return m_mAdvanceX; } - int RawAdvanceY() { return m_mAdvanceY; } - int ShiftX() { return m_mShiftX; } - int ShiftY() { return m_mShiftY; } - - int AttachTo() { return m_srAttachTo; } - int AttachLevel() { return m_nAttachLevel; } - - int RawAttachAtX() { return m_mAttachAtX; } - int AttachAtY() { return m_mAttachAtY; } - int AttachAtGpoint() { return m_nAttachAtGpoint; } - int AttachAtXOffset() { return m_mAttachAtXOffset; } - int AttachAtYOffset() { return m_mAttachAtYOffset; } - - int RawAttachWithX() { return m_mAttachWithX; } - int AttachWithY() { return m_mAttachWithY; } - int AttachWithGpoint() { return m_nAttachWithGpoint; } - int AttachWithXOffset() { return m_mAttachWithXOffset; } - int AttachWithYOffset() { return m_mAttachWithYOffset; } - - bool HasComponents() { return m_fHasComponents; } - -// int CompRef(int i) -// { -// Assert(i < m_cnCompPerLig); -// if (i < m_cnCompPerLig) -// return m_rgsrCompRef[i]; -// else -// return kNotYetSet; -// } - - GrSlotState * CompRefSlot(int i); + //GrSlotState * CompRefSlot(int i); int BreakWeight() { - return m_lb; + return (int)m_lb; } DirCode Directionality() { - return DirCode(m_dirc); + return DirCode(int(m_dirc)); } int InsertBefore() { @@ -189,104 +122,17 @@ public: } void SetSpecialSlotFlag(int spsl) { - m_spsl = spsl; + m_spsl = sdata8(spsl); } - void CopyFrom(GrSlotState * pslot); - enum { kNotYetSet = 0x7FFF, + kNotYetSet8 = 0x7F, kInvalidGlyph = 0xFFFF }; - int PosPassIndex() - { - return m_islotPosPass; - } - void SetPosPassIndex(int islot, bool fInputToPosPass1) - { - // If we're resetting it, it should be to the same value as before: - Assert(fInputToPosPass1 || m_islotPosPass == kNotYetSet || m_islotPosPass == islot); - m_islotPosPass = islot; - } - void IncPosPassIndex() - { - m_islotPosPass++; - } - void ZapPosPassIndex() - { - m_islotPosPass = kNotYetSet; - } - gid16 ActualGlyphForOutput(GrTableManager * ptman); - // Variable-length buffer--includes four sub-buffers: - // * user-defined variables - // * component.???.ref assignments - // * mapping from components used to global attribute IDs for components - // * feature values - - int UserDefn(int slati) - { - Assert(slati < m_cnUserDefn); - return m_prgnVarLenBuf[slati].nValue; - } - void SetUserDefn(int slati, int nVal) - { - Assert(slati < m_cnUserDefn); - m_prgnVarLenBuf[slati].nValue = nVal; - } - u_intslot * PUserDefnBuf() - { - return m_prgnVarLenBuf; - } - - GrSlotState * CompRef(int slati) - { - Assert(slati < m_cnCompPerLig); - return m_prgnVarLenBuf[m_cnUserDefn + slati].pslot; - } - void SetCompRef(int slati, GrSlotState * pvSlot) - { - Assert(slati < m_cnCompPerLig); - m_prgnVarLenBuf[m_cnUserDefn + slati].pslot = pvSlot; - } - u_intslot * PCompRefBuf() - { - return m_prgnVarLenBuf + m_cnUserDefn; - } - - int Slati(int i) - { - Assert(i < m_cnCompPerLig); - return m_prgnVarLenBuf[m_cnUserDefn + m_cnCompPerLig + i].nValue; - } - void SetSlati(int i, int n) - { - Assert(i < m_cnCompPerLig); - m_prgnVarLenBuf[m_cnUserDefn + m_cnCompPerLig + i].nValue = n; - } - u_intslot * PSlatiBuf() - { - return m_prgnVarLenBuf + m_cnUserDefn + m_cnCompPerLig; - } - - int FeatureValue(int i) - { - Assert(i < m_cnFeat); - return m_prgnVarLenBuf[m_cnUserDefn + (m_cnCompPerLig * 2) + i].nValue; - } - - u_intslot * PFeatureBuf() - { - return m_prgnVarLenBuf + m_cnUserDefn + (m_cnCompPerLig * 2); - } - - int CExtraSpace() - { - return m_cnUserDefn + (m_cnCompPerLig * 2) + m_cnFeat; - } - // Needed for GlyphInfo: float XPosition() { @@ -301,51 +147,18 @@ protected: gid16 m_chwGlyphID; gid16 m_chwActual; // actual glyph to output (which is a different glyph for pseudos) - int m_islotPosPass; // index of slot in positioning streams, relative to first official - // slot in the segment (possibly the LB slot) - - int m_spsl; // special slot flag: LB, bidi marker + sdata8 m_spsl; // special slot flag: LB, bidi marker // bool m_fInitialLB; // for LB slots: true if this is the initial LB; // false if it is the terminating LB // TODO: remove - int m_dirc; // default = kNotYetSet (read from glyph attr) - int m_lb; // default = kNotYetSet (read from glyph attr) - - int m_nDirLevel; - - // raw glyph metrics (directly from font) - float m_xysFontAscent; - float m_xysFontDescent; - float m_xysGlyphWidth; - float m_xysGlyphHeight; - float m_xysGlyphX; - float m_xysGlyphY; - float m_xysAdvX; - float m_xysAdvY; - - // Slot attributes: - short m_mAdvanceX; - short m_mAdvanceY; - short m_mShiftX; - short m_mShiftY; + sdata8 m_dirc; // default = kNotYetSet8 (read from glyph attr) + sdata8 m_lb; // default = kNotYetSet8 (read from glyph attr) - short m_srAttachTo; - short m_nAttachLevel; - - short m_mAttachAtX; - short m_mAttachAtY; - short m_mAttachAtXOffset; - short m_mAttachAtYOffset; - short m_mAttachWithX; - short m_mAttachWithY; - short m_mAttachWithXOffset; - short m_mAttachWithYOffset; - - short m_nAttachAtGpoint; - short m_nAttachWithGpoint; + sdata8 m_nDirLevel; + // Slot attributes that are used by GrSlotOutput: short m_mMeasureSol; short m_mMeasureEol; @@ -357,15 +170,9 @@ protected: bool m_fInsertBefore; // default = true - bool m_fHasComponents; // default = false - - bool m_fIsSpace; - - byte m_bStyleIndex; + sdata8 m_bIsSpace; // 0 = false, 1 = true, -1 = unknown - byte m_cnUserDefn; byte m_cnCompPerLig; - byte m_cnFeat; // There is a large block managed by either the GrTableManager (for GrSlotState) // or the segment (for GrSlotOutput); this variable points at the sub-buffer for this // particular slot: @@ -374,10 +181,6 @@ protected: float m_xsPositionX; float m_ysPositionY; -public: // for transduction logging - bool m_fAdvXSet; - bool m_fAdvYSet; - }; // end of class GrSlotAbstract @@ -394,8 +197,8 @@ public: // for transduction logging ----------------------------------------------------------------------------------------------*/ class GrSlotState : public GrSlotAbstract { - friend class GrSlotStream; + friend class FontMemoryUsage; public: enum { kNeutral = 99 }; @@ -423,6 +226,44 @@ public: { } + void BasicInitialize(int cnUserDefn, int cnCompPerLig, int cnFeat, u_intslot * pnBuf) + { + BasicInitializeAbstract(cnCompPerLig, pnBuf); + + m_xysGlyphWidth = -1; + m_xysFontAscent = -1; + m_xysFontDescent = -1; + + m_mAdvanceX = kNotYetSet; + m_mAdvanceY = kNotYetSet; + m_mShiftX = 0; + m_mShiftY = 0; + + m_fAdvXSet = false; // for transduction logging + m_fAdvYSet = false; + + m_srAttachTo = 0; + m_nAttachLevel = 0; + + m_mAttachAtX = kNotYetSet; + m_mAttachAtY = 0; + m_nAttachAtGpoint = kNotYetSet; + m_mAttachAtXOffset = 0; + m_mAttachAtYOffset = 0; + m_mAttachWithX = kNotYetSet; + m_mAttachWithY = 0; + m_nAttachWithGpoint = kNotYetSet; + m_mAttachWithXOffset = 0; + m_mAttachWithYOffset = 0; + + m_islotPosPass = kNotYetSet; + + m_cnUserDefn = byte(cnUserDefn); + m_cnFeat = byte(cnFeat); + + m_fHasComponents = false; + } + void Initialize(gid16 chw, GrEngine *, GrFeatureValues fval, int ipass, int ichwSegOffset, int nUnicode = -1); void Initialize(gid16 chw, GrEngine *, GrSlotState * pslotFeat, @@ -434,6 +275,8 @@ public: void CopyFeaturesFrom(GrSlotState * pslotSrc); void FixAttachmentTree(GrSlotState * pslotOld); + void CopyFrom(GrSlotState * pslot, bool fCopyEverything = true); + // General: int RawSegOffset() { return m_ichwSegOffset; } @@ -442,13 +285,52 @@ public: m_chwGlyphID = chw; m_chwActual = kInvalidGlyph; m_xysGlyphWidth = -1; // indicate glyph metrics are invalid + m_ipassFsmCol = -1; + m_colFsm = -1; + } + + int PosPassIndex() + { + return m_islotPosPass; + } + void SetPosPassIndex(int islot, bool fInputToPosPass1) + { + // If we're resetting it, it should be to the same value as before: + Assert(fInputToPosPass1 || m_islotPosPass == kNotYetSet || m_islotPosPass == islot); + m_islotPosPass = islot; + } + void IncPosPassIndex() + { + m_islotPosPass++; + } + void ZapPosPassIndex() + { + m_islotPosPass = kNotYetSet; } + + int StyleIndex() { return m_bStyleIndex; } + + int AttachTo() { return m_srAttachTo; } + int AttachLevel() { return m_nAttachLevel; } + + int RawAttachAtX() { return m_mAttachAtX; } + int AttachAtY() { return m_mAttachAtY; } + int AttachAtGpoint() { return m_nAttachAtGpoint; } + int AttachAtXOffset() { return m_mAttachAtXOffset; } + int AttachAtYOffset() { return m_mAttachAtYOffset; } + + int RawAttachWithX() { return m_mAttachWithX; } + int AttachWithY() { return m_mAttachWithY; } + int AttachWithGpoint() { return m_nAttachWithGpoint; } + int AttachWithXOffset() { return m_mAttachWithXOffset; } + int AttachWithYOffset() { return m_mAttachWithYOffset; } + void Associate(GrSlotState *); void Associate(GrSlotState *, GrSlotState *); void Associate(std::vector<GrSlotState*> &); void ClearAssocs(); - int AssocsSize() { return m_vpslotAssoc.size(); } + int AssocsSize() { return m_vpslotAssoc.size(); } GrSlotState * RawBeforeAssocSlot() { if (m_vpslotAssoc.size() == 0) @@ -518,10 +400,12 @@ public: return false; } + bool HasComponents() { return m_fHasComponents; } + // Directionality as determined by the bidi algorithm DirCode DirProcessed() // return the value { - Assert(m_dirc != kNotYetSet); + Assert(m_dirc != kNotYetSet8); if (m_dircProc == kdircUnknown) m_dircProc = DirCode(m_dirc); return m_dircProc; @@ -539,6 +423,11 @@ public: m_fDirProcessed = true; } + int RawAdvanceX() { return m_mAdvanceX; } + int RawAdvanceY() { return m_mAdvanceY; } + int ShiftX() { return m_mShiftX; } + int ShiftY() { return m_mShiftY; } + // Slot attributes that must be calculated: int AdvanceX(GrTableManager * ptman) @@ -618,10 +507,16 @@ public: Assert(mVal < 0xFFFF); m_mAdvanceY = short(mVal & 0xFFFF); m_fShiftMod = true; m_fAdvYSet = true; // for transduction logging } - void SetShiftX(int mVal) { - Assert(mVal < 0xFFFF); m_mShiftX = short(mVal & 0xFFFF); m_fShiftMod = true; } - void SetShiftY(int mVal) { - Assert(mVal < 0xFFFF); m_mShiftY = short(mVal & 0xFFFF); m_fShiftMod = true; } + void SetShiftX(int mVal) + { + Assert(mVal < 0xFFFF); m_mShiftX = short(mVal & 0xFFFF); + m_fShiftMod = true; + } + void SetShiftY(int mVal) + { + Assert(mVal < 0xFFFF); m_mShiftY = short(mVal & 0xFFFF); + m_fShiftMod = true; + } void SetAttachTo(int srVal) { @@ -660,11 +555,11 @@ public: void SetCompRefSlot(GrTableManager * ptman, int i, GrSlotState * pslotComp); - void SetBreakWeight(int lb) { m_lb = lb; } + void SetBreakWeight(int lb) { m_lb = sdata8(lb); } void SetInsertBefore(bool f) { m_fInsertBefore = f; } - void SetDirectionality(DirCode dirc) { m_dirc = dirc; } - void SetDirLevel(int n) { m_nDirLevel = n; } + void SetDirectionality(DirCode dirc) { m_dirc = sdata8(dirc); } + void SetDirLevel(int n) { m_nDirLevel = sdata8(n); } void SetMeasureSol(int mVal) { m_mMeasureSol = short(mVal); } void SetMeasureEol(int mVal) { m_mMeasureEol = short(mVal); } @@ -862,6 +757,96 @@ public: bool IsLrm(); bool IsRlm(); + // Cache of FSM column information for the most recent pass: + int FsmColumn() { return m_colFsm; } + int PassNumberForColumn() { return m_ipassFsmCol; } + void CacheFsmColumn(int ipass, int col) + { + m_colFsm = col; + m_ipassFsmCol = ipass; + } + + // Variable-length buffer--includes four sub-buffers: + // * user-defined variables + // * component.???.ref assignments + // * mapping from components used to global attribute IDs for components + // * feature values + + // user-defined slot attributes + int UserDefn(int slati) + { + Assert(slati < m_cnUserDefn); + return m_prgnVarLenBuf[slati].nValue; + } + void SetUserDefn(int slati, int nVal) + { + Assert(slati < m_cnUserDefn); + m_prgnVarLenBuf[slati].nValue = nVal; + } + u_intslot * PUserDefnBuf() + { + return m_prgnVarLenBuf; + } + + // pointer to the associated slot which is the value of the comp.ref attribute + GrSlotState * CompRef(int slati) + { + Assert(slati < m_cnCompPerLig); + return m_prgnVarLenBuf[m_cnUserDefn + slati].pslot; + } + void SetCompRef(int slati, GrSlotState * pvSlot) + { + Assert(slati < m_cnCompPerLig); + m_prgnVarLenBuf[m_cnUserDefn + slati].pslot = pvSlot; + } + u_intslot * PCompRefBuf() + { + return m_prgnVarLenBuf + m_cnUserDefn; + } + + // global component identifier + int Slati(int i) + { + Assert(i < m_cnCompPerLig); + return m_prgnVarLenBuf[m_cnUserDefn + m_cnCompPerLig + i].nValue; + } + void SetSlati(int i, int n) + { + Assert(i < m_cnCompPerLig); + m_prgnVarLenBuf[m_cnUserDefn + m_cnCompPerLig + i].nValue = n; + } + u_intslot * PSlatiBuf() + { + return m_prgnVarLenBuf + m_cnUserDefn + m_cnCompPerLig; + } + + // feature settings + int FeatureValue(int i) + { + Assert(i < m_cnFeat); + return m_prgnVarLenBuf[m_cnUserDefn + (m_cnCompPerLig * 2) + i].nValue; + } + + u_intslot * PFeatureBuf() + { + return m_prgnVarLenBuf + m_cnUserDefn + (m_cnCompPerLig * 2); + } + + int CExtraSpace() + { + return m_cnUserDefn + (m_cnCompPerLig * 2) + m_cnFeat; + } + + GrSlotState * CompRefSlot(int i); + + void GetFeatureValues(GrFeatureValues * pfval) + { + pfval->m_nStyleIndex = m_bStyleIndex; + std::fill(pfval->m_rgnFValues, pfval->m_rgnFValues + kMaxFeatures, 0); + for (size_t i = 0; i < m_cnFeat; i++) + pfval->m_rgnFValues[i] = PFeatureBuf()[i].nValue; + } + // For transduction logging: #ifdef TRACING void SlotAttrsModified(bool * rgfMods, bool fPreJust, int * pccomp, int * pcassoc); @@ -876,7 +861,6 @@ public: protected: // Instance variables: - int m_ipassModified; // pass in which this slot was modified GrSlotState * m_pslotPrevState; @@ -885,7 +869,11 @@ protected: // underlying text relative to the official // beginning of the segment; // should == kInvalid for other slot states - int m_nUnicode;; // for debugging + int m_islotPosPass; // index of slot in positioning streams, relative to first official + // slot in the segment (possibly the LB slot) + + int m_colFsm; // which FSM column this glyph corresponds to... + int m_ipassFsmCol; // ...for the most recent pass std::vector<GrSlotState*> m_vpslotAssoc; // association mappings @@ -893,9 +881,47 @@ protected: // default, rather than them being set explicitly // within a rule + int m_nUnicode; // for debugging + DirCode m_dircProc; // directionality as processed in bidi algorithm bool m_fDirProcessed; + // affects length of variable-length buffer + byte m_cnUserDefn; + byte m_cnFeat; + + byte m_bStyleIndex; + + // Slot attributes: + short m_mAdvanceX; + short m_mAdvanceY; + short m_mShiftX; + short m_mShiftY; + + short m_srAttachTo; + short m_nAttachLevel; + + short m_mAttachAtX; + short m_mAttachAtY; + short m_mAttachAtXOffset; + short m_mAttachAtYOffset; + short m_mAttachWithX; + short m_mAttachWithY; + short m_mAttachWithXOffset; + short m_mAttachWithYOffset; + + short m_nAttachAtGpoint; + short m_nAttachWithGpoint; + + // Raw glyph metrics (directly from font) + float m_xysFontAscent; + float m_xysFontDescent; + float m_xysGlyphWidth; + float m_xysGlyphHeight; + float m_xysGlyphX; + float m_xysGlyphY; + float m_xysAdvX; + float m_xysAdvY; // Attachment and metrics @@ -939,9 +965,12 @@ protected: float m_xsRootShiftX; float m_ysRootShiftY; + bool m_fHasComponents; // default = false // Private methods: + void CopyAbstractFrom(GrSlotState * pslot); + void AdjustRootMetrics(GrTableManager * ptman, GrSlotStream *); void InitMetrics(GrTableManager * ptman, GrSlotState * pslotRoot); void InitLeafMetrics(GrTableManager * ptman, GrSlotState * pslotRoot); @@ -998,6 +1027,10 @@ protected: } } +public: // for transduction logging + bool m_fAdvXSet; + bool m_fAdvYSet; + }; // end of class GrSlotState @@ -1011,18 +1044,21 @@ class GrSlotOutput : public GrSlotAbstract { friend class GlyphInfo; friend class Segment; + friend class SegmentMemoryUsage; public: GrSlotOutput() { m_cComponents = 0; m_isloutClusterBase = -1; // not part of any cluster + m_disloutCluster = 0; m_igbb = -1; - m_visloutClusterMembers.clear(); } void ExactCopyFrom(GrSlotOutput * pslout, u_intslot * pnVarLenBuf, int cnExtraPerSlot); + void InitializeOutputFrom(GrSlotState * pslot); + int BeforeAssoc() { return m_ichwBeforeAssoc; // relative to the official beginning of the segment @@ -1048,10 +1084,7 @@ public: } else { - // Must be kept consistent with UserDefn() and CompRef() methods inherited - // from GrSlotAbstract. The component indices come after the above variable- - // length buffers. - m_prgnVarLenBuf[m_cnUserDefn + (m_cnCompPerLig * 2) + m_cnFeat + m_cComponents].nValue + m_prgnVarLenBuf[m_cComponents].nValue = ichw; // OBSOLETE comment: @@ -1060,8 +1093,7 @@ public: // have defined components a, b, and c, but only mapped a and c to actual // characters. This buffer will then hold [0,2]. - m_prgnVarLenBuf[m_cnUserDefn + (m_cnCompPerLig * 2) + m_cnFeat - + m_cnCompPerLig + m_cComponents].nValue + m_prgnVarLenBuf[m_cnCompPerLig + m_cComponents].nValue = slati; // Assert(iComp >= m_cComponents); // because we process them in order they are defined @@ -1079,24 +1111,22 @@ public: int UnderlyingComponent(int iComp) { Assert(iComp < m_cnCompPerLig); - // Must be kept consistent with UserDefn() and CompRef() methods inherited - // from GrSlotAbstract. The component indices come after the above variable- - // length buffers. - return m_prgnVarLenBuf[m_cnUserDefn + (m_cnCompPerLig * 2) + m_cnFeat + iComp].nValue; + return m_prgnVarLenBuf[iComp].nValue; } int ComponentId(int iComp) { - return m_prgnVarLenBuf[m_cnUserDefn + (m_cnCompPerLig * 2) + m_cnFeat - + m_cnCompPerLig + iComp].nValue; + return m_prgnVarLenBuf[m_cnCompPerLig + iComp].nValue; } - // Given the index of the component used by the rules, indicate the - // corresponding component as defined by the glyph attributes. -// int DefinedComponent(int iCompUsed) -// { -// return m_prgnVarLenBuf[m_cnUserDefn + m_cnCompPerLig + m_cnFeat -// + m_cnUserDefn + iCompUsed]; -// } + //u_intslot * PCompRefBufSlout() + //{ + // return m_prgnVarLenBuf; + //} + + int CExtraSpaceSlout() + { + return (m_cnCompPerLig * 2); + } void SetClusterBase(int islout) { @@ -1110,22 +1140,28 @@ public: bool IsPartOfCluster() { - return m_isloutClusterBase > -1; + return (m_isloutClusterBase > -1); } - int NumClusterMembers() - { - return m_visloutClusterMembers.size(); - } + //int NumClusterMembers() + //{ + // return m_visloutClusterMembers.size(); + //} + //int ClusterMember(int iislout) + //{ + // return m_visloutClusterMembers[iislout]; + //} - int ClusterMember(int iislout) + void AddClusterMember(int isloutThis, int isloutAttached) { - return m_visloutClusterMembers[iislout]; + m_disloutCluster = sdata8(max(int(m_disloutCluster), abs(isloutThis - isloutAttached))); } - void AddClusterMember(int islout) + void ClusterMembers(Segment * pseg, int islout, std::vector<int> & visloutRet); + + int ClusterRange() { - m_visloutClusterMembers.push_back(islout); + return m_disloutCluster; } float ClusterXOffset() { return m_xsClusterXOffset; } @@ -1134,11 +1170,24 @@ public: void SetClusterAdvance(float xs) { m_xsClusterAdvance = xs; } float GlyphMetricLogUnits(Font * pfont, int nGlyphMetric); - float GlyphMetricLogUnits(int nMetricID); + //float GlyphMetricLogUnits(int nMetricID); int GlyphBbIndex() { return m_igbb; } void SetGlyphBbIndex (int i) { m_igbb = i; } + Rect BoundingBox(Font & font) + { + Rect rectBB; + rectBB.left = m_xsPositionX + GlyphMetricLogUnits(&font, kgmetBbLeft); + if (IsSpace()) + rectBB.right = m_xsPositionX + GlyphMetricLogUnits(&font, kgmetAdvWidth); + else + rectBB.right = m_xsPositionX + GlyphMetricLogUnits(&font, kgmetBbRight); + rectBB.top = m_ysPositionY + GlyphMetricLogUnits(&font, kgmetBbTop); + rectBB.bottom = m_ysPositionY + GlyphMetricLogUnits(&font, kgmetBbBottom); + return rectBB; + } + bool IsLineBreak() { return (IsInitialLineBreak() || IsFinalLineBreak()); @@ -1152,22 +1201,18 @@ public: return (m_spsl == kspslLbFinal); } - float AdvanceXMetric() - { - return m_xysAdvX; - } - bool IsSpace(); + //float AdvanceXMetric() + //{ + // return m_xysAdvX; + //} - int CExtraSpaceSlout() - { - return m_cnUserDefn + (m_cnCompPerLig * 2) + m_cnFeat + (m_cnCompPerLig * 2); - } + bool IsSpace(); void AdjustPosXBy(float dxs) { m_xsPositionX += dxs; - m_rectBB.left += dxs; - m_rectBB.right += dxs; + //m_rectBB.left += dxs; + //m_rectBB.right += dxs; } void ShiftForDirDepthChange(float dxsSegWidth); @@ -1188,20 +1233,21 @@ public: protected: // Instance variables: - int m_ichwBeforeAssoc; // index of associated character in the string - int m_ichwAfterAssoc; // (relative to the official beginning of the segment) - // char might possibly not be officially in this segment - - int m_cComponents; + sdata8 m_cComponents; - std::vector<int> m_visloutClusterMembers; // indices (logical surface position) - // of other slots that have this cluster as - // its base (absolute root), not necessarily sorted; - // does not include self + data8 m_disloutCluster; // how far to search on either side of this glyph to find + // other members of the cluster; + // 0 means there are no cluster members or this glyph is + // attached to some other base int m_isloutClusterBase; // the index of the slot that serves as the base for the // cluster this slot is a part of; -1 if not part of cluster + int m_ichwBeforeAssoc; // index of associated character in the string + int m_ichwAfterAssoc; // (relative to the official beginning of the segment) + // char might possibly not be officially in this segment, + // in which case value is infinity + // Measurements for highlighting an entire cluster, relative to origin of this slot, // which is the cluster base. float m_xsClusterXOffset; @@ -1211,8 +1257,8 @@ protected: int m_igbb; float m_xsAdvanceX; - float m_ysAdvanceY; - Rect m_rectBB; +// float m_ysAdvanceY; -- not used +// Rect m_rectBB; }; // end of class GrSlotOutput diff --git a/Build/source/libs/graphite-engine/src/segment/GrSlotStream.cpp b/Build/source/libs/graphite-engine/src/segment/GrSlotStream.cpp index b6ca2e599b4..f71aefdee3a 100644 --- a/Build/source/libs/graphite-engine/src/segment/GrSlotStream.cpp +++ b/Build/source/libs/graphite-engine/src/segment/GrSlotStream.cpp @@ -1610,7 +1610,7 @@ void GrSlotStream::AppendLineBreak(GrTableManager * ptman, GrCharStream * pchstr pengst->NewSlot(ptman->LBGlyphID(), fval, 0, ichwSegOffset, -1, &pslotNew); } - pslotNew->m_lb = lb; + pslotNew->m_lb = sdata8(lb); pslotNew->SetSpecialSlotFlag(fInitial ? kspslLbInitial : kspslLbFinal); //pslotNew->m_fInitialLB = fInitial; // TODO: remove pslotNew->SetDirectionality(dirc); diff --git a/Build/source/libs/graphite-engine/src/segment/GrSlotStream.h b/Build/source/libs/graphite-engine/src/segment/GrSlotStream.h index fd35d50c0d0..006191252dc 100644 --- a/Build/source/libs/graphite-engine/src/segment/GrSlotStream.h +++ b/Build/source/libs/graphite-engine/src/segment/GrSlotStream.h @@ -88,6 +88,7 @@ class Font; class GrSlotStream { friend class GrSlotState; + friend class FontMemoryUsage; public: // Constructor: diff --git a/Build/source/libs/graphite-engine/src/segment/GrTableManager.cpp b/Build/source/libs/graphite-engine/src/segment/GrTableManager.cpp index 1e5a1aa2846..dfb49717946 100644 --- a/Build/source/libs/graphite-engine/src/segment/GrTableManager.cpp +++ b/Build/source/libs/graphite-engine/src/segment/GrTableManager.cpp @@ -347,7 +347,7 @@ void GrTableManager::Run(Segment * psegNew, Font * pfont, m_fLogging = (pstrmLog != NULL); int cbPrev; - byte * pbPrevSegDat; + byte * pbPrevSegDat = NULL; if (psegPrev) cbPrev = psegPrev->NextSegInitBuffer(&pbPrevSegDat); else if (psegInit) @@ -493,7 +493,7 @@ void GrTableManager::Run(Segment * psegNew, Font * pfont, { // Nothing will fit. Initialize the new segment just enough so that // we can delete it. - InitSegmentToDelete(psegNew); + InitSegmentToDelete(psegNew, pfont, pchstrm); return; } } @@ -730,14 +730,14 @@ void GrTableManager::InitNewSegment(Segment * psegNew, { // Invalid empty segment. Assert(ichwMin == ichwLim); - InitSegmentToDelete(psegNew); + InitSegmentToDelete(psegNew, pfont, pchstrm); } return; } Assert(psegNew); - psegNew->Initialize(pchstrm->String(), + psegNew->Initialize(pchstrm->TextSrc(), ichwMin, ichwLim, lbStart, lbEnd, est, fStartLine, fEndLine, m_pgreng->RightToLeft()); @@ -761,10 +761,18 @@ void GrTableManager::InitNewSegment(Segment * psegNew, couldn't find a valid break point. Initialize it just enough so that it can be deleted by the client. ----------------------------------------------------------------------------------------------*/ -void GrTableManager::InitSegmentToDelete(Segment * psegNew) +void GrTableManager::InitSegmentToDelete(Segment * psegNew, Font * pfont, + GrCharStream * pchstrm) { - psegNew->Initialize(NULL, 0, 0, klbClipBreak, klbClipBreak, kestNothingFit, - false, false, false); + psegNew->Initialize(pchstrm->TextSrc(), 0, 0, + klbClipBreak, klbClipBreak, kestNothingFit, false, false, + m_pgreng->RightToLeft()); + + psegNew->SetEngine(m_pgreng); + psegNew->SetFont(pfont); + psegNew->SetJustifier(NULL); // can't justify an empty segment + psegNew->SetFaceName(m_pgreng->FaceName(), m_pgreng->BaseFaceName()); + psegNew->SetPreContext(0); } /*---------------------------------------------------------------------------------------------- @@ -877,7 +885,7 @@ void GrTableManager::InitSegmentAsEmpty(Segment * psegNew, Font * pfont, Assert(psegNew); - psegNew->Initialize(pchstrm->String(), ichwMin, ichwLim, + psegNew->Initialize(pchstrm->TextSrc(), ichwMin, ichwLim, lbStart, lbEnd, kestNoMore, fStartLine, fEndLine, m_pgreng->RightToLeft()); psegNew->SetEngine(m_pgreng); @@ -890,18 +898,15 @@ void GrTableManager::InitSegmentAsEmpty(Segment * psegNew, Font * pfont, int * pcbNextSegDat = &cbNextSegDat; // Initialization for (theoretical) next segment. - if (pbNextSegDat) - { - byte * pb = pbNextSegDat; - *pb++ = byte(lbEnd); - *pb++ = kdircNeutral; - *pb++ = kdircNeutral; + byte * pb = pbNextSegDat; + *pb++ = byte(lbEnd); + *pb++ = kdircNeutral; + *pb++ = kdircNeutral; + *pb++ = 0; + for (int ipass = 0; ipass < m_cpass; ipass++) *pb++ = 0; - for (int ipass = 0; ipass < m_cpass; ipass++) - *pb++ = 0; - *pcbNextSegDat = 0; - psegNew->RecordInitializationForNextSeg(*pcbNextSegDat, pbNextSegDat); - } + *pcbNextSegDat = 0; + psegNew->RecordInitializationForNextSeg(*pcbNextSegDat, pbNextSegDat); psegNew->SetPreContext(0); } @@ -931,11 +936,12 @@ bool GrTableManager::Backtrack(int * pislotPrevBreak, LineBrk * plbFound) { int islotStartTry; - if (*pislotPrevBreak == ichwCallerBtLim - 1) - { - islotStartTry = *pislotPrevBreak; - } - else if (*pislotPrevBreak == -1) + //if (*pislotPrevBreak == ichwCallerBtLim - 1) + //{ + // islotStartTry = *pislotPrevBreak; + //} + //else + if (*pislotPrevBreak == -1) { // If no line break has been found so far, figure out where to start trying based // on where the final stream choked. @@ -956,6 +962,10 @@ bool GrTableManager::Backtrack(int * pislotPrevBreak, else islotStartTry = *pislotPrevBreak - 1; // skip previous slot } + if (ichwCallerBtLim > -1 && islotStartTry > ichwCallerBtLim - 1) + { + islotStartTry = ichwCallerBtLim - 1; + } // Determine if we want to insert an actual line-break "glyph". Don't do that if // we are omitting trailing white space or we are at a writing-system or font break. @@ -985,7 +995,7 @@ bool GrTableManager::Backtrack(int * pislotPrevBreak, Assert(*plbMin <= lbMax); GrSlotStream * psstrmLB = OutputStream(m_cpassLB); islotStartTry = min(islotStartTry, psstrmLB->WritePos() - 1); - int islotNewBreak; + int islotNewBreak = -1; while (lb <= lbMax) { LineBrk lbNextToTry; @@ -1119,17 +1129,6 @@ void GrTableManager::InitializeForNextSeg(Segment * pseg, std::vector<int> vcslotSkipOffsets; vcslotSkipOffsets.resize(m_cpass); - if (cbNextMax == 0 || !pbNextSegDat) - { - // Caller is not interested in cross-line-boundary contextualization. - Assert(cbNextMax == 0); - Assert(!pbNextSegDat); - return; - } - - if (cbNextMax < m_cpass + 4) - THROW(kresInvalidArg); - byte * pb = pbNextSegDat; if (!fNextSegNeedsContext) @@ -1198,8 +1197,8 @@ void GrTableManager::InitializeForNextSeg(Segment * pseg, if (ipass >= m_cpassLB && m_engst.m_fInitialLB) islotBackupMin++; // how far we can back up--not before the start of this segment - int islotPrevRS; // corresponding slot in the previous stream for rule-start position - int islotPrevPC; // same for pre-context position + int islotPrevRS = 0; // corresponding slot in the previous stream for rule-start position + int islotPrevPC = 0; // same for pre-context position // Initially we have to include at least this many prior slots: int cslotSkipOffset = 0; @@ -1406,6 +1405,7 @@ void GrTableManager::CalculateAssociations(Segment * pseg, int csloutSurface) } AdjustAssocsForOverlaps(pseg); + pseg->CleanUpAssocsVectors(); // pseg->AdjustForOverlapsWithPrevSeg(); // for any characters officially in the // previous segment but rendered in this one, @@ -1774,7 +1774,7 @@ void EngineState::NextSlot(GrSlotState ** ppslotRet) } *ppslotRet = m_vslotblk[m_islotblkCurr] + m_islotNext; - (*ppslotRet)->GrSlotAbstract::BasicInitialize(m_cUserDefn, m_cCompPerLig, m_cFeat, + (*ppslotRet)->BasicInitialize(m_cUserDefn, m_cCompPerLig, m_cFeat, (m_vprgnSlotVarLenBufs[m_islotblkCurr] + (m_islotNext * cnExtraPerSlot))); m_islotNext++; } @@ -2481,7 +2481,7 @@ void GrTableManager::CalcPositionsUpTo(int ipass, GrSlotState * pslotLast, // Only do this for slots that have actually been processed by the final // pass, because others may have intermediate values that may be changed // later. - m_engst.m_islotPosNext = pslotLastBase->PosPassIndex() + psstrm->IndexOffset() + 1; + m_engst.m_islotPosNext = pslot->PosPassIndex() + psstrm->IndexOffset() + 1; m_engst.m_xsPosXNext = xs; m_engst.m_ysPosYNext = ys; m_engst.m_dxsTotWidthSoFar = *pxsWidth; diff --git a/Build/source/libs/graphite-engine/src/segment/GrTableManager.h b/Build/source/libs/graphite-engine/src/segment/GrTableManager.h index b19ca8deb5a..b0ab1e819d1 100644 --- a/Build/source/libs/graphite-engine/src/segment/GrTableManager.h +++ b/Build/source/libs/graphite-engine/src/segment/GrTableManager.h @@ -34,6 +34,8 @@ class Font; class EngineState { friend class GrTableManager; + friend class FontMemoryUsage; + public: EngineState(); void Initialize(GrEngine *, GrTableManager *); @@ -310,6 +312,7 @@ protected: ----------------------------------------------------------------------------------------------*/ class GrTableManager { + friend class FontMemoryUsage; public: // Constructor & destructor: @@ -487,7 +490,7 @@ protected: void InitSegmentAsEmpty(Segment * psegNew, Font * pfont, GrCharStream * pchstrm, bool fStartLine, bool fEndLine); - void InitSegmentToDelete(Segment * psegNew); + void InitSegmentToDelete(Segment * psegNew, Font * pfont, GrCharStream * pchstrm); int ChunkInPrev(int ipass, int islot, GrCharStream * pchstrm); diff --git a/Build/source/libs/graphite-engine/src/segment/Main.h b/Build/source/libs/graphite-engine/src/segment/Main.h index def3d771c7b..5fed3be3973 100644 --- a/Build/source/libs/graphite-engine/src/segment/Main.h +++ b/Build/source/libs/graphite-engine/src/segment/Main.h @@ -22,9 +22,11 @@ Description: #define NO_EXCEPTIONS 1 // It's okay to use functions that were declared deprecated by VS 2005: +#ifdef _MSC_VER #define _CRT_SECURE_NO_DEPRECATE #pragma warning(disable: 4996) // warning: function was declared deprecated #pragma warning(disable: 4702) // unreachable code +#endif #include "GrCommon.h" @@ -150,11 +152,12 @@ struct Rect #include "FontFace.h" #include "Segment.h" #include "SegmentPainter.h" -#ifdef _WIN32 -#include <hash_map> -#include "WinFont.h" -#include "WinSegmentPainter.h" -#endif + +//#ifdef _WIN32 +//#include <hash_map> +//#include "WinFont.h" +//#include "WinSegmentPainter.h" +//#endif // Internal headers #include "TtfUtil.h" diff --git a/Build/source/libs/graphite-engine/src/segment/Makefile.am b/Build/source/libs/graphite-engine/src/segment/Makefile.am index ad5c107f668..59113aa924b 100644 --- a/Build/source/libs/graphite-engine/src/segment/Makefile.am +++ b/Build/source/libs/graphite-engine/src/segment/Makefile.am @@ -14,6 +14,7 @@ libgraphite_la_SOURCES += $(segmentdir)/GrPass.cpp libgraphite_la_SOURCES += $(segmentdir)/GrSlotState.cpp libgraphite_la_SOURCES += $(segmentdir)/GrSlotStream.cpp libgraphite_la_SOURCES += $(segmentdir)/GrTableManager.cpp +libgraphite_la_SOURCES += $(segmentdir)/MemoryUsage.cpp libgraphite_la_SOURCES += $(segmentdir)/Platform.cpp libgraphite_la_SOURCES += $(segmentdir)/SegmentAux.cpp libgraphite_la_SOURCES += $(segmentdir)/Segment.cpp @@ -22,5 +23,4 @@ libgraphite_la_SOURCES += $(segmentdir)/TestPasses.cpp libgraphite_la_SOURCES += $(segmentdir)/TransductionLog.cpp EXTRA_DIST += $(segmentdir)/*.h -EXTRA_DIST += $(segmentdir)/explicit_instantiations.cpp diff --git a/Build/source/libs/graphite-engine/src/segment/MemoryUsage.cpp b/Build/source/libs/graphite-engine/src/segment/MemoryUsage.cpp new file mode 100644 index 00000000000..ac693b5b1d4 --- /dev/null +++ b/Build/source/libs/graphite-engine/src/segment/MemoryUsage.cpp @@ -0,0 +1,780 @@ +/*--------------------------------------------------------------------*//*:Ignore this sentence. +Copyright (C) 1999, 2001 SIL International. All rights reserved. + +Distributable under the terms of either the Common Public License or the +GNU Lesser General Public License, as specified in the LICENSING.txt file. + +File: MemoryUsage.cpp +Responsibility: Sharon Correll +Last reviewed: Not yet. + +Description: + Calculates memory usage for the engine and segments. +----------------------------------------------------------------------------------------------*/ + +#pragma warning(disable: 4244) // conversion from wchar_t to char +#pragma warning(disable: 4702) // unreachable code + +//:>******************************************************************************************** +//:> Include files +//:>******************************************************************************************** + +#include "GrCommon.h" +#include "GrData.h" +#ifndef _WIN32 +#include "GrMstypes.h" +#endif +#include "GrDebug.h" +//#include <fstream> +#include <iostream> +//#include <string> +// Forward declarations. + +#include "Main.h" + +//namespace gr +//{ +// class GrTableManager; +// class Segment; +// class GrEngine; +//} +// +//#include "GrTableManager.h" +//#include "GrFeatureValues.h" +//#include "GrSlotState.h" +//#include "SegmentAux.h" +//#include "Segment.h" +#include "MemoryUsage.h" + +//#ifndef _MSC_VER +//#include "config.h" +//#endif + +#ifdef _MSC_VER +#pragma hdrstop +#endif +#undef THIS_FILE +DEFINE_THIS_FILE + +//:End Ignore + +//:>******************************************************************************************** +//:> Forward declarations +//:>******************************************************************************************** + +//:>******************************************************************************************** +//:> Local Constants and static variables +//:>******************************************************************************************** + +const int stringOverhead = (3 * sizeof(int)) + (sizeof(void *)) + (8 * sizeof(short)); +const int vectorOverhead = 3 * sizeof(void *); + +namespace gr +{ + +//:>******************************************************************************************** +//:> Font/engine +//:>******************************************************************************************** + +void FontMemoryUsage::initialize() +{ + font = 0; + fontCache = 0; + fontFace = 0; + + eng_count = 0; + eng_overhead = 0; + eng_scalars = 0; + eng_strings = 0; + eng_pointers = 0; + eng_cmap = 0; + eng_nameTable = 0; + + pseudoMap = 0; + + clstbl_counters = 0; + clstbl_offsets = 0; + clstbl_glyphList = 0; + + glftbl_general = 0; + glftbl_compDefns = 0; + glftbl_attrTable = 0; + glftbl_attrOffsets = 0; + + lngtbl_general = 0; + lngtbl_entries = 0; + lngtbl_featureSets = 0; + + tman_general = 0; + + pass_count = 0; + pass_general = 0; + pass_fsm = 0; + pass_ruleExtras = 0; + pass_constraintOffsets = 0; + pass_constraintCode = 0; + pass_actionOffsets = 0; + pass_actionCode = 0; + + engst_general = 0; + engst_passState = 0; + + sstrm_count = 0; + sstrm_general = 0; + sstrm_chunkMapsUsed = 0; + sstrm_chunkMapsAlloc = 0; + sstrm_reprocBuf = 0; + + slot_count = 0; + slot_general = 0; + slot_abstract = 0; + slot_varLenBuf = 0; + slot_assocsUsed = 0; + slot_assocsAlloc = 0; + slot_attachUsed = 0; + slot_attachAlloc = 0; +} + +/*---------------------------------------------------------------------------------------------- + Return the total byte count. +----------------------------------------------------------------------------------------------*/ +int FontMemoryUsage::total() +{ + int grandTotal = 0; + grandTotal += font + fontCache + fontFace; + grandTotal += eng_overhead + eng_scalars + eng_strings + eng_pointers + eng_cmap + eng_nameTable; + grandTotal += pseudoMap; + grandTotal += clstbl_counters + clstbl_offsets + clstbl_glyphList; + grandTotal += glftbl_general + glftbl_compDefns + glftbl_attrTable + glftbl_attrOffsets; + grandTotal += lngtbl_general + lngtbl_entries + lngtbl_featureSets; + grandTotal += tman_general; + grandTotal += pass_general + pass_fsm + pass_ruleExtras + + pass_constraintOffsets + pass_constraintCode + pass_actionOffsets + pass_actionCode; + grandTotal += engst_general + engst_passState; + grandTotal += sstrm_general + sstrm_chunkMapsAlloc + sstrm_reprocBuf; + grandTotal += slot_general + slot_abstract + slot_varLenBuf + slot_assocsAlloc + slot_attachAlloc; + + return grandTotal; +} + +/*---------------------------------------------------------------------------------------------- + Add the results of two runs together. +----------------------------------------------------------------------------------------------*/ +void FontMemoryUsage::add(FontMemoryUsage & fmu) +{ + font += fmu.font; + fontCache += fmu.fontCache; + fontFace += fmu.fontFace; + + eng_count += fmu.eng_count; + eng_overhead += fmu.eng_overhead; + eng_scalars += fmu.eng_scalars; + eng_strings += fmu.eng_strings; + eng_pointers += fmu.eng_pointers; + eng_cmap += fmu.eng_cmap; + eng_nameTable += fmu.eng_nameTable; + + pseudoMap += fmu.pseudoMap; + + clstbl_counters += fmu.clstbl_counters; + clstbl_offsets += fmu.clstbl_offsets; + clstbl_glyphList += fmu.clstbl_glyphList; + + glftbl_general += fmu.glftbl_general; + glftbl_compDefns += fmu.glftbl_compDefns; + glftbl_attrTable += fmu.glftbl_attrTable; + glftbl_attrOffsets += fmu.glftbl_attrOffsets; + + lngtbl_general += fmu.lngtbl_general; + lngtbl_entries += fmu.lngtbl_entries; + lngtbl_featureSets += fmu.lngtbl_featureSets; + + tman_general += fmu.tman_general; + + pass_count += fmu.pass_count; + pass_general += fmu.pass_general; + pass_fsm += fmu.pass_fsm; + pass_ruleExtras += fmu.pass_ruleExtras; + pass_constraintOffsets += fmu.pass_constraintOffsets; + pass_constraintCode += fmu.pass_constraintCode; + pass_actionOffsets += fmu.pass_actionOffsets; + pass_actionCode += fmu.pass_actionCode; + + engst_general += fmu.engst_general; + engst_passState += fmu.engst_passState; + + sstrm_count += fmu.sstrm_count; + sstrm_general += fmu.sstrm_general; + sstrm_chunkMapsUsed += fmu.sstrm_chunkMapsUsed; + sstrm_chunkMapsAlloc += fmu.sstrm_chunkMapsAlloc; + sstrm_reprocBuf += fmu.sstrm_reprocBuf; + + slot_count += fmu.slot_count; + slot_general += fmu.slot_general; + slot_abstract += fmu.slot_abstract; + slot_varLenBuf += fmu.slot_varLenBuf; + slot_assocsUsed += fmu.slot_assocsUsed; + slot_assocsAlloc += fmu.slot_assocsAlloc; + slot_attachUsed += fmu.slot_attachUsed; + slot_attachAlloc += fmu.slot_attachAlloc; +} + +/*---------------------------------------------------------------------------------------------- + Add up the memory used by all the engines in the cache. +----------------------------------------------------------------------------------------------*/ +FontMemoryUsage Font::calculateMemoryUsage() +{ + FontMemoryUsage fmu; + FontFace::calculateAllMemoryUsage(fmu); + return fmu; +} + +void FontFace::calculateAllMemoryUsage(FontMemoryUsage & fmu) +{ + s_pFontCache->calculateMemoryUsage(fmu); +} + +void FontCache::calculateMemoryUsage(FontMemoryUsage & fmuTotal) +{ + fmuTotal.fontCache += sizeof(int) * 4; // m_cfci, m_cfciMax, m_cfface, m_flush + fmuTotal.fontCache += sizeof(void*); // m_prgfci; + + // Iterate through all the font faces in the cache. + for (int ifci = 0; ifci < m_cfci; ifci++) + { + CacheItem * pfci = m_prgfci + ifci; + char rgchFontName[32]; + memset(rgchFontName, 0, 32 * sizeof(char)); + std::copy(pfci->szFaceName, pfci->szFaceName + 32, rgchFontName); + std::string strFontName(rgchFontName); + fmuTotal.vstrFontNames.push_back(strFontName); + int cface = 0; + if (pfci->pffaceRegular) + { + FontMemoryUsage fmu; + pfci->pffaceRegular->calculateMemoryUsage(fmu); + fmuTotal.add(fmu); + fmuTotal.vFontTotalsReg.push_back(fmu.total()); + cface++; + } + else + fmuTotal.vFontTotalsReg.push_back(0); + + if (pfci->pffaceBold) + { + FontMemoryUsage fmu; + pfci->pffaceBold->calculateMemoryUsage(fmu); + fmuTotal.add(fmu); + fmuTotal.vFontTotalsBold.push_back(fmu.total()); + cface++; + } + else + fmuTotal.vFontTotalsBold.push_back(0); + + if (pfci->pffaceItalic) + { + FontMemoryUsage fmu; + pfci->pffaceItalic->calculateMemoryUsage(fmu); + fmuTotal.add(fmu); + fmuTotal.vFontTotalsItalic.push_back(fmu.total()); + cface++; + } + else + fmuTotal.vFontTotalsItalic.push_back(0); + + if (pfci->pffaceBI) + { + FontMemoryUsage fmu; + pfci->pffaceBI->calculateMemoryUsage(fmu); + fmuTotal.add(fmu); + fmuTotal.vFontTotalsBI.push_back(fmu.total()); + cface++; + } + else + fmuTotal.vFontTotalsBI.push_back(0); + + fmuTotal.vFaceCount.push_back(cface); + } +} + +void FontFace::calculateMemoryUsage(FontMemoryUsage & fmu) +{ + fmu.fontFace += sizeof(int); // m_cfonts + fmu.fontFace += sizeof(void *) * 2; // s_pFontCache, m_pgreng + + fmu.font += m_cfonts * sizeof(void*); // m_pfface + + fmu.addEngine(m_pgreng); +} + +void FontMemoryUsage::addEngine(GrEngine * pgreng) +{ + eng_count++; + + eng_overhead += sizeof(long); // m_cref + eng_scalars += sizeof(bool) * 6; // m_fBold, m_fItalic, m_fSmart... + eng_scalars += sizeof(bool) * 2; // m_fFakeItalicCache, m_fFakeBICache; + eng_strings += stringOverhead * 4; // m_strCtrlFileReg/Bold/Italic/BI + eng_strings += sizeof(wchar_t) * pgreng->m_strCtrlFileReg.length(); + eng_strings += sizeof(wchar_t) * pgreng->m_strCtrlFileBold.length(); + eng_strings += sizeof(wchar_t) * pgreng->m_strCtrlFileItalic.length(); + eng_strings += sizeof(wchar_t) * pgreng->m_strCtrlFileBI.length(); + eng_scalars += sizeof(bool); + eng_strings += stringOverhead * 6; // m_stuCtrlFile etc. + eng_strings += sizeof(wchar_t) * pgreng->m_stuCtrlFile.length(); + eng_strings += sizeof(wchar_t) * pgreng->m_stuInitError.length(); + eng_strings += sizeof(wchar_t) * pgreng->m_stuFaceName.length(); + eng_strings += sizeof(wchar_t) * pgreng->m_stuFeatures.length(); + eng_strings += sizeof(wchar_t) * pgreng->m_stuBaseFaceName.length(); + eng_scalars += sizeof(bool); // m_fUseSepBase + eng_scalars += sizeof(GrResult) * 2; // m_resFontRead, m_resFontValid + eng_scalars += sizeof(FontErrorCode); + eng_scalars += sizeof(int) * 3; // m_fxdBadVersion, m_nFontCheckSum, m_nScriptTag, m_grfsdc + eng_scalars += sizeof(bool); // m_fRightToLeft + eng_scalars += sizeof(int) * 2; // m_mXAscent, m_mXDescent + eng_scalars += sizeof(float); // m_dysOffset + eng_scalars += sizeof(bool); // m_fBasicJust + eng_scalars += sizeof(int); // m_cJLevels + eng_pointers += sizeof(void*) * 4; // m_ptman, m_pctbl, m_pgtbl, m_pfface + eng_scalars += sizeof(GrFeature) * kMaxFeatures; + eng_scalars += sizeof(int); // m_cfeat + eng_scalars += sizeof(size_t); // m_clcidFeatLabelLangs + eng_scalars += sizeof(short) * pgreng->m_clcidFeatLabelLangs; + // m_langtbl + eng_scalars += sizeof(bool); // m_fLineBreak + eng_scalars += sizeof(int) * 2; // m_cchwPreXlbContext, m_cchwPostXlbContext + eng_scalars += sizeof(data16) * 7; // m_chwPseudoAttr, etc. + eng_scalars += sizeof(gid16); // m_chwLBGlyphID + eng_scalars += sizeof(int) * 4; // m_cComponents, m_cnUserDefn, m_cnCompPerLig, m_mFontEmUnits + + pseudoMap += sizeof(int) * 3; + pseudoMap += sizeof(GrPseudoMap) * pgreng->m_cpsd; + + eng_cmap += sizeof(void*) * 2; + eng_cmap += sizeof(byte*); + eng_cmap += sizeof(bool); + if (pgreng->m_fCmapTblCopy) + eng_cmap += pgreng->m_cbCmapTbl; + + eng_nameTable += sizeof(byte *); + eng_nameTable += sizeof(bool); + if (pgreng->m_fNameTblCopy) + eng_nameTable += pgreng->m_cbNameTbl; + + eng_scalars += sizeof(bool) * 2; // m_fLogXductn, m_fInErrorState + + clstbl_counters += sizeof(int) * 2; // m_ccls, m_cclsLinear + clstbl_offsets += sizeof(data16) * (pgreng->m_pctbl->m_ccls + 1); + clstbl_glyphList += sizeof(data16) * (pgreng->m_pctbl->m_prgichwOffsets[pgreng->m_pctbl->m_ccls]); + + glftbl_general += sizeof(int) * 3; // m_cglf, m_cComponents, m_cgstbl + glftbl_general += vectorOverhead; // m_vpgstbl + GrGlyphSubTable * pgstbl = pgreng->m_pgtbl->m_vpgstbl[0]; + glftbl_general += sizeof(int) * 4; // m_fxdSilfVersion, m_nAttrIDLim, m_cComponents, m_cnCompPerLig + glftbl_general += sizeof(bool) * 2; // m_fHasDebugStrings, m_fGlocShort + glftbl_general += sizeof(data16) * 3; // m_chw...Attr + glftbl_compDefns += sizeof(int) * (pgstbl->m_cnCompPerLig + 1) * pgreng->m_pgtbl->m_cglf; + glftbl_attrTable += sizeof(int) * 2; // m_fxdSilfVersion, m_cbEntryBufLen + glftbl_attrTable += sizeof(byte) * pgstbl->m_pgatbl->m_cbEntryBufLen; + glftbl_attrOffsets += + (pgreng->m_pgtbl->m_cglf + 1) * ((pgstbl->m_fGlocShort) ? sizeof(data16) : sizeof(data32)); + + lngtbl_general += sizeof(size_t); // m_clang + lngtbl_general += sizeof(data16) * 3; // m_dilangInit, m_cLoop, m_ilangStart + lngtbl_general += sizeof(void*) * 2; // m_prglang, m_prgfset + lngtbl_general += sizeof(int); // m_cbOffset0 + lngtbl_entries += sizeof(GrLangTable::LangEntry) * pgreng->m_langtbl.m_clang; + lngtbl_featureSets += sizeof(GrLangTable::FeatSet) * pgreng->m_langtbl.m_cfset; + + GrTableManager * ptman = pgreng->m_ptman; + tman_general += sizeof(int) * 4; // m_cpass, m_cpassLB, m_ipassPos1, m_ipassJust1 + tman_general += sizeof(bool); // m_fBidi + tman_general += sizeof(void*) * 2; // m_prgppass, m_pgreng + tman_general += sizeof(void*) * ptman->m_cpass; // m_prgppass + tman_general += sizeof(bool); // m_fLogging + + pass_count += ptman->m_cpass; + for (int ipass = 0; ipass < ptman->m_cpass; ipass++) + { + GrPass * ppass = ptman->m_prgppass[ipass]; + pass_general = sizeof(GrPass); + + GrFSM * pfsm = ppass->m_pfsm; + if (pfsm) + { + pass_fsm += sizeof(int) * 5; // m_crow, m_crowFinal, m_rowFinalMin, m_crowNonAcpt, m_ccol + pass_fsm += sizeof(void*) * 3; // m_prgirulnMin, m_prgrulnMatched, m_prgrowTransitions + int crowSuccess = pfsm->m_crow - pfsm->m_crowNonAcpt; + pass_fsm += sizeof(data16) * (crowSuccess + 1); // m_prgirulnMin + pass_fsm += sizeof(data16) * (pfsm->m_crulnMatched); // m_prgrulnMatched + pass_fsm += sizeof(short) * ((pfsm->m_crow - pfsm->m_crowFinal) * pfsm->m_ccol); + pass_fsm += sizeof(data16); // m_dimcrInit, m_cLoop, m_imcrStart + pass_fsm += sizeof(int); // m_cmcr + pass_fsm += sizeof(void*); // m_prgmcr + pass_fsm += sizeof(GrFSMClassRange) * pfsm->m_cmcr; + pass_fsm += sizeof(int) * 2; // m_critMinRulePreContext, m_critMaxRulePreContext + pass_fsm += sizeof(void*); // m_prgrowStartStates + pass_fsm += sizeof(short) * (pfsm->m_critMaxRulePreContext - pfsm->m_critMinRulePreContext + 1); + } + + pass_ruleExtras = sizeof(data16) * ppass->m_crul; // m_prgchwRuleSortKeys + pass_ruleExtras = sizeof(byte*) * ppass->m_crul; // m_prgcritRulePreModContext + + pass_constraintOffsets += sizeof(data16) * (ppass->m_crul + 1); + pass_actionOffsets =+ sizeof(data16) * (ppass->m_crul + 1); + + pass_constraintCode += sizeof(byte) * ppass->m_cbConstraints; + pass_actionCode += sizeof(byte) * ppass->m_cbActions; + + pass_general += sizeof(bool) * ppass->m_crul; // m_prgfRuleOkay + pass_general += vectorOverhead; // m_vnStack + pass_general += sizeof(int) * ppass->m_vnStack.capacity(); + } + + engst_general += sizeof(EngineState); + engst_general += sizeof(void *) * ptman->m_engst.m_vslotblk.capacity(); + engst_general += sizeof(void *) * ptman->m_engst.m_vprgnSlotVarLenBufs.capacity(); + engst_general += sizeof(void *) * ptman->m_engst.m_cpass; // m_prgpsstrm + + engst_passState += sizeof(PassState) * ptman->m_engst.m_cpass; + + for (int isstrm = 0; isstrm < ptman->m_engst.m_cpass; isstrm++) + { + sstrm_count++; + GrSlotStream * psstrm = ptman->m_engst.m_prgpsstrm[isstrm]; + sstrm_general += sizeof(GrSlotStream); + sstrm_chunkMapsUsed += psstrm->m_vislotPrevChunkMap.size(); + sstrm_chunkMapsUsed += psstrm->m_vislotPrevChunkMap.size(); + sstrm_chunkMapsAlloc += psstrm->m_vislotPrevChunkMap.capacity(); + sstrm_chunkMapsAlloc += psstrm->m_vislotNextChunkMap.capacity(); + sstrm_reprocBuf += psstrm->m_vpslotReproc.capacity(); + sstrm_reprocBuf += sizeof(int) * 2; + sstrm_general -= sizeof(int) * 2; + } + + slot_general += ptman->m_engst.m_vslotblk.size() * EngineState::kSlotBlockSize + * (sizeof(GrSlotState) - sizeof(GrSlotAbstract)); + slot_abstract += ptman->m_engst.m_vslotblk.size() * EngineState::kSlotBlockSize + * sizeof(GrSlotAbstract); + int cnExtraPerSlot = ptman->m_engst.m_cUserDefn + (ptman->m_engst.m_cCompPerLig * 2) + + ptman->m_engst.m_cFeat; + slot_varLenBuf += EngineState::kSlotBlockSize * cnExtraPerSlot * sizeof(u_intslot); + for (size_t islotblk = 0; islotblk < ptman->m_engst.m_vslotblk.size(); islotblk++) + { + for (int islot = 0; islot < EngineState::kSlotBlockSize; islot++) + { + slot_count++; + GrSlotState * pslot = ptman->m_engst.m_vslotblk[islotblk] + islot; + slot_assocsUsed += pslot->m_vpslotAssoc.size(); + slot_assocsAlloc += pslot->m_vpslotAssoc.capacity(); + slot_attachUsed += pslot->m_vdislotAttLeaves.size(); + slot_attachAlloc += pslot->m_vdislotAttLeaves.capacity(); + } + } + +} + +/*---------------------------------------------------------------------------------------------- + Write out the memory usage onto a stream. +----------------------------------------------------------------------------------------------*/ +void FontMemoryUsage::prettyPrint(std::ostream & strm) +{ + int totalBytes = total(); + + strm << "Number of engines: " << eng_count << "\n"; + strm << "Number of passes: " << pass_count << "\n\n"; + + strm << "Number of slot streams: " << sstrm_count << "\n"; + strm << "Number of slots: " << slot_count << "\n\n"; + + int classTableTotal = clstbl_counters + clstbl_offsets + clstbl_glyphList; + int glyphTableTotal = glftbl_general + glftbl_compDefns + glftbl_attrTable + glftbl_attrOffsets; + int langTableTotal = lngtbl_general + lngtbl_entries + lngtbl_featureSets; + int passTotal = pass_general + pass_fsm + pass_ruleExtras + pass_constraintOffsets + pass_constraintCode + + pass_actionOffsets + pass_actionCode; + int engineTotal = eng_overhead + eng_scalars + eng_strings + eng_pointers + eng_cmap + eng_nameTable + + pseudoMap + classTableTotal + glyphTableTotal + langTableTotal + tman_general + + passTotal; + + strm << "BYTE COUNT TOTALS\n"; + strm << "Font: " << font << "\n"; + strm << "Font cache: " << fontCache << "\n"; + strm << "Font face: " << fontFace << "\n"; + strm << "Engine " << engineTotal << "\n"; + strm << " Overhead: " << eng_overhead << "\n"; + strm << " Scalars: " << eng_scalars << "\n"; + strm << " Strings: " << eng_strings << "\n"; + strm << " Pointers: " << eng_pointers << "\n"; + strm << " Cmap table: " << eng_cmap << "\n"; + strm << " Name table: " << eng_nameTable << "\n"; + strm << " Pseudo map: " << pseudoMap << "\n"; + strm << " Class table: " << classTableTotal << "\n"; + strm << " Counters: " << clstbl_counters << "\n"; + strm << " Offsets: " << clstbl_offsets << "\n"; + strm << " Glyph list: " << clstbl_glyphList << "\n"; + strm << " Glyph table: " << glyphTableTotal << "\n"; + strm << " General: " << glftbl_general << "\n"; + strm << " Component defns: " << glftbl_compDefns << "\n"; + strm << " Attr table: " << glftbl_attrTable << "\n"; + strm << " Attr offsets: " << glftbl_attrOffsets << "\n"; + strm << " Language table: " << langTableTotal << "\n"; + strm << " General: " << lngtbl_general << "\n"; + strm << " Entries: " << lngtbl_entries << "\n"; + strm << " Feature sets: " << lngtbl_featureSets << "\n"; + strm << " Table manager: " << tman_general << "\n"; + strm << " Passes: " << passTotal << "\n"; + strm << " General: " << pass_general << "\n"; + strm << " FSM: " << pass_fsm << "\n"; + strm << " Rule extras: " << pass_ruleExtras << "\n"; + strm << " Constraint offsets: " << pass_constraintOffsets << "\n\n"; + strm << " Constraint code: " << pass_constraintCode << "\n"; + strm << " Action offsets: " << pass_actionOffsets << "\n"; + strm << " Action code: " << pass_actionCode << "\n\n"; + + int slotTotal = slot_general + slot_abstract + slot_varLenBuf + slot_assocsAlloc + slot_attachAlloc; + int streamTotal = sstrm_general + sstrm_chunkMapsAlloc + sstrm_reprocBuf + slotTotal; + int engineStateTotal = engst_general + engst_passState + streamTotal; + + strm << " Engine State: " << engineStateTotal << "\n"; + strm << " General: " << engst_general << "\n"; + strm << " Pass states: " << engst_passState << "\n"; + strm << " Slot streams: " << streamTotal << "\n"; + strm << " General: " << sstrm_general << "\n"; + strm << " Chunk maps: " << sstrm_chunkMapsAlloc << " (" << sstrm_chunkMapsUsed << " used)\n"; + strm << " Reprocess buffer: " << sstrm_reprocBuf << "\n"; + strm << " Slots: " << slotTotal << "\n"; + strm << " General: " << slot_general << "\n"; + strm << " Abstract: " << slot_abstract << "\n"; + strm << " Var-length buf: " << slot_varLenBuf << "\n"; + strm << " Associations: " << slot_assocsAlloc << " (" << slot_assocsUsed << " used)\n"; + strm << " Attachments: " << slot_attachAlloc << " (" << slot_attachUsed << " used)\n\n"; + + strm << "Total bytes used: " << totalBytes << "\n\n"; + + strm << "TOTALS PER FONT\n"; + for (size_t ifont = 0; ifont < vstrFontNames.size(); ifont++) + { + strm << vstrFontNames[ifont].c_str() << "\n"; + strm << " Regular: " << vFontTotalsReg[ifont] << "\n"; + strm << " Bold: " << vFontTotalsBold[ifont] << "\n"; + strm << " Italic: " << vFontTotalsItalic[ifont] << "\n"; + strm << " Bold-italic: " << vFontTotalsBI[ifont] << "\n\n"; + } +} + + +//:>******************************************************************************************** +//:> Segment +//:>******************************************************************************************** + +/*---------------------------------------------------------------------------------------------- + Initialize the data structure. +----------------------------------------------------------------------------------------------*/ +void SegmentMemoryUsage::initialize() +{ + seg_count = 0; + overhead = 0; + pointers = 0; + scalars = 0; + strings = 0; + metrics = 0; + associations = 0; + init = 0; + obsolete = 0; + + slot_count = 0; + slot_abstract = 0; + slot_varLenBuf = 0; + slot_scalars = 0; + slot_clusterMembers = 0; + + glyphInfo_count = 0; + glyphInfo = 0; + + wastedVector = 0; +} + +/*---------------------------------------------------------------------------------------------- + Add the memory for the segemtn to the SegmentMemoryUsage data structure. +----------------------------------------------------------------------------------------------*/ +void Segment::calculateMemoryUsage(SegmentMemoryUsage & smu) +{ + smu.addSegment(*this); +} + + +void SegmentMemoryUsage::addSegment(Segment & seg) +{ + seg_count++; + + overhead += sizeof(long); // m_cref + pointers += sizeof(void*); // m_pgts + scalars += sizeof(int); // m_dichwLim + scalars += sizeof(int); // m_ichwMin + pointers += sizeof(void*); // m_pfont + pointers += sizeof(void*); // m_preneng + scalars += sizeof(bool); // m_fErroneous + pointers += sizeof(void*); // m_pgjus + scalars += sizeof(LayoutEnvironment); + scalars += sizeof(bool); // m_fWsRtl + scalars += sizeof(bool); // m_fParaRtl + scalars += sizeof(TrWsHandling); + scalars += sizeof(int); // m_nDirDepth + init += sizeof(byte*); // m_prgbNextSegDat + init += sizeof(int); // m_cbNextSegDat + init += sizeof(byte) * seg.m_cbNextSegDat; + init += sizeof(byte*); // m_prgInitDat + init += sizeof(int); // m_cbInitDat + init += sizeof(byte) * seg.m_cbInitDat; + init += sizeof(int); // m_dichPreContext +// obsolete += sizeof(void *); // m_psegPrev +// obsolete += sizeof(void *); // m_psegNext +// strings += stringOverhead * 2; +// strings += sizeof(wchar_t) * seg.m_stuFaceName.length(); +// strings += sizeof(wchar_t) * seg.m_stuBaseFaceName.length(); +// scalars += sizeof(bool); // m_fUseSepBase; +// scalars += sizeof(float); // m_pixHeight +// scalars += sizeof(bool); // m_fBold +// scalars += sizeof(bool); // m_fItalic + scalars += sizeof(LineBrk); // m_lbStart + scalars += sizeof(LineBrk); // m_lbEnd + scalars += sizeof(bool); // m_fStartLine + scalars += sizeof(bool); // m_fEndLine + scalars += sizeof(SegEnd); // m_est + metrics += sizeof(int); // m_mFontEmUnits + metrics += sizeof(float) * 17; // was 19, removed m_x/ysDPI + associations += sizeof(int); // m_ichwAssocsMin + associations += sizeof(int); // m_ichwAssocsLim + int dichw = seg.m_ichwAssocsLim - seg.m_ichwAssocsMin; + associations += sizeof(int*); // m_prgisloutBefore + associations += sizeof(int) * dichw; + associations += sizeof(int*); // m_prgisloutAfter + associations += sizeof(int) * dichw; + associations += sizeof(void*); // m_prgpvisloutAssocs + associations += sizeof(void*) * dichw; + for (int idichw = 0; idichw < dichw; idichw++) + { + std::vector<int> * pvisloutAssocs = seg.m_prgpvisloutAssocs[idichw]; + if (pvisloutAssocs) + { + associations += vectorOverhead; + associations += sizeof(int) * pvisloutAssocs->capacity(); + wastedVector += sizeof(int) * (pvisloutAssocs->capacity() - pvisloutAssocs->size()); + } + } + associations += sizeof(int*); // m_prgisloutLigature + associations += sizeof(int) * dichw; + associations += sizeof(sdata8*); // m_prgiComponent + associations += sizeof(sdata8) * dichw; +// obsolete += sizeof(void*); // m_psstrm + scalars += sizeof(int); // m_cslout + slot_count += seg.m_cslout; + for (int islout = 0; islout < seg.m_cslout; islout++) + { + GrSlotOutput * pslout = seg.m_prgslout + islout; + slot_abstract += sizeof(gid16) * 2; // m_chwGlyphID, m_chwActual + slot_abstract += sizeof(sdata8) * 4; // m_spsl, m_dirc, m_lb, m_nDirLevel +// slot_abstract += sizeof(float) * 8; // font/glyph metrics + slot_abstract += sizeof(short) * 5; // slot attributes - was 21 + slot_abstract += sizeof(int); // m_mJWidth0; + slot_abstract += sizeof(byte); // m_nJWeight0; + slot_abstract += sizeof(bool); // m_fInsertBefore + slot_abstract += sizeof(sdata8); // m_bIsSpace + slot_abstract += sizeof(byte); // m_cnCompPerLig + slot_abstract += sizeof(void*); // m_prgnVarLenBuf + slot_varLenBuf += pslout->CExtraSpaceSlout() * sizeof(u_intslot); + slot_abstract += sizeof(float); // m_xsPositionX, m_ysPositionY +// slot_abstract += sizeof(bool); // m_fAdvXSet, m_fAdvYSet + slot_scalars += sizeof(int) * 2; // m_ichwBefore/AfterAssoc + slot_scalars += sizeof(sdata8); // m_cComponents + slot_scalars += sizeof(int); // m_isloutClusterBase + slot_scalars += sizeof(sdata8); // m_disloutCluster + slot_scalars += sizeof(float) * 3; // m_xsClusterXOffset, m_xsClusterAdvance, m_xsAdvanceX + slot_scalars += sizeof(int); // m_igbb +// slot_scalars += sizeof(Rect); // m_rectBB + } + scalars += sizeof(int); // m_cnUserDefn + scalars += sizeof(int); // m_cnCompPerLig + scalars += sizeof(int); // m_cnFeat + glyphInfo_count += seg.m_cginf; + scalars += sizeof(int); // m_cginf; + scalars += sizeof(int); // m_isloutGinf0 + for (int iginf = 0; iginf < seg.m_cginf; iginf++) + { + ///GlyphInfo * pginf = seg.m_prgginf + iginf; + glyphInfo += sizeof(void *); // m_pseg + glyphInfo += sizeof(void *); // m_pslout + glyphInfo += sizeof(int); // m_islout + } + init += sizeof(int); // m_cslotRestartBackup + init += vectorOverhead; + init += sizeof(sdata8) * seg.m_vnSkipOffsets.capacity(); + wastedVector += sizeof(sdata8) * (seg.m_vnSkipOffsets.capacity() - seg.m_vnSkipOffsets.size()); + init += sizeof(DirCode); // m_dircPrevStrong + init += sizeof(DirCode); // m_dircPrevTerm + + //int grandTotal; + //grandTotal = overhead + pointers + scalars + strings + metrics + associations + // + init + obsolete + slot_count + slot_abstract + slot_varLenBuf + slot_scalars + // + slot_clusterMembers + glyphInfo_count + glyphInfo; + + //int totalPerSeg = grandTotal / seg_count; +} + +/*---------------------------------------------------------------------------------------------- + Write out the memory usage onto a stream. +----------------------------------------------------------------------------------------------*/ +void SegmentMemoryUsage::prettyPrint(std::ostream & strm) +{ + int totalBytes = overhead + pointers + scalars + strings + metrics + associations + + init + obsolete + slot_count + slot_abstract + slot_varLenBuf + slot_scalars + + slot_clusterMembers + glyphInfo_count + glyphInfo; + + int slotTotal = slot_abstract + slot_varLenBuf + slot_scalars + slot_clusterMembers; + + strm << "Number of segments: " << seg_count << "\n\n"; + + strm << "TOTALS\n"; + strm << "Overhead: " << overhead << "\n"; + strm << "Pointers: " << pointers << "\n"; + strm << "Scalars: " << scalars << "\n"; + strm << "Strings: " << strings << "\n"; + strm << "Metrics: " << metrics << "\n"; + strm << "Associations: " << associations << "\n"; + strm << "Obsolete: " << obsolete << "\n"; + strm << "Slot data: " << slotTotal << "\n"; + strm << " Abstract: " << slot_abstract << "\n"; + strm << " Var-length buffer: " << slot_varLenBuf << "\n"; + strm << " Scalars: " << slot_scalars << "\n"; + strm << " Cluster members: " << slot_clusterMembers << "\n"; + strm << "Glyph info: " << glyphInfo << "\n\n"; + + strm << "Wasted in vectors: " << wastedVector << "\n\n"; + + strm << "Total bytes used: " << totalBytes << "\n\n"; + + if (seg_count > 0) + { + strm << "AVERAGES\n"; + strm << "Overhead: " << overhead/seg_count << "\n"; + strm << "Pointers: " << pointers/seg_count << "\n"; + strm << "Scalars: " << scalars/seg_count << "\n"; + strm << "Strings: " << strings/seg_count << "\n"; + strm << "Metrics: " << metrics/seg_count << "\n"; + strm << "Associations: " << associations/seg_count << "\n"; + strm << "Obsolete: " << obsolete/seg_count << "\n"; + strm << "Slot data: " << slotTotal/seg_count << "\n"; + strm << " Abstract: " << slot_abstract/seg_count << "\n"; + strm << " Var-length buffer: " << slot_varLenBuf/seg_count << "\n"; + strm << " Scalars: " << slot_scalars/seg_count << "\n"; + strm << " Cluster members: " << slot_clusterMembers/seg_count << "\n"; + strm << "Glyph info: " << glyphInfo/seg_count << "\n\n"; + + strm << "Avg. bytes per segment: " << totalBytes / seg_count << "\n\n"; + + strm << "Avg. # of slots per segment: " << slot_count / seg_count << "\n\n"; + } +} + +} //namespace gr + diff --git a/Build/source/libs/graphite-engine/src/segment/Segment.cpp b/Build/source/libs/graphite-engine/src/segment/Segment.cpp index 319baef85b5..69e5349bca3 100644 --- a/Build/source/libs/graphite-engine/src/segment/Segment.cpp +++ b/Build/source/libs/graphite-engine/src/segment/Segment.cpp @@ -75,20 +75,20 @@ Segment::Segment() : m_cbNextSegDat(0), m_prgInitDat(NULL), m_cbInitDat(0), - m_fUseSepBase(0), +// m_fUseSepBase(0), //m_psegAltEndLine(NULL), m_prgisloutBefore(NULL), m_prgisloutAfter(NULL), - m_prgvisloutAssocs(NULL), + m_prgpvisloutAssocs(NULL), m_prgisloutLigature(NULL), m_prgiComponent(NULL), - m_psstrm(NULL), +// m_psstrm(NULL), m_cslout(0), m_prgslout(NULL), m_prgnSlotVarLenBuf(NULL), - m_cnUserDefn(0), +// m_cnUserDefn(0), m_cnCompPerLig(0), - m_cnFeat(0), +// m_cnFeat(0), m_cginf(0), m_prgginf(NULL) { @@ -96,8 +96,8 @@ Segment::Segment() : g_csegTotal++; - m_stuFaceName.erase(); - m_stuBaseFaceName.erase(); +// m_stuFaceName.erase(); +// m_stuBaseFaceName.erase(); m_vnSkipOffsets.clear(); } @@ -247,12 +247,12 @@ void Segment::Initialize(ITextSource * pgts, int ichwMin, int ichwLim, m_dxsVisibleWidth = -1; m_dxsTotalWidth = -1; - m_psstrm = NULL; +// m_psstrm = NULL; m_prgslout = NULL; m_prgnSlotVarLenBuf = NULL; m_prgisloutBefore = NULL; m_prgisloutAfter = NULL; - m_prgvisloutAssocs = NULL; + m_prgpvisloutAssocs = NULL; m_prgisloutLigature = NULL; m_prgiComponent = NULL; @@ -261,12 +261,12 @@ void Segment::Initialize(ITextSource * pgts, int ichwMin, int ichwLim, //m_psegAltEndLine = NULL; - m_stuFaceName.erase(); - m_stuBaseFaceName.erase(); - m_fUseSepBase = false; +// m_stuFaceName.erase(); +// m_stuBaseFaceName.erase(); +// m_fUseSepBase = false; - m_psegPrev = NULL; // obsolete - m_psegNext = NULL; +// m_psegPrev = NULL; // obsolete +// m_psegNext = NULL; //InitializePlatform(); } @@ -311,7 +311,12 @@ void Segment::DestroyContents() delete[] m_prgnSlotVarLenBuf; delete[] m_prgisloutBefore; delete[] m_prgisloutAfter; - delete[] m_prgvisloutAssocs; + for (int ichw = 0; ichw < m_ichwAssocsLim - m_ichwAssocsMin; ichw++) + { + if (m_prgpvisloutAssocs && m_prgpvisloutAssocs[ichw]) + delete m_prgpvisloutAssocs[ichw]; + } + delete[] m_prgpvisloutAssocs; delete[] m_prgisloutLigature; delete[] m_prgiComponent; delete[] m_prgbNextSegDat; @@ -446,14 +451,14 @@ Segment::Segment(Segment & seg) m_cbNextSegDat = seg.m_cbNextSegDat; m_prgbNextSegDat = new byte[m_cbNextSegDat]; std::copy(seg.m_prgbNextSegDat, seg.m_prgbNextSegDat + m_cbNextSegDat, m_prgbNextSegDat); - m_psegPrev = seg.m_psegPrev; - m_psegNext = seg.m_psegNext; - m_stuFaceName = seg.m_stuFaceName; - m_stuBaseFaceName = seg.m_stuBaseFaceName; - m_fUseSepBase = seg.m_fUseSepBase; - m_pixHeight = seg.m_pixHeight; - m_fBold = seg.m_fBold; - m_fItalic = seg.m_fItalic; +// m_psegPrev = seg.m_psegPrev; +// m_psegNext = seg.m_psegNext; +// m_stuFaceName = seg.m_stuFaceName; +// m_stuBaseFaceName = seg.m_stuBaseFaceName; +// m_fUseSepBase = seg.m_fUseSepBase; +// m_pixHeight = seg.m_pixHeight; +// m_fBold = seg.m_fBold; +// m_fItalic = seg.m_fItalic; m_lbStart = seg.m_lbStart; m_lbEnd = seg.m_lbEnd; m_fStartLine = seg.m_fStartLine; @@ -463,8 +468,8 @@ Segment::Segment(Segment & seg) m_dysFontAscent = seg.m_dysFontAscent; m_dysFontDescent = seg.m_dysFontDescent; m_xysEmSquare = seg.m_xysEmSquare; - m_xsDPI = seg.m_xsDPI; - m_ysDPI = seg.m_ysDPI; +// m_xsDPI = seg.m_xsDPI; +// m_ysDPI = seg.m_ysDPI; m_dxsStretch = seg.m_dxsStretch; m_dxsWidth = seg.m_dxsWidth; m_dysHeight = seg.m_dysHeight; @@ -488,16 +493,22 @@ Segment::Segment(Segment & seg) std::copy(seg.m_prgisloutBefore, seg.m_prgisloutBefore + dichw, m_prgisloutBefore); m_prgisloutAfter = new int[dichw]; std::copy(seg.m_prgisloutAfter, seg.m_prgisloutAfter + dichw, m_prgisloutAfter); - m_prgvisloutAssocs = new std::vector<int>[dichw]; - std::copy(seg.m_prgvisloutAssocs, seg.m_prgvisloutAssocs + dichw, - m_prgvisloutAssocs); + m_prgpvisloutAssocs = new std::vector<int> * [dichw]; + for (int ivislout = 0; ivislout < dichw; ivislout++) + { + std::vector<int> * pvislout = seg.m_prgpvisloutAssocs[ivislout]; + if (pvislout) + { + std::vector<int> * pvisloutNew = new std::vector<int>; + m_prgpvisloutAssocs[ivislout] = pvisloutNew; + *pvisloutNew = *pvislout; // copy the vector + } + } m_prgisloutLigature = new int[dichw]; std::copy(seg.m_prgisloutLigature, seg.m_prgisloutLigature + dichw, m_prgisloutLigature); - m_prgiComponent = new int[dichw]; + m_prgiComponent = new sdata8[dichw]; std::copy(seg.m_prgiComponent, seg.m_prgiComponent + dichw, m_prgiComponent); - // m_psstrm - m_cslout = seg.m_cslout; int cnExtraPerSlot = (m_cslout > 0) ? seg.m_prgslout[0].CExtraSpaceSlout() : 0; m_prgnSlotVarLenBuf = new u_intslot[m_cslout * cnExtraPerSlot]; @@ -511,9 +522,9 @@ Segment::Segment(Segment & seg) cnExtraPerSlot); } - m_cnUserDefn = seg.m_cnUserDefn; +// m_cnUserDefn = seg.m_cnUserDefn; m_cnCompPerLig = seg.m_cnCompPerLig; - m_cnFeat = seg.m_cnFeat; +// m_cnFeat = seg.m_cnFeat; m_cslotRestartBackup = seg.m_cslotRestartBackup; std::copy(seg.m_prgnSlotVarLenBuf, seg.m_prgnSlotVarLenBuf + (m_cslout * cnExtraPerSlot), m_prgnSlotVarLenBuf); @@ -921,14 +932,19 @@ std::pair<GlyphIterator, GlyphIterator> Segment::glyphs() ----------------------------------------------------------------------------------------------*/ std::pair<GlyphSetIterator, GlyphSetIterator> Segment::charToGlyphs(toffset ich) { - std::vector<int> * pvislout = UnderlyingToLogicalAssocs(ich); + std::vector<int> vislout = UnderlyingToLogicalAssocs(ich); - // UnderlyingToLogicalAssocs can return NULL for edge cases - if (pvislout == NULL) + if (vislout.size() == 0) return std::make_pair(GlyphSetIterator(), GlyphSetIterator()); else - return std::make_pair(GlyphSetIterator(*this, 0, *pvislout), - GlyphSetIterator(*this, pvislout->size(), *pvislout)); + { + // Note that BOTH instances of GlyphSetIterator must use the same underlying vector, + // so that comparisons make sense. + RcVector * qvislout = new RcVector(vislout); + return std::make_pair( + GlyphSetIterator(*this, 0, qvislout), + GlyphSetIterator(*this, vislout.size(), qvislout)); + } } /*---------------------------------------------------------------------------------------------- @@ -1107,7 +1123,7 @@ LineBrk Segment::getBreakWeight(int ich, bool fBreakBefore) return klbClipBreak; GrSlotOutput * psloutFirst = m_prgslout + isloutFirst; bool fNotFirst = false; - if (psloutFirst->HasComponents() + if ((psloutFirst->NumberOfComponents() > 0) && psloutFirst->UnderlyingComponent(0) != ich) { // Not the first component of a ligature. @@ -1124,7 +1140,7 @@ LineBrk Segment::getBreakWeight(int ich, bool fBreakBefore) return klbClipBreak; GrSlotOutput * psloutLast = m_prgslout + isloutLast; bool fNotLast = false; - if (psloutLast->HasComponents() + if ((psloutLast->NumberOfComponents() > 0) && psloutLast->UnderlyingComponent(psloutLast->NumberOfComponents() - 1) != ich) { // Not the last component of a ligature. @@ -1285,7 +1301,7 @@ int Segment::findNextBreakPoint(int ichStart, else iginfMin = iginfMid; } - Assert(iginfLim < m_cginf); + Assert(iginfLim <= m_cginf); if (iginfLim >= m_cginf) iginfLim = m_cginf - 1; ichFit = PhysicalSurfaceToUnderlying(iginfLim, false); } @@ -1534,11 +1550,11 @@ void Segment::SetUpOutputArrays(Font * pfont, GrTableManager * ptman, m_mFontEmUnits = EngineImpl()->GetFontEmUnits(); pfont->getFontMetrics(&m_dysFontAscent, &m_dysFontDescent, &m_xysEmSquare); - m_xsDPI = (float)pfont->getDPIx(); - m_ysDPI = (float)pfont->getDPIy(); +// m_xsDPI = (float)pfont->getDPIx(); +// m_ysDPI = (float)pfont->getDPIy(); // Note that storing both of these values is redundant; they should be the same. - Assert(m_xysEmSquare == m_pixHeight); +// Assert(m_xysEmSquare == m_pixHeight); m_twsh = twsh; m_fParaRtl = fParaRtl; @@ -1560,24 +1576,24 @@ void Segment::SetUpOutputArrays(Font * pfont, GrTableManager * ptman, m_prgisloutAfter = new int[cchwInThisSeg]; - m_prgvisloutAssocs = new std::vector<int>[cchwInThisSeg]; + m_prgpvisloutAssocs = new std::vector<int> * [cchwInThisSeg]; m_prgisloutLigature = new int[cchwInThisSeg]; - m_prgiComponent = new int[cchwInThisSeg]; + m_prgiComponent = new sdata8[cchwInThisSeg]; int cslot = 0; - m_psstrm = psstrmFinal; // TODO: make a local variable - if (m_psstrm) - cslot = m_psstrm->FinalSegLim(); + //m_psstrm = psstrmFinal; // TODO: make a local variable + if (psstrmFinal) + cslot = psstrmFinal->FinalSegLim(); else Assert(fEmpty); float xsMin = 0; int islot; - int islotMin = (m_psstrm) ? m_psstrm->IndexOffset() : 0; + int islotMin = (psstrmFinal) ? psstrmFinal->IndexOffset() : 0; for (islot = islotMin; islot < cslot; islot++) - xsMin = min(xsMin, m_psstrm->SlotAt(islot)->XPosition()); + xsMin = min(xsMin, psstrmFinal->SlotAt(islot)->XPosition()); // For right-to-left segments, the draw origin is at the left side of the visible // portion of the text. So if necessary, scoot everything left so that the invisible @@ -1587,7 +1603,7 @@ void Segment::SetUpOutputArrays(Font * pfont, GrTableManager * ptman, float dxsInvisible = (m_fEndLine) ? m_dxsTotalWidth - m_dxsVisibleWidth : 0; for (islot = islotMin; ((m_nDirDepth % 2) && (islot < cslot)); islot++) { - GrSlotState * pslot = m_psstrm->SlotAt(islot); + GrSlotState * pslot = psstrmFinal->SlotAt(islot); // int islout = islot - islotMin; if (pslot->GlyphID() == chwLB) continue; // skip over linebreak markers @@ -1606,38 +1622,50 @@ void Segment::SetUpOutputArrays(Font * pfont, GrTableManager * ptman, { m_prgisloutBefore[ichw] = kPosInfinity; m_prgisloutAfter[ichw] = kNegInfinity; - m_prgvisloutAssocs[ichw].clear(); + m_prgpvisloutAssocs[ichw] = new std::vector<int>; m_prgisloutLigature[ichw] = kNegInfinity; m_prgiComponent[ichw] = 0; } m_cslout = csloutSurface; - m_cnUserDefn = ptman->NumUserDefn(); + if (ptman->NumUserDefn() > 0 && ptman->NumCompPerLig() > 0) + { + int x; x = 3; + } + +// m_cnUserDefn = ptman->NumUserDefn(); m_cnCompPerLig = ptman->NumCompPerLig(); - m_cnFeat = ptman->NumFeat(); +// m_cnFeat = ptman->NumFeat(); // Normal buffers, plus underlying indices of ligature components, plus // map from used components to defined components. - int cnExtraPerSlot = m_cnUserDefn + (m_cnCompPerLig * 2) + m_cnFeat + (m_cnCompPerLig * 2); +// int cnExtraPerSlot = m_cnUserDefn + (m_cnCompPerLig * 2) + m_cnFeat + (m_cnCompPerLig * 2); + + // We don't need to store the user-defined slot attributes or the features in the segment itself. + // What we need is: (1) component.ref attr settings, (2) slot-attribute indices, + // (3) underlying indicates of ligature components, and (4) map from used components + // to defined components + int cnExtraPerSlot = m_cnCompPerLig * 4; m_prgslout = new GrSlotOutput[m_cslout]; m_prgnSlotVarLenBuf = new u_intslot[m_cslout * cnExtraPerSlot]; m_isloutVisLim = 0; - if (m_psstrm) + if (psstrmFinal) { for (islot = islotMin; islot < psstrmFinal->FinalSegLim(); ++islot) { - int isloutAdj = islot - islotMin; + int isloutRel = islot - islotMin; GrSlotState * pslot = psstrmFinal->SlotAt(islot); - pslot->SetPosPassIndex(isloutAdj, false); + pslot->SetPosPassIndex(isloutRel, false); pslot->EnsureCacheForOutput(ptman); - GrSlotOutput * pslout = OutputSlot(isloutAdj); - pslout->SetBufferPtr(m_prgnSlotVarLenBuf + (isloutAdj * cnExtraPerSlot)); - pslout->CopyFrom(pslot); + GrSlotOutput * pslout = OutputSlot(isloutRel); + pslout->SetBufferPtr(m_prgnSlotVarLenBuf + (isloutRel * cnExtraPerSlot)); + pslout->InitializeOutputFrom(pslot); pslout->SetBeforeAssoc(pslot->BeforeAssoc()); pslout->SetAfterAssoc(pslot->AfterAssoc()); if (pslot->HasComponents()) - pslot->SetComponentRefsFor(pslout); // also sets it for pslout, since they share the buffer + pslot->SetComponentRefsFor(pslout); + Assert(pslot->HasComponents() == (pslout->NumberOfComponents() > 0)); //if (pslot->HasClusterMembers()) //{ //Assert(pslot->HasClusterMembers() || pslot->ClusterRootOffset() == 0); @@ -1659,7 +1687,7 @@ void Segment::SetUpOutputArrays(Font * pfont, GrTableManager * ptman, int isloutBaseIndex = pslot->Base(psstrmFinal)->PosPassIndex(); if (!pslot->IsBase()) { - OutputSlot(isloutBaseIndex)->AddClusterMember(pslot->PosPassIndex()); + OutputSlot(isloutBaseIndex)->AddClusterMember(isloutBaseIndex, pslot->PosPassIndex()); OutputSlot(isloutAdj)->SetClusterBase(isloutBaseIndex); } else if (pslot->HasClusterMembers() && pslot->IsBase()) @@ -1680,7 +1708,7 @@ void Segment::SetUpOutputArrays(Font * pfont, GrTableManager * ptman, // Final output for draw routines. - SetUpGlyphInfo(ptman, chwLB, nDirDepth, islotMin, cslot); + SetUpGlyphInfo(ptman, psstrmFinal, chwLB, nDirDepth, islotMin, cslot); //SetUpOutputArraysPlatform(ptman, chwLB, nDirDepth, islotMin, cslot); @@ -1689,8 +1717,8 @@ void Segment::SetUpOutputArrays(Font * pfont, GrTableManager * ptman, /*---------------------------------------------------------------------------------------------- Set up the data structures that represent the actual rendered glyphs for the new segment. ----------------------------------------------------------------------------------------------*/ -void Segment::SetUpGlyphInfo(GrTableManager * ptman, gid16 chwLB, int nDirDepth, - int islotMin, int cslot) +void Segment::SetUpGlyphInfo(GrTableManager * ptman, GrSlotStream * psstrmFinal, + gid16 chwLB, int nDirDepth, int islotMin, int cslot) { //int paraDirLevel = (ptman->State()->ParaRightToLeft()) ? 1 : 0; @@ -1699,7 +1727,7 @@ void Segment::SetUpGlyphInfo(GrTableManager * ptman, gid16 chwLB, int nDirDepth, int islot; for (islot = islotMin; islot < cslot; islot++) { - if (m_psstrm->SlotAt(islot)->GlyphID() != chwLB) + if (psstrmFinal->SlotAt(islot)->GlyphID() != chwLB) { m_cginf++; } @@ -1718,7 +1746,7 @@ void Segment::SetUpGlyphInfo(GrTableManager * ptman, gid16 chwLB, int nDirDepth, int iginf = 0; for (int islot = islotMin; islot < cslot; islot++) { - GrSlotState * pslot = m_psstrm->SlotAt(islot); + GrSlotState * pslot = psstrmFinal->SlotAt(islot); if (pslot->GlyphID() == chwLB) { @@ -1737,32 +1765,37 @@ void Segment::SetUpGlyphInfo(GrTableManager * ptman, gid16 chwLB, int nDirDepth, // Fill in stuff in the output slot that is needed by the GlyphInfo object. pslout->m_xsAdvanceX = pslot->GlyphMetricLogUnits(ptman, kgmetAdvWidth); - pslout->m_ysAdvanceY = pslot->GlyphMetricLogUnits(ptman, kgmetAdvHeight); - pslout->m_rectBB.top - = pslot->YPosition() + pslot->GlyphMetricLogUnits(ptman, kgmetBbTop); - pslout->m_rectBB.bottom - = pslot->YPosition() + pslot->GlyphMetricLogUnits(ptman, kgmetBbBottom); - pslout->m_rectBB.left - = pslot->XPosition() + pslot->GlyphMetricLogUnits(ptman, kgmetBbLeft); - if (pslot->IsSpace(ptman)) - pslout->m_rectBB.right - = pslot->XPosition() + pslot->GlyphMetricLogUnits(ptman, kgmetAdvWidth); - else - pslout->m_rectBB.right - = pslot->XPosition() + pslot->GlyphMetricLogUnits(ptman, kgmetBbRight); + //pslout->m_ysAdvanceY = pslot->GlyphMetricLogUnits(ptman, kgmetAdvHeight); + //pslout->m_rectBB.top + // = pslot->YPosition() + pslot->GlyphMetricLogUnits(ptman, kgmetBbTop); + //pslout->m_rectBB.bottom + // = pslot->YPosition() + pslot->GlyphMetricLogUnits(ptman, kgmetBbBottom); + //pslout->m_rectBB.left + // = pslot->XPosition() + pslot->GlyphMetricLogUnits(ptman, kgmetBbLeft); + //if (pslot->IsSpace(ptman)) + // pslout->m_rectBB.right + // = pslot->XPosition() + pslot->GlyphMetricLogUnits(ptman, kgmetAdvWidth); + //else + // pslout->m_rectBB.right + // = pslot->XPosition() + pslot->GlyphMetricLogUnits(ptman, kgmetBbRight); iginf++; } if (cslot - islotMin == 0) m_isloutGinf0 = 0; + if (m_isloutGinf0 == -1) + { + Assert(m_cginf == 0); + m_isloutGinf0 = ((OutputSlot(0)->IsInitialLineBreak()) ? 1 : 0); + } Assert(m_isloutGinf0 == 0 || m_isloutGinf0 == 1); } /* // OLD VERSION -void Segment::SetUpGlyphInfo(GrTableManager * ptman, gid16 chwLB, int nDirDepth, +void Segment::SetUpGlyphInfo(GrTableManager * ptman, GrSlotStream * psstrmFinal, gid16 chwLB, int nDirDepth, int islotMin, int cslot) { int paraDirLevel = (ptman->State()->ParaRightToLeft()) ? 1 : 0; @@ -1771,7 +1804,7 @@ void Segment::SetUpGlyphInfo(GrTableManager * ptman, gid16 chwLB, int nDirDepth, int islot; for (islot = islotMin; islot < cslot; islot++) { - if (m_psstrm->SlotAt(islot)->GlyphID() != chwLB) + if (psstrmFinal->SlotAt(islot)->GlyphID() != chwLB) m_cginf++; } @@ -1788,7 +1821,7 @@ void Segment::SetUpGlyphInfo(GrTableManager * ptman, gid16 chwLB, int nDirDepth, m_isloutGinf0 = -1; for (islot = islotMin; islot < cslot; islot++) { - GrSlotState * pslot = m_psstrm->SlotAt(islot); + GrSlotState * pslot = psstrmFinal->SlotAt(islot); int islout = islot - islotMin; if (pslot->GlyphID() == chwLB) @@ -2030,6 +2063,30 @@ void Segment::AdjustAfterArrayFromNextSeg() #endif // -------------------------- END OF OBSOLETE CODE ---------------------------------- + +/*---------------------------------------------------------------------------------------------- + Generate a list of all the glyphs that are attached to the base with the given index. + Note that we want to generate glyph indices, not slot indices. + + @param disloutCluster - indicates how far on either side of the base to look. +----------------------------------------------------------------------------------------------*/ +void Segment::ClusterMembersForGlyph(int isloutBase, int disloutCluster, + std::vector<int> & visloutRet) +{ + for (int islout = max(0, isloutBase - disloutCluster); + islout < min(m_cslout, isloutBase + disloutCluster + 1); + islout++) + { + if (islout == isloutBase) + continue; // don't include the base itself + GrSlotOutput * pslout = m_prgslout + islout; + if (pslout->ClusterBase() == isloutBase) + { + visloutRet.push_back(islout); + } + } +} + /*---------------------------------------------------------------------------------------------- Record an underlying-to-surface association mapping, based on the fact that there is a corresponding surface-to-underlying association in the streams. @@ -2062,7 +2119,7 @@ void Segment::RecordSurfaceAssoc(int ichwUnder, int islotSurface, int nDir) min(m_prgisloutAfter[ ichwUnder - m_ichwAssocsMin], islotSurface); } - m_prgvisloutAssocs[ichwUnder - m_ichwAssocsMin].push_back(islotSurface); + m_prgpvisloutAssocs[ichwUnder - m_ichwAssocsMin]->push_back(islotSurface); } /*---------------------------------------------------------------------------------------------- @@ -2083,7 +2140,8 @@ void Segment::RecordLigature(int ichwUnder, int islotSurface, int iComponent) Assert(m_prgisloutLigature[ichwUnder - m_ichwAssocsMin] == kNegInfinity); m_prgisloutLigature[ichwUnder - m_ichwAssocsMin] = islotSurface; - m_prgiComponent[ ichwUnder - m_ichwAssocsMin] = iComponent; + Assert(iComponent < kMaxComponentsPerGlyph); + m_prgiComponent[ ichwUnder - m_ichwAssocsMin] = sdata8(iComponent); } /*---------------------------------------------------------------------------------------------- @@ -2141,12 +2199,12 @@ void Segment::EnsureSpaceAtLineBoundaries(int ichwUnder) m_prgisloutAfter + cchwPreAdd); delete[] prgisloutTmp; - std::vector<int> * pvisloutTmp = m_prgvisloutAssocs; - m_prgvisloutAssocs = new std::vector<int>[cchwNewLim - cchwNewMin]; - std::swap_ranges(m_prgvisloutAssocs + cchwPreAdd, - m_prgvisloutAssocs + cchwPreAdd + - (m_ichwAssocsLim - m_ichwAssocsMin), pvisloutTmp); - delete[] pvisloutTmp; + std::vector<int> ** ppvisloutTmp = m_prgpvisloutAssocs; + m_prgpvisloutAssocs = new std::vector<int> * [cchwNewLim - cchwNewMin]; + std::swap_ranges(m_prgpvisloutAssocs + cchwPreAdd, + m_prgpvisloutAssocs + cchwPreAdd + + (m_ichwAssocsLim - m_ichwAssocsMin), ppvisloutTmp); + delete[] ppvisloutTmp; prgisloutTmp = m_prgisloutLigature; m_prgisloutLigature = new int[cchwNewLim - cchwNewMin]; @@ -2154,11 +2212,11 @@ void Segment::EnsureSpaceAtLineBoundaries(int ichwUnder) m_prgisloutLigature + cchwPreAdd); delete[] prgisloutTmp; - prgisloutTmp = m_prgiComponent; - m_prgiComponent = new int[cchwNewLim - cchwNewMin]; - std::copy(prgisloutTmp, prgisloutTmp + (m_ichwAssocsLim - m_ichwAssocsMin), + sdata8 * prgiCompTmp = m_prgiComponent; + m_prgiComponent = new sdata8[cchwNewLim - cchwNewMin]; + std::copy(prgiCompTmp, prgiCompTmp + (m_ichwAssocsLim - m_ichwAssocsMin), m_prgiComponent + cchwPreAdd); - delete[] prgisloutTmp; + delete[] prgiCompTmp; // Initialize new slots. int i; @@ -2166,7 +2224,7 @@ void Segment::EnsureSpaceAtLineBoundaries(int ichwUnder) { m_prgisloutBefore[i] = kPosInfinity; m_prgisloutAfter[i] = kNegInfinity; - m_prgvisloutAssocs[i].clear(); + m_prgpvisloutAssocs[i] = new std::vector<int>; m_prgisloutLigature[i] = kNegInfinity; m_prgiComponent[i] = 0; } @@ -2176,7 +2234,7 @@ void Segment::EnsureSpaceAtLineBoundaries(int ichwUnder) { m_prgisloutBefore[i] = kPosInfinity; m_prgisloutAfter[i] = kNegInfinity; - m_prgvisloutAssocs[i].clear(); + m_prgpvisloutAssocs[i] = new std::vector<int>; m_prgisloutLigature[i] = kNegInfinity; m_prgiComponent[i] = 0; } @@ -2212,11 +2270,11 @@ void Segment::SetFont(Font * pfont) { m_pfont = pfont->copyThis(); - m_fBold = pfont->bold(); - m_fItalic = pfont->italic(); +// m_fBold = pfont->bold(); +// m_fItalic = pfont->italic(); // Note that we store the character height (which does not include the internal leading), // not the actual font height, ie, ascent + descent. This is what is used in the LOGFONT. - pfont->getFontMetrics(NULL, NULL, &m_pixHeight); + pfont->getFontMetrics(NULL, NULL, &m_xysEmSquare); // m_xysEmSquare = m_pixHeight } /*---------------------------------------------------------------------------------------------- @@ -2308,7 +2366,7 @@ int Segment::LogicalSurfaceToUnderlying(int islout, float xsOffset, float ysClic // If the slot has components, see if the offset falls within one of them. - if (pslout->HasComponents()) + if (pslout->NumberOfComponents() > 0) { GrEngine * pgreng = EngineImpl(); if (!pgreng) @@ -2388,6 +2446,9 @@ LNotLigature: // diCharAdj--; } + if (dichw == kNegInfinity || dichw == kPosInfinity) + return dichw; + // This should be true because of the way the associations are set up: Assert(GrCharStream::AtUnicodeCharBoundary(m_pgts, m_ichwMin + dichw)); // + diCharAdj)); @@ -2516,6 +2577,7 @@ int Segment::LogicalToPhysicalSurface(int islout) return the physical surface locations of all the associated surface glyphs. OBSOLETE ----------------------------------------------------------------------------------------------*/ +#if 0 void Segment::UnderlyingToPhysicalAssocs(int ichw, std::vector<int> & viginf) { int ichwSegOffset = ichw - m_ichwMin; @@ -2539,29 +2601,48 @@ void Segment::UnderlyingToPhysicalAssocs(int ichw, std::vector<int> & viginf) } } } +#endif /*---------------------------------------------------------------------------------------------- Given an underlying character position (relative to the beginning of the string), return a pointer to the vector containing the logical surface locations of all the associated surface glyphs. - WARNING: this method returns a pointer to the actual data, not a copy of it. - Do not modify the returned vector! + Returns an empty vector (not something containing infinities) if the character is + "invisible." ----------------------------------------------------------------------------------------------*/ -std::vector<int> * Segment::UnderlyingToLogicalAssocs(int ichw) +std::vector<int> Segment::UnderlyingToLogicalAssocs(int ichw) { + std::vector<int> vnEmpty; + vnEmpty.clear(); + Assert(vnEmpty.size() == 0); + int ichwSegOffset = ichw - m_ichwMin; if (ichwSegOffset < m_ichwAssocsMin) - return NULL; // probably rendered in previous segment + return vnEmpty; // probably rendered in previous segment else if (ichwSegOffset >= m_ichwAssocsLim) - return NULL; // probably rendered in following segment + return vnEmpty; // probably rendered in following segment + else if (m_prgpvisloutAssocs[ichwSegOffset - m_ichwAssocsMin] == NULL) + { + // Create a vector using the before and after values. + std::vector<int> visloutRet; + int isloutBefore = m_prgisloutBefore[ichwSegOffset - m_ichwAssocsMin]; + int isloutAfter = m_prgisloutAfter[ichwSegOffset - m_ichwAssocsMin]; + if (isloutBefore != kPosInfinity && isloutBefore != kNegInfinity) + visloutRet.push_back(isloutBefore); + if (isloutAfter != kPosInfinity && isloutAfter != kNegInfinity && isloutBefore != isloutAfter) + { + visloutRet.push_back(isloutAfter); + } + return visloutRet; + } else { - std::vector<int> * pvisloutRet = &(m_prgvisloutAssocs[ichwSegOffset - m_ichwAssocsMin]); - return pvisloutRet; + std::vector<int> * pvisloutRet = m_prgpvisloutAssocs[ichwSegOffset - m_ichwAssocsMin]; + return *pvisloutRet; } } @@ -2573,15 +2654,12 @@ std::vector<int> * Segment::UnderlyingToLogicalAssocs(int ichw) int Segment::UnderlyingToLogicalInThisSeg(int ichw) { int isloutTest = kNegInfinity; - std::vector<int> * pvislout = UnderlyingToLogicalAssocs(ichw); - if (pvislout) + std::vector<int> vislout = UnderlyingToLogicalAssocs(ichw); + for (size_t iislout = 0; iislout < vislout.size(); iislout++) { - for (size_t iislout = 0; iislout < pvislout->size(); iislout++) - { - isloutTest = (*pvislout)[iislout]; - if (isloutTest != kNegInfinity && isloutTest != kPosInfinity) - return isloutTest; - } + isloutTest = vislout[iislout]; + if (isloutTest != kNegInfinity && isloutTest != kPosInfinity) + return isloutTest; } return isloutTest; } @@ -2591,20 +2669,26 @@ int Segment::UnderlyingToLogicalInThisSeg(int ichw) ----------------------------------------------------------------------------------------------*/ bool Segment::SameSurfaceGlyphs(int ichw1, int ichw2) { - std::vector<int> * pvislout1 = UnderlyingToLogicalAssocs(ichw1); - std::vector<int> * pvislout2 = UnderlyingToLogicalAssocs(ichw2); - - if (pvislout1 == NULL || pvislout1 == NULL) - return false; + std::vector<int> vislout1 = UnderlyingToLogicalAssocs(ichw1); + std::vector<int> vislout2 = UnderlyingToLogicalAssocs(ichw2); - if (pvislout1->size() != pvislout2->size()) - return false; - for (size_t islout = 0; islout < pvislout1->size(); islout++) + bool fRet = true; + if (vislout1.size() == 0 || vislout2.size() == 0) + fRet = false; + else if (vislout1.size() != vislout2.size()) + fRet = false; + else { - if ((*pvislout1)[islout] != (*pvislout2)[islout]) - return false; + for (size_t islout = 0; islout < vislout1.size(); islout++) + { + if (vislout1[islout] != vislout2[islout]) + { + fRet = false; + break; + } + } } - return true; + return fRet; } /*---------------------------------------------------------------------------------------------- @@ -2767,9 +2851,9 @@ GrResult Segment::getUniscribeClusters( // insertion is not allowed. for (ich = 0; ich < m_dichwLim; ich++) { - std::vector<int> * pvislout = UnderlyingToLogicalAssocs(ich + m_ichwMin); + std::vector<int> vislout = UnderlyingToLogicalAssocs(ich + m_ichwMin); - if (!pvislout || pvislout->size() == 0) + if (vislout.size() == 0) { // No glyphs represent this character. Merge it with the previous // character. @@ -2779,9 +2863,9 @@ GrResult Segment::getUniscribeClusters( } size_t iislout; - for (iislout = 0; iislout < pvislout->size(); iislout++) + for (iislout = 0; iislout < vislout.size(); iislout++) { - int islout = (*pvislout)[iislout]; + int islout = vislout[iislout]; if (!m_prgslout[islout].InsertBefore()) { // This glyph does not allow insertion before it; make its character part @@ -2823,6 +2907,10 @@ GrResult Segment::getUniscribeClusters( for (ich = 0; ich < m_dichwLim - 1; ich++) { Assert(visloutBefore[ich] <= visloutAfter[ich]); + Assert(visloutBefore[ich] != kPosInfinity); + Assert(visloutBefore[ich] != kNegInfinity); + Assert(visloutAfter[ich] != kPosInfinity); + Assert(visloutAfter[ich] != kNegInfinity); const int b1 = visloutBefore[ich]; const int a1 = visloutAfter[ich]; const int b2 = visloutBefore[ich + 1]; @@ -3174,10 +3262,11 @@ int Segment::GlyphHit(float xsClick, float ysClick) return 0; } - // Find all BB that OVERLAP the click point (BbLeft < XClick < BbRight). + // Find all BB that OVERLAP the click point (bb.left < XClick < bb.right). for (iginf = iginfHit; iginf >= 0; iginf--) { - if (m_prgginf[iginf].bb().left <= xsClick && xsClick <= m_prgginf[iginf].bb().right) + Rect rectBB = m_prgginf[iginf].bb(); + if (rectBB.left <= xsClick && xsClick <= rectBB.right) { viginfNear.push_back(iginf); } @@ -3194,11 +3283,36 @@ int Segment::GlyphHit(float xsClick, float ysClick) } } - // Find all BB for which the click is within their advance width. + if (viginfNear.size() > 2 && viginfHit.size() == 0) + { + // No hit along y-axis; find the closest thing. + float dy = float(10000000.0); + for (int iiginf2 = 0; iiginf2 < (int)viginfNear.size(); iiginf2++) + { + Rect rectBB = m_prgginf[viginfNear[iiginf2]].bb(); + if (fabsf(rectBB.top - ysClick) < dy) + { + dy = fabsf(rectBB.top - ysClick); + viginfHit.clear(); + viginfHit.push_back(viginfNear[iiginf2]); + } + if (fabsf(rectBB.bottom - ysClick) < dy) + { + dy = fabsf(rectBB.bottom - ysClick); + viginfHit.clear(); + viginfHit.push_back(viginfNear[iiginf2]); + } + } + } + + // Find all BB for which the click is within their advance width, if any. for (iiginf = 0; iiginf < (int)viginfHit.size(); iiginf++) { - Rect rectBB = m_prgginf[viginfHit[iiginf]].bb(); - if (rectBB.left <= xsClick && xsClick <= rectBB.right) + //Rect rectBB = m_prgginf[viginfHit[iiginf]].bb(); -- ?? this tests the bounding box again :-/ + //if (rectBB.left <= xsClick && xsClick <= rectBB.right) + gr::GlyphInfo * pginf = m_prgginf + viginfHit[iiginf]; + if (pginf->advanceWidth() == 0 // advance width is irrelevant + || (pginf->origin() < xsClick && xsClick <= pginf->origin() + pginf->advanceWidth())) { viginfInside.push_back(viginfHit[iiginf]); } @@ -3253,7 +3367,8 @@ int Segment::GlyphHit(float xsClick, float ysClick) /*---------------------------------------------------------------------------------------------- Select the bounding box we will use for a mouse hit. - Select the BB with the left-most (LTR) or right-most (RTL) edge. + First select any glyph with a significantly smaller bounding box. + Then, select the BB with the left-most (LTR) or right-most (RTL) edge. If more than one BB has same edge of interest, select the one that is closest to the the baseline. If that is a tie, select the one with the lowest islout. @@ -3272,6 +3387,27 @@ int Segment::SelectBb(std::vector<int> & viginf, bool fRTL) if (viginf.size() == 1) return viginf[0]; + // Find a glyph that has a signficantly smaller bounding box. + // The idea is that it is going to be harder to hit than the bigger glyph. + float smallestArea = float(1000000000.0); + float largestArea = 0.0; + size_t iiginfSmallest; + size_t iiginf; + for (iiginf = 0; iiginf < viginf.size(); iiginf++) + { + gr::GlyphInfo * pginf = m_prgginf + viginf[iiginf]; + Rect rectBB = pginf->bb(); + float thisArea = (rectBB.right - rectBB.left) * (rectBB.top - rectBB.bottom); + if (smallestArea > thisArea) + { + smallestArea = thisArea; + iiginfSmallest = iiginf; + } + largestArea = max(largestArea, thisArea); + } + if (smallestArea * 2.0 < largestArea) + return viginf[iiginfSmallest]; + // Find appropriate x coor of leading edge. float xsLeading; if (!fRTL) @@ -3279,27 +3415,28 @@ int Segment::SelectBb(std::vector<int> & viginf, bool fRTL) else xsLeading = m_prgginf[viginf[0]].bb().right; - size_t iiginf; for (iiginf = 1; iiginf < viginf.size(); iiginf++) { + Rect rectBB = m_prgginf[viginf[iiginf]].bb(); if (!fRTL) - xsLeading = min(xsLeading, m_prgginf[viginf[iiginf]].bb().left); + xsLeading = min(xsLeading, rectBB.left); else - xsLeading = max(xsLeading, m_prgginf[viginf[iiginf]].bb().right); + xsLeading = max(xsLeading, rectBB.right); } // Find BBs with the leading edge. std::vector<int> viginfSameEdge; for (iiginf = 0; iiginf < viginf.size(); iiginf++) { + Rect rectBB = m_prgginf[viginf[iiginf]].bb(); if (!fRTL) { - if (m_prgginf[viginf[iiginf]].bb().left == xsLeading) + if (rectBB.left == xsLeading) viginfSameEdge.push_back(viginf[iiginf]); } else { - if (m_prgginf[viginf[iiginf]].bb().right == xsLeading) + if (rectBB.right == xsLeading) viginfSameEdge.push_back(viginf[iiginf]); } } diff --git a/Build/source/libs/graphite-engine/src/segment/SegmentAux.cpp b/Build/source/libs/graphite-engine/src/segment/SegmentAux.cpp index 00dce43df65..9191e8724d5 100644 --- a/Build/source/libs/graphite-engine/src/segment/SegmentAux.cpp +++ b/Build/source/libs/graphite-engine/src/segment/SegmentAux.cpp @@ -77,11 +77,12 @@ float GlyphInfo::attachedClusterAdvance() const throw() std::pair<gr::GlyphSetIterator, gr::GlyphSetIterator> GlyphInfo::attachedClusterGlyphs() const { + std::vector<int> visloutClusterMembers; + m_pslout->ClusterMembers(m_pseg, m_islout, visloutClusterMembers); + RcVector * qvislout = new RcVector(visloutClusterMembers); return std::make_pair( - GlyphSetIterator(*m_pseg, 0, - m_pslout->m_visloutClusterMembers), - GlyphSetIterator(*m_pseg, m_pslout->m_visloutClusterMembers.size(), - m_pslout->m_visloutClusterMembers)); + GlyphSetIterator(*m_pseg, 0, qvislout), + GlyphSetIterator(*m_pseg, visloutClusterMembers.size(), qvislout)); } size_t GlyphInfo::logicalIndex() @@ -104,7 +105,8 @@ float GlyphInfo::advanceWidth() // logical units float GlyphInfo::advanceHeight() // logical units; zero for horizontal fonts { - return m_pslout->m_xysAdvY; + Font & font = m_pseg->getFont(); + return m_pslout->GlyphMetricLogUnits(&font, kgmetAdvHeight); } float GlyphInfo::yOffset() @@ -114,7 +116,7 @@ float GlyphInfo::yOffset() Rect GlyphInfo::bb() // logical units { - return m_pslout->m_rectBB; + return m_pslout->BoundingBox(m_pseg->getFont()); } bool GlyphInfo::isSpace() @@ -221,13 +223,21 @@ bool GlyphInfo::erroneous() //:> GlyphIterator methods //:>******************************************************************************************** - // Constructor +// Constructor GlyphIterator::GlyphIterator(Segment & seg, size_t iginf) -: _itr(seg.m_prgginf + iginf) +: m_pginf(seg.m_prgginf + iginf) {} -GlyphIterator::GlyphIterator(const GlyphSetIterator &set_itr) -: _itr(set_itr->segment().m_prgginf + set_itr->logicalIndex()) +// Copy constructor. +// Check if the incoming iterator is null, as we cannot dereference +// it to get the segment, and create a null GlyphIterator. +// Technically this might better be an assert as converting a null +// GlyphSetIterator into a null GlyphIterator is pointless and suggests +// some kind of error. +GlyphIterator::GlyphIterator(const GlyphSetIterator & sit) +: m_pginf((sit == GlyphSetIterator()) + ? 0 + : sit->segment().m_prgginf + sit->logicalIndex()) {} /*---------------------------------------------------------------------------------------------- @@ -236,9 +246,10 @@ GlyphIterator::GlyphIterator(const GlyphSetIterator &set_itr) GlyphSetIterator::reference GlyphSetIterator::operator*() const { - assert(_seg_ptr); + assert(m_pseg != 0); + assert(m_vit != std::vector<int>::const_iterator()); // in the case of a non-contiguous list - return _seg_ptr->m_prgginf[(*_itr) - _seg_ptr->m_isloutGinf0]; + return m_pseg->m_prgginf[(*m_vit) - m_pseg->m_isloutGinf0]; } diff --git a/Build/source/libs/graphite-engine/src/segment/TransductionLog.cpp b/Build/source/libs/graphite-engine/src/segment/TransductionLog.cpp index 658b2ec1044..29a1be2af12 100644 --- a/Build/source/libs/graphite-engine/src/segment/TransductionLog.cpp +++ b/Build/source/libs/graphite-engine/src/segment/TransductionLog.cpp @@ -973,7 +973,8 @@ void Segment::LogUnderlyingToSurface(GrTableManager * ptman, std::ostream & strm int ichw; for (ichw = 0; ichw < (m_ichwAssocsLim - m_ichwAssocsMin); ichw++) { - cassocs = max(cassocs, m_prgvisloutAssocs[ichw].size()); + if (m_prgpvisloutAssocs[ichw]) + cassocs = max(cassocs, m_prgpvisloutAssocs[ichw]->size()); if (m_prgisloutLigature[ichw] != kNegInfinity) fLigs = true; } @@ -1080,7 +1081,7 @@ void Segment::LogUnderlyingToSurface(GrTableManager * ptman, std::ostream & strm } strmOut <<"\n"; - for (size_t ix = 1; ix < cassocs - 1; ix++) //(cassocs > 2) + for (int ix = 1; ix < signed(cassocs) - 1; ix++) //(cassocs > 2) { if (ix == 1) strmOut << "other "; @@ -1088,10 +1089,13 @@ void Segment::LogUnderlyingToSurface(GrTableManager * ptman, std::ostream & strm strmOut << " "; for (ichw = 0; ichw < (m_ichwAssocsLim - m_ichwAssocsMin); ichw++) { - if (m_prgvisloutAssocs[ichw].size() <= ix) + std::vector<int> * pvislout = m_prgpvisloutAssocs[ichw]; + if (pvislout == NULL) strmOut << " "; - else if (m_prgvisloutAssocs[ichw][ix] != m_prgisloutAfter[ichw]) - ptman->LogInTable(strmOut, m_prgvisloutAssocs[ichw][ix]); + else if (signed(pvislout->size()) <= ix) + strmOut << " "; + else if ((*pvislout)[ix] != m_prgisloutAfter[ichw]) + ptman->LogInTable(strmOut, (*pvislout)[ix]); else strmOut << " "; } @@ -1171,8 +1175,7 @@ void Segment::LogSurfaceToUnderlying(GrTableManager * ptman, std::ostream & strm else { ptman->LogHexInTable(strmOut, psloutTmp->GlyphID()); - if (psloutTmp->HasComponents()) - ccomp = max(ccomp, psloutTmp->NumberOfComponents()); + ccomp = max(ccomp, psloutTmp->NumberOfComponents()); } } strmOut << "\n"; @@ -1464,9 +1467,9 @@ void GrSlotState::SlotAttrsModified(bool * rgfMods, bool fPreJust, int * pccomp, if (m_nAttachLevel != 0) rgfMods[kslatAttLevel] = true; - if (m_lb != kNotYetSet) + if (m_lb != kNotYetSet8) rgfMods[kslatBreak] = true; - if (m_dirc != kNotYetSet) + if (m_dirc != kNotYetSet8) rgfMods[kslatDir] = true; if (m_fInsertBefore != true) rgfMods[kslatInsert] = true; @@ -1759,14 +1762,14 @@ void GrSlotState::LogSlotAttribute(GrTableManager * ptman, break; case kslatBreak: - if (m_lb != (pslotPrev ? pslotPrev->m_lb : kNotYetSet)) + if (m_lb != (pslotPrev ? pslotPrev->m_lb : kNotYetSet8)) { ptman->LogBreakWeightInTable(strmOut, m_lb); return; } break; case kslatDir: - if (m_dirc != (pslotPrev ? pslotPrev->m_dirc : kNotYetSet)) + if (m_dirc != (pslotPrev ? pslotPrev->m_dirc : kNotYetSet8)) { ptman->LogDirCodeInTable(strmOut, m_dirc); return; diff --git a/Build/source/libs/graphite-engine/src/segment/explicit_instantiations.cpp b/Build/source/libs/graphite-engine/src/segment/explicit_instantiations.cpp deleted file mode 100644 index 0aa2a40dddf..00000000000 --- a/Build/source/libs/graphite-engine/src/segment/explicit_instantiations.cpp +++ /dev/null @@ -1,44 +0,0 @@ -/*--------------------------------------------------------------------*//*:Ignore this sentence. -Copyright (C) 1999, 2001 SIL International. All rights reserved. - -Distributable under the terms of either the Common Public License or the -GNU Lesser General Public License, as specified in the LICENSING.txt file. - -File: explicit_instantiation.cpp -Responsibility: Sharon Correll -Last reviewed: Not yet. - -Description: - Explicitly instantiate HashMap and Vector types used in the GrEngine module. --------------------------------------------------------------------------------*//*:End Ignore*/ - -// Standard includes for the module, gives the types we have to instantiate -#include "Main.h" -#pragma hdrstop - -// Standard includes for doing explicit instantiation: - -//////#include "Vector_i.cpp" - -namespace gr -{ - -// Types we use: -template class std::vector<int>; -// STL port doesn't like this -//template class std::vector<bool>; -template class std::vector<GrSlotState *>; -template class std::vector<GrGlyphSubTable *>; -template class std::vector<int *>; -/////template std::vector<std::wstring>; // remove -template class std::vector<OLECHAR>; -template class std::vector<byte>; -template class std::vector<DirCode>; - -// VS6.0 doesn't like these: -//template std::vector<RECT>; -//template std::vector<Segment::GlyphStrmKey>; -//template std::vector<Segment::LineSeg>; -//template std::vector<GrGlyphIndexPair>; - -} // namespace gr diff --git a/Build/source/libs/graphite-engine/test/Makefile.am b/Build/source/libs/graphite-engine/test/Makefile.am index 4a5422f014f..96570ad125a 100644 --- a/Build/source/libs/graphite-engine/test/Makefile.am +++ b/Build/source/libs/graphite-engine/test/Makefile.am @@ -1,2 +1,2 @@ -SUBDIRS = RegressionTest +SUBDIRS = ProfileHarness RegressionTest EXTRA_DIST = fonterrors diff --git a/Build/source/libs/graphite-engine/test/Makefile.in b/Build/source/libs/graphite-engine/test/Makefile.in index 4c74fbb3979..29d0d87eeb5 100644 --- a/Build/source/libs/graphite-engine/test/Makefile.in +++ b/Build/source/libs/graphite-engine/test/Makefile.in @@ -110,6 +110,7 @@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ REL_CODENAME = @REL_CODENAME@ +SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ SIZEOF_WCHAR_T = @SIZEOF_WCHAR_T@ @@ -162,7 +163,7 @@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ -SUBDIRS = RegressionTest +SUBDIRS = ProfileHarness RegressionTest EXTRA_DIST = fonterrors all: all-recursive diff --git a/Build/source/libs/graphite-engine/test/ProfileHarness/GrUtfTextSrc.cpp b/Build/source/libs/graphite-engine/test/ProfileHarness/GrUtfTextSrc.cpp new file mode 100644 index 00000000000..7904b1c6653 --- /dev/null +++ b/Build/source/libs/graphite-engine/test/ProfileHarness/GrUtfTextSrc.cpp @@ -0,0 +1,310 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: NPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Netscape Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is sila.mozdev.org code.
+ *
+ * The Initial Developer of the Original Code is
+ * Keith Stribley.
+ * Portions created by the Initial Developer are Copyright (C) 2004
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the NPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the NPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+#include <graphite/GrClient.h>
+#include <graphite/ITextSource.h>
+#include <graphite/IGrJustifier.h>
+#include <graphite/IGrEngine.h>
+#include <graphite/SegmentAux.h>
+#include <graphite/Font.h>
+#include <graphite/Segment.h>
+#include <graphite/GraphiteProcess.h>
+#include <graphite/FileFont.h>
+
+#include "GrUtfTextSrc.h"
+
+
+
+GrUtfTextSrc::GrUtfTextSrc()
+: mLength(0),
+ mBufferLength8(64), mBufferLength16(64), mBufferLength32(64),
+ mData8(NULL), mData16(NULL), mData32(NULL),
+ mType(gr::kutf16),
+ mForeground(gr::kclrBlack), mBackground(gr::kclrTransparent),
+ mSelectForeground(0), mSelectBackground(0),
+ mIsSelected(false),
+ mFont(NULL),
+ mRtl(false)
+{
+
+}
+
+GrUtfTextSrc::~GrUtfTextSrc()
+{
+ if (mData8) delete [] mData8;
+ if (mData16) delete [] mData16;
+ if (mData32) delete [] mData32;
+ mSelectionVector.clear();
+}
+
+bool GrUtfTextSrc::setText(const char * pszText, int len)
+{
+ return setText((gr::utf8*)pszText, len);
+}
+
+bool GrUtfTextSrc::setText(const gr::utf8 * pszText, int len)
+{
+ mType = gr::kutf8;
+ mLength = len;
+ if (!checkBuffer8()) return false;
+
+ for(size_t i = 0; i < mLength; i++)
+ {
+ mData8[i] = pszText[i];
+ // stray line feeds and other control characters from the html file
+ // cause artificial truncation of segments
+ if (mData8[i] < 0x0020)//(pszText[i] == '\n' || pszText[i] == '\r')
+ mData8[i] = 0x20; // ZWSP
+ }
+ mData8[mLength] = '\0'; // zero-terminate
+ mSelectionVector.clear();
+ mIsSelected = false;
+ return true;
+}
+
+
+bool GrUtfTextSrc::setText(const gr::utf16 * pszText, int len)
+{
+ mType = gr::kutf16;
+ mLength = len;
+ if (!checkBuffer16()) return false;
+
+ for(size_t i = 0; i < mLength; i++)
+ {
+ mData16[i] = pszText[i];
+ // stray line feeds and other control characters from the html file
+ // cause artificial truncation of segments
+ if (mData16[i] < 0x0020)//(pszText[i] == '\n' || pszText[i] == '\r')
+ mData16[i] = 0x200B; // ZWSP
+ }
+ mData16[mLength] = '\0'; // zero-terminate
+ mSelectionVector.clear();
+ mIsSelected = false;
+ return true;
+}
+
+bool GrUtfTextSrc::setText(const gr::utf32 * pszText, int len)
+{
+ mType = gr::kutf32;
+ mLength = len;
+ if (!checkBuffer32()) return false;
+
+ for(size_t i = 0; i < mLength; i++)
+ {
+ mData32[i] = pszText[i];
+ }
+ mData32[mLength] = '\0'; // zero-terminate
+ mSelectionVector.clear();
+ mIsSelected = false;
+ return true;
+}
+
+bool GrUtfTextSrc::checkBuffer8(void)
+{
+ if (!mData8 || mBufferLength8 < mLength + 1)
+ {
+ do
+ {
+ mBufferLength8 *= 2;
+ } while (mBufferLength8 < mLength + 1);
+ if (mData8) delete [] mData8;
+ mData8 = new gr::utf8[mBufferLength8];
+ }
+ return (mData8) ? true : false;
+}
+
+bool GrUtfTextSrc::checkBuffer16(void)
+{
+ if (!mData16 || mBufferLength16 < mLength + 1)
+ {
+ do
+ {
+ mBufferLength16 *= 2;
+ } while (mBufferLength16 < mLength + 1);
+ if (mData16) delete [] mData16;
+ mData16 = new gr::utf16[mBufferLength16];
+ }
+ return (mData16) ? true : false;
+}
+
+bool GrUtfTextSrc::checkBuffer32(void)
+{
+ if (!mData32 || mBufferLength32 < mLength + 1)
+ {
+ do
+ {
+ mBufferLength32 *= 2;
+ } while (mBufferLength32 < mLength + 1);
+ if (mData32) delete [] mData32;
+ mData32 = new gr::utf32[mBufferLength32];
+ }
+ return (mData32) ? true : false;
+}
+
+size_t GrUtfTextSrc::fetch(gr::toffset ichMin, size_t cch, gr::utf8 * prgchwBuffer)
+{
+ assert(cch <= mLength);
+ if (cch > mLength)
+ {
+ return 0;
+ }
+ std::copy(mData8 + ichMin, mData8 + ichMin + cch, prgchwBuffer);
+ return (cch - ichMin);
+}
+
+size_t GrUtfTextSrc::fetch(gr::toffset ichMin, size_t cch, gr::utf16 * prgchwBuffer)
+{
+ assert(cch <= mLength);
+ if (cch > mLength)
+ {
+ return 0;
+ }
+ std::copy(mData16 + ichMin, mData16 + ichMin + cch, prgchwBuffer);
+ return (cch - ichMin);
+}
+
+size_t GrUtfTextSrc::fetch(gr::toffset ichMin, size_t cch, gr::utf32 * prgchwBuffer)
+{
+ assert(cch <= mLength);
+ if (cch > mLength)
+ {
+ return 0;
+ }
+ std::copy(mData32 + ichMin, mData32 + ichMin + cch, prgchwBuffer);
+ return (cch - ichMin);
+}
+
+
+bool GrUtfTextSrc::getRightToLeft(gr::toffset ich)
+{
+ return mRtl; // assumes src only contains one direction
+}
+
+unsigned int GrUtfTextSrc::getDirectionDepth(gr::toffset ich)
+{
+ return (mRtl) ? 1 : 0; // TBD
+}
+
+std::pair<gr::toffset, gr::toffset> GrUtfTextSrc::propertyRange(gr::toffset ich)
+{
+ std::pair<gr::toffset, gr::toffset> range(0, mLength);
+ if (mIsSelected)
+ {
+ bool selectState = mSelectionVector[ich];
+ // find start
+ int s = ich - 1;
+ int e = ich + 1;
+ if (s > -1)
+ for ( ; s >= 0; s--)
+ {
+ if (mSelectionVector[s] != selectState)
+ {
+ s++; // backup
+ break;
+ }
+ }
+ if (s < 0) s = 0;
+ // find end
+ for ( ; e < static_cast<int>(mLength); e++)
+ {
+ if (mSelectionVector[e] != selectState)
+ {
+ // don't need to backup for end
+ break;
+ }
+ }
+ range.first = s;
+ range.second = e;
+ }
+ return range;
+}
+
+size_t GrUtfTextSrc::getFontFeatures(gr::toffset ich, gr::FeatureSetting * prgfset)
+{
+ return 0;
+}
+
+void GrUtfTextSrc::getColors(gr::toffset ich, int * pclrFore, int * pclrBack)
+{
+ // selections are handled here
+ if (mIsSelected && mSelectionVector[ich])
+ {
+ *pclrFore = mSelectForeground;
+ *pclrBack = mSelectBackground;
+ }
+ else
+ {
+ *pclrFore = mForeground;
+ *pclrBack = mBackground;
+ }
+}
+
+
+// these should be called I hope
+float
+GrUtfTextSrc::getFontSize(gr::toffset ich)
+{
+ assert(mFont);
+ return mPointSize;
+}
+
+bool
+GrUtfTextSrc::getBold(gr::toffset ich)
+{
+ assert(mFont);
+// NS_ASSERTION(false, "unexpected call to getBold");
+// return false;
+ return mFont->bold();
+}
+
+bool
+GrUtfTextSrc::getItalic(gr::toffset ich)
+{
+ assert(mFont);
+ //NS_ASSERTION(false, "unexpected call to getItalic");
+ //return false;
+ return mFont->italic();
+}
+
+gr::isocode GrUtfTextSrc::getLanguage(gr::toffset ich)
+{
+ gr::isocode unknown;
+ std::fill_n(unknown.rgch, 4, '\0');
+ return unknown;
+}
+
diff --git a/Build/source/libs/graphite-engine/test/ProfileHarness/GrUtfTextSrc.h b/Build/source/libs/graphite-engine/test/ProfileHarness/GrUtfTextSrc.h new file mode 100644 index 00000000000..bdcd5fd6caf --- /dev/null +++ b/Build/source/libs/graphite-engine/test/ProfileHarness/GrUtfTextSrc.h @@ -0,0 +1,146 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: NPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Netscape Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is sila.mozdev.org code.
+ *
+ * The Initial Developer of the Original Code is
+ * Keith Stribley.
+ * Portions created by the Initial Developer are Copyright (C) 2004
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the NPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the NPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+#ifdef _MSC_VER
+#pragma once
+#endif
+#ifndef GRUTFTXTSRC_INCLUDED
+#define GRUTFTXTSRC_INCLUDED
+
+#include <vector>
+#include <assert.h>
+
+#include <graphite/GrAppData.h>
+#include <graphite/GrStructs.h>
+#include <graphite/ITextSource.h>
+
+class nsIGrSegWrapper;
+
+/*-----------------------------------------------------------------------------
+ Class: ITextSource
+ This class provides an interface of a text source for the Graphite engine.
+------------------------------------------------------------------------------*/
+class GrUtfTextSrc : public gr::IColorTextSource
+{
+public:
+ GrUtfTextSrc();
+ ~GrUtfTextSrc();
+ bool setText(const gr::utf8 * pszText, int len);
+ bool setText(const char * pszText, int len);
+ bool setText(const gr::utf16 * pszText, int len);
+ bool setText(const gr::utf32 * pszText, int len);
+ void setColors(int foreground, int background)
+ {
+ mForeground = foreground;
+ mBackground = background;
+ };
+ //void setSelectionDetails(nsIGrSegWrapper * wrapper);
+ void setFont(gr::Font * font) { mFont = font; };
+ void setPointSize(float & pointSize) { mPointSize = pointSize; };
+ // --------------------------------------------------------------------------
+ // New V2 interface:
+
+ virtual gr::UtfType utfEncodingForm() { return mType; };
+ virtual size_t getLength() { return mLength; };
+ virtual size_t fetch(gr::toffset ichMin, size_t cch, gr::utf32 * prgchBuffer);
+ virtual size_t fetch(gr::toffset ichMin, size_t cch, gr::utf16 * prgchwBuffer);
+ virtual size_t fetch(gr::toffset ichMin, size_t cch, gr::utf8 * prgchsBuffer);
+ virtual gr::GrResult getFaceName(int ich, unsigned int cchMax,
+ gr::utf16 * prgchFaceName, unsigned int * pcchLen)
+ {
+ prgchFaceName[0] = 0;
+ *pcchLen = 0;
+ return gr::kresNotImpl;
+ };
+ //virtual std::wstring getFaceName(int ich) { return mFont->getFaceName(); };
+ virtual float getFontSize(gr::toffset ich);
+ virtual bool getBold(gr::toffset ich);
+ virtual bool getItalic(gr::toffset ich);
+ virtual bool getRightToLeft(gr::toffset ich);
+ virtual unsigned int getDirectionDepth(gr::toffset ich);
+ virtual float getVerticalOffset(gr::toffset ich) { return 0;};
+ virtual gr::isocode getLanguage(gr::toffset ich);
+
+ virtual std::pair<gr::toffset, gr::toffset> propertyRange(gr::toffset ich);
+ virtual size_t getFontFeatures(gr::toffset ich, gr::FeatureSetting * prgfset);
+ virtual bool sameSegment(gr::toffset ich1, gr::toffset ich2) { return true; };
+
+protected:
+ bool checkBuffer8();
+ bool checkBuffer16();
+ bool checkBuffer32();
+
+private:
+ size_t mLength;
+ size_t mBufferLength8;
+ size_t mBufferLength16;
+ size_t mBufferLength32;
+ gr::utf8 * mData8;
+ gr::utf16 * mData16;
+ gr::utf32 * mData32;
+ gr::UtfType mType;
+ int mForeground;
+ int mBackground;
+ int mSelectForeground;
+ int mSelectBackground;
+ bool mIsSelected;
+ std::wstring mFaceName;
+ std::vector<bool> mSelectionVector;
+ gr::Font * mFont;
+ bool mRtl;
+ float mPointSize;
+
+public: // methods that will go
+ // Temporary--eventually these will be of interest only to SegmentPainter.
+ virtual void getColors(gr::toffset ich, int * pclrFore, int * pclrBack);
+
+ // Shouldn't be here!
+ virtual gr::GrResult Fetch(int ichMin, int ichLim, gr::utf16 * prgchBuf) { return gr::kresNotImpl; };
+ virtual gr::GrResult get_Length(int * pcch) { return gr::kresNotImpl; };
+ virtual gr::GrResult GetFontVariations(int ich,
+ wchar_t * prgchFontVar, int ichMax, int * pich,
+ int * pichMin, int * pichLim) { return gr::kresNotImpl; };
+
+};
+
+
+#if !defined(GR_NAMESPACE)
+using namespace gr;
+#endif
+
+#endif // !GRUTFTXTSRC_INCLUDED
+
diff --git a/Build/source/libs/graphite-engine/test/ProfileHarness/Makefile.am b/Build/source/libs/graphite-engine/test/ProfileHarness/Makefile.am new file mode 100644 index 00000000000..07d07348eff --- /dev/null +++ b/Build/source/libs/graphite-engine/test/ProfileHarness/Makefile.am @@ -0,0 +1,14 @@ +AUTOMAKE_OPTIONS = 1.6 + +noinst_PROGRAMS = profile-graphite + +AM_CPPFLAGS = -I$(top_srcdir)/include + +profile_graphite_LDFLAGS = -L$(top_builddir)/src -lgraphite + +profile_graphite_SOURCES = \ + GrUtfTextSrc.cpp GrUtfTextSrc.h \ + ProfileHarness.cpp + +#dist-hook: +# rm -f grregtest.log tracelog.txt diff --git a/Build/source/libs/graphite-engine/test/ProfileHarness/Makefile.in b/Build/source/libs/graphite-engine/test/ProfileHarness/Makefile.in new file mode 100644 index 00000000000..a9d264683b2 --- /dev/null +++ b/Build/source/libs/graphite-engine/test/ProfileHarness/Makefile.in @@ -0,0 +1,447 @@ +# Makefile.in generated by automake 1.9.6 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = ../.. +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +noinst_PROGRAMS = profile-graphite$(EXEEXT) +subdir = test/ProfileHarness +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_CLEAN_FILES = +PROGRAMS = $(noinst_PROGRAMS) +am_profile_graphite_OBJECTS = GrUtfTextSrc.$(OBJEXT) \ + ProfileHarness.$(OBJEXT) +profile_graphite_OBJECTS = $(am_profile_graphite_OBJECTS) +profile_graphite_LDADD = $(LDADD) +DEFAULT_INCLUDES = -I. -I$(srcdir) +depcomp = $(SHELL) $(top_srcdir)/config/depcomp +am__depfiles_maybe = depfiles +CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) +LTCXXCOMPILE = $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CXXFLAGS) $(CXXFLAGS) +CXXLD = $(CXX) +CXXLINK = $(LIBTOOL) --tag=CXX --mode=link $(CXXLD) $(AM_CXXFLAGS) \ + $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +SOURCES = $(profile_graphite_SOURCES) +DIST_SOURCES = $(profile_graphite_SOURCES) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +F77 = @F77@ +FFLAGS = @FFLAGS@ +GREP = @GREP@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LN_S = @LN_S@ +LSB_RELEASE = @LSB_RELEASE@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ +MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ +MAKEINFO = @MAKEINFO@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +RANLIB = @RANLIB@ +REL_CODENAME = @REL_CODENAME@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SIZEOF_WCHAR_T = @SIZEOF_WCHAR_T@ +STRIP = @STRIP@ +VERSION = @VERSION@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_F77 = @ac_ct_F77@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +AUTOMAKE_OPTIONS = 1.6 +AM_CPPFLAGS = -I$(top_srcdir)/include +profile_graphite_LDFLAGS = -L$(top_builddir)/src -lgraphite +profile_graphite_SOURCES = \ + GrUtfTextSrc.cpp GrUtfTextSrc.h \ + ProfileHarness.cpp + +all: all-am + +.SUFFIXES: +.SUFFIXES: .cpp .lo .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign test/ProfileHarness/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --foreign test/ProfileHarness/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +clean-noinstPROGRAMS: + @list='$(noinst_PROGRAMS)'; for p in $$list; do \ + f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f $$p $$f"; \ + rm -f $$p $$f ; \ + done +profile-graphite$(EXEEXT): $(profile_graphite_OBJECTS) $(profile_graphite_DEPENDENCIES) + @rm -f profile-graphite$(EXEEXT) + $(CXXLINK) $(profile_graphite_LDFLAGS) $(profile_graphite_OBJECTS) $(profile_graphite_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GrUtfTextSrc.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ProfileHarness.Po@am__quote@ + +.cpp.o: +@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $< + +.cpp.obj: +@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.cpp.lo: +@am__fastdepCXX_TRUE@ if $(LTCXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +uninstall-info-am: + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkdir_p) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(PROGRAMS) +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool clean-noinstPROGRAMS \ + mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-libtool distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: + +install-exec-am: + +install-info: install-info-am + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-info-am + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libtool clean-noinstPROGRAMS ctags distclean \ + distclean-compile distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-exec \ + install-exec-am install-info install-info-am install-man \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ + pdf pdf-am ps ps-am tags uninstall uninstall-am \ + uninstall-info-am + + +#dist-hook: +# rm -f grregtest.log tracelog.txt +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/Build/source/libs/graphite-engine/test/ProfileHarness/ProfileHarness.cpp b/Build/source/libs/graphite-engine/test/ProfileHarness/ProfileHarness.cpp new file mode 100644 index 00000000000..bf1f874e9bc --- /dev/null +++ b/Build/source/libs/graphite-engine/test/ProfileHarness/ProfileHarness.cpp @@ -0,0 +1,475 @@ +/*-----------------------------------------------------------------------------
+Copyright (C) 2007 SIL International
+
+Distributable under the terms of either the Common Public License or the
+GNU Lesser General Public License, as specified in the LICENSING.txt file.
+
+File:
+Responsibility: Sharon Correll
+Last reviewed: Not yet.
+
+Description:
+A simple console app that creates a segment using FileFont and dumps a
+diagnostic table of the resulting glyph vector to the console.
+If graphite has been built with -DTRACING then it will also produce a
+diagnostic log of the segment creation in grSegmentLog.txt
+-----------------------------------------------------------------------------*/
+
+//#include <stdlib.h>
+#include <stdio.h>
+#include <assert.h>
+#include <iostream>
+#include <iomanip>
+#include <string>
+#include <sstream>
+
+#include <graphite/GrClient.h>
+#include <graphite/ITextSource.h>
+///#include <graphite/IGrJustifier.h>
+#include <graphite/IGrEngine.h>
+#include <graphite/SegmentAux.h>
+#include <graphite/Font.h>
+#include <graphite/Segment.h>
+#include <graphite/GraphiteProcess.h>
+#include <graphite/FileFont.h>
+
+#include "GrUtfTextSrc.h"
+
+typedef std::pair< gr::GlyphIterator, gr::GlyphIterator > GlyphRange;
+
+#ifndef HAVE_STRTOF
+float strtof(char * text, char ** ignore)
+{
+ return static_cast<float>(atof(text));
+}
+#endif
+
+#ifndef HAVE_STRTOL
+long strtol(char * text, char ** ignore)
+{
+ return atol(text);
+}
+#endif
+
+struct Parameters
+{
+ const char * textFile;
+ const char * fontFile;
+ float pointSize;
+ int dpi;
+ bool lineStart;
+ bool lineEnd;
+ bool useLineFill;
+ bool useCodes;
+ float width;
+ int textArgIndex;
+ gr::utf16 * pText16;
+ gr::utf32 * pText32;
+ size_t charLength;
+ size_t offset;
+};
+
+#ifdef HAVE_ICONV
+void
+convertUtf8ToUtf32(char* pText, Parameters & parameters)
+{
+ int length = strlen(reinterpret_cast<char*>(pText));
+ //gr::utf8 * pText = reinterpret_cast<gr::utf8*>(argv[2]);
+ // convert text to utf32 using iconv because its easier to debug string placements
+ size_t bytesLeft = length;
+ size_t outBytesLeft = (length + 1) * sizeof(gr::utf32);
+ size_t outBufferSize = outBytesLeft;
+ gr::utf32 * text32 = new gr::utf32[length + 1];
+ iconv_t utf8to32 = iconv_open("utf32","utf8");
+ assert(utf8to32 != (iconv_t)(-1));
+ char * pText32 = reinterpret_cast<char*>(&text32[0]);
+ size_t convertLength = iconv(utf8to32, &pText, &bytesLeft, &pText32, &outBytesLeft);
+ if (convertLength == size_t(-1)) perror("iconv failed:");
+ size_t charLength = (outBufferSize - outBytesLeft) / sizeof(gr::utf32);
+ assert(convertLength != size_t(-1));
+ // size_t offset = 0;
+ // offset by 1 to avoid bom
+ if (text32[0] == 0xfeff)
+ {
+ parameters.offset = 1;
+ charLength--;
+ }
+ std::cout << "String has " << charLength << " characters (" << length << " bytes)" << std::endl;
+ size_t ci;
+ for (ci = 0; ci < 10 && ci < charLength; ci++)
+ {
+ std::cout << std::setw(4) << ci << '\t';
+ }
+ std::cout << std::endl;
+ for (ci = 0; ci < charLength; ci++)
+ {
+ std::cout << std::setw(4) << std::hex
+ << text32[ci+parameters.offset] << '\t';
+ if (((ci + 1) % 10) == 0) std::cout << std::endl;
+ }
+ std::cout << std::endl;
+ parameters.charLength = charLength;
+ parameters.pText32 = text32;
+ iconv_close(utf8to32);
+}
+#endif
+
+bool parseArgs(int argc, char *argv[], Parameters & parameters)
+{
+ int mainArgOffset = 0;
+ bool argError = false;
+ char* pText = NULL;
+ typedef enum
+ {
+ NONE,
+ POINT_SIZE,
+ DPI,
+ LINE_START,
+ LINE_END,
+ LINE_FILL,
+ CODES
+ } TestOptions;
+ TestOptions option = NONE;
+ char * pIntEnd = NULL;
+ char * pFloatEnd = NULL;
+ long lTestSize = 0;
+ float fTestSize = 0.0f;
+ for (int a = 1; a < argc; a++)
+ {
+ switch (option)
+ {
+ case DPI:
+ pIntEnd = NULL;
+ lTestSize = strtol(argv[a],&pIntEnd, 10);
+ if (lTestSize > 0 && lTestSize < INT_MAX && lTestSize != LONG_MAX)
+ {
+ parameters.dpi = lTestSize;
+ }
+ else
+ {
+ fprintf(stderr,"Invalid dpi %s\n", argv[a]);
+ }
+ option = NONE;
+ break;
+ case POINT_SIZE:
+ pFloatEnd = NULL;
+ fTestSize = strtof(argv[a],&pFloatEnd);
+ // what is a reasonable maximum here
+ if (fTestSize > 0 && fTestSize < 5000.0f)
+ {
+ parameters.pointSize = fTestSize;
+ }
+ else
+ {
+ fprintf(stderr,"Invalid point size %s\n", argv[a]);
+ argError = true;
+ }
+ option = NONE;
+ break;
+ case LINE_FILL:
+ pFloatEnd = NULL;
+ fTestSize = strtof(argv[a],&pFloatEnd);
+ // what is a good max width?
+ if (fTestSize > 0 && fTestSize < 10000)
+ {
+ parameters.width = fTestSize;
+ }
+ else
+ {
+ fprintf(stderr,"Invalid line width %s\n", argv[a]);
+ argError = true;
+ }
+ option = NONE;
+ break;
+ default:
+ option = NONE;
+ if (argv[a][0] == '-')
+ {
+ if (strcmp(argv[a], "-pt") == 0)
+ {
+ option = POINT_SIZE;
+ }
+ else if (strcmp(argv[a], "-dpi") == 0)
+ {
+ option = DPI;
+ }
+ else if (strcmp(argv[a], "-ls") == 0)
+ {
+ option = NONE;
+ parameters.lineStart = true;
+ }
+ else if (strcmp(argv[a], "-le") == 0)
+ {
+ option = NONE;
+ parameters.lineEnd = true;
+ }
+ else if (strcmp(argv[a], "-linefill") == 0)
+ {
+ option = LINE_FILL;
+ parameters.useLineFill = true;
+ }
+ else if (strcmp(argv[a], "-codes") == 0)
+ {
+ option = NONE;
+ parameters.useCodes = true;
+ // must be less than argc
+ parameters.pText32 = new gr::utf32[argc];
+ printf("\nText codes\n");
+ }
+ else
+ {
+ argError = true;
+ fprintf(stderr,"Unknown option %s\n",argv[a]);
+ }
+ }
+ else if (mainArgOffset == 0)
+ {
+ parameters.textFile = argv[a];
+ mainArgOffset++;
+ }
+ else if (mainArgOffset == 1)
+ {
+ parameters.fontFile = argv[a];
+ mainArgOffset++;
+ }
+ else if (parameters.useCodes)
+ {
+ pIntEnd = NULL;
+ mainArgOffset++;
+ gr::utf32 code = strtol(argv[a],&pIntEnd, 16);
+ if (code > 0)
+ {
+ parameters.pText32[parameters.charLength++] = code;
+ if (parameters.charLength % 10 == 0)
+ printf("%4x\n",code);
+ else
+ printf("%4x\t",code);
+ }
+ else
+ {
+ fprintf(stderr,"Invalid dpi %s\n", argv[a]);
+ }
+ }
+ else if (mainArgOffset == 1)
+ {
+ mainArgOffset++;
+ pText = argv[a];
+ parameters.textArgIndex = a;
+ }
+ else
+ {
+ argError = true;
+ fprintf(stderr,"too many arguments %s\n",argv[a]);
+ }
+ }
+ }
+ if (mainArgOffset < 2) argError = true;
+ else
+ {
+ if (!parameters.useCodes && pText != NULL)
+ {
+#ifdef HAVE_ICONV
+ convertUtf8ToUtf32(pText, parameters);
+#else
+ fprintf(stderr,"Only the -codes option is supported on Win32\r\n");
+ argError = true;
+#endif
+ }
+ else
+ {
+ ///parameters.pText32[parameters.charLength] = 0;
+ printf("\n");
+ }
+ }
+ return (argError) ? false : true;
+}
+
+
+void initParameters(Parameters & parameters)
+{
+ parameters.textFile = "";
+ parameters.fontFile = "";
+ parameters.pointSize = 12.0f;
+ parameters.dpi = 72;
+ parameters.lineStart = false;
+ parameters.lineEnd = false;
+ parameters.useLineFill = false;
+ parameters.useCodes = false;
+ parameters.width = 100.0f;
+ parameters.pText16 = NULL;
+ parameters.pText32 = NULL;
+ parameters.textArgIndex = 0;
+ parameters.charLength = 0;
+ parameters.offset = 0;
+}
+
+
+
+int runGraphite(Parameters parameters)
+{
+ int returnCode = 0;
+ FILE * file = fopen(parameters.fontFile, "rb");
+ gr::FileFont * fileFont = NULL;
+
+ // Put the text into an array of string, each string is one paragraph.
+ std::ifstream textFileStrm(parameters.textFile);
+ std::cout << "FILE: " << parameters.textFile << "\n";
+ std::string stringArray[100];
+ + std::stringbuf buf; + textFileStrm >> &buf; + std::cout << "read " << buf.str().length() << " characters" << std::endl; + std::cout << "====BEGIN===" << buf.str() << "====END====" << std::endl; + const std::string strTemp = buf.str();
+ stringArray[0] = strTemp;
+ int cpara = 1;
+
+ try
+ {
+ if (file)
+ {
+ fileFont = new gr::FileFont(file, parameters.pointSize, parameters.dpi);
+ if (!fileFont || !fileFont->isValid())
+ {
+ fprintf(stderr,"graphitejni:Invalid font!");
+ delete fileFont;
+ fileFont = NULL;
+ return 2;
+ }
+ printf("Font: %s bold=%d italic=%d %4.1fpt dpi %d\n",
+ parameters.fontFile,
+ fileFont->bold(), fileFont->italic(),
+ parameters.pointSize, parameters.dpi);
+ bool isGraphite = fileFont->fontHasGraphiteTables();
+ if (!isGraphite)
+ {
+ fprintf(stderr,"graphitejni: %s does not have graphite tables",
+ parameters.fontFile);
+ delete fileFont;
+ fileFont = NULL;
+ return 3;
+ }
+ }
+ else
+ {
+ fprintf(stderr, "Failed to open %s\n", parameters.fontFile);
+ return 4;
+ }
+
+ for (int ipara = 0; ipara < cpara; ipara++)
+ {
+ GrUtfTextSrc textSrc;
+ gr::LayoutEnvironment layout;
+
+ textSrc.setText(stringArray[ipara].data(), stringArray[ipara].length());
+ textSrc.setPointSize(parameters.pointSize);
+ textSrc.setFont(fileFont);
+
+ layout.setStartOfLine(parameters.lineStart);
+ layout.setEndOfLine(parameters.lineEnd);
+ layout.setDumbFallback(true);
+ layout.setJustifier(NULL);
+
+ gr::Segment * pSegment = NULL;
+ //try
+ //{
+ if (parameters.useLineFill)
+ {
+ pSegment = new gr::LineFillSegment(fileFont, &textSrc, &layout,
+ 0, stringArray[ipara].length(),
+ parameters.width);
+ printf("LineFillSegment overing char %d - %d\nline start=%d line end=%d\n",
+ pSegment->startCharacter(), pSegment->stopCharacter(),
+ parameters.lineStart, parameters.lineEnd);
+ }
+ else
+ {
+ pSegment = new gr::RangeSegment(fileFont, &textSrc, &layout,
+ 0, stringArray[ipara].length());
+ printf("RangeSegment covering char %d - %d\nline start=%d line end=%d\n",
+ pSegment->startCharacter(), pSegment->stopCharacter(),
+ parameters.lineStart, parameters.lineEnd);
+ }
+ //}
+ //catch (...)
+ //{
+ // printf("Exception occurred while creating segment\n");
+ // returnCode = 5;
+ // throw;
+ //}
+
+ if (!pSegment) return returnCode;
+
+ // for justifier testing
+ /*
+ gr::GrJustifier justifier;
+ pSegment->SetJustifier(&justifier);
+ gr::Segment * justified = gr::Segment::JustifiedSegment(*pSegment, 2.0f * advanceWidth);
+ delete justified;
+ */
+
+ delete pSegment;
+ }
+ }
+ catch (...)
+ {
+ printf("Exception occurred\n");
+ returnCode = 5;
+ }
+
+ delete fileFont;
+
+ return returnCode;
+}
+
+#ifdef WIN32
+
+int _tmain(int argc, _TCHAR* argv[])
+{
+ Parameters parameters;
+ initParameters(parameters);
+
+ if (!parseArgs(argc, argv, parameters))
+ {
+ fprintf(stderr,"Usage: %s [options] textfile fontfile \n",argv[0]);
+ return 1;
+ }
+ // UTF16 arguments
+ //if (parameters.textArgIndex > 0)
+ //{
+ // parameters.pText16 = reinterpret_cast<wchar_t*>(argv[parameters.textArgIndex]);
+ // std::wstring text(parameters.pText16);
+ // parameters.charLength = text.size();
+ // for (int i = 0; i < text.size(); i++)
+ // {
+ // if (i % 10 == 0)
+ // printf("\r\n%4x", text[i]);
+ // else
+ // printf("\t%4x", text[i]);
+ // }
+ //}
+ //else
+ //{
+ // assert(parameters.pText32);
+ //}
+
+ return runGraphite(parameters);
+}
+
+#else
+
+int main(int argc, char *argv[])
+{
+
+ Parameters parameters;
+ initParameters(parameters);
+
+ if (!parseArgs(argc, argv, parameters))
+ {
+ fprintf(stderr,"Usage: %s [options] textfile fontfile \n",argv[0]);
+ return 1;
+ }
+ return runGraphite(parameters);
+}
+
+#endif
diff --git a/Build/source/libs/graphite-engine/test/ProfileHarness/makefile.vc b/Build/source/libs/graphite-engine/test/ProfileHarness/makefile.vc new file mode 100644 index 00000000000..dadff7cd363 --- /dev/null +++ b/Build/source/libs/graphite-engine/test/ProfileHarness/makefile.vc @@ -0,0 +1,111 @@ +!IF "$(OS)" == "Windows_NT"
+NULL=
+!ELSE
+NULL=nul
+!ENDIF
+
+!IF "$(CFG)" == ""
+CFG=DEBUG
+!ENDIF
+
+!IF "$(CFG)" == "RELEASE"
+
+OUTDIR=.\release
+INTDIR=.\release_temp
+
+all : "$(OUTDIR)\ProfileHarness.exe"
+
+clean :
+ @- rd /s/q .\release_temp
+
+realclean : clean
+ @- rd /s/q .\release
+
+CPP_PROJ=/nologo /MT /W3 /GR /GX /O2 /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /c
+LINK32_FLAGS=kernel32.lib user32.lib advapi32.lib shell32.lib uuid.lib graphite.lib /nologo /subsystem:console /incremental:no /machine:I386 /out:"$(OUTDIR)\ProfileHarness.exe" /libpath:"..\..\release"
+BSC32_FLAGS=/nologo /o"$(OUTDIR)\ProfileHarness.bsc"
+
+!ELSEIF "$(CFG)" == "DEBUG"
+
+OUTDIR=.\debug
+INTDIR=.\debug_temp
+
+all : "$(OUTDIR)\ProfileHarness.exe" "$(OUTDIR)\ProfileHarness.bsc"
+
+clean :
+ @- rd /s/q .\debug_temp
+
+realclean : clean
+ @- rd /s/q .\debug
+
+CPP_PROJ=/nologo /MTd /W3 /Gm /GR /GX /GZ /ZI /Od /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FR"$(INTDIR)\\" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /c
+LINK32_FLAGS=kernel32.lib user32.lib advapi32.lib shell32.lib uuid.lib graphite.lib /nologo /subsystem:console /incremental:yes /pdb:"$(OUTDIR)\ProfileHarness.pdb" /debug /machine:I386 /out:"$(OUTDIR)\ProfileHarness.exe" /libpath:"..\..\debug"
+BSC32_FLAGS=/nologo /o"$(OUTDIR)\ProfileHarness.bsc"
+
+!ENDIF
+
+"$(OUTDIR)" :
+ if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
+
+"$(INTDIR)" :
+ if not exist "$(INTDIR)/$(NULL)" mkdir "$(INTDIR)"
+
+.cpp{$(INTDIR)}.obj::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+.cpp{$(INTDIR)}.sbr::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+{$(APPLIB)}.cpp{$(INTDIR)}.obj::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+{$(APPLIB)}.cpp{$(INTDIR)}.sbr::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+{$(TEXTSRCDIR)}.cpp{$(INTDIR)}.obj::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+{$(TEXTSRCDIR)}.cpp{$(INTDIR)}.sbr::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+
+CPP=cl.exe
+RSC=rc.exe
+BSC32=bscmake.exe
+LINK32=link.exe
+
+LINK32_OBJS= \
+ "$(INTDIR)\ProfileHarness.obj" \
+ "$(INTDIR)\GrUtfTextSrc.obj" \
+
+"$(OUTDIR)\ProfileHarness.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
+ $(LINK32) @<<
+ $(LINK32_FLAGS) $(LINK32_OBJS)
+<<
+
+BSC32_SBRS= \
+ "$(INTDIR)\ProfileHarness.sbr" \
+ "$(INTDIR)\GrUtfTextSrc.sbr"
+
+"$(OUTDIR)\ProfileHarness.bsc" : "$(OUTDIR)" $(BSC32_SBRS)
+ $(BSC32) @<<
+ $(BSC32_FLAGS) $(BSC32_SBRS)
+<<
+
+
+"$(INTDIR)\ProfileHarness.obj" "$(INTDIR)\ProfileHarness.sbr" : ".\ProfileHarness.cpp" "$(INTDIR)"
+"$(INTDIR)\GrTxtSrc.obj" "$(INTDIR)\GrUtfTextSrc.sbr" : ".\GrUtfTextSrc.cpp" "$(INTDIR)"
+
+
diff --git a/Build/source/libs/graphite-engine/test/RegressionTest/Makefile.am b/Build/source/libs/graphite-engine/test/RegressionTest/Makefile.am index 4d5c989e451..fe59b65fbaa 100644 --- a/Build/source/libs/graphite-engine/test/RegressionTest/Makefile.am +++ b/Build/source/libs/graphite-engine/test/RegressionTest/Makefile.am @@ -5,10 +5,15 @@ EXTRA_DIST = \ romanText.wpx \ xlineText.wpx \ grtest_arabic.ttf \ + grtest_badVersion.ttf \ + grtest_badCmap.ttf \ grtest_burmese.ttf \ grtest_roman.ttf \ - grtest_xline.ttf xline.gdl \ - Makefile.vc makedebug.bat \ + grtest_taiviet.ttf \ + grtest_xline.ttf \ + xline.gdl \ + Makefile.vc \ + makedebug.bat \ readme.txt noinst_PROGRAMS = regression-test diff --git a/Build/source/libs/graphite-engine/test/RegressionTest/Makefile.in b/Build/source/libs/graphite-engine/test/RegressionTest/Makefile.in index 0bd860db975..547e7dfa408 100644 --- a/Build/source/libs/graphite-engine/test/RegressionTest/Makefile.in +++ b/Build/source/libs/graphite-engine/test/RegressionTest/Makefile.in @@ -130,6 +130,7 @@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ REL_CODENAME = @REL_CODENAME@ +SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ SIZEOF_WCHAR_T = @SIZEOF_WCHAR_T@ @@ -188,10 +189,14 @@ EXTRA_DIST = \ romanText.wpx \ xlineText.wpx \ grtest_arabic.ttf \ + grtest_badVersion.ttf \ + grtest_badCmap.ttf \ grtest_burmese.ttf \ grtest_roman.ttf \ - grtest_xline.ttf xline.gdl \ - Makefile.vc makedebug.bat \ + grtest_xline.ttf \ + xline.gdl \ + Makefile.vc \ + makedebug.bat \ readme.txt AM_CPPFLAGS = -I$(top_srcdir)/include/graphite diff --git a/Build/source/libs/graphite-engine/test/RegressionTest/RegressionTest.cpp b/Build/source/libs/graphite-engine/test/RegressionTest/RegressionTest.cpp index 187437d7f3e..33c95da5683 100644 --- a/Build/source/libs/graphite-engine/test/RegressionTest/RegressionTest.cpp +++ b/Build/source/libs/graphite-engine/test/RegressionTest/RegressionTest.cpp @@ -13,12 +13,14 @@ Description: -------------------------------------------------------------------------------*//*:End Ignore*/
#include "main.h"
+#include "MemoryUsage.h"
//:>********************************************************************************************
//:> Global variables
//:>********************************************************************************************
std::ofstream g_strmLog; // log file output stream
std::ofstream g_strmTrace; // debugger trace for selected tests
+std::ofstream g_strmMemUsage;
int g_errorCount;
@@ -29,6 +31,9 @@ bool g_silentMode = false; int g_itcaseStart = 0; // adjust to skip to a certain test
+SegmentMemoryUsage g_smu;
+FontMemoryUsage g_fmu;
+
std::string g_fontPath = ".";
#ifdef _WIN32
#define PATH_SEP "\\"
@@ -119,6 +124,11 @@ int main(int argc, char* argv[]) // ::ReleaseDC(NULL, g_hdc);
+ // Output segment memory usage information.
+ //g_strmMemUsage.open("SegMemoryUsage.log");
+ //g_smu.prettyPrint(g_strmMemUsage);
+ //g_strmMemUsage.close();
+
return g_errorCount;
}
@@ -161,12 +171,22 @@ void RunTests(int numberOfTests, TestCase * ptcaseList) Run a single test case.
----------------------------------------------------------------------------------------------*/
int RunOneTestCase(TestCase * ptcase, Segment * psegPrev, Segment ** ppsegRet, RtTextSrc ** pptsrcRet)
-{
+{ +#ifdef _WIN32
+ if (ptcase->Skip())
+ {
+ std::cout << "\nskipped\n";
+ g_strmLog << "skipping\n";
+ *ppsegRet = NULL;
+ return 0;
+ }
+
// Break into the debugger if requested.
- //if (ptcase->RunDebugger() && ::IsDebuggerPresent())
- //{
- // ::DebugBreak();
- //}
+ if (ptcase->RunDebugger() && ::IsDebuggerPresent())
+ {
+ ::DebugBreak();
+ } +#endif
int errorCount = 0;
@@ -209,7 +229,7 @@ int RunOneTestCase(TestCase * ptcase, Segment * psegPrev, Segment ** ppsegRet, R // Generate a segment.
LayoutEnvironment layout;
- layout.setDumbFallback(true);
+ layout.setDumbFallback(ptcase->DumbFallback());
layout.setStartOfLine(true);
layout.setRightToLeft(ptcase->ParaRtl());
if (ptcase->InitWithPrevSeg())
@@ -241,9 +261,21 @@ int RunOneTestCase(TestCase * ptcase, Segment * psegPrev, Segment ** ppsegRet, R }
catch (...)
{
- OutputError(ptcase, "ERROR: generating segment; remaining tests skipped");
+ if (!ptcase->NoSegment())
+ {
+ if (ptcase->BadFont() && !ptcase->DumbFallback())
+ // Weird situation.
+ OutputError(ptcase, "ERROR: bad font with no fallback, yet a segment was expected???");
+ else
+ OutputError(ptcase, "ERROR: generating segment; remaining tests skipped");
+ errorCount++;
+ }
+ // else segment creation failed as expected
+
+ // NB: failure to create a segment due to throwing an exception seems to result in a memory
+ // leak--the FontCache object FontFace::s_pFontCache does not get deleted.
+
*ppsegRet = NULL;
- errorCount++;
return WriteLog(errorCount);
}
@@ -253,7 +285,7 @@ int RunOneTestCase(TestCase * ptcase, Segment * psegPrev, Segment ** ppsegRet, R g_strmTrace.close();
}
- if ((*ppsegRet)->segmentTermination() == kestNothingFit)
+ if ((*ppsegRet) && (*ppsegRet)->segmentTermination() == kestNothingFit)
{
delete *ppsegRet;
*ppsegRet = NULL;
@@ -279,6 +311,14 @@ int RunOneTestCase(TestCase * ptcase, Segment * psegPrev, Segment ** ppsegRet, R Segment * pseg = *ppsegRet;
+ pseg->calculateMemoryUsage(g_smu);
+
+ // Calculate and output font memory usage.
+ //g_fmu = Font::calculateMemoryUsage();
+ //g_strmMemUsage.open("fontMemoryUsage.log");
+ //g_fmu.prettyPrint(g_strmMemUsage);
+ //g_strmMemUsage.close();
+
// Test results.
int segMin = pseg->startCharacter();
int segLim = pseg->stopCharacter();
@@ -336,6 +376,34 @@ int RunOneTestCase(TestCase * ptcase, Segment * psegPrev, Segment ** ppsegRet, R int((*gitThis).advanceWidth()), ptcase->AdvWidth(iglyph));
errorCount++;
}
+ if (ptcase->BbTests())
+ {
+ gr::Rect rectBb = (*gitThis).bb();
+ if (int(rectBb.left) != ptcase->BbLeft(iglyph))
+ {
+ OutputErrorWithValues(ptcase, "ERROR: bb left ", iglyph,
+ int(rectBb.left), ptcase->BbLeft(iglyph));
+ errorCount++;
+ }
+ if (int(rectBb.right) != ptcase->BbRight(iglyph))
+ {
+ OutputErrorWithValues(ptcase, "ERROR: bb right ", iglyph,
+ int(rectBb.right), ptcase->BbRight(iglyph));
+ errorCount++;
+ }
+ if (int(rectBb.top) != ptcase->BbTop(iglyph))
+ {
+ OutputErrorWithValues(ptcase, "ERROR: bb top ", iglyph,
+ int(rectBb.top), ptcase->BbTop(iglyph));
+ errorCount++;
+ }
+ if (int(rectBb.bottom) != ptcase->BbBottom(iglyph))
+ {
+ OutputErrorWithValues(ptcase, "ERROR: bb bottom ", iglyph,
+ int(rectBb.bottom), ptcase->BbBottom(iglyph));
+ errorCount++;
+ }
+ }
}
}
@@ -356,9 +424,91 @@ int RunOneTestCase(TestCase * ptcase, Segment * psegPrev, Segment ** ppsegRet, R }
}
+ int c2gi = 0;
+ while (c2gi < ptcase->CharToGlyphCount())
+ {
+ int ichar = ptcase->CharToGlyphItem(c2gi++);
+ int glyphCount = ptcase->CharToGlyphItem(c2gi++);
+ std::pair<gr::GlyphSetIterator, gr::GlyphSetIterator> glyphSet = pseg->charToGlyphs(ichar);
+ gr::GlyphSetIterator gitStart = glyphSet.first;
+ gr::GlyphSetIterator gitStop = glyphSet.second;
+ if ((gitStop - gitStart) != glyphCount)
+ {
+ OutputErrorWithValues(ptcase, "ERROR: number of glyphs for char ", ichar,
+ gitStop - gitStart, glyphCount);
+ errorCount++;
+ c2gi += glyphCount;
+ }
+ else
+ {
+ GlyphSetIterator glyphLp = glyphSet.first;
+ for (int ig = 0; ig < glyphCount; ig++)
+ {
+ if (static_cast<int>((*glyphLp).logicalIndex()) != ptcase->CharToGlyphItem(c2gi))
+ {
+ OutputErrorWithValues(ptcase, "ERROR: glyph for char ", ichar,
+ (*glyphLp).logicalIndex(), ptcase->CharToGlyphItem(c2gi));
+ errorCount++;
+ }
+ c2gi++;
+ glyphLp++;
+ }
+ }
+ }
+
+ int att = 0;
+ while (att < ptcase->AttachedGlyphCount())
+ {
+ int iglyph = ptcase->AttachedGlyphItem(att++);
+ if (iglyph > cGlyphs)
+ {
+ OutputError(ptcase, "ERROR: non-existent glyph in attachment test ", iglyph);
+ errorCount++;
+ att++;
+ att += ptcase->AttachedGlyphItem(att) + 1;
+ continue;
+ }
+
+ GlyphIterator gitThis = gitBegin + iglyph;
+ GlyphIterator gitBase = gitThis->attachedClusterBase();
+ int ibase = gitBase->logicalIndex();
+ if (ibase != ptcase->AttachedGlyphItem(att))
+ {
+ OutputErrorWithValues(ptcase, "ERROR: attachment base for glyph ", iglyph,
+ ibase, ptcase->AttachedGlyphItem(att));
+ errorCount++;
+ }
+ att++;
+ std::pair<gr::GlyphSetIterator, gr::GlyphSetIterator> glyphSet = gitThis->attachedClusterGlyphs();
+ gr::GlyphSetIterator gitStart = glyphSet.first;
+ gr::GlyphSetIterator gitStop = glyphSet.second;
+ int glyphCount = ptcase->AttachedGlyphItem(att++);
+ if ((gitStop - gitStart) != glyphCount)
+ {
+ OutputErrorWithValues(ptcase, "ERROR: number of attachments for glyph ", iglyph,
+ gitStop - gitStart, glyphCount);
+ errorCount++;
+ att += glyphCount;
+ }
+ else
+ {
+ GlyphSetIterator glyphLp = glyphSet.first;
+ for (int ig = 0; ig < glyphCount; ig++)
+ {
+ if (static_cast<int>((*glyphLp).logicalIndex()) != ptcase->AttachedGlyphItem(att))
+ {
+ OutputErrorWithValues(ptcase, "ERROR: attachment for glyph ", iglyph,
+ (*glyphLp).logicalIndex(), ptcase->AttachedGlyphItem(att));
+ errorCount++;
+ }
+ att++;
+ glyphLp++;
+ }
+ }
+ }
+
for (int iclicktest = 0; iclicktest < ptcase->NumberOfClickTests(); iclicktest++)
{
-// POINT ptClick;
gr::Point ptClick;
ptClick.x = static_cast<float>(ptcase->XClick(iclicktest));
ptClick.y = static_cast<float>(ptcase->YClick(iclicktest));
diff --git a/Build/source/libs/graphite-engine/test/RegressionTest/TestCase.cpp b/Build/source/libs/graphite-engine/test/RegressionTest/TestCase.cpp index a0068672bb5..080d2f92dcd 100644 --- a/Build/source/libs/graphite-engine/test/RegressionTest/TestCase.cpp +++ b/Build/source/libs/graphite-engine/test/RegressionTest/TestCase.cpp @@ -19,7 +19,7 @@ How to add a test: and data.
Things that still need testing:
- Ligatures
+ Ligatures (there is one small test of this)
Justification
Fake italic
-------------------------------------------------------------------------------*//*:End Ignore*/
@@ -30,7 +30,7 @@ Things that still need testing: //:> Test constants and methods
//:>********************************************************************************************
-const int g_numberOfTests = 17; // *** increment as tests are added ***
+const int g_numberOfTests = 23; // *** increment as tests are added ***
TestCase * g_ptcaseList; // list of test cases
@@ -45,27 +45,36 @@ typedef unsigned char byte; int TestCase::SetupTests(TestCase ** pptcaseList)
{
g_ptcaseList = new TestCase[g_numberOfTests];
+ int cptcase = 0;
// The number of methods called here should equal g_numberOfTests above.
- g_ptcaseList[0].SetupSimpleTest();
- g_ptcaseList[1].SetupSimpleBacktrackTest();
- g_ptcaseList[2].SetupBurmese1();
- g_ptcaseList[3].SetupBurmese2();
- g_ptcaseList[4].SetupBurmese3();
- g_ptcaseList[5].SetupBurmese4();
- g_ptcaseList[6].SetupRoman();
- g_ptcaseList[7].SetupRomanFeatures();
- g_ptcaseList[8].SetupNoWhiteSpace();
- g_ptcaseList[9].SetupNoWhiteSpaceFailure();
- g_ptcaseList[10].SetupOnlyWhiteSpace();
- g_ptcaseList[11].SetupCrossLine1();
- g_ptcaseList[12].SetupCrossLine2();
- g_ptcaseList[13].SetupCrossLine3();
- g_ptcaseList[14].SetupCrossLine4();
- g_ptcaseList[15].SetupArabic1();
- g_ptcaseList[16].SetupArabic2();
+ g_ptcaseList[0].SetupSimpleTest(); cptcase++;
+ g_ptcaseList[1].SetupSimpleBacktrackTest(); cptcase++;
+ g_ptcaseList[2].SetupBurmese1(); cptcase++;
+ g_ptcaseList[3].SetupBurmese2(); cptcase++;
+ g_ptcaseList[4].SetupBurmese3(); cptcase++;
+ g_ptcaseList[5].SetupBurmese4(); cptcase++;
+ g_ptcaseList[6].SetupRoman(); cptcase++;
+ g_ptcaseList[7].SetupRomanFeatures(); cptcase++;
+ g_ptcaseList[8].SetupStackingAndBridging(); cptcase++;
+ g_ptcaseList[9].SetupNoWhiteSpace(); cptcase++;
+ g_ptcaseList[10].SetupNoWhiteSpaceNoSeg(); cptcase++;
+ g_ptcaseList[11].SetupOnlyWhiteSpace(); cptcase++;
+ g_ptcaseList[12].SetupCrossLine1(); cptcase++;
+ g_ptcaseList[13].SetupCrossLine2(); cptcase++;
+ g_ptcaseList[14].SetupCrossLine3(); cptcase++;
+ g_ptcaseList[15].SetupCrossLine4(); cptcase++;
+ g_ptcaseList[16].SetupArabic1(); cptcase++;
+ g_ptcaseList[17].SetupArabic2(); cptcase++;
+ g_ptcaseList[18].SetupTaiViet1(); cptcase++;
+ g_ptcaseList[19].SetupTaiViet2(); cptcase++;
+ g_ptcaseList[20].SetupDumbFallback1(); cptcase++;
+ g_ptcaseList[21].SetupDumbFallback2(); cptcase++;
+ g_ptcaseList[22].SetupBadFont(); cptcase++;
// *** Add more method calls here. ***
+ assert(cptcase == g_numberOfTests);
+
*pptcaseList = g_ptcaseList;
return g_numberOfTests;
@@ -77,8 +86,9 @@ int TestCase::SetupTests(TestCase ** pptcaseList) void TestCase::SetupSimpleTest()
{
m_testName = "Simple";
- m_debug = false;
- m_traceLog = false;
+ //m_debug = true;
+ //m_traceLog = false;
+ //m_skip = true;
// Input:
m_fontName = L"Graphite Test Roman";
@@ -106,20 +116,31 @@ void TestCase::SetupSimpleTest() const int glyphCnt = 15; // number of glyphs in the segment
// need glyphCnt elements in these arrays:
- gid16 glyphList[] = {55, 77, 78, 90, 3, 78, 90, 3, 68, 3, 91, 73, 90, 91, 17};
+ gid16 glyphList[] = {55, 75, 76, 86, 3, 76, 86, 3, 68, 3, 87, 72, 86, 87, 17};
int xPositions[] = { 0, 9, 17, 22, 28, 33, 37, 43, 48, 55, 60, 64, 71, 77, 82};
int yPositions[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
int advWidths[] = { 9, 8, 4, 6, 4, 4, 6, 4, 7, 4, 4, 7, 6, 4, 4};
+ int bbLefts[] = { 0, 9, 18, 22, 28, 33, 38, 43, 48, 55, 60, 65, 72, 78, 83};
+ int bbRights[] = { 9, 17, 21, 27, 33, 37, 43, 48, 55, 60, 64, 71, 77, 82, 85};
+ int bbTops[] = {10, 11, 10, 7, 0, 10, 7, 0, 7, 0, 9, 7, 7, 9, 1};
+ int bbBottoms[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
+
+ int charsToGlyphs[] = {
+ 1, 1, 1, 2, 1, 2, 3, 1, 3, 4, 1, 4, 5, 1, 5, 6, 1, 6, 7, 1, 7
+ };
+ int c2gCount = 21;
+
// Each line in clickStuff represents one click test with the following items:
// click x-coord, click y-coord, char index, assoc-prev,
// prim sel Top, prim sel bottom, prim sel left,
- // sec sel Top, sec sel bottom, sec sel left,
+ // sec sel Top, sec sel bottom, sec sel left
+ // Y-coordinates are offsets from segment top; ie, (0,0) is segment top-left.
const int clickTestCnt = 3;
int clickStuff[] = {
- 11, 25, 1, false, 0, 24, 8, kAbsent, kAbsent, kAbsent,
- 42, 5, 7, true, 0, 24, 42, kAbsent, kAbsent, kAbsent,
- 90, 40, 15, true, 0, 24, 85, kAbsent, kAbsent, kAbsent
+ 11, 25, 1, false, 0, 24, 8, kAbsent, kAbsent, kAbsent, // below baseline
+ 42, 5, 7, true, 0, 24, 42, kAbsent, kAbsent, kAbsent, // near top of text
+ 90, 16, 15, true, 0, 24, 85, kAbsent, kAbsent, kAbsent // near baseline
};
// Finish setting up test case.
@@ -129,7 +150,9 @@ void TestCase::SetupSimpleTest() SetXPositions(xPositions);
SetYPositions(yPositions);
SetAdvWidths(advWidths);
+ SetBBs(bbLefts, bbRights, bbTops, bbBottoms);
SetInsPtFlags(insPtFlags);
+ SetCharsToGlyphs(charsToGlyphs, c2gCount);
SetClickTests(clickTestCnt, clickStuff);
}
@@ -139,6 +162,7 @@ void TestCase::SetupSimpleTest() void TestCase::SetupSimpleBacktrackTest()
{
m_testName = "Simple Backtrack";
+ //m_skip = true;
// Input:
m_fontName = L"Graphite Test Roman";
@@ -165,7 +189,7 @@ void TestCase::SetupSimpleBacktrackTest() const int glyphCnt = 10; // number of glyphs in the segment
// need glyphCnt elements in these arrays:
- gid16 glyphList[] = {55, 77, 78, 90, 3, 78, 90, 3, 68, 3};
+ gid16 glyphList[] = {55, 75, 76, 86, 3, 76, 86, 3, 68, 3};
int xPositions[] = { 0, 9, 17, 22, 28, 33, 37, 43, 48, 55};
int yPositions[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
int advWidths[] = { 9, 8, 4, 6, 4, 4, 6, 4, 7, 4};
@@ -180,6 +204,7 @@ void TestCase::SetupSimpleBacktrackTest() SetXPositions(xPositions);
SetYPositions(yPositions);
SetAdvWidths(advWidths);
+ SetBBs(NULL, NULL, NULL, NULL);
SetInsPtFlags(insPtFlags);
SetOutputContextBlock(contextBlockOutSize, contextBlockOut);
}
@@ -192,7 +217,8 @@ void TestCase::SetupBurmese1() {
m_testName = "Burmese 1";
m_debug = false;
- m_traceLog = false;
+ //m_traceLog = true;
+ //m_skip = true;
// Input:
m_fontName = L"Graphite Test Burmese";
@@ -213,6 +239,16 @@ void TestCase::SetupBurmese1() 45, // glyph count
5); // number of click-tests
+ // Each group = glyph-index, base, number of attached, glyphs, attached-glyph-indices
+ int attachments[] = {
+ 0,0,0, 1,1,0, 2,2,2,3,4, 3,2,0, 4,2,0, 5,5,1,6, 6,5,0, 7,7,3,8,9,10,
+ 8,7,0, 9,7,0, 10,7,0, 11,11,0, 12,12,0, 13,13,0, 14,14,0, 15,15,0,
+ 16,16,1,17, 17,16,0, 18,18,1,19, 19,18,0, 20,20,1,21, 21,20,0, 22,22,1,23,
+ 23,22,0, 24,24,0, 25,25,0
+ };
+ int attCount = sizeof(attachments) / sizeof(int);
+ SetAttachedClusters(attachments, attCount);
+
const int contextBlockOutSize = 11;
gr::byte contextBlockOut[] = { 20, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
SetOutputContextBlock(contextBlockOutSize, contextBlockOut);
@@ -221,6 +257,9 @@ void TestCase::SetupBurmese1() void TestCase::SetupBurmese2()
{
m_testName = "Burmese 2";
+ //m_debug = true;
+ //m_traceLog = true;
+ //m_skip = true;
// Input:
m_fontName = L"Graphite Test Burmese";
@@ -251,6 +290,8 @@ void TestCase::SetupBurmese3() {
m_testName = "Burmese 3";
//m_debug = true;
+ //m_traceLog = true;
+ //m_skip = true;
// Input:
m_fontName = L"Graphite Test Burmese";
@@ -282,6 +323,7 @@ void TestCase::SetupBurmese4() m_testName = "Burmese 4";
//m_traceLog = true;
//m_debug = true;
+ //m_skip = true;
// Input:
m_fontName = L"Graphite Test Burmese";
@@ -328,10 +370,23 @@ void TestCase::SetupBurmeseAux(int charCnt, int glyphCnt, int clickTestCnt) int yPositions[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
int advWidths[] = { 17, 2, 9, 4, 0, 10, 0, 17, 2, 0, 0, 15, 6, 10, 10, 2, 7, 0, 10, 9, 9, 0, 10, 7, 2, 6, 17, 7, 17, 7, 6, 10, 6, 10, 2, 10, 7, 10, 7, 9, 4, 9, 0, 0, 6};
+ int bbLefts[] = { 0, 10, 21, 23, 23, 30, 33, 41, 51, 49, 53, 58, 73, 80, 90, 96,100,103,111,109,121,123,131,132,141,143,150,165,175,189,198,206,215,223,233,235,243,253,254,263,265,272,275,275,281};
+ int bbRights[] = { 16, 19, 28, 25, 28, 39, 38, 56, 54, 55, 56, 72, 79, 88, 98,101,109,109,119,119,129,129,139,138,142,149,166,173,190,197,205,214,222,231,244,244,251,261,260,271,267,280,280,278,288};
+ int bbTops[] = { 7, 7, 7, -1, 15, 7, 15, 7, -1, 15, -2, 15, 0, 7, 7, 7, 7, 15, 7, -1, 7, 15, 7, -1, 7, 0, 7, 7, 7, 7, 0, 7, 0, 7, 16, 7, 7, 7, -1, 7, -1, 7, 15, -2, 0};
+ int bbBottoms[] = { 0, -7, -1, -7, 9, 0, 9, 0, -7, 9, -5, 0, 0, 0, 0, -7, 0, 9, -4, -7, 0, 9, 0, -7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -7, 0, 0, 0, -7, -1, -7, 0, 9, -5, 0};
+
+ // Each group = char-index, number of glyphs, glyph-indices.
+ int charsToGlyphs[] = {
+ 0, 1, 0, 1, 1, 1, 2, 1, 1, 3, 1, 1, 4, 1, 1, 5, 1, 2, 6, 1, 3, 7, 1, 3,
+ 8, 1, 4, 9, 1, 4, 10, 1, 5, 11, 1, 6, 12, 1, 6, 13, 1, 7
+ };
+ int c2gCount = sizeof(charsToGlyphs) / sizeof(int);
+
// Each line in clickStuff represents one click test with the following items:
// click x-coord, click y-coord, char index, assoc-prev,
// prim sel Top, prim sel bottom, prim sel left,
- // sec sel Top, sec sel bottom, sec sel left,
+ // sec sel Top, sec sel bottom, sec sel left
+ // Y-coordinates are offsets from segment top; ie, (0,0) is segment top-left.
int clickStuff[] = {
10, 25, 1, true, 0, 25, 16, kAbsent, kAbsent, kAbsent,
40, 5, 13, false, 0, 25, 39, kAbsent, kAbsent, kAbsent,
@@ -347,6 +402,8 @@ void TestCase::SetupBurmeseAux(int charCnt, int glyphCnt, int clickTestCnt) SetXPositions(xPositions);
SetYPositions(yPositions);
SetAdvWidths(advWidths);
+ SetCharsToGlyphs(charsToGlyphs, c2gCount);
+ SetBBs(bbLefts, bbRights, bbTops, bbBottoms);
SetInsPtFlags(insPtFlags);
SetClickTests(clickTestCnt, clickStuff);
}
@@ -380,6 +437,7 @@ void TestCase::SetupRoman() m_testName = "Roman";
//m_traceLog = true;
//m_debug = true;
+ //m_skip = true;
// Input:
m_fontName = L"Graphite Test Roman";
@@ -394,35 +452,47 @@ void TestCase::SetupRoman() m_backtrack = false;
// Output:
- m_segWidth = 236; // physical width of segment
+ m_segWidth = 278; // physical width of segment
- const int charCnt = 23; // number of characters in the segment
+ const int charCnt = 26; // number of characters in the segment
// need charCnt elements in this array:
bool insPtFlags[] = {
- true, false, false, true, true, true, true, false, false, true,
- true, true, false, false, true, false, true, false, true, false,
- false, false, false
+ true, true, true, true, true, true, true, true, true, true,
+ true, true, true, true, true, true, true, true, true, true,
+ true, true, true, true, true, true
};
- const int glyphCnt = 21; // number of glyphs in the segment
+ const int glyphCnt = 24; // number of glyphs in the segment
// need glyphCnt elements in these arrays:
- // 0 10 20
- gid16 glyphList[] = {73,752,749, 87,833, 90, 75,2181,296, 68,751,750, 79,752, 44,752, 84,806,749,759,753};
- int xPositions[] = { 0, 23, 23, 21, 41, 45, 64, 88,116,148,170,170,169,188,183,203,199,229,229,229,229};
- int yPositions[] = { 0, 0, 10, 0, -6, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 10, 0, 0, 0, 10, 20};
- int advWidths[] = {21, 0, 0, 24, 0, 18, 24, 28, 31, 21, 0, 0, 13, 0, 15, 0, 37, 0, 0, 0, 0};
+ // 0 10 20
+ gid16 glyphList[] = {72,1815,1768, 83,1789, 86, 74,1943,1956,1926,1061, 68,1777,1755,805,1815, 44,1815, 80,1833,1768,1855,1838,637};
+ int xPositions[] = { 0, 23, 23, 21, 41, 45, 64, 88, 98, 112, 116,148, 171, 171,170, 188,183, 203, 199, 230, 230, 230, 230,236};
+ int yPositions[] = { 0, 0, 10, 0, -6, 0, 0, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 10, 0, 0, 0, 10, 20, 0};
+ int advWidths[] = {21, 0, 0, 24, 0, 18, 24, 13, 13, 4, 31, 21, 0, 0, 13, 0, 15, 0, 37, 0, 0, 0, 0, 41};
+
+ // Each group = glyph-index, base, number of attached, glyphs, attached-glyph-indices
+ int attachments[] = {
+ 0,0,2,1,2, 1,0,0, 2,0,0, 3,3,0, 4,4,0, 5,5,0, 6,6,0, 7,7,2,8,9,
+ 8,7,0, 9,7,0, 10,10,0, 11,11,2,12,13, 12,11,0, 13,11,0, 14,14,1,15, 15,14,0,
+ 16,16,1,17, 17,16,0, 18,18,4,19,20,21,22, 19,18,0, 20,18,0, 21,18,0, 22,18,0,
+ 23,23,0
+ };
+ int attCount = sizeof(attachments) / sizeof(int);
// Each line in clickStuff represents one click test with the following items:
// click x-coord, click y-coord, char index, assoc-prev,
// prim sel Top, prim sel bottom, prim sel left,
- // sec sel Top, sec sel bottom, sec sel left,
- const int clickTestCnt = 3;
+ // sec sel Top, sec sel bottom, sec sel left
+ // Y-coordinates are offsets from segment top; ie, (0,0) is segment top-left.
+ const int clickTestCnt = 5;
int clickStuff[] = {
- 10, 15, 3, true, 0, 72, 20, kAbsent, kAbsent, kAbsent,
+ 10, 15, 2, false, 9, 21, 1, 20, 30, 18,
61, 50, 6, true, 0, 72, 63, kAbsent, kAbsent, kAbsent,
- 90, 40, 9, false, 0, 72, 87, kAbsent, kAbsent, kAbsent
+ 90, 40, 7, false, 0, 72, 87, kAbsent, kAbsent, kAbsent,
+ 260, 40, 25, true, 0, 73,263, kAbsent, kAbsent, kAbsent, // ligature
+ 267, 40, 25, false, 0, 73,263, kAbsent, kAbsent, kAbsent, // ligature
};
// Finish setting up test case.
@@ -432,6 +502,8 @@ void TestCase::SetupRoman() SetXPositions(xPositions);
SetYPositions(yPositions);
SetAdvWidths(advWidths);
+ SetBBs(NULL, NULL, NULL, NULL);
+ SetAttachedClusters(attachments, attCount);
SetInsPtFlags(insPtFlags);
SetClickTests(clickTestCnt, clickStuff);
}
@@ -441,6 +513,7 @@ void TestCase::SetupRomanFeatures() m_testName = "Roman Features";
//m_traceLog = true;
//m_debug = true;
+ //m_skip = true;
// Input:
m_fontName = L"Graphite Test Roman";
@@ -459,33 +532,35 @@ void TestCase::SetupRomanFeatures() m_fset[2].id = 1029; m_fset[2].value = 1; // vietnamese diacritics
m_fset[3].id = 1032; m_fset[3].value = 1; // literacy alternates
m_fset[4].id = 1034; m_fset[4].value = 1; // y-hook alternate (default)
- m_fset[5].id = 0;
+ m_fset[5].id = 1051; m_fset[5].value = 0; // diacritic selection
+ m_fset[6].id = 0;
// Output:
- m_segWidth = 265; // physical width of segment
+ m_segWidth = 307; // physical width of segment
- const int charCnt = 23; // number of characters in the segment
+ const int charCnt = 26; // number of characters in the segment
// need charCnt elements in this array:
bool insPtFlags[] = {
true, false, false, true, true, true, true, true, true, true,
true, true, false, false, true, false, true, false, true, false,
- false, false, false
+ false, false, false, true, true, true
};
- const int glyphCnt = 22; // number of glyphs in the segment
+ const int glyphCnt = 23; // number of glyphs in the segment
// need glyphCnt elements in these arrays:
- // 0 10 20
- gid16 glyphList[] = {73,752,749, 87,833, 90, 76,1581,128,122,298, 69,1964, 79,752, 44,752, 84,806,749,759,753};
- int xPositions[] = { 0, 23, 23, 21, 41, 45, 64, 87,104,121,138,173, 174,198,217,211,231,227,258,258,258,258};
- int yPositions[] = { 0, 0, 10, 0, -6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 10, 20};
- int advWidths[] = {21, 0, 0, 24, 0, 18, 23, 17, 17, 17, 34, 24, 24, 13, 0, 15, 0, 37, 0, 0, 0, 0};
+ // 0 10 20
+ gid16 glyphList[] = {72,1815,1768, 83,1789, 86,681,1659,1667,1662,1056,274,1778, 805,1815, 44,1815, 80,1833,1768,1855,1838,637};
+ int xPositions[] = { 0, 23, 23, 21, 41, 45, 64, 87, 104, 121, 138,173, 174, 198, 217, 211, 231, 227, 258, 258, 258, 258,265};
+ int yPositions[] = { 0, 0, 10, 0, -6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 10, 20, 0};
+ int advWidths[] = {21, 0, 0, 24, 0, 18, 23, 17, 17, 17, 34, 24, 24, 13, 0, 15, 0, 37, 0, 0, 0, 0, 41};
// Each line in clickStuff represents one click test with the following items:
// click x-coord, click y-coord, char index, assoc-prev,
// prim sel Top, prim sel bottom, prim sel left,
- // sec sel Top, sec sel bottom, sec sel left,
+ // sec sel Top, sec sel bottom, sec sel left
+ // Y-coordinates are offsets from segment top; ie, (0,0) is segment top-left.
const int clickTestCnt = 3;
int clickStuff[] = {
10, 15, 3, true, 0, 72, 20, kAbsent, kAbsent, kAbsent,
@@ -500,6 +575,7 @@ void TestCase::SetupRomanFeatures() SetXPositions(xPositions);
SetYPositions(yPositions);
SetAdvWidths(advWidths);
+ SetBBs(NULL, NULL, NULL, NULL);
SetInsPtFlags(insPtFlags);
SetClickTests(clickTestCnt, clickStuff);
}
@@ -510,18 +586,122 @@ std::wstring TestCase::RomanText() wchar_t charData[] = {
0x0065, 0x0303, 0x0300, 0x0070, 0x0361, 0x0073, 0x0067, 0x02e8, 0x02e5, 0x02e7,
0x014a, 0x0061, 0x0302, 0x0301, 0x0069, 0x0303, 0x0049, 0x0303, 0x006d, 0x033c,
- 0x0300, 0x0308, 0x0304, 0x0000
+ 0x0300, 0x0308, 0x0304, 0x0066, 0x0066, 0x0069, 0x0000
};
strRet.assign(charData);
return strRet;
}
/*----------------------------------------------------------------------------------------------
+ A set of tests for handling complex diacritic stacking and bridging.
+----------------------------------------------------------------------------------------------*/
+void TestCase::SetupStackingAndBridging()
+{
+ m_testName = "Roman Stacking and Bridging";
+ //m_traceLog = true;
+ //m_debug = true;
+ //m_skip = true;
+
+ // Input:
+ m_fontName = L"Graphite Test Roman";
+ m_fontFile = "grtest_roman.ttf";
+ m_fontSize = 36; // font size in points
+ m_prefBreak = klbWordBreak; // preferred break-weight
+ m_availWidth = 500; // width available for segment
+ m_bold = false;
+ m_italic = false;
+ m_rtl = false;
+ m_backtrack = false;
+
+ // text to render
+ wchar_t charData[] = {
+ 0x0061,0x035d,0x0061,0x0020,0x0074,0x035d,0x0061,0x0020,0x0061,0x0300,
+ 0x0300,0x035d,0x0061,0x0020,0x0283,0x0300,0x0300,0x035d,0x0061,0x0020,
+ 0x0061,0x0316,0x0316,0xf176,0x0061,0x0020,0x0283,0x0300,0x0300,0xf176,
+ 0x0061,0x0020,0x0061,0x0316,0x0316,0xf176,0x0061,0x0020,0x0283,0x035d,
+ 0xf176,0x0061,0x0000
+ };
+ m_text.assign(charData);
+
+ // Output:
+ m_segWidth = 414; // physical width of segment
+
+ const int charCnt = 42; // number of characters in the segment
+
+ // need charCnt elements in this array:
+ bool insPtFlags[] = {
+ true, true, true, true, true, true, true, true, true, true,
+ true, true, true, true, true, true, true, true, true, true,
+ true, true, true, true, true, true, true, true, true, true,
+ true, true, true, true, true, true, true, true, true, true,
+ true, true,
+ };
+
+ const int glyphCnt = 42; // number of glyphs in the segment
+
+ // 68 = a, 97 = t, 1305 = esh, 1768 = upper grave, 1765 = lower grave, 1802 = upper bridge,
+ // 1801 = lower bridge
+
+ // need glyphCnt elements in these arrays:
+ // 0 10 20 30 40
+ gid16 glyphList[] = {68,1802, 68, 3, 87,1802, 68, 3, 68,1768,1768,1802, 68, 3,1305,1768,1768,1802, 68, 3, 68,1765,1765,1801, 68, 3,1305,1768,1768,1801, 68, 3, 68,1765,1765,1801, 68, 3,1305,1802,1801, 68};
+ int xPositions[] = { 0, 21, 21, 42, 56, 73, 69, 91, 105, 127, 127, 126, 126,147, 161, 181, 181, 178,177,199,212, 235, 235, 234,234,255, 269, 289, 289, 286,285,307,320, 343, 343, 342,342,363, 377, 393, 393,393};
+ int yPositions[] = { 0, -7, 0, 0, 0, -1, 0, 0, 0, 0, 10, 12, 0, 0, 0, 10, 20, 23, 0, 0, 0, 0, -9, -17, 0, 0, 0, 10, 20, -6, 0, 0, 0, 0, -9, -17, 0, 0, 0, 3, -6, 0};
+ int advWidths[] = {21, 0, 21, 13, 13, 0, 21, 13, 21, 0, 0, 0, 21, 13, 16, 0, 0, 0, 21, 13, 21, 0, 0, 0, 21, 13, 16, 0, 0, 0, 21, 13, 21, 0, 0, 0, 21, 13, 16, 0, 0, 21};
+
+ int bbLefts[] = { 1, 0, 23, 42, 56, 52, 71, 91, 106, 108, 108, 105, 128,147, 159, 162, 162, 157,179,199,214, 217, 217, 213,235,255, 267, 270, 270, 265,287,307,322, 325, 325, 321,343,363, 375, 373, 373,395};
+ int bbRights[] = {21, 41, 42, 56, 69, 93, 91,105, 126, 119, 119, 146, 147,161, 178, 173, 173, 198,199,212,234, 228, 228, 254,255,269, 286, 281, 281, 306,306,320,342, 336, 336, 362,363,377, 394, 413, 414,414};
+ int bbTops [] = {22, 33, 22, 0, 28, 40, 22, 0, 22, 32, 42, 54, 22, 0, 33, 42, 53, 64, 22, 0, 22, -3, -13, -26, 22, 0, 33, 42, 53, -15, 22, 0, 22, -3, -13, -26, 22, 0, 33, 44, -15, 22};
+ int bbBottoms [] = { 0, 26, 0, 0, 0, 33, 0, 0, 0, 24, 34, 47, 0, 0, -10, 34, 44, 57, 0, 0, 0, -11, -21, -32, 0, 0, -10, 34, 44, -21, 0, 0, 0, -11, -21, -32, 0, 0, -10, 38, -21, 0};
+
+ // Each group = glyph-index, base, number of attached, glyphs, attached-glyph-indices
+ int attachments[] = {
+ 0,0,0, 1,1,0, 2,2,0, 3,3,0, 4,4,0, 5,5,0, 6,6,0, 7,7,0,
+ 8,8,2,9,10, 9,8,0, 10,8,0, 11,11,0, 12,12,0, 13,13,0, 14,14,2,15,16,
+ 15,14,0, 16,14,0, 17,17,0, 18,18,0, 19,19,0, 20,20,2,21,22, 21,20,0,
+ 22,20,0, 23,23,0, 24,24,0, 25,25,0, 26,26,2,27,28, 27,26,0, 28,26,0,
+ 29,29,0, 30,30,0, 31,31,0, 32,32,2,33,34, 33,32,0, 34,32,0, 35,35,0,
+ 36,36,0, 37,37,0, 38,38,0, 39,39,0, 40,40,0, 41,41,0
+ };
+ int attCount = sizeof(attachments) / sizeof(int);
+
+ // Each line in clickStuff represents one click test with the following items:
+ // click x-coord, click y-coord, char index, assoc-prev,
+ // prim sel Top, prim sel bottom, prim sel left,
+ // sec sel Top, sec sel bottom, sec sel left
+ // Y-coordinates are offsets from segment top; ie, (0,0) is segment top-left.
+ const int clickTestCnt = 6;
+ int clickStuff[] = {
+ 109, 25, 9, false, 19, 32, 105, 30, 56, 125, // first grave on 4th a
+ 178, 26, 15, true, 19, 66, 176, 9, 21, 159, // top of 1st esh, right side
+ 220, 84, 23, false, 78, 89, 210, 65, 77, 228, // first lower bridge diac
+ 271, 40, 26, false, 0, 72, 266, kAbsent, kAbsent, kAbsent, // second esh, left side
+ 271, 65, 26, false, 0, 72, 266, kAbsent, kAbsent, kAbsent, // just below second esh, left side
+ 271, 68, 29, false, 67, 78, 262, 0, 11, 280 // lower bridge diac under esh, left side
+ };
+
+ // Finish setting up test case.
+ SetCharCount(charCnt);
+ SetGlyphCount(glyphCnt);
+ SetGlyphList(glyphList);
+ SetXPositions(xPositions);
+ SetYPositions(yPositions);
+ SetAdvWidths(advWidths);
+ SetBBs(bbLefts, bbRights, bbTops, bbBottoms);
+ SetInsPtFlags(insPtFlags);
+ SetAttachedClusters(attachments, attCount);
+ SetClickTests(clickTestCnt, clickStuff);
+}
+
+/*----------------------------------------------------------------------------------------------
A set of tests for handling trailing whitespace.
----------------------------------------------------------------------------------------------*/
void TestCase::SetupNoWhiteSpace()
{
m_testName = "No white space";
+ //m_debug = true;
+ //m_traceLog = true;
+ //m_skip = true;
// Input:
m_fontName = L"Graphite Test Roman";
@@ -551,7 +731,7 @@ void TestCase::SetupNoWhiteSpace() const int glyphCnt = 16; // number of glyphs in the segment
// need glyphCnt elements in these arrays:
- gid16 glyphList[] = {55, 77, 73, 3, 3, 88, 92, 78, 71, 82, 3, 70, 89, 86, 94, 85};
+ gid16 glyphList[] = {55, 75, 72, 3, 3, 84, 88, 76, 70, 78, 3, 69, 85, 82, 90, 81};
int xPositions[] = { 0, 9, 17, 24, 29, 34, 42, 50, 54, 61, 69, 74, 82, 87, 95,107};
int yPositions[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
int advWidths[] = { 9, 8, 7, 4, 4, 8, 8, 4, 7, 8, 4, 8, 5, 8, 11, 8};
@@ -566,14 +746,16 @@ void TestCase::SetupNoWhiteSpace() SetXPositions(xPositions);
SetYPositions(yPositions);
SetAdvWidths(advWidths);
+ SetBBs(NULL, NULL, NULL, NULL);
SetInsPtFlags(insPtFlags);
SetClickTests(0, NULL);
SetOutputContextBlock(contextBlockOutSize, contextBlockOut);
}
-void TestCase::SetupNoWhiteSpaceFailure()
+void TestCase::SetupNoWhiteSpaceNoSeg()
{
- m_testName = "No white space - failure";
+ m_testName = "No white space - no segment";
+ //m_skip = true;
// Input:
m_fontName = L"Graphite Test Roman";
@@ -606,6 +788,7 @@ void TestCase::SetupNoWhiteSpaceFailure() void TestCase::SetupOnlyWhiteSpace()
{
m_testName = "Only white space";
+ //m_skip = true;
// Input:
m_fontName = L"Graphite Test Roman";
@@ -639,7 +822,8 @@ void TestCase::SetupOnlyWhiteSpace() // Each line in clickStuff represents one click test with the following items:
// click x-coord, click y-coord, char index, assoc-prev,
// prim sel Top, prim sel bottom, prim sel left,
- // sec sel Top, sec sel bottom, sec sel left,
+ // sec sel Top, sec sel bottom, sec sel left
+ // Y-coordinates are offsets from segment top; ie, (0,0) is segment top-left.
const int clickTestCnt = 6;
int clickStuff[] = {
2, 25, 0, false, 0, 24, -1, kAbsent, kAbsent, kAbsent,
@@ -657,6 +841,7 @@ void TestCase::SetupOnlyWhiteSpace() SetXPositions(xPositions);
SetYPositions(yPositions);
SetAdvWidths(advWidths);
+ SetBBs(NULL, NULL, NULL, NULL);
SetInsPtFlags(insPtFlags);
SetClickTests(clickTestCnt, clickStuff);
}
@@ -667,6 +852,7 @@ void TestCase::SetupOnlyWhiteSpace() void TestCase::SetupCrossLine1()
{
m_testName = "Cross-line 1";
+ //m_skip = true;
// Input:
m_fontName = L"Graphite Test CrossLine";
@@ -702,7 +888,8 @@ void TestCase::SetupCrossLine1() // Each line in clickStuff represents one click test with the following items:
// click x-coord, click y-coord, char index, assoc-prev,
// prim sel Top, prim sel bottom, prim sel left,
- // sec sel Top, sec sel bottom, sec sel left,
+ // sec sel Top, sec sel bottom, sec sel left
+ // Y-coordinates are offsets from segment top; ie, (0,0) is segment top-left.
const int clickTestCnt = 0;
int * clickStuff = NULL;
//int clickStuff[] = ;
@@ -720,6 +907,7 @@ void TestCase::SetupCrossLine1() SetXPositions(xPositions);
SetYPositions(yPositions);
SetAdvWidths(advWidths);
+ SetBBs(NULL, NULL, NULL, NULL);
SetInsPtFlags(insPtFlags);
SetClickTests(clickTestCnt, clickStuff);
SetOutputContextBlock(contextBlockOutSize, contextBlockOut);
@@ -730,6 +918,7 @@ void TestCase::SetupCrossLine2() m_testName = "Cross-line 2";
//m_traceLog = true;
//m_debug = true;
+ //m_skip = true;
// Input:
m_fontName = L"Graphite Test CrossLine";
@@ -770,7 +959,8 @@ void TestCase::SetupCrossLine2() // Each line in clickStuff represents one click test with the following items:
// click x-coord, click y-coord, char index, assoc-prev,
// prim sel Top, prim sel bottom, prim sel left,
- // sec sel Top, sec sel bottom, sec sel left,
+ // sec sel Top, sec sel bottom, sec sel left
+ // Y-coordinates are offsets from segment top; ie, (0,0) is segment top-left.
const int clickTestCnt = 0;
int * clickStuff = NULL;
//int clickStuff[] = ;
@@ -788,6 +978,7 @@ void TestCase::SetupCrossLine2() SetXPositions(xPositions);
SetYPositions(yPositions);
SetAdvWidths(advWidths);
+ SetBBs(NULL, NULL, NULL, NULL);
SetInsPtFlags(insPtFlags);
SetClickTests(clickTestCnt, clickStuff);
SetInputContextBlock(contextBlockInSize, contextBlockIn);
@@ -797,6 +988,7 @@ void TestCase::SetupCrossLine2() void TestCase::SetupCrossLine3()
{
m_testName = "Cross-line 3";
+ //m_skip = true;
// Input:
m_fontName = L"Graphite Test CrossLine";
@@ -837,7 +1029,8 @@ void TestCase::SetupCrossLine3() // Each line in clickStuff represents one click test with the following items:
// click x-coord, click y-coord, char index, assoc-prev,
// prim sel Top, prim sel bottom, prim sel left,
- // sec sel Top, sec sel bottom, sec sel left,
+ // sec sel Top, sec sel bottom, sec sel left
+ // Y-coordinates are offsets from segment top; ie, (0,0) is segment top-left.
const int clickTestCnt = 0;
int * clickStuff = NULL;
//int clickStuff[] = ;
@@ -855,6 +1048,7 @@ void TestCase::SetupCrossLine3() SetXPositions(xPositions);
SetYPositions(yPositions);
SetAdvWidths(advWidths);
+ SetBBs(NULL, NULL, NULL, NULL);
SetInsPtFlags(insPtFlags);
SetClickTests(clickTestCnt, clickStuff);
SetInputContextBlock(contextBlockInSize, contextBlockIn);
@@ -864,6 +1058,7 @@ void TestCase::SetupCrossLine3() void TestCase::SetupCrossLine4()
{
m_testName = "Cross-line 4";
+ //m_skip = true;
// Input:
m_fontName = L"Graphite Test CrossLine";
@@ -904,7 +1099,8 @@ void TestCase::SetupCrossLine4() // Each line in clickStuff represents one click test with the following items:
// click x-coord, click y-coord, char index, assoc-prev,
// prim sel Top, prim sel bottom, prim sel left,
- // sec sel Top, sec sel bottom, sec sel left,
+ // sec sel Top, sec sel bottom, sec sel left
+ // Y-coordinates are offsets from segment top; ie, (0,0) is segment top-left.
const int clickTestCnt = 0;
int * clickStuff = NULL;
//int clickStuff[] = ;
@@ -922,6 +1118,7 @@ void TestCase::SetupCrossLine4() SetXPositions(xPositions);
SetYPositions(yPositions);
SetAdvWidths(advWidths);
+ SetBBs(NULL, NULL, NULL, NULL);
SetInsPtFlags(insPtFlags);
SetClickTests(clickTestCnt, clickStuff);
SetInputContextBlock(contextBlockInSize, contextBlockIn);
@@ -942,8 +1139,9 @@ std::wstring TestCase::CrossLineText() void TestCase::SetupArabic1()
{
m_testName = "Arabic 1";
- m_debug = true;
+ //m_debug = true;
m_traceLog = false;
+ //m_skip = true;
// Input:
m_fontName = L"Graphite Test Arabic";
@@ -963,10 +1161,20 @@ void TestCase::SetupArabic1() 61, // character count
61); // glyph count
+ // Each group = glyph-index, base, number of attached, glyphs, attached-glyph-indices
+ int attachments[] = {
+ 0,0,0, 1,1,1,2, 2,1,0, 3,3,4,4,5,6,7, 4,3,0, 5,3,0, 6,3,0, 7,3,0,
+ 8,8,0, 9,9,4,10,11,12,13, 10,9,0, 11,9,0, 12,9,0, 13,9,0, 14,14,0,
+ 15,15,0, 16,16,1,17, 17,16,0, 18,18,1,19, 19,18,0 // etc
+ };
+ int attCount = sizeof(attachments) / sizeof(int);
+ SetAttachedClusters(attachments, attCount);
+
// Each line in clickStuff represents one click test with the following items:
// click x-coord, click y-coord, char index, assoc-prev,
// prim sel Top, prim sel bottom, prim sel left,
- // sec sel Top, sec sel bottom, sec sel left,
+ // sec sel Top, sec sel bottom, sec sel left
+ // Y-coordinates are offsets from segment top; ie, (0,0) is segment top-left.
int clickStuff[] = {
199, 13, 37, true, 0, 35,196, kAbsent, kAbsent, kAbsent,
396, 13, 3, false, 8, 26,399, 10, 17, 397,
@@ -982,6 +1190,7 @@ void TestCase::SetupArabic2() m_testName = "Arabic 2";
m_debug = false;
m_traceLog = false;
+ //m_skip = true;
// Input:
m_fontName = L"Graphite Test Arabic";
@@ -1036,6 +1245,7 @@ void TestCase::SetupArabicAux(int charCnt, int glyphCnt) SetXPositions(xPositions);
SetYPositions(yPositions);
SetAdvWidths(advWidths);
+ SetBBs(NULL, NULL, NULL, NULL);
SetInsPtFlags(insPtFlags);
}
@@ -1055,7 +1265,340 @@ std::wstring TestCase::ArabicText() return strRet;
}
+/*----------------------------------------------------------------------------------------------
+ A set of tests that uses Tai Viet script to test positioning.
+----------------------------------------------------------------------------------------------*/
+void TestCase::SetupTaiViet1()
+{
+ m_testName = "Tai Viet Collisions";
+ //m_traceLog = true;
+ //m_debug = true;
+ //m_skip = true;
+ // Input:
+ m_fontName = L"Graphite Test TaiViet";
+ m_fontFile = "grtest_taiviet.ttf";
+ m_fontSize = 36; // font size in points
+ m_prefBreak = klbWordBreak; // preferred break-weight
+ m_availWidth = 2000; // width available for segment
+ m_bold = false;
+ m_italic = false;
+ m_rtl = false;
+ m_backtrack = false;
+ m_text = TaiVietText();
+
+ m_fset[0].id = 2001; m_fset[0].value = 2; // vowel position = final consonant
+ m_fset[1].id = 1051; m_fset[1].value = 0; // diacritic selection = off
+ m_fset[2].id = 2102; m_fset[2].value = 0; // collision avoidance = off
+ m_fset[3].id = 0;
+
+ // Output:
+ m_segWidth = 946; // physical width of segment
+
+ const int charCnt = 46; // number of characters in the segment
+
+ // need charCnt elements in this array:
+ bool insPtFlags[] = {
+ true, true, false, true, true, true, false, true, true, true,
+ false, false, true, true, false, true, true, false, false, true,
+ true, false, false, true, true, false, false, true, true, false,
+ false, true, true, false, true, true, false, false, true, true,
+ false, true, true, true, false, false
+ };
+
+ const int glyphCnt = 46; // number of glyphs in the segment
+
+ // need glyphCnt elements in these arrays:
+ // 0 10 20 30 40
+ gid16 glyphList[] = {59, 70, 71, 65, 59, 70, 71, 23, 32, 175, 70, 65, 55, 70, 73, 55, 175, 184,185, 55, 76, 184,185, 55, 77, 70, 185, 41, 77, 70, 23, 56,175, 65, 27, 93, 70,185, 53, 69, 81, 50, 27,175, 70, 23};
+ int xPositions[] = { 0, 72, 47, 72,101, 174,149,174, 206, 281, 283, 251, 283,352, 316, 352, 418, 425,386,425,493, 495,458, 495,556,559, 528, 559, 623, 623,591,623,706, 676, 706, 776,777,738, 777, 836, 816,843,880,944,946,912};
+ int yPositions[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 0, 0, 5, 13, 0, 0, 5, 22, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 19, 0, 0, 8, 0, 0, 0, 5, 21, 0};
+ int advWidths[] = {47, 0, 24, 29, 47, 0, 24, 32, 44, 0, 0, 29, 33, 0, 36, 33, 0, 0, 26, 33, 0, 0, 26, 33, 0, 0, 26, 32, 0, 0, 32, 52, 0, 29, 32, 0, 0, 26, 39, 0, 26, 36, 32, 0, 0, 32};
+
+ int bbLefts[] = { 5, 45, 52, 73,106, 147,154,177, 209, 254, 257, 252, 286,326, 322, 355, 391, 414,390,428,463, 484, 462,498,540,532, 532, 562, 607, 597,594,627,679, 677, 709, 744,751,742, 784, 825, 820,849,883,917,919,915};
+ int bbRights[] = {72, 72, 63, 97,174, 174,165,211, 277, 281, 283, 276, 349,352, 355, 419, 418, 422,409,491,494, 491, 481,561,553,559, 551, 621, 620, 623,628,681,706, 701, 756, 776,777,761, 835, 833, 840,882,930,944,946,949};
+ int bbTops [] = {60, 50, 25, 25, 60, 50, 25, 41, 60, 49, 66, 25, 60, 50, 40, 60, 55, 65, 36, 60, 56, 74, 36, 60, -5, 55, 36, 60, -5, 50, 41, 40, 49, 25, 55, 56, 69, 36, 55, 61, 41, 40, 55, 55, 71, 41};
+ int bbBottoms [] = { 0, 35, 0, 0, 0, 35, 0, 0, 0, 34, 50, 0, 0, 35, 0, 0, 39, 51, 0, 0, 40, 60, 0, 0,-27, 40, 0, 0, -27, 35, 0, 0, 34, 0, 0, 40, 54, 0, 0, 45, 0, 0, 0, 39, 56, 0};
+
+ // Each group = glyph-index, base, number of attached, glyphs, attached-glyph-indices
+ int attachments[] = {
+ 0,0,0, 1,2,0, 2,2,1,1, 3,3,0, 4,4,0, 5,6,0, 6,6,1,5, 7,7,0,
+ 8,8,0, 9,11,0, 10,11,0, 11,11,2,9,10, 12,12,0, 13,14,0, 14,14,1,13,
+ 15,15,0, 16,18,0, 17,18,0, 18,18,2,16,17, 19,19,0, 20,22,0, 21,22,0,
+ 22,22,2,20,21, 23,23,0, 24,26,0, 25,26,0, 26,26,2,24,25, 27,27,0, 28,30,0,
+ 29,30,0, 30,30,2,28,29, 31,31,0, 32,33,0, 33,33,1,32, 34,34,0, 35,37,0,
+ 36,37,0, 37,37,2,35,36, 38,38,0, 39,40,0, 40,40,1,39, 41,41,0, 42,42,0,
+ 43,45,0, 44,45,0, 45,45,2,43,44
+ };
+ int attCount = sizeof(attachments) / sizeof(int);
+
+ // Each line in clickStuff represents one click test with the following items:
+ // click x-coord, click y-coord, char index, assoc-prev,
+ // prim sel Top, prim sel bottom, prim sel left,
+ // sec sel Top, sec sel bottom, sec sel left
+ // Y-coordinates are offsets from segment top; ie, (0,0) is segment top-left.
+ const int clickTestCnt = 4;
+ int clickStuff[] = {
+ 55, 40, 1, true, 0,100, 46, kAbsent, kAbsent, kAbsent,
+ 65, 20, 1, false, 0,100, 46, kAbsent, kAbsent, kAbsent, // adjust to the left to get a valid IP?
+ 95, 84, 4, true, 0,100, 100, kAbsent, kAbsent, kAbsent,
+ 104, 40, 4, false, 0,100, 100, kAbsent, kAbsent, kAbsent
+ };
+
+ // Finish setting up test case.
+ SetCharCount(charCnt);
+ SetGlyphCount(glyphCnt);
+ SetGlyphList(glyphList);
+ SetXPositions(xPositions);
+ SetYPositions(yPositions);
+ SetAdvWidths(advWidths);
+ SetBBs(bbLefts, bbRights, bbTops, bbBottoms);
+ SetInsPtFlags(insPtFlags);
+ SetAttachedClusters(attachments, attCount);
+ SetClickTests(clickTestCnt, clickStuff);
+}
+
+/*----------------------------------------------------------------------------------------------
+ A set of tests that uses Tai Viet script to test positioning.
+----------------------------------------------------------------------------------------------*/
+void TestCase::SetupTaiViet2()
+{
+ m_testName = "Tai Viet No Collisions";
+ //m_traceLog = true;
+ //m_debug = true;
+ //m_skip = true;
+
+ // Input:
+ m_fontName = L"Graphite Test TaiViet";
+ m_fontFile = "grtest_taiviet.ttf";
+ m_fontSize = 36; // font size in points
+ m_prefBreak = klbWordBreak; // preferred break-weight
+ m_availWidth = 2000; // width available for segment
+ m_bold = false;
+ m_italic = false;
+ m_rtl = false;
+ m_backtrack = false;
+ m_text = TaiVietText();
+
+ m_fset[0].id = 2001; m_fset[0].value = 2; // vowel position = final consonant
+ m_fset[1].id = 1051; m_fset[1].value = 1; // diacritic selection = on
+ m_fset[2].id = 2102; m_fset[2].value = 1; // collision avoidance = off
+ m_fset[3].id = 0;
+
+ // Output:
+ m_segWidth = 947; // physical width of segment
+
+ const int charCnt = 46; // number of characters in the segment
+
+ // need charCnt elements in this array:
+ bool insPtFlags[] = {
+ true, true, true, true, true, true, true, true, true, true,
+ true, true, true, true, true, true, true, true, true, true,
+ true, true, true, true, true, true, true, true, true, true,
+ true, true, true, true, true, true, true, true, true, true,
+ true, true, true, true, true, true
+ };
+
+ const int glyphCnt = 46; // number of glyphs in the segment
+
+ // need glyphCnt elements in these arrays:
+ // 0 10 20 30 40
+ gid16 glyphList[] = {59, 70, 71, 65, 59, 70, 71, 23, 32, 175, 70, 65, 55, 70, 73, 55, 175, 184,185, 55, 76, 184,185, 55, 77, 70, 185, 41, 77, 70, 23, 56,175, 65, 27, 93, 70,185, 53, 69, 81, 50, 27,175, 70, 23};
+ int xPositions[] = { 0, 82, 47, 72,101, 184,149,174, 206, 281, 283, 251, 283,359, 316, 352, 418, 431,386,425,496, 508,458, 497,559,578, 530, 561, 626, 635,593,626,709, 678, 708, 778,780,740, 780, 853, 819,846,882,942,947,914};
+ int yPositions[] = { 0, -3, 0, 0, 0, -3, 0, 0, 0, 0, 22, 0, 0, 0, 0, 0, 0, 9, 0, 0, 2, 20, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, -4, 0, 0, 5, 25, 0, 0, 8, 0, 0, 0, 0, 23, 0};
+ int advWidths[] = {47, 0, 24, 29, 47, 0, 24, 32, 44, 0, 0, 29, 33, 0, 36, 33, 0, 0, 26, 33, 0, 0, 26, 33, 0, 0, 26, 32, 0, 0, 32, 52, 0, 29, 32, 0, 0, 26, 39, 0, 26, 36, 32, 0, 0, 32};
+
+ int bbLefts[] = { 5, 56, 52, 73,106, 158,154,177, 209, 254, 257, 252, 286,333, 322, 355, 391, 420,390,428,466, 497, 462,500,542,552, 534, 564, 609, 609,597,629,682, 679, 711, 747,753,744, 786, 842, 823,851,885,916,921,918};
+ int bbRights[] = {72, 82, 63, 97,174, 184,165,211, 277, 281, 283, 276, 349,359, 355, 419, 418, 427,409,491,496, 504, 481,564,555,578, 553, 624, 622, 635,630,684,709, 703, 758, 778,780,763, 837, 850, 842,885,932,942,947,951};
+ int bbTops [] = {60, 46, 25, 25, 60, 46, 25, 41, 60, 49, 73, 25, 60, 50, 40, 60, 50, 60, 36, 60, 54, 72, 36, 60, -5, 52, 36, 60, -5, 50, 41, 40, 45, 25, 55, 56, 75, 36, 55, 61, 41, 40, 55, 50, 73, 41};
+ int bbBottoms [] = { 0, 31, 0, 0, 0, 31, 0, 0, 0, 34, 57, 0, 0, 35, 0, 0, 34, 46, 0, 0, 37, 57, 0, 0,-27, 36, 0, 0, -27, 35, 0, 0, 29, 0, 0, 40, 60, 0, 0, 45, 0, 0, 0, 34, 58, 0};
+
+ // Each group = glyph-index, base, number of attached, glyphs, attached-glyph-indices
+ int attachments[] = {
+ 0,0,0, 1,2,0, 2,2,1,1, 3,3,0, 4,4,0, 5,6,0, 6,6,1,5, 7,7,0,
+ 8,8,0, 9,11,0, 10,11,0, 11,11,2,9,10, 12,12,0, 13,14,0, 14,14,1,13,
+ 15,15,0, 16,18,0, 17,18,0, 18,18,2,16,17, 19,19,0, 20,22,0, 21,22,0,
+ 22,22,2,20,21, 23,23,0, 24,26,0, 25,26,0, 26,26,2,24,25, 27,27,0, 28,30,0,
+ 29,30,0, 30,30,2,28,29, 31,31,0, 32,33,0, 33,33,1,32, 34,34,0, 35,37,0,
+ 36,37,0, 37,37,2,35,36, 38,38,0, 39,40,0, 40,40,1,39, 41,41,0, 42,42,0,
+ 43,45,0, 44,45,0, 45,45,2,43,44
+ };
+ int attCount = sizeof(attachments) / sizeof(int);
+
+ // Each line in clickStuff represents one click test with the following items:
+ // click x-coord, click y-coord, char index, assoc-prev,
+ // prim sel top, prim sel bottom, prim sel left,
+ // sec sel top, sec sel bottom, sec sel left
+ // Y-coordinates are offsets from segment top; ie, (0,0) is segment top-left.
+ const int clickTestCnt = 4;
+ int clickStuff[] = {
+ 55, 40, 2, false, 35, 65, 49, 14, 33, 82,
+ 65, 20, 1, false, 0,100, 50, kAbsent, kAbsent, kAbsent,
+ 95, 84, 4, true, 0,100, 100, kAbsent, kAbsent, kAbsent,
+ 104, 40, 4, false, 0,100, 100, kAbsent, kAbsent, kAbsent
+ };
+
+ // Finish setting up test case.
+ SetCharCount(charCnt);
+ SetGlyphCount(glyphCnt);
+ SetGlyphList(glyphList);
+ SetXPositions(xPositions);
+ SetYPositions(yPositions);
+ SetAdvWidths(advWidths);
+ SetBBs(bbLefts, bbRights, bbTops, bbBottoms);
+ SetInsPtFlags(insPtFlags);
+ SetAttachedClusters(attachments, attCount);
+ SetClickTests(clickTestCnt, clickStuff);
+}
+
+std::wstring TestCase::TaiVietText()
+{
+ std::wstring strRet;
+ wchar_t charData[] = {
+ 0xe00f,0xe042,0xe031,0xe02b,0xe00f,0xe042,0xe031,0xe025,0xe021,0xe033,
+ 0xe042,0xe02b,0xe01c,0xe042,0xe03e,0xe01c,0xe033,0xe040,0xe009,0xe01c,
+ 0xe039,0xe040,0xe009,0xe01c,0xe035,0xe042,0xe009,0xe024,0xe035,0xe042,
+ 0xe025,0xe01b,0xe033,0xe02b,0xe00a,0xe030,0xe042,0xe009,0xe01e,0xe040,
+ 0xe03b,0xe019,0xe00a,0xe033,0xe042,0xe025,0x0000
+ };
+ strRet.assign(charData);
+ return strRet;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Set up a test where the font is bad and we revert to dumb rendering
+----------------------------------------------------------------------------------------------*/
+void TestCase::SetupDumbFallback1()
+{
+ m_testName = "Dumb Fallback 1";
+ //m_debug = true;
+ m_traceLog = false;
+ //m_skip = true;
+
+ // Input:
+ m_fontName = L"GrErr BadVersion";
+ m_fontFile = "grtest_badVersion.ttf";
+ m_text = RomanText(); // text to render
+ m_fontSize = 12; // font size in points
+ m_prefBreak = klbWordBreak; // preferred break-weight
+ m_availWidth = 500; // width available for segment
+ m_bold = false;
+ m_italic = false;
+ m_rtl = false;
+ m_backtrack = false;
+ m_dumbFallback = true;
+
+ // Output:
+ m_badFont = true;
+ m_segWidth = 196; // physical width of segment
+
+ const int charCnt = 26; // number of characters in the segment
+
+ // need charCnt elements in this array:
+ bool insPtFlags[] = {
+ true, true, true, true, true, true, true, true, true, true,
+ true, true, true, true, true, true, true, true, true, true,
+ true, true, true, true, true, true
+ };
+
+ const int glyphCnt = 26; // number of glyphs in the segment
+
+ // need glyphCnt elements in these arrays:
+ // 0 10 20
+ gid16 glyphList[] = {71, 0, 0, 82, 0, 85, 73, 0, 0, 0, 0, 67, 0, 0, 75, 0, 43, 0, 79, 0, 0, 0, 0, 72, 72, 75};
+ int xPositions[] = { 0, 7, 15, 23, 31, 39, 46, 54, 62, 70, 78, 86, 93,101,109,114,122,128,136,149,157,165,173,181,186,192};
+ int yPositions[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
+ int advWidths[] = { 7, 8, 8, 8, 8, 6, 8, 8, 8, 8, 8, 7, 8, 8, 4, 8, 5, 8, 12, 8, 8, 8, 8, 5, 5, 4};
+
+ const int clickTestCnt = 0;
+ int * clickStuff = NULL;
+
+ // Finish setting up test case.
+ SetCharCount(charCnt);
+ SetGlyphCount(glyphCnt);
+ SetGlyphList(glyphList);
+ SetXPositions(xPositions);
+ SetYPositions(yPositions);
+ SetAdvWidths(advWidths);
+ SetBBs(NULL, NULL, NULL, NULL);
+ SetInsPtFlags(insPtFlags);
+ SetClickTests(clickTestCnt, clickStuff);
+}
+
+/*----------------------------------------------------------------------------------------------
+ Now make sure we will get a crash when we turn dumb rendering off for the same font.
+----------------------------------------------------------------------------------------------*/
+void TestCase::SetupDumbFallback2()
+{
+ m_testName = "Dumb Fallback 2";
+ //m_debug = true;
+ m_traceLog = false;
+ //m_skip = true;
+
+ // Input:
+ m_fontName = L"GrErr BadVersion";
+ m_fontFile = "grtest_badVersion.ttf";
+ m_text = L"This is a test."; // text to render
+ m_fontSize = 12; // font size in points
+ m_prefBreak = klbWordBreak; // preferred break-weight
+ m_availWidth = 500; // width available for segment
+ m_bold = false;
+ m_italic = false;
+ m_rtl = false;
+ m_backtrack = false;
+ m_dumbFallback = false;
+
+ // Output:
+ m_badFont = true;
+ m_noSegment = true;
+ m_segWidth = 0; // physical width of segment
+
+ const int charCnt = 0; // number of characters in the segment
+
+ const int glyphCnt = 0; // number of glyphs in the segment
+
+ // Finish setting up test case.
+ SetCharCount(charCnt);
+ SetGlyphCount(glyphCnt);
+}
+
+/*----------------------------------------------------------------------------------------------
+ Now make sure we will get a crash when we turn dumb rendering off for the same font.
+----------------------------------------------------------------------------------------------*/
+void TestCase::SetupBadFont()
+{
+ m_testName = "Bad Font";
+ //m_debug = true;
+ m_traceLog = false;
+ //m_skip = true;
+
+ // Input:
+ // The font has been corrupted so that the size of the cmap in the directory is invalid.
+ m_fontName = L"Graphite Test Roman";
+ m_fontFile = "grtest_badCmap.ttf";
+ m_text = L"This is a test."; // text to render
+ m_fontSize = 12; // font size in points
+ m_prefBreak = klbWordBreak; // preferred break-weight
+ m_availWidth = 500; // width available for segment
+ m_bold = false;
+ m_italic = false;
+ m_rtl = false;
+ m_backtrack = false;
+ m_dumbFallback = true; // wants to do dumb fall-back, but can't because the font is totally invalid
+
+ // Output:
+ m_badFont = true;
+ m_noSegment = true;
+ m_segWidth = 0; // physical width of segment
+
+ const int charCnt = 0; // number of characters in the segment
+
+ const int glyphCnt = 0; // number of glyphs in the segment
+
+ // Finish setting up test case.
+ SetCharCount(charCnt);
+ SetGlyphCount(glyphCnt);
+}
// *** Add more methods here. ***
@@ -1079,6 +1622,7 @@ TestCase::TestCase() m_testName = "Unknown";
m_debug = false;
m_traceLog = false;
+ m_skip = false;
m_fontName.erase();
m_fontFile.erase();
@@ -1097,7 +1641,9 @@ TestCase::TestCase() m_contextBlockIn = NULL;
m_initWithPrev = false;
memset(m_fset, 0, MAXFEAT * sizeof(FeatureSetting));
+ m_dumbFallback = true;
+ m_badFont = false;
m_noSegment = false; // yes, a segment should be generated
m_charCount = 0;
m_glyphCount = 0;
@@ -1105,7 +1651,15 @@ TestCase::TestCase() m_xPositions = NULL;
m_yPositions = NULL;
m_advWidths = NULL;
+ m_bbLefts = NULL;
+ m_bbRights = NULL;
+ m_bbTops = NULL;
+ m_bbBottoms = NULL;
m_insPointFlags = NULL;
+ m_charsToGlyphs = NULL;
+ m_c2gCount = 0;
+ m_attGlyphs = NULL;
+ m_attGCount = 0;
m_contextBlockOutSize = 0;
m_contextBlockOut = NULL;
@@ -1122,7 +1676,13 @@ TestCase::~TestCase() delete[] m_xPositions;
delete[] m_yPositions;
delete[] m_advWidths;
+ delete[] m_bbLefts;
+ delete[] m_bbRights;
+ delete[] m_bbTops;
+ delete[] m_bbBottoms;
delete[] m_insPointFlags;
+ delete[] m_charsToGlyphs;
+ delete[] m_attGlyphs;
delete[] m_clickTests;
delete[] m_contextBlockIn;
delete[] m_contextBlockOut;
@@ -1144,6 +1704,10 @@ void TestCase::SetGlyphCount(int glyphCount) m_xPositions = new int[glyphCount];
m_yPositions = new int[glyphCount];
m_advWidths = new int[glyphCount];
+ m_bbLefts = new int[glyphCount];
+ m_bbRights = new int[glyphCount];
+ m_bbTops = new int[glyphCount];
+ m_bbBottoms = new int[glyphCount];
}
void TestCase::SetGlyphList(gid16 * glyphList)
@@ -1170,12 +1734,52 @@ void TestCase::SetAdvWidths(int * advWidths) m_advWidths[i] = advWidths[i];
}
+void TestCase::SetBBs(int * bbLefts, int * bbRights, int * bbTops, int * bbBottoms)
+{
+ if (bbLefts == NULL) // no bb tests
+ {
+ delete[] m_bbLefts;
+ delete[] m_bbRights;
+ delete[] m_bbTops;
+ delete[] m_bbBottoms;
+ m_bbLefts = NULL;
+ m_bbRights = NULL;
+ m_bbTops = NULL;
+ m_bbBottoms = NULL;
+ return;
+ }
+
+ for (int i = 0; i < m_glyphCount; i++)
+ {
+ m_bbLefts[i] = bbLefts[i];
+ m_bbRights[i] = bbRights[i];
+ m_bbTops[i] = bbTops[i];
+ m_bbBottoms[i] = bbBottoms[i];
+ }
+}
+
void TestCase::SetInsPtFlags(bool * flags)
{
for (int i = 0; i < m_charCount; i++)
m_insPointFlags[i] = flags[i];
}
+void TestCase::SetCharsToGlyphs(int * stuff, int count)
+{
+ m_c2gCount = count;
+ m_charsToGlyphs = new int[count];
+ for (int i = 0; i < count; i++)
+ m_charsToGlyphs[i] = stuff[i];
+}
+
+void TestCase::SetAttachedClusters(int * stuff, int count)
+{
+ m_attGCount = count;
+ m_attGlyphs = new int[count];
+ for (int i = 0; i < count; i++)
+ m_attGlyphs[i] = stuff[i];
+}
+
void TestCase::SetClickTests(int clickTestCount, int * clickStuff)
{
const int fc = ClickTest::fieldCnt;
diff --git a/Build/source/libs/graphite-engine/test/RegressionTest/TestCase.h b/Build/source/libs/graphite-engine/test/RegressionTest/TestCase.h index 811a7e2c455..d18fd22b126 100644 --- a/Build/source/libs/graphite-engine/test/RegressionTest/TestCase.h +++ b/Build/source/libs/graphite-engine/test/RegressionTest/TestCase.h @@ -32,8 +32,9 @@ public: void SetupBurmese4();
void SetupRoman();
void SetupRomanFeatures();
+ void SetupStackingAndBridging();
void SetupNoWhiteSpace();
- void SetupNoWhiteSpaceFailure();
+ void SetupNoWhiteSpaceNoSeg();
void SetupOnlyWhiteSpace();
void SetupCrossLine1();
void SetupCrossLine2();
@@ -41,6 +42,11 @@ public: void SetupCrossLine4();
void SetupArabic1();
void SetupArabic2();
+ void SetupTaiViet1();
+ void SetupTaiViet2();
+ void SetupDumbFallback1();
+ void SetupDumbFallback2();
+ void SetupBadFont();
// *** Add more methods here. ***
protected:
@@ -51,6 +57,7 @@ protected: std::wstring RomanText();
std::wstring CrossLineText();
std::wstring ArabicText();
+ std::wstring TaiVietText();
public:
const static int kAbsent = -100; // not present in data
@@ -68,6 +75,7 @@ public: std::string TestName() { return m_testName; }
bool RunDebugger() { return m_debug; }
bool TraceLog() { return m_traceLog; }
+ bool Skip() { return m_skip; }
std::wstring Text() { return m_text; }
std::wstring FontName() { return m_fontName; }
@@ -84,6 +92,7 @@ public: bool Rtl() { return m_rtl; }
bool ParaRtl() { return m_paraRtl; }
size_t FirstChar() { return m_firstChar; }
+ bool DumbFallback() { return m_dumbFallback; }
size_t InputContextBlock(gr::byte ** ppContextBlock)
{
*ppContextBlock = m_contextBlockIn;
@@ -91,16 +100,29 @@ public: }
bool InitWithPrevSeg() { return m_initWithPrev; }
+ bool BadFont() { return m_badFont; }
bool NoSegment() { return m_noSegment; }
int SegWidth() { return m_segWidth; }
int CharCount() { return m_charCount; }
int GlyphCount() { return m_glyphCount; }
+
int GlyphID(int i) { return m_glyphArray[i]; }
int XPos(int i) { return m_xPositions[i]; }
int YPos(int i) { return m_yPositions[i]; }
int AdvWidth(int i) { return m_advWidths[i]; }
+ int BbLeft(int i) { return m_bbLefts[i]; }
+ int BbRight(int i) { return m_bbRights[i]; }
+ int BbTop(int i) { return m_bbTops[i]; }
+ int BbBottom(int i) { return m_bbBottoms[i]; }
+ bool BbTests() { return (m_bbLefts != NULL); }
+
int InsPtFlag(int i) { return m_insPointFlags[i]; }
+ int CharToGlyphCount() { return m_c2gCount; }
+ int CharToGlyphItem(int i) { return m_charsToGlyphs[i]; }
+ int AttachedGlyphCount() { return m_attGCount; } // that is, the lenght of the data
+ int AttachedGlyphItem(int i) { return m_attGlyphs[i]; }
+
int NumberOfClickTests() { return m_clickTestCount; }
int XClick(int i) { return m_clickTests[i].xClick; }
int YClick(int i) { return m_clickTests[i].yClick; }
@@ -144,6 +166,7 @@ protected: bool m_debug; // break into the debugger when running this test
bool m_traceLog; // generate a logging file (tracelog.txt) for this test; if this is turned on for
// more than one test, the tests will be appended
+ bool m_skip;
#define MAXFEAT 10
@@ -166,12 +189,14 @@ protected: size_t m_contextBlockInSize; // default: 0
gr::byte * m_contextBlockIn; // default: NULL -- DELETE
bool m_initWithPrev; // default: false
+ bool m_dumbFallback; // default: true
// start of line flag
// resolution
// justification
// Output:
- bool m_noSegment; // no segment should be generated
+ bool m_badFont; // default: false
+ bool m_noSegment; // no segment should be generated
int m_segWidth;
int m_charCount;
int m_glyphCount;
@@ -179,13 +204,20 @@ protected: int * m_xPositions;
int * m_yPositions;
int * m_advWidths;
+ int * m_bbLefts;
+ int * m_bbRights;
+ int * m_bbTops;
+ int * m_bbBottoms;
bool * m_insPointFlags;
+ int * m_charsToGlyphs; // char-to-glyph mappings
+ int m_c2gCount;
+ int * m_attGlyphs; // attachment clusters
+ int m_attGCount;
int m_clickTestCount;
ClickTest * m_clickTests;
size_t m_contextBlockOutSize;
gr::byte * m_contextBlockOut;
// glyphs-to-chars
- // chars-to-glyphs
// pdichwContext
// arrow key behavior
// etc.
@@ -197,7 +229,10 @@ protected: void SetXPositions(int * posList);
void SetYPositions(int * posList);
void SetAdvWidths(int * advWidths);
+ void SetBBs(int * bbLefts, int * bbRights, int * bbTops, int * bbBottoms);
void SetInsPtFlags(bool * flags);
+ void SetCharsToGlyphs(int * stuff, int count);
+ void SetAttachedClusters(int * stuff, int count);
void SetClickTests(int clickTestCount, int * clickStuff);
void SetInputContextBlock(int contextBlockInSize, gr::byte * contextBlockIn);
void SetOutputContextBlock(int contextBlockOutSize, gr::byte * contextBlockIn);
diff --git a/Build/source/libs/graphite-engine/test/RegressionTest/bridgingStackingText.wpx b/Build/source/libs/graphite-engine/test/RegressionTest/bridgingStackingText.wpx new file mode 100644 index 00000000000..2682bad84f6 --- /dev/null +++ b/Build/source/libs/graphite-engine/test/RegressionTest/bridgingStackingText.wpx @@ -0,0 +1,158 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE WpDoc SYSTEM "WorldPad.dtd">
+<WpDoc wpxVersion="2.0">
+
+<Languages>
+ <LgWritingSystem id="en" language="en" type="ISO-639-1">
+ <Name24>
+ <AUni ws="en">English</AUni>
+ </Name24>
+ <Abbr24>
+ <AUni ws="en">Eng</AUni>
+ </Abbr24>
+ <Description24>
+ <AStr ws="en">
+ <Run ws="en">The standard alphabetic representation of English (United States style).</Run>
+ </AStr>
+ </Description24>
+ <Locale24><Integer val="1033"/></Locale24>
+ <RightToLeft24><Boolean val="false"/></RightToLeft24>
+ <DefaultSerif24><Uni>Times New Roman</Uni></DefaultSerif24>
+ <DefaultSansSerif24><Uni>Arial</Uni></DefaultSansSerif24>
+ <DefaultBodyFont24><Uni>Charis SIL</Uni></DefaultBodyFont24>
+ <DefaultMonospace24><Uni>Courier New</Uni></DefaultMonospace24>
+ <ICULocale24><Uni>en</Uni></ICULocale24>
+ <KeyboardType24><Uni>standard</Uni></KeyboardType24>
+ <Collations24>
+ <LgCollation>
+ <Name30>
+ <AUni ws="en">Default Collation</AUni>
+ </Name30>
+ <WinLCID30><Integer val="1033"/></WinLCID30>
+ <WinCollation30><Uni>Latin1_General_CI_AI</Uni></WinCollation30>
+ </LgCollation>
+ <LgCollation>
+ <Name30>
+ <AUni ws="en">Case Sensitive</AUni>
+ </Name30>
+ <WinLCID30><Integer val="1033"/></WinLCID30>
+ <WinCollation30><Uni>Latin1_General_CS_AI</Uni></WinCollation30>
+ </LgCollation>
+ </Collations24>
+ </LgWritingSystem>
+</Languages>
+
+<Styles>
+ <StStyle>
+ <Name17><Uni>Normal</Uni></Name17>
+ <Type17><Integer val="0"/></Type17>
+ <BasedOn17><Uni></Uni></BasedOn17>
+ <Next17><Uni>Normal</Uni></Next17>
+ <Rules17>
+ </Rules17>
+ </StStyle>
+ <StStyle>
+ <Name17><Uni>Bulleted List</Uni></Name17>
+ <Type17><Integer val="0"/></Type17>
+ <BasedOn17><Uni>Normal</Uni></BasedOn17>
+ <Next17><Uni>Bulleted List</Uni></Next17>
+ <Rules17>
+ <Prop firstIndent="-18000" bulNumScheme="101" bulNumStartAt="1"/>
+ </Rules17>
+ </StStyle>
+ <StStyle>
+ <Name17><Uni>Heading 1</Uni></Name17>
+ <Type17><Integer val="0"/></Type17>
+ <BasedOn17><Uni>Normal</Uni></BasedOn17>
+ <Next17><Uni>Heading 1</Uni></Next17>
+ <Rules17>
+ <Prop bold="invert" fontsize="14000" fontsizeUnit="mpt" spaceBefore="12000" spaceAfter="3000"/>
+ </Rules17>
+ </StStyle>
+ <StStyle>
+ <Name17><Uni>Heading 2</Uni></Name17>
+ <Type17><Integer val="0"/></Type17>
+ <BasedOn17><Uni>Normal</Uni></BasedOn17>
+ <Next17><Uni>Heading 2</Uni></Next17>
+ <Rules17>
+ <Prop italic="invert" fontsize="12000" fontsizeUnit="mpt" spaceBefore="12000" spaceAfter="3000"/>
+ </Rules17>
+ </StStyle>
+ <StStyle>
+ <Name17><Uni>Heading 3</Uni></Name17>
+ <Type17><Integer val="0"/></Type17>
+ <BasedOn17><Uni>Normal</Uni></BasedOn17>
+ <Next17><Uni>Heading 3</Uni></Next17>
+ <Rules17>
+ <Prop fontsize="12000" fontsizeUnit="mpt" spaceBefore="12000" spaceAfter="3000"/>
+ </Rules17>
+ </StStyle>
+ <StStyle>
+ <Name17><Uni>Numbered List</Uni></Name17>
+ <Type17><Integer val="0"/></Type17>
+ <BasedOn17><Uni>Normal</Uni></BasedOn17>
+ <Next17><Uni>Numbered List</Uni></Next17>
+ <Rules17>
+ <Prop firstIndent="-18000" bulNumScheme="10"/>
+ </Rules17>
+ </StStyle>
+ <StStyle>
+ <Name17><Uni>External Link</Uni></Name17>
+ <Type17><Integer val="1"/></Type17>
+ <BasedOn17><Uni>Normal</Uni></BasedOn17>
+ <Next17><Uni>External Link</Uni></Next17>
+ <Rules17>
+ <Prop underline="single" forecolor="7f007f" undercolor="7f007f"/>
+ </Rules17>
+ </StStyle>
+</Styles>
+
+<Body docRightToLeft="false">
+ <StTxtPara>
+ <StyleRules15>
+ <Prop namedStyle="Normal"/>
+ </StyleRules15>
+ <Contents16>
+ <Str>
+ <Run ws="en" fontsize="48000" fontsizeUnit="mpt" fontFamily="Doulos SIL"></Run>
+ </Str>
+ </Contents16>
+ </StTxtPara>
+ <StTxtPara>
+ <StyleRules15>
+ <Prop namedStyle="Normal"/>
+ </StyleRules15>
+ <Contents16>
+ <Str>
+ <Run ws="en" fontsize="36000" fontsizeUnit="mpt" fontFamily="Graphite Test Roman">a͝a t͝a à̀͝a ʃ̀̀͝a a̖̖a ʃ̀̀a a̖̖a ʃ͝a</Run>
+ </Str>
+ </Contents16>
+ </StTxtPara>
+</Body>
+
+<PageSetup>
+ <PageInfo>
+ <TopMargin9999><Integer val="72000"/></TopMargin9999>
+ <BottomMargin9999><Integer val="72000"/></BottomMargin9999>
+ <LeftMargin9999><Integer val="90000"/></LeftMargin9999>
+ <RightMargin9999><Integer val="90000"/></RightMargin9999>
+ <HeaderMargin9999><Integer val="36000"/></HeaderMargin9999>
+ <FooterMargin9999><Integer val="36000"/></FooterMargin9999>
+ <PageSize9999><Integer val="0"/></PageSize9999>
+ <PageHeight9999><Integer val="792000"/></PageHeight9999>
+ <PageWidth9999><Integer val="612000"/></PageWidth9999>
+ <PageOrientation9999><Integer val="0"/></PageOrientation9999>
+ <Header9999>
+ <Str>
+ <Run ws="en">bridgingDiacTest.wpx</Run>
+ </Str>
+ </Header9999>
+ <Footer9999>
+ <Str>
+ <Run ws="en">&[page],&[date]</Run>
+ </Str>
+ </Footer9999>
+ </PageInfo>
+</PageSetup>
+
+</WpDoc>
diff --git a/Build/source/libs/graphite-engine/test/RegressionTest/grtest_arabic.ttf b/Build/source/libs/graphite-engine/test/RegressionTest/grtest_arabic.ttf Binary files differindex e40c668a03d..df25e54b3f3 100644 --- a/Build/source/libs/graphite-engine/test/RegressionTest/grtest_arabic.ttf +++ b/Build/source/libs/graphite-engine/test/RegressionTest/grtest_arabic.ttf diff --git a/Build/source/libs/graphite-engine/test/RegressionTest/grtest_badCmap.ttf b/Build/source/libs/graphite-engine/test/RegressionTest/grtest_badCmap.ttf Binary files differnew file mode 100644 index 00000000000..d66c725f12e --- /dev/null +++ b/Build/source/libs/graphite-engine/test/RegressionTest/grtest_badCmap.ttf diff --git a/Build/source/libs/graphite-engine/test/RegressionTest/grtest_badVersion.ttf b/Build/source/libs/graphite-engine/test/RegressionTest/grtest_badVersion.ttf Binary files differnew file mode 100644 index 00000000000..babe42e5352 --- /dev/null +++ b/Build/source/libs/graphite-engine/test/RegressionTest/grtest_badVersion.ttf diff --git a/Build/source/libs/graphite-engine/test/RegressionTest/grtest_roman.ttf b/Build/source/libs/graphite-engine/test/RegressionTest/grtest_roman.ttf Binary files differindex b0ced0a7752..2001ff6b5ac 100644 --- a/Build/source/libs/graphite-engine/test/RegressionTest/grtest_roman.ttf +++ b/Build/source/libs/graphite-engine/test/RegressionTest/grtest_roman.ttf diff --git a/Build/source/libs/graphite-engine/test/RegressionTest/grtest_taiviet.ttf b/Build/source/libs/graphite-engine/test/RegressionTest/grtest_taiviet.ttf Binary files differnew file mode 100644 index 00000000000..3bf4a662b11 --- /dev/null +++ b/Build/source/libs/graphite-engine/test/RegressionTest/grtest_taiviet.ttf diff --git a/Build/source/libs/graphite-engine/test/RegressionTest/romanText.wpx b/Build/source/libs/graphite-engine/test/RegressionTest/romanText.wpx index 674659fa7de..3f8342364c7 100644 --- a/Build/source/libs/graphite-engine/test/RegressionTest/romanText.wpx +++ b/Build/source/libs/graphite-engine/test/RegressionTest/romanText.wpx @@ -19,6 +19,7 @@ <RightToLeft24><Boolean val="false"/></RightToLeft24>
<DefaultSerif24><Uni>Times New Roman</Uni></DefaultSerif24>
<DefaultSansSerif24><Uni>Arial</Uni></DefaultSansSerif24>
+ <DefaultBodyFont24><Uni>Charis SIL</Uni></DefaultBodyFont24>
<DefaultMonospace24><Uni>Courier New</Uni></DefaultMonospace24>
<ICULocale24><Uni>en</Uni></ICULocale24>
<KeyboardType24><Uni>standard</Uni></KeyboardType24>
@@ -48,7 +49,7 @@ <BasedOn17><Uni></Uni></BasedOn17>
<Next17><Uni>Normal</Uni></Next17>
<Rules17>
- <Prop italic="off" bold="off" superscript="off" underline="none" fontsize="10000" fontsizeUnit="mpt" offset="0" offsetUnit="mpt" forecolor="black" backcolor="white" undercolor="black" align="leading" firstIndent="0" leadingIndent="0" trailingIndent="0" spaceBefore="0" spaceAfter="0" lineHeight="10000" lineHeightUnit="mpt" rightToLeft="0" borderTop="0" borderBottom="0" borderLeading="0" borderTrailing="0" borderColor="black" bulNumScheme="0" bulNumStartAt="1" fontFamily="<default serif>">
+ <Prop italic="off" bold="off" superscript="off" underline="none" fontsize="10000" fontsizeUnit="mpt" offset="0" offsetUnit="mpt" forecolor="black" backcolor="white" undercolor="black" align="leading" firstIndent="0" leadingIndent="0" trailingIndent="0" spaceBefore="0" spaceAfter="0" lineHeight="10000" lineHeightUnit="mpt" lineHeightType="atLeast" rightToLeft="0" borderTop="0" borderBottom="0" borderLeading="0" borderTrailing="0" borderColor="black" bulNumScheme="0" bulNumStartAt="1" fontFamily="<default serif>">
<BulNumFontInfo backcolor="white" bold="off" fontsize="10000mpt" forecolor="black" italic="off" offset="0mpt" superscript="off" undercolor="black" underline="none" fontFamily="Times New Roman"/>
</Prop>
</Rules17>
@@ -116,7 +117,7 @@ </StyleRules15>
<Contents16>
<Str>
- <Run ws="en" fontsize="36000" fontsizeUnit="mpt" fontFamily="Graphite Test Roman">ẽ̀p͡sg˨˥˧ŊấĩĨm̼̀̈̄</Run>
+ <Run ws="en" fontsize="36000" fontsizeUnit="mpt" fontFamily="Graphite Test Roman">ẽ̀p͡sg˨˥˧ŊấĩĨm̼̀̈̄ffi</Run>
</Str>
</Contents16>
</StTxtPara>
@@ -136,7 +137,7 @@ </StyleRules15>
<Contents16>
<Str>
- <Run ws="en" fontsize="36000" fontsizeUnit="mpt" fontFamily="Graphite Test Roman" fontVariations="1024=2,1026=1,1029=1,1032=1">ẽ̀p͡sg˨˥˧ŊấĩĨm̼̀̈̄</Run>
+ <Run ws="en" fontsize="36000" fontsizeUnit="mpt" fontFamily="Graphite Test Roman" fontVariations="1026=1,1029=1,1032=1,1024=2,1051=0">ẽ̀p͡sg˨˥˧ŊấĩĨm̼̀̈̄ffi</Run>
</Str>
</Contents16>
</StTxtPara>
@@ -150,6 +151,26 @@ </Str>
</Contents16>
</StTxtPara>
+ <StTxtPara>
+ <StyleRules15>
+ <Prop rightToLeft="0" namedStyle="Normal"/>
+ </StyleRules15>
+ <Contents16>
+ <Str>
+ <Run ws="en" fontsize="20000" fontsizeUnit="mpt" fontFamily="Graphite Test Roman">stacking and bridging:</Run>
+ </Str>
+ </Contents16>
+ </StTxtPara>
+ <StTxtPara>
+ <StyleRules15>
+ <Prop rightToLeft="0" namedStyle="Normal"/>
+ </StyleRules15>
+ <Contents16>
+ <Str>
+ <Run ws="en" fontsize="36000" fontsizeUnit="mpt" fontFamily="Graphite Test Roman">a͝a t͝a à̀͝a ʃ̀̀͝a a̖̖a ʃ̀̀a a̖̖a</Run>
+ </Str>
+ </Contents16>
+ </StTxtPara>
</Body>
<PageSetup>
diff --git a/Build/source/libs/graphite-engine/test/RegressionTest/taivietText.wpx b/Build/source/libs/graphite-engine/test/RegressionTest/taivietText.wpx new file mode 100644 index 00000000000..05532a9385a --- /dev/null +++ b/Build/source/libs/graphite-engine/test/RegressionTest/taivietText.wpx @@ -0,0 +1,162 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE WpDoc SYSTEM "WorldPad.dtd">
+<WpDoc wpxVersion="2.0">
+
+<Languages>
+ <LgWritingSystem id="blt_TV" language="blt" type="ISO-639-2">
+ <Name24>
+ <AUni ws="en">Tai Dam</AUni>
+ </Name24>
+ <Locale24><Integer val="1033"/></Locale24>
+ <RightToLeft24><Boolean val="false"/></RightToLeft24>
+ <FontVariation24><Uni>2001=0,2005=0,2101=1,1051=1,2102=1</Uni></FontVariation24>
+ <DefaultSerif24><Uni>Tai Heritage Graphite</Uni></DefaultSerif24>
+ <DefaultSansSerif24><Uni>Arial</Uni></DefaultSansSerif24>
+ <DefaultBodyFont24><Uni>Charis SIL</Uni></DefaultBodyFont24>
+ <DefaultMonospace24><Uni>Courier</Uni></DefaultMonospace24>
+ <ICULocale24><Uni>blt_TV</Uni></ICULocale24>
+ <KeyboardType24><Uni>standard</Uni></KeyboardType24>
+ <Collations24>
+ <LgCollation>
+ <WinLCID30><Integer val="1033"/></WinLCID30>
+ <WinCollation30><Uni>Latin1_General_CI_AI</Uni></WinCollation30>
+ </LgCollation>
+ </Collations24>
+ </LgWritingSystem>
+</Languages>
+
+<Styles>
+ <StStyle>
+ <Name17><Uni>Normal</Uni></Name17>
+ <Type17><Integer val="0"/></Type17>
+ <BasedOn17><Uni></Uni></BasedOn17>
+ <Next17><Uni>Normal</Uni></Next17>
+ <Rules17>
+ </Rules17>
+ </StStyle>
+ <StStyle>
+ <Name17><Uni>Bulleted List</Uni></Name17>
+ <Type17><Integer val="0"/></Type17>
+ <BasedOn17><Uni>Normal</Uni></BasedOn17>
+ <Next17><Uni>Bulleted List</Uni></Next17>
+ <Rules17>
+ <Prop firstIndent="-18000" bulNumScheme="101" bulNumStartAt="1"/>
+ </Rules17>
+ </StStyle>
+ <StStyle>
+ <Name17><Uni>Heading 1</Uni></Name17>
+ <Type17><Integer val="0"/></Type17>
+ <BasedOn17><Uni>Normal</Uni></BasedOn17>
+ <Next17><Uni>Heading 1</Uni></Next17>
+ <Rules17>
+ <Prop bold="invert" fontsize="14000" fontsizeUnit="mpt" spaceBefore="12000" spaceAfter="3000"/>
+ </Rules17>
+ </StStyle>
+ <StStyle>
+ <Name17><Uni>Heading 2</Uni></Name17>
+ <Type17><Integer val="0"/></Type17>
+ <BasedOn17><Uni>Normal</Uni></BasedOn17>
+ <Next17><Uni>Heading 2</Uni></Next17>
+ <Rules17>
+ <Prop italic="invert" fontsize="12000" fontsizeUnit="mpt" spaceBefore="12000" spaceAfter="3000"/>
+ </Rules17>
+ </StStyle>
+ <StStyle>
+ <Name17><Uni>Heading 3</Uni></Name17>
+ <Type17><Integer val="0"/></Type17>
+ <BasedOn17><Uni>Normal</Uni></BasedOn17>
+ <Next17><Uni>Heading 3</Uni></Next17>
+ <Rules17>
+ <Prop fontsize="12000" fontsizeUnit="mpt" spaceBefore="12000" spaceAfter="3000"/>
+ </Rules17>
+ </StStyle>
+ <StStyle>
+ <Name17><Uni>Numbered List</Uni></Name17>
+ <Type17><Integer val="0"/></Type17>
+ <BasedOn17><Uni>Normal</Uni></BasedOn17>
+ <Next17><Uni>Numbered List</Uni></Next17>
+ <Rules17>
+ <Prop firstIndent="-18000" bulNumScheme="10"/>
+ </Rules17>
+ </StStyle>
+ <StStyle>
+ <Name17><Uni>External Link</Uni></Name17>
+ <Type17><Integer val="1"/></Type17>
+ <BasedOn17><Uni>Normal</Uni></BasedOn17>
+ <Next17><Uni>External Link</Uni></Next17>
+ <Rules17>
+ <Prop underline="single" forecolor="7f007f" undercolor="7f007f"/>
+ </Rules17>
+ </StStyle>
+</Styles>
+
+<Body docRightToLeft="false">
+ <StTxtPara>
+ <StyleRules15>
+ <Prop namedStyle="Normal"/>
+ </StyleRules15>
+ <Contents16>
+ <Str>
+ <Run></Run>
+ </Str>
+ </Contents16>
+ </StTxtPara>
+ <StTxtPara>
+ <StyleRules15>
+ <Prop namedStyle="Normal"/>
+ </StyleRules15>
+ <Contents16>
+ <Str>
+ <Run ws="blt_TV" fontsize="36000" fontsizeUnit="mpt" forecolor="transparent" fontFamily="Graphite Test TaiViet" fontVariations="2001=2,1051=0,2102=0"></Run>
+ </Str>
+ </Contents16>
+ </StTxtPara>
+ <StTxtPara>
+ <StyleRules15>
+ <Prop namedStyle="Normal"/>
+ </StyleRules15>
+ <Contents16>
+ <Str>
+ <Run ws="blt_TV" fontsize="36000" fontsizeUnit="mpt" forecolor="transparent" fontFamily="Graphite Test TaiViet" fontVariations="2001=2,2102=0"></Run>
+ </Str>
+ </Contents16>
+ </StTxtPara>
+ <StTxtPara>
+ <StyleRules15>
+ <Prop namedStyle="Normal"/>
+ </StyleRules15>
+ <Contents16>
+ <Str>
+ <Run ws="blt_TV" fontsize="36000" fontsizeUnit="mpt" forecolor="transparent" fontFamily="Graphite Test TaiViet" fontVariations="2001=2,2102=1"></Run>
+ <Run ws="blt_TV" fontsize="36000" fontsizeUnit="mpt" forecolor="transparent" fontFamily="Graphite Test TaiViet" fontVariations="2001=2"></Run>
+ </Str>
+ </Contents16>
+ </StTxtPara>
+</Body>
+
+<PageSetup>
+ <PageInfo>
+ <TopMargin9999><Integer val="72000"/></TopMargin9999>
+ <BottomMargin9999><Integer val="72000"/></BottomMargin9999>
+ <LeftMargin9999><Integer val="90000"/></LeftMargin9999>
+ <RightMargin9999><Integer val="90000"/></RightMargin9999>
+ <HeaderMargin9999><Integer val="36000"/></HeaderMargin9999>
+ <FooterMargin9999><Integer val="36000"/></FooterMargin9999>
+ <PageSize9999><Integer val="0"/></PageSize9999>
+ <PageHeight9999><Integer val="792000"/></PageHeight9999>
+ <PageWidth9999><Integer val="612000"/></PageWidth9999>
+ <PageOrientation9999><Integer val="0"/></PageOrientation9999>
+ <Header9999>
+ <Str>
+ <Run ws="en">collision_examples.wpx</Run>
+ </Str>
+ </Header9999>
+ <Footer9999>
+ <Str>
+ <Run ws="en">&[page],&[date]</Run>
+ </Str>
+ </Footer9999>
+ </PageInfo>
+</PageSetup>
+
+</WpDoc>
diff --git a/Build/source/libs/graphite-engine/test/examples/burmese/Padauk.ttf b/Build/source/libs/graphite-engine/test/examples/burmese/Padauk.ttf Binary files differnew file mode 100644 index 00000000000..16a2ed864d9 --- /dev/null +++ b/Build/source/libs/graphite-engine/test/examples/burmese/Padauk.ttf diff --git a/Build/source/libs/graphite-engine/test/examples/burmese/bh1.utx b/Build/source/libs/graphite-engine/test/examples/burmese/bh1.utx new file mode 100644 index 00000000000..9dcaa5c3459 --- /dev/null +++ b/Build/source/libs/graphite-engine/test/examples/burmese/bh1.utx @@ -0,0 +1,4 @@ +ကျွနှ်ပ်တို့၏ ပျော်ရွှင်မှု၊ သာယာ ၀ ပြောမှုနှင့် အောင်မြင်မှုတို့သည် ကျွနု်ပ်တို့၏ ကျန်းမာခြင်းအပေါ်တွင် အများကြီး မှီခိုနေပါသည်။ ပညာတတ်ရန်၊ ကြွယ်၀ချမ်းသာရန်နှင့် ကြိုးပမ်း လုပ်ဆောင်မှုအားလုံး အောင်မြင်စေရန်အတွက် ကျန်းမာရေးသည် အထူးပင် အရေးကြီးပါသည်။ ကျန်းမာရေးမပြည့်စုံလျှင် ကျွနု်ပ်တို့၏ ပညာရေး၊ စီးပွားရေး မြှင့်တင်မှုလုပ်ငန်းများ လုပ်နိုင်လိမ့်မည် မဟုတ်ပါ။ သို့ဖြစ်၍ အစဥ်သဖြင့် ကျန်းမာနေရန် ကျွနု်ပ်တို့ ကြိုးစားကြရပါမည်။
+ကျွန်းမာရေးနှင့် ပြည့်စုံရန်အတွက် ဆောင်ရွက်ရန် နည်းလမ်းများကို သိရှိလိုက်နာရပါမည်။ အစားအသောက်၊ အအိပ်အနေ၊ လေ့ကျင့်ခန်းနှင့် သန့်ရှင်းမှုတို့သည် ကျန်းမာရေးအတွက် လိုအပ်ချက်များ ဖြစ်ပါသည်။ အစားအစာသည် အသက်ရှင်မှုအတွက် အထူးလိုအပ်ချက် ဖြစ်ပါသည်။ ကျွနု်ပ်တို့သည် အသက် ရှင်နေနိုင်ရန် အစာစားရခြင်းဖြစ်ပြီး စားသောက်ရန် အသက်ရှင်နေခြင်း မဟုတ််ပါ။ ကျန်းမာမှုအတွက် သင့်တော်သည့် ပရိုတိန်း၊ သတ္တုဓာတ်များနှင့် ဗီတာမင်များ များစွာပါ၀င်သည့် အစာများကို ရယူစားသုံးရန် လိုအပ်ပါသည်။ ကျွနု်ပ်တို့နှင့် လျှော်ကန်သင့် မြတ်မည့် အိပ်စက်အနားယူမှုမှာလည်း အရေးကြီးပါသည်။ ကျွနု်ပ်တို့၏ ခန္ဓာကိုယ်မှ ကြွက်သားများနှင့် အသားမျှင်များအား ထိန်းသိမ်းပြုပြင်မှုအတွက် အိပ်စက်ခြင်းနှင့် နားနေခြင်းတို့ အညီအမျှ လိုအပ်ပါသည်။ ထို့ကြောင့် လုံလောက်စွာ အိပ်စက်နားနေရပါမည်။
+ကိုယ်ကာယလေ့ကျင့်ခန်းများနှင့် သန့်ရှင်းမှုတို့လည်း အရေးကြီး လိုအပ်ပါသည်။ လမ်းလျှောက်ခြင်းနှင့် အိမ်တွင်း လေ့ကျင့်ခန်းများသည် အစားအသောက်စားလိုစိတ်နှင့် စိတ်ရွှင်လန်းမှုတို့ကို တိုးပွားစေပါသည်။ တစ်ကိုယ်ရေသန့်ရှင်းရေးက ကျန်းမာမှုကို အထောက်အကူပြုပါသည်။ နေ့စဥ် ရေချိုးခြင်း၊ အစာမစားမီနှင့် စားပြီးတိုင်း လက်များကို စနစ်တကျဆေးကြော ရပါမည်။
+အထက်ပါ ကျန်းမာရေး နည်းလမ်းများကို လိုက်နာဆောင်ရွက်ပါက ကျွနု်ပ်တို့ တစ်သက်တာအတွက် ကျန်းမာရေးနှင့်ပြည့်စုံနေမည်မှာ သေချာပါသည်။ ကျွနု်ပ်တို့ ကျန်းမာနေလျှင် စီးပွားဥစ္စာပြည့်စုံခြင်း၊ ပညာရေးပြည့်စုံခြင်းနှင့် အခြားအောင်မြင်မှုများကို စွမ်းဆောင်နိုင်ပါမည်။ သို့ပါ၍ ကျန်းမာခြင်းသည် ချမ်းသာခြင်းဖြစ်ကြောင်းနှင့် ကျန်းမာခြင်းသည် ချမ်းသာခြင်းထက် ပိုမိုကောင်းမွန်သည်ဟု ဆိုရမည် ဖြစ်ပါသည်။
diff --git a/Build/source/libs/graphite-engine/test/examples/khmer/cloudsku2.txt b/Build/source/libs/graphite-engine/test/examples/khmer/cloudsku2.txt new file mode 100755 index 00000000000..e9c75837a9a --- /dev/null +++ b/Build/source/libs/graphite-engine/test/examples/khmer/cloudsku2.txt @@ -0,0 +1,29 @@ +ពពក
+១-ពពកនៅលើមេឃគឺជាតំណក់ទឹកតូចៗជាច្រើន ។
+២-ពពកមើលទៅឃើញស្អាត ហើយមានប្រយោជន៍ចំញេះមនុស្សដែរ ។
+៣-ពពកគឺជាប្រភពនៃទឹកភ្លៀង ដែលរុក្ខជាតិ នឹងសត្វទាំងឡាយត្រូវការ ។
+៤-ទឹកភ្លៀងបង្អុរពីលើ "ពពក" ទៅក្នុងទន្លេដែលជាទីកន្លែងសំរាប់យើងរកត្រី ។
+៥-ទឹកអណ្ដូងរបស់យើងក៏មកពីទឹកភ្លៀងដែរ ។
+៦-យើងប្រើទឹកសំរាប់ហូប សំរាប់ដាំស្ល និងសំរាប់ងូតទឹកសំរាប់បោកគក់ ។
+៧-នៅពេលថ្ងៃ ពពកផ្ដល់ម្លប់អោយយើងពីកំដៅព្រះអាទិត្យ ។
+៨-ប្រសិនបើមានពពកនៅពេលយប់ នោះនឹង អាចការពារកំដៅពីចំហាយផែនដី ។ ហេតុដូច្នេះហើយទើបធ្វើអោយយើងមានអារម្មណ៍កក់ក្ដៅនៅពេលយប់ដែលមានពពកច្រើន ។
+៩-ពេលខ្លះពពកធ្វើអោយមានភ្លៀងធ្លាក់យ៉ាងខ្លាំង និងធ្វើអោយមានទឹកជំនន់ទឹកទន្លេជន់ឡើងយ៉ាងខ្លាំងហើយផ្ទះសំបែងជាច្រើនបានត្រូវលិចលង់ ។
+១០-ទឹកជំនន់បំផ្លិចបំផ្លាញផលដំណាំជាច្រើន ។
+១១-សត្វជាច្រើនបានលង់ទឹកស្លាប់ ។
+១២-មានផ្ទាំងដីធ្លាក់បាក់ចុះមកជាច្រើន ។
+១៣-ប៉ុន្ដែនៅទីណាដែលគ្មានពពកច្រើន ទីកន្លែងនោះខ្វះខាតទឹក និងក្លាយទៅជាវាលរហោស្ថាន ។ អត់មានដើមឈើរុក្ខជាតិរស់ ស្វតនិងមនុស្សក៏មិនអាចរស់នៅទីនោះបានដែរ ។
+
+CLOUDS
+1 The clouds in the sky are made up of little drops of water.
+2 Clouds are pretty to look at as well as useful to man.
+3 Clouds are the source of rain, which is needed by both plants and animals.
+4 Rain from the clouds fills the rivers where we get fish.
+5 Our wells are also filled by the rain that falls from the clouds.
+6 We use water for drinking, for cooking and for washing.
+7 During the day, the clouds provide shade from the heat of the sun.
+8 If there are clouds at night, they prevent the heat from the surface of the earth from rising. So that is why we feel warm on a cloudy night.
+9 Sometimes clouds bring heavy rains and floods. Rivers overflow and houses get flooded.
+10 The floods destroy crops.
+11 Animals are drowned.
+12 There are landslides.
+13 But in places where there are not many clouds, there is less water and the place becomes a desert in which no plants grow and no animals and people live.
diff --git a/Build/source/libs/graphite-engine/test/examples/khmer/mond40gr6.ttf b/Build/source/libs/graphite-engine/test/examples/khmer/mond40gr6.ttf Binary files differnew file mode 100755 index 00000000000..a4a784c9026 --- /dev/null +++ b/Build/source/libs/graphite-engine/test/examples/khmer/mond40gr6.ttf diff --git a/Build/source/libs/graphite-engine/test/fonterrors/readme.txt b/Build/source/libs/graphite-engine/test/fonterrors/readme.txt index d6f98f16347..943b2853cf6 100644 --- a/Build/source/libs/graphite-engine/test/fonterrors/readme.txt +++ b/Build/source/libs/graphite-engine/test/fonterrors/readme.txt @@ -2,7 +2,7 @@ FONTS FOR TESTING ERROR HANDLING This directory constains a set of fonts that have been deliberately corrupted in order to test Graphite's error recovery capabilities. -The "correct" behavior of the font is that vowel are rendered as lowercase, consonants as uppercase, and digits are raised vertically. For some of the fonts, recovery will be adequate to show some smart behaviors; for others the engine will revert to pure dumb rendering. +The "correct" behavior of the font is that vowels are rendered as lowercase, consonants as uppercase, and digits are raised vertically. For some of the fonts, recovery will be adequate to show some smart behaviors; for others the engine will revert to pure dumb rendering. * GrErr BadGloc - errBadGloc.ttf @@ -15,7 +15,7 @@ The "correct" behavior of the font is that vowel are rendered as lowercase, cons One of the offsets to the pass information points off to somewhere nonsensical. * GrErr BadStackMachine - errStackMachine.ttf - Extra bytes inserted into the stack machine commands for both of the substitution rules. The engine manages to recover and handle the rule correctly in this case. (Reproduce using lowercase consonants or uppercase vowels.) + Extra bytes have been inserted into the stack machine commands for both of the substitution rules. The engine manages to recover and handle the rule correctly in this case. (Reproduce using lowercase consonants or uppercase vowels.) * GrErr BadSubs - errSubs.ttf A PutSubs command references a non-existent replacement class. This causes the glyph to appear as a square box. (Reproduce using lowercase consonants or uppercase vowels.) |