* autogen.sh, builds/unix/configure.raw,

include/freetype/config/ftconfig.h, builds/unix/ftconfig.in: Minor
beautifying.

* include/freetype/ftadvanc.h, include/freetype/ftgasp.h,
include/freetype/ftlcdfil.h: Protect against FreeType 1.
Some other minor fixes.

* devel/ftoption.h: Synchronize with
include/freetype/config/ftoption.h.

Formatting, documentation improvements.
This commit is contained in:
Werner Lemberg 2008-09-12 16:27:48 +00:00
parent 8d3e6ecc3c
commit b211651ac9
27 changed files with 693 additions and 429 deletions

167
ChangeLog
View File

@ -1,62 +1,129 @@
2008-09-13 Werner Lemberg <wl@gnu.org>
* autogen.sh, builds/unix/configure.raw,
include/freetype/config/ftconfig.h, builds/unix/ftconfig.in: Minor
beautifying.
* include/freetype/ftadvanc.h, include/freetype/ftgasp.h,
include/freetype/ftlcdfil.h: Protect against FreeType 1.
Some other minor fixes.
* devel/ftoption.h: Synchronize with
include/freetype/config/ftoption.h.
2008-09-11 Werner Lemberg <wl@gnu.org> 2008-09-11 Werner Lemberg <wl@gnu.org>
* src/base/ftbase.c: Include ftadvanc.c. * src/base/ftbase.c: Include ftadvanc.c.
2008-09-11 suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp> 2008-09-11 suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp>
* builds/unix/ftconfig.in: Duplicate the cpp computation of * builds/unix/ftconfig.in: Duplicate the cpp computation of
FT_SIZEOF_{INT|LONG} from include/freetype/config/ftconfig.h. FT_SIZEOF_{INT|LONG} from include/freetype/config/ftconfig.h.
If FT_USE_AUTOCONF_SIZEOF_TYPES is defined, the cpp computation (FT_USE_AUTOCONF_SIZEOF_TYPES): New macro. If defined, the cpp
is disabled and the statically configured sizes are used. computation is disabled and the statically configured sizes are
This fixes Savannah bug #21250 used. This fixes Savannah bug #21250.
* builds/unix/configure.raw: Add the checks to compare the * builds/unix/configure.raw: Add the checks to compare the cpp
cpp computation results of the bit length of int and long computation results of the bit length of int and long versus the
versus the sizes detected by running configure. If the results sizes detected by running `configure'. If the results are
are different, FT_USE_AUTOCONF_SIZEOF_TYPES is defined to different, FT_USE_AUTOCONF_SIZEOF_TYPES is defined to prioritize the
prioritize the results detected by running configure. results.
New option --{enable|disable}-biarch-config is added to New option --{enable|disable}-biarch-config is added to define or
define or undefine FT_USE_AUTOCONF_SIZEOF_TYPES manually. undefine FT_USE_AUTOCONF_SIZEOF_TYPES manually.
2008-09-05 suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp> 2008-09-05 suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp>
* builds/unix/configure.raw: Clear FT2_EXTRA_LIBS when Carbon * builds/unix/configure.raw: Clear FT2_EXTRA_LIBS when Carbon or
or ApplicationService framework is missing. Although this ApplicationService framework is missing. Although this value is not
value is not used in building of FreeType2, it is written in used in building of FreeType2, it is written in `freetype2.pc' and
freetype2.pc and freetype-config. `freetype-config'.
2008-09-01 david turner <david@freetype.org> 2008-09-01 david turner <david@freetype.org>
* include/freetype/ftcache.h, src/cache/ftccmap.c: * src/cache/ftccmap.c (FTC_CMapCache_Lookup): Accept a negative cmap
modify FTC_CMapCache_Lookup to accept a negative cmap index index to mean `use default cached FT_Face's charmap'. This fixes
to mean "use default cached FT_Face's charmap". This fixes Savannah bug #22625.
Savannah issue #22625 * include/freetype/ftcache.h: Document it.
* include/freetype/ftoption.h, include/freetype/ftconfig.h,
builds/unix/ftconfig.in, include/freetype/freetype.h, Make FT_MulFix an inlined function. This is done to speed up
src/base/ftcalc.c:
Make FT_MulFix an inlined function. Also provide an assembler
implementation for ARM architectures. this is done to speedup
FreeType a little (on x86 3% when loading+hinting, 10% when FreeType a little (on x86 3% when loading+hinting, 10% when
rendering, ARM savings are more important though). rendering, ARM savings are more important though). Disable this by
Disable this by undefining FT_CONFIG_OPTION_INLINE_MULFIX in undefining FT_CONFIG_OPTION_INLINE_MULFIX.
ftconfig.h
* include/freetype/ftadvanc.h, src/base/ftadvanc.c, Use of assembler code can now be controlled with
include/freetype/config/ftheader.h, include/freetype/freetype.h, FT_CONFIG_OPTION_NO_ASSEMBLER.
src/base/Jamfile, src/base/rules.mk, src/cff/cffdrivr.c,
src/cff/cffgload.c, src/cff/cffgload.h, src/truetype/ttdriver.c,
src/truetype/ttgload.h, src/truetype/ttgload.c, src/type1/t1driver.c,
src/type1/t1gload.h, src/type1/t1gload.c:
Add a new header named FT_ADVANCES_H declaring some new APIs
to extract the advances of one or more glyphs without necessarily
loading their outlines. Also provide 'fast loaders' for the
TrueType, Type1 and CFF font drivers (more to come later)
* autogen.sh: add checks for minimum version of the 'autotools' * include/freetype/config/ftconfig.h, builds/unix/ftconfig.in
stuff. [!FT_CONFIG_OPTION_NO_ASSEMBLER] (FT_MulFix_arm): New assembler
implementation.
[!FT_CONFIG_OPTION_NO_ASSEMBLER] (FT_MulFix_i386): Assembler
implementation taken from `ftcalc.c'.
[!FT_CONFIG_OPTION_NO_ASSEMBLER] (FT_MULFIX_ASSEMBLER): New macro
which is defined to the platform-specific assembler implementation
of FT_MulFix.
[FT_CONFIG_OPTION_INLINE_MULFIX && FT_MULFIX_ASSEMBLER]
(FT_MULFIX_INLINED): New macro.
2008-08-29 suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp> * include/freetype/config/ftoption.h (FT_CONFIG_OPTION_NO_ASSEMBLER,
FT_CONFIG_OPTION_INLINE_MULFIX): New macros.
* include/freetype/freetype.h: Updated to handle FT_MULFIX_INLINED.
* src/base/ftcalc.c: Updated to use FT_MULFIX_ASSEMBLER and
FT_MULFIX_INLINED.
Add a new header named FT_ADVANCES_H declaring some new APIs to
extract the advances of one or more glyphs without necessarily
loading their outlines. Also provide `fast loaders' for the
TrueType, Type1, and CFF font drivers (more to come later).
* src/base/ftadvanc.c, include/freetype/ftadvanc.h: New files.
* include/freetype/config/ftheader.h (FT_ADVANCES_H): New macro.
* include/freetype/freetype.h (FT_LOAD_ADVANCE_ONLY): New macro.
* include/freetype/internal/ftdriver.h (FT_Face_GetAdvancesFunc):
`flags' and `advances' are now of type `FT_UInt' and `FT_Fixed',
respectively.
* src/base/Jamfile (_sources), src/base/rules.mk (BASE_SRC): Add
ftadvanc.c.
* src/cff/cffdrivr.c (cff_get_advances): New function.
(cff_driver_class): Register it.
* src/cff/cffgload.c (cff_decoder_set_width_only): New function.
(cff_decoder_parse_charstrings): Handle `width_only'.
(cff_slot_load): Handle FT_LOAD_ADVANCE_ONLY.
* src/cff/cffgload.h (cff_decoder): New element `width_only'.
(cff_decoder_set_width_only): New declaration.
* src/truetype/ttdriver.c (tt_get_advances): New function.
(tt_driver_class): Register it.
* src/truetype/ttgload.c (Get_HMetrics, Get_VMetrics): Renamed to...
(TT_Get_HMetrics, TT_Get_VMetrics): This.
Update callers.
* src/truetype/ttgload.h: Declare them.
* src/type1/t1gload.h, src/type1/t1gload.c (T1_Get_Advances): New
function.
* src/type1/t1driver.c (t1_driver_class): Register T1_Get_Advances.
Add checks for minimum version of the `autotools' stuff.
* autogen.sh: Implement it.
(get_major_version, get_minor_version, get_patch_version,
compare_to_minimum_version, check_tool_version): New auxiliary
functions.
* README.CVS: Document it.
2008-08-29 suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp>
* src/sfnt/sfobjs.c (sfnt_open_font): Use TTAG_OTTO defined in * src/sfnt/sfobjs.c (sfnt_open_font): Use TTAG_OTTO defined in
ttags.h instead of FT_MAKE_TAG( 'O', 'T', 'T', 'O' ). ttags.h instead of FT_MAKE_TAG( 'O', 'T', 'T', 'O' ).
@ -73,7 +140,7 @@
(afm_compare_kern_pairs): Fix comparison. This fixes Savannah bug (afm_compare_kern_pairs): Fix comparison. This fixes Savannah bug
#24119. #24119.
2008-08-19 suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp> 2008-08-19 suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp>
* src/base/ftobjs.c (FT_Stream_New): Initialize *astream always, * src/base/ftobjs.c (FT_Stream_New): Initialize *astream always,
even if passed library or arguments are invalid. This fixes a bug even if passed library or arguments are invalid. This fixes a bug
@ -83,7 +150,7 @@
(FT_Open_Face): Ditto (stream). (FT_Open_Face): Ditto (stream).
(load_face_in_embedded_rfork): Ditto (stream2). (load_face_in_embedded_rfork): Ditto (stream2).
2008-08-18 suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp> 2008-08-18 suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp>
* src/base/ftmac.c: Add a fallback to guess the availability of the * src/base/ftmac.c: Add a fallback to guess the availability of the
`ResourceIndex' type. It is used when built without configure `ResourceIndex' type. It is used when built without configure
@ -92,13 +159,13 @@
* builds/unix/configure.raw: Set HAVE_TYPE_RESOURCE_INDEX to 1 or 0 * builds/unix/configure.raw: Set HAVE_TYPE_RESOURCE_INDEX to 1 or 0
explicitly, even if `ResourceIndex' is unavailable. explicitly, even if `ResourceIndex' is unavailable.
2008-08-18 suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp> 2008-08-18 suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp>
* builds/unix/configure.raw: In checking of Mac OS X features, * builds/unix/configure.raw: In checking of Mac OS X features,
all-in-one header file `Carbon.h' is replaced by the minimum all-in-one header file `Carbon.h' is replaced by the minimum
header file `CoreServices.h', similar to current src/base/ftmac.c. header file `CoreServices.h', similar to current src/base/ftmac.c.
2008-08-18 suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp> 2008-08-18 suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp>
* src/sfnt/ttcmap.c (tt_cmap2_validate): Skip the validation of * src/sfnt/ttcmap.c (tt_cmap2_validate): Skip the validation of
sub-header when its code_count is 0. Many Japanese Dynalab fonts sub-header when its code_count is 0. Many Japanese Dynalab fonts
@ -285,7 +352,7 @@
* src/tools/docmaker/tohtml.py (make_html_para): Implement it. * src/tools/docmaker/tohtml.py (make_html_para): Implement it.
Update header files accordingly. Update header files accordingly.
2008-06-24 suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp> 2008-06-24 suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp>
* builds/unix/configure.raw: Check type `ResourceIndex' explicitly * builds/unix/configure.raw: Check type `ResourceIndex' explicitly
and define HAVE_TYPE_RESOURCE_INDEX if it is defined. Mac OS X 10.5 and define HAVE_TYPE_RESOURCE_INDEX if it is defined. Mac OS X 10.5
@ -318,7 +385,7 @@
* docs/CHANGES: Updated. * docs/CHANGES: Updated.
2008-06-22 suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp> 2008-06-22 suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp>
* builds/unix/configure.raw: If CFLAGS has `-isysroot XXX' option * builds/unix/configure.raw: If CFLAGS has `-isysroot XXX' option
but LDFLAGS does not, import it to LDFLAGS. The option is used to but LDFLAGS does not, import it to LDFLAGS. The option is used to
@ -549,7 +616,7 @@
* docs/CHANGES: Updated. * docs/CHANGES: Updated.
2008-05-18 David Turner <david@freetype.org> 2008-05-18 David Turner <david@freetype.org>
* src/psnames/psmodule.c (ft_wgl_extra_unicodes, * src/psnames/psmodule.c (ft_wgl_extra_unicodes,
ft_wgl_extra_glyph_names, ft_wgl_extra_glyph_name_offsets, ft_wgl_extra_glyph_names, ft_wgl_extra_glyph_name_offsets,
@ -1869,7 +1936,7 @@
* src/base/ftglyph.c (FT_Glyph_Copy): Always set second argument to * src/base/ftglyph.c (FT_Glyph_Copy): Always set second argument to
zero in case of error. This fixes Savannah bug #19689. zero in case of error. This fixes Savannah bug #19689.
2007-04-25 Boris Letocha <b.letocha@cz.gmc.net> 2007-04-25 Boris Letocha <b.letocha@cz.gmc.net>
* src/truetype/ttobjs.c: Fix a typo that created a speed regression * src/truetype/ttobjs.c: Fix a typo that created a speed regression
in the TrueType bytecode loader. in the TrueType bytecode loader.

View File

@ -13,13 +13,13 @@ The versions given in parentheses are known to work. Newer versions
should work too, of course. Note that autogen.sh also sets up proper should work too, of course. Note that autogen.sh also sets up proper
file permissions for the `configure' and auxiliary scripts. file permissions for the `configure' and auxiliary scripts.
The autogen.sh script now checks the version of your installed auto tools The autogen.sh script now checks the version of above three packages
to see if they match the numbers above. If not, it will complain and suggest whether they match the numbers above. Otherwise it will complain and
either upgrading or using an environment variable to point to a more recent suggest either upgrading or using an environment variable to point to
version of the required tool(s). a more recent version of the required tool(s).
Note that 'aclocal' is provided by the 'automake' package on Linux, and Note that `aclocal' is provided by the `automake' package on Linux,
that 'libtoolize' is called 'glibtoolize' on Darwin (OS X) and that `libtoolize' is called `glibtoolize' on Darwin (OS X).
For static builds which don't use platform specific optimizations, no For static builds which don't use platform specific optimizations, no

View File

@ -20,78 +20,78 @@ run ()
fi fi
} }
# extract major version
get_major_version () get_major_version ()
{ {
echo $1 | sed -e 's/\([0-9]\+\)\..*/\1/g' echo $1 | sed -e 's/\([0-9]\+\)\..*/\1/g'
} }
get_minor_version () get_minor_version ()
{ {
echo $1 | sed -e 's/[0-9]\+\.\([0-9]\+\).*/\1/g' echo $1 | sed -e 's/[0-9]\+\.\([0-9]\+\).*/\1/g'
} }
get_patch_version () get_patch_version ()
{ {
# tricky, some version numbers don't include a patch # tricky: some version numbers don't include a patch
# separated with a point, but something like 1.4-p6 # separated with a point, but something like 1.4-p6
# patch=`echo $1 | sed -e 's/[0-9]\+\.[0-9]\+\.\([0-9]\+\).*/\1/g'`
patch=`echo $1 | sed -e 's/[0-9]\+\.[0-9]\+\.\([0-9]\+\).*/\1/g'` if test "$patch" = "$1"; then
patch=`echo $1 | sed -e 's/[0-9]\+\.[0-9]\+\-p\([0-9]\+\).*/\1/g'`
# if there isn't any patch number, default to 0
if test "$patch" = "$1"; then if test "$patch" = "$1"; then
patch=`echo $1 | sed -e 's/[0-9]\+\.[0-9]\+\-p\([0-9]\+\).*/\1/g'` patch=0
# if there isn't any patch number, default to 0
if test "$patch" = "$1"; then
patch=0
fi
fi fi
echo $patch fi
echo $patch
} }
# $1: version to check # $1: version to check
# $2: minimum version # $2: minimum version
compare_to_minimum_version () compare_to_minimum_version ()
{ {
MAJOR1=`get_major_version $1` MAJOR1=`get_major_version $1`
MAJOR2=`get_major_version $2` MAJOR2=`get_major_version $2`
if test $MAJOR1 -lt $MAJOR2; then if test $MAJOR1 -lt $MAJOR2; then
echo 0 echo 0
return
else
if test $MAJOR1 -gt $MAJOR2; then
echo 1
return return
else
if test $MAJOR1 -gt $MAJOR2; then
echo 1
return
fi
fi fi
fi
MINOR1=`get_minor_version $1` MINOR1=`get_minor_version $1`
MINOR2=`get_minor_version $2` MINOR2=`get_minor_version $2`
if test $MINOR1 -lt $MINOR2; then if test $MINOR1 -lt $MINOR2; then
echo 0 echo 0
return
else
if test $MINOR1 -gt $MINOR2; then
echo 1
return return
else
if test $MINOR1 -gt $MINOR2; then
echo 1
return
fi
fi fi
fi
PATCH1=`get_patch_version $1` PATCH1=`get_patch_version $1`
PATCH2=`get_patch_version $2` PATCH2=`get_patch_version $2`
if test $PATCH1 -lt $PATCH2; then if test $PATCH1 -lt $PATCH2; then
echo 0 echo 0
else else
echo 1 echo 1
fi fi
} }
# check the version of a given tool against a minimum version number
# check that version of a given tool against a minimum version number
# $1: tool path
# $2: tool usual name (e.g. 'aclocal')
# $3: tool variable (e.g. 'ACLOCAL')
# $4: minimum version to check against
# $5: option field index used to extract the tool version from the output of --version
# #
# $1: tool path
# $2: tool usual name (e.g. `aclocal')
# $3: tool variable (e.g. `ACLOCAL')
# $4: minimum version to check against
# $5: option field index used to extract the tool version from the
# output of --version
check_tool_version () check_tool_version ()
{ {
field=$5 field=$5
@ -101,10 +101,11 @@ check_tool_version ()
version=`$1 --version | head -1 | cut -d ' ' -f $field` version=`$1 --version | head -1 | cut -d ' ' -f $field`
version_check=`compare_to_minimum_version $version $4` version_check=`compare_to_minimum_version $version $4`
if test "$version_check"x = 0x; then if test "$version_check"x = 0x; then
echo "ERROR: You $2 version is too old. minimum version $4 is required (yours is $version)" echo "ERROR: Your version of the \`$2' tool is too old."
echo "please upgrade or use the $3 variable to point to a more recent one" echo " Minimum version $4 is required (yours is version $version)."
echo "" echo " Please upgrade or use the $3 variable to point to a more recent one."
exit 1 echo ""
exit 1
fi fi
} }
@ -129,9 +130,9 @@ if test "$AUTOCONF"x = x; then
AUTOCONF=autoconf AUTOCONF=autoconf
fi fi
check_tool_version $ACLOCAL aclocal ACLOCAL 1.10.1 check_tool_version $ACLOCAL aclocal ACLOCAL 1.10.1
check_tool_version $LIBTOOLIZE libtoolize LIBTOOLIZE 2.2.4 check_tool_version $LIBTOOLIZE libtoolize LIBTOOLIZE 2.2.4
check_tool_version $AUTOCONF autoconf AUTOCONF 2.62 check_tool_version $AUTOCONF autoconf AUTOCONF 2.62
# This sets freetype_major, freetype_minor, and freetype_patch. # This sets freetype_major, freetype_minor, and freetype_patch.
eval `sed -nf version.sed include/freetype/freetype.h` eval `sed -nf version.sed include/freetype/freetype.h`

View File

@ -126,13 +126,14 @@ AC_CHECK_SIZEOF([int])
AC_CHECK_SIZEOF([long]) AC_CHECK_SIZEOF([long])
# checks for cpp computation of size of int and long ftconfig.in works # check whether cpp computation of size of int and long in ftconfig.in works
AC_MSG_CHECKING([cpp computation of bit length in ftconfig.in works]) AC_MSG_CHECKING([cpp computation of bit length in ftconfig.in works])
orig_CPPFLAGS="${CPPFLAGS}" orig_CPPFLAGS="${CPPFLAGS}"
CPPFLAGS="-I${srcdir} -I. ${CPPFLAGS}" CPPFLAGS="-I${srcdir} -I. ${CPPFLAGS}"
ac_clean_files="ft2build.h ftoption.h ftstdlib.h" ac_clean_files="ft2build.h ftoption.h ftstdlib.h"
touch ft2build.h ftoption.h ftstdlib.h touch ft2build.h ftoption.h ftstdlib.h
cat > conftest.c <<\_ACEOF cat > conftest.c <<\_ACEOF
#include <limits.h> #include <limits.h>
#define FT_CONFIG_OPTIONS_H "ftoption.h" #define FT_CONFIG_OPTIONS_H "ftoption.h"
@ -147,41 +148,45 @@ echo >> conftest.c "#endif"
echo >> conftest.c "#if FT_SIZEOF_LONG == "${ac_cv_sizeof_long} echo >> conftest.c "#if FT_SIZEOF_LONG == "${ac_cv_sizeof_long}
echo >> conftest.c "ac_cpp_ft_sizeof_long="${ac_cv_sizeof_long} echo >> conftest.c "ac_cpp_ft_sizeof_long="${ac_cv_sizeof_long}
echo >> conftest.c "#endif" echo >> conftest.c "#endif"
${CPP} ${CPPFLAGS} conftest.c | ${GREP} ac_cpp_ft > conftest.sh ${CPP} ${CPPFLAGS} conftest.c | ${GREP} ac_cpp_ft > conftest.sh
eval `cat conftest.sh` eval `cat conftest.sh`
${RMF} conftest.c conftest.sh confft2build.h ftoption.h ftstdlib.h ${RMF} conftest.c conftest.sh confft2build.h ftoption.h ftstdlib.h
if test x != "x${ac_cpp_ft_sizeof_int}" -a x != x"${ac_cpp_ft_sizeof_long}"
then if test x != "x${ac_cpp_ft_sizeof_int}" \
-a x != x"${ac_cpp_ft_sizeof_long}"; then
unset ft_use_autoconf_sizeof_types unset ft_use_autoconf_sizeof_types
else else
ft_use_autoconf_sizeof_types="yes" ft_use_autoconf_sizeof_types=yes
fi fi
AC_ARG_ENABLE(biarch-config, AC_ARG_ENABLE(biarch-config,
[ --enable-biarch-config install biarch ftconfig.h to support multiple [ --enable-biarch-config install biarch ftconfig.h to support multiple
architechtures by single file], [], []) architectures by single file], [], [])
case :${ft_use_autoconf_sizeof_types}:${enable_biarch_config}: in case :${ft_use_autoconf_sizeof_types}:${enable_biarch_config}: in
:yes:yes: ) :yes:yes:)
AC_MSG_RESULT([broken but use]) AC_MSG_RESULT([broken but use it])
unset ft_use_autoconf_sizeof_types unset ft_use_autoconf_sizeof_types
;; ;;
::no: ) ::no:)
AC_MSG_RESULT([works but ignore]) AC_MSG_RESULT([works but ignore it])
ft_use_autoconf_sizeof_types="yes" ft_use_autoconf_sizeof_types=yes
;; ;;
::yes: | ::: ) ::yes: | :::)
AC_MSG_RESULT([yes]) AC_MSG_RESULT([yes])
unset ft_use_autoconf_sizeof_types unset ft_use_autoconf_sizeof_types
;; ;;
* ) *)
AC_MSG_RESULT([no]) AC_MSG_RESULT([no])
ft_use_autoconf_sizeof_types="yes" ft_use_autoconf_sizeof_types=yes
;; ;;
esac esac
if test xyes = x"${ft_use_autoconf_sizeof_types}"
then if test x"${ft_use_autoconf_sizeof_types}" = xyes; then
AC_DEFINE([FT_USE_AUTOCONF_SIZEOF_TYPES]) AC_DEFINE([FT_USE_AUTOCONF_SIZEOF_TYPES])
fi fi
CPPFLAGS="${orig_CPPFLAGS}" CPPFLAGS="${orig_CPPFLAGS}"

View File

@ -4,7 +4,7 @@
/* */ /* */
/* UNIX-specific configuration file (specification only). */ /* UNIX-specific configuration file (specification only). */
/* */ /* */
/* Copyright 1996-2001, 2002, 2003, 2004, 2006, 2007 by */ /* Copyright 1996-2001, 2002, 2003, 2004, 2006, 2007, 2008 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */ /* */
/* This file is part of the FreeType project, and may only be used, */ /* This file is part of the FreeType project, and may only be used, */
@ -77,11 +77,13 @@ FT_BEGIN_HEADER
#undef FT_USE_AUTOCONF_SIZEOF_TYPES #undef FT_USE_AUTOCONF_SIZEOF_TYPES
#ifdef FT_USE_AUTOCONF_SIZEOF_TYPES #ifdef FT_USE_AUTOCONF_SIZEOF_TYPES
#undef SIZEOF_INT #undef SIZEOF_INT
#undef SIZEOF_LONG #undef SIZEOF_LONG
#define FT_SIZEOF_INT SIZEOF_INT #define FT_SIZEOF_INT SIZEOF_INT
#define FT_SIZEOF_LONG SIZEOF_LONG #define FT_SIZEOF_LONG SIZEOF_LONG
#else /* ! FT_USE_AUTOCONF_SIZEOF_TYPES */
#else /* !FT_USE_AUTOCONF_SIZEOF_TYPES */
/* Following cpp computation of the bit length of int and long */ /* Following cpp computation of the bit length of int and long */
/* is copied from default include/freetype/config/ftconfig.h. */ /* is copied from default include/freetype/config/ftconfig.h. */
@ -112,7 +114,8 @@ FT_BEGIN_HEADER
#error "Unsupported size of `long' type!" #error "Unsupported size of `long' type!"
#endif #endif
#endif /* ! FT_USE_AUTOCONF_SIZEOF_TYPES */ #endif /* !FT_USE_AUTOCONF_SIZEOF_TYPES */
/* Preferred alignment of data */ /* Preferred alignment of data */
#define FT_ALIGNMENT 8 #define FT_ALIGNMENT 8
@ -242,79 +245,13 @@ FT_BEGIN_HEADER
#endif /* FT_SIZEOF_LONG == 8 */ #endif /* FT_SIZEOF_LONG == 8 */
#if !defined(FT_CONFIG_OPTION_NO_ASSEMBLER)
/* provide assembler fragments for performance-critical
* functions. these must be defined static __inline__
* with GCC
*/
#if defined(__GNUC__)
# if defined(__arm__) && !defined(__thumb__)
# define FT_MULFIX_ASSEMBLER FT_MulFix_arm
static __inline__ FT_Int32
FT_MulFix_arm( FT_Int32 a, FT_Int32 b )
{
register FT_Int32 t, t2;
asm __volatile__ (
"smull %1, %2, %4, %3\n\t" /* (lo=%1,hi=%2) = a*b */
"mov %0, %2, asr #31\n\t" /* %0 = (hi >> 31) */
"add %0, %0, #0x8000\n\t" /* %0 += 0x8000 */
"adds %1, %1, %0\n\t" /* %1 += %0 */
"adc %2, %2, #0\n\t" /* %2 += carry */
"mov %0, %1, lsr #16\n\t" /* %0 = %1 >> 16 */
"orr %0, %2, lsl #16\n\t" /* %0 |= %2 << 16 */
: "=r"(a), "=&r"(t2), "=&r"(t)
: "r"(a), "r"(b)
);
return a;
}
# endif /* __arm__ */
# if defined(i386)
# define FT_MULFIX_ASSEMBLER FT_MulFix_i386
static __inline__ FT_Int32
FT_MulFix_i386( FT_Int32 a, FT_Int32 b )
{
register FT_Int32 result;
__asm__ __volatile__ (
"imul %%edx\n"
"movl %%edx, %%ecx\n"
"sarl $31, %%ecx\n"
"addl $0x8000, %%ecx\n"
"addl %%ecx, %%eax\n"
"adcl $0, %%edx\n"
"shrl $16, %%eax\n"
"shll $16, %%edx\n"
"addl %%edx, %%eax\n"
: "=a"(result), "+d"(b)
: "a"(a)
: "%ecx"
);
return result;
}
# endif /* i386 */
#endif /* __GNUC__ */
#endif /* !NO_ASSEMBLER */
#ifdef FT_CONFIG_OPTION_INLINE_MULFIX
# ifdef FT_MULFIX_ASSEMBLER
# define FT_MULFIX_INLINED FT_MULFIX_ASSEMBLER
# endif
#endif
#define FT_BEGIN_STMNT do {
#define FT_END_STMNT } while ( 0 )
#define FT_DUMMY_STMNT FT_BEGIN_STMNT FT_END_STMNT
/*************************************************************************/ /*************************************************************************/
/* */ /* */
/* A 64-bit data type will create compilation problems if you compile */ /* A 64-bit data type will create compilation problems if you compile */
/* in strict ANSI mode. To avoid them, we disable their use if */ /* in strict ANSI mode. To avoid them, we disable its use if __STDC__ */
/* __STDC__ is defined. You can however ignore this rule by */ /* is defined. You can however ignore this rule by defining the */
/* defining the FT_CONFIG_OPTION_FORCE_INT64 configuration macro. */ /* FT_CONFIG_OPTION_FORCE_INT64 configuration macro. */
/* */ /* */
#if defined( FT_LONG64 ) && !defined( FT_CONFIG_OPTION_FORCE_INT64 ) #if defined( FT_LONG64 ) && !defined( FT_CONFIG_OPTION_FORCE_INT64 )
@ -332,6 +269,82 @@ FT_BEGIN_HEADER
#endif /* FT_LONG64 && !FT_CONFIG_OPTION_FORCE_INT64 */ #endif /* FT_LONG64 && !FT_CONFIG_OPTION_FORCE_INT64 */
#define FT_BEGIN_STMNT do {
#define FT_END_STMNT } while ( 0 )
#define FT_DUMMY_STMNT FT_BEGIN_STMNT FT_END_STMNT
#ifndef FT_CONFIG_OPTION_NO_ASSEMBLER
/* Provide assembler fragments for performance-critical functions. */
/* These must be defined `static __inline__' with GCC. */
#ifdef __GNUC__
#if defined( __arm__ ) && !defined( __thumb__ )
#define FT_MULFIX_ASSEMBLER FT_MulFix_arm
static __inline__ FT_Int32
FT_MulFix_arm( FT_Int32 a,
FT_Int32 b )
{
register FT_Int32 t, t2;
asm __volatile__ (
"smull %1, %2, %4, %3\n\t" /* (lo=%1,hi=%2) = a*b */
"mov %0, %2, asr #31\n\t" /* %0 = (hi >> 31) */
"add %0, %0, #0x8000\n\t" /* %0 += 0x8000 */
"adds %1, %1, %0\n\t" /* %1 += %0 */
"adc %2, %2, #0\n\t" /* %2 += carry */
"mov %0, %1, lsr #16\n\t" /* %0 = %1 >> 16 */
"orr %0, %2, lsl #16\n\t" /* %0 |= %2 << 16 */
: "=r"(a), "=&r"(t2), "=&r"(t)
: "r"(a), "r"(b) );
return a;
}
#endif /* __arm__ && !__thumb__ */
#if defined( i386 )
#define FT_MULFIX_ASSEMBLER FT_MulFix_i386
static __inline__ FT_Int32
FT_MulFix_i386( FT_Int32 a,
FT_Int32 b )
{
register FT_Int32 result;
__asm__ __volatile__ (
"imul %%edx\n"
"movl %%edx, %%ecx\n"
"sarl $31, %%ecx\n"
"addl $0x8000, %%ecx\n"
"addl %%ecx, %%eax\n"
"adcl $0, %%edx\n"
"shrl $16, %%eax\n"
"shll $16, %%edx\n"
"addl %%edx, %%eax\n"
: "=a"(result), "+d"(b)
: "a"(a)
: "%ecx" );
return result;
}
#endif /* i386 */
#endif /* __GNUC__ */
#endif /* !FT_CONFIG_OPTION_NO_ASSEMBLER */
#ifdef FT_CONFIG_OPTION_INLINE_MULFIX
#ifdef FT_MULFIX_ASSEMBLER
#define FT_MULFIX_INLINED FT_MULFIX_ASSEMBLER
#endif
#endif
#ifdef FT_MAKE_OPTION_SINGLE_OBJECT #ifdef FT_MAKE_OPTION_SINGLE_OBJECT
#define FT_LOCAL( x ) static x #define FT_LOCAL( x ) static x

View File

@ -115,6 +115,27 @@ FT_BEGIN_HEADER
#undef FT_CONFIG_OPTION_FORCE_INT64 #undef FT_CONFIG_OPTION_FORCE_INT64
/*************************************************************************/
/* */
/* If this macro is defined, do not try to use an assembler version of */
/* performance-critical functions (e.g. FT_MulFix). You should only do */
/* that to verify that the assembler function works properly, or to */
/* execute benchmark tests of the various implementations. */
/* #define FT_CONFIG_OPTION_NO_ASSEMBLER */
/*************************************************************************/
/* */
/* If this macro is defined, try to use an inlined assembler version of */
/* the `FT_MulFix' function, which is a `hotspot' when loading and */
/* hinting glyphs, and which should be executed as fast as possible. */
/* */
/* Note that if your compiler or CPU is not supported, this will default */
/* to the standard and portable implementation found in `ftcalc.c'. */
/* */
#define FT_CONFIG_OPTION_INLINE_MULFIX
/*************************************************************************/ /*************************************************************************/
/* */ /* */
/* LZW-compressed file support. */ /* LZW-compressed file support. */

View File

@ -4,7 +4,7 @@
/* */ /* */
/* ANSI-specific configuration file (specification only). */ /* ANSI-specific configuration file (specification only). */
/* */ /* */
/* Copyright 1996-2001, 2002, 2003, 2004, 2006, 2007 by */ /* Copyright 1996-2001, 2002, 2003, 2004, 2006, 2007, 2008 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */ /* */
/* This file is part of the FreeType project, and may only be used, */ /* This file is part of the FreeType project, and may only be used, */
@ -43,6 +43,7 @@
#include FT_CONFIG_OPTIONS_H #include FT_CONFIG_OPTIONS_H
#include FT_CONFIG_STANDARD_LIBRARY_H #include FT_CONFIG_STANDARD_LIBRARY_H
FT_BEGIN_HEADER FT_BEGIN_HEADER
@ -212,6 +213,7 @@ FT_BEGIN_HEADER
#error "no 32bit type found -- please check your configuration files" #error "no 32bit type found -- please check your configuration files"
#endif #endif
/* look up an integer type that is at least 32 bits */ /* look up an integer type that is at least 32 bits */
#if FT_SIZEOF_INT >= (32 / FT_CHAR_BIT) #if FT_SIZEOF_INT >= (32 / FT_CHAR_BIT)
@ -225,67 +227,6 @@ FT_BEGIN_HEADER
#endif #endif
#if !defined(FT_CONFIG_OPTION_NO_ASSEMBLER)
/* provide assembler fragments for performance-critical
* functions. these must be defined static __inline__
* with GCC
*/
#if defined(__GNUC__)
# if defined(__arm__) && !defined(__thumb__)
# define FT_MULFIX_ASSEMBLER FT_MulFix_arm
static __inline__ FT_Int32
FT_MulFix_arm( FT_Int32 a, FT_Int32 b )
{
register FT_Int32 t, t2;
asm __volatile__ (
"smull %1, %2, %4, %3\n\t" /* (lo=%1,hi=%2) = a*b */
"mov %0, %2, asr #31\n\t" /* %0 = (hi >> 31) */
"add %0, %0, #0x8000\n\t" /* %0 += 0x8000 */
"adds %1, %1, %0\n\t" /* %1 += %0 */
"adc %2, %2, #0\n\t" /* %2 += carry */
"mov %0, %1, lsr #16\n\t" /* %0 = %1 >> 16 */
"orr %0, %2, lsl #16\n\t" /* %0 |= %2 << 16 */
: "=r"(a), "=&r"(t2), "=&r"(t)
: "r"(a), "r"(b)
);
return a;
}
# endif /* __arm__ */
# if defined(i386)
# define FT_MULFIX_ASSEMBLER FT_MulFix_i386
static __inline__ FT_Int32
FT_MulFix_i386( FT_Int32 a, FT_Int32 b )
{
register FT_Int32 result;
__asm__ __volatile__ (
"imul %%edx\n"
"movl %%edx, %%ecx\n"
"sarl $31, %%ecx\n"
"addl $0x8000, %%ecx\n"
"addl %%ecx, %%eax\n"
"adcl $0, %%edx\n"
"shrl $16, %%eax\n"
"shll $16, %%edx\n"
"addl %%edx, %%eax\n"
: "=a"(result), "+d"(b)
: "a"(a)
: "%ecx"
);
return result;
}
# endif /* i386 */
#endif /* __GNUC__ */
#endif /* !NO_ASSEMBLER */
#ifdef FT_CONFIG_OPTION_INLINE_MULFIX
# ifdef FT_MULFIX_ASSEMBLER
# define FT_MULFIX_INLINED FT_MULFIX_ASSEMBLER
# endif
#endif
/* determine whether we have a 64-bit int type for platforms without */ /* determine whether we have a 64-bit int type for platforms without */
/* Autoconf */ /* Autoconf */
@ -328,17 +269,12 @@ FT_BEGIN_HEADER
#endif /* FT_SIZEOF_LONG == (64 / FT_CHAR_BIT) */ #endif /* FT_SIZEOF_LONG == (64 / FT_CHAR_BIT) */
#define FT_BEGIN_STMNT do {
#define FT_END_STMNT } while ( 0 )
#define FT_DUMMY_STMNT FT_BEGIN_STMNT FT_END_STMNT
/*************************************************************************/ /*************************************************************************/
/* */ /* */
/* A 64-bit data type will create compilation problems if you compile */ /* A 64-bit data type will create compilation problems if you compile */
/* in strict ANSI mode. To avoid them, we disable their use if */ /* in strict ANSI mode. To avoid them, we disable its use if __STDC__ */
/* __STDC__ is defined. You can however ignore this rule by */ /* is defined. You can however ignore this rule by defining the */
/* defining the FT_CONFIG_OPTION_FORCE_INT64 configuration macro. */ /* FT_CONFIG_OPTION_FORCE_INT64 configuration macro. */
/* */ /* */
#if defined( FT_LONG64 ) && !defined( FT_CONFIG_OPTION_FORCE_INT64 ) #if defined( FT_LONG64 ) && !defined( FT_CONFIG_OPTION_FORCE_INT64 )
@ -353,6 +289,86 @@ FT_BEGIN_HEADER
#endif /* FT_LONG64 && !FT_CONFIG_OPTION_FORCE_INT64 */ #endif /* FT_LONG64 && !FT_CONFIG_OPTION_FORCE_INT64 */
#define FT_BEGIN_STMNT do {
#define FT_END_STMNT } while ( 0 )
#define FT_DUMMY_STMNT FT_BEGIN_STMNT FT_END_STMNT
#ifndef FT_CONFIG_OPTION_NO_ASSEMBLER
/* Provide assembler fragments for performance-critical functions. */
/* These must be defined `static __inline__' with GCC. */
#ifdef __GNUC__
#if defined( __arm__ ) && !defined( __thumb__ )
#define FT_MULFIX_ASSEMBLER FT_MulFix_arm
/* documentation is in freetype.h */
static __inline__ FT_Int32
FT_MulFix_arm( FT_Int32 a,
FT_Int32 b )
{
register FT_Int32 t, t2;
asm __volatile__ (
"smull %1, %2, %4, %3\n\t" /* (lo=%1,hi=%2) = a*b */
"mov %0, %2, asr #31\n\t" /* %0 = (hi >> 31) */
"add %0, %0, #0x8000\n\t" /* %0 += 0x8000 */
"adds %1, %1, %0\n\t" /* %1 += %0 */
"adc %2, %2, #0\n\t" /* %2 += carry */
"mov %0, %1, lsr #16\n\t" /* %0 = %1 >> 16 */
"orr %0, %2, lsl #16\n\t" /* %0 |= %2 << 16 */
: "=r"(a), "=&r"(t2), "=&r"(t)
: "r"(a), "r"(b) );
return a;
}
#endif /* __arm__ && !__thumb__ */
#if defined( i386 )
#define FT_MULFIX_ASSEMBLER FT_MulFix_i386
/* documentation is in freetype.h */
static __inline__ FT_Int32
FT_MulFix_i386( FT_Int32 a,
FT_Int32 b )
{
register FT_Int32 result;
__asm__ __volatile__ (
"imul %%edx\n"
"movl %%edx, %%ecx\n"
"sarl $31, %%ecx\n"
"addl $0x8000, %%ecx\n"
"addl %%ecx, %%eax\n"
"adcl $0, %%edx\n"
"shrl $16, %%eax\n"
"shll $16, %%edx\n"
"addl %%edx, %%eax\n"
: "=a"(result), "+d"(b)
: "a"(a)
: "%ecx" );
return result;
}
#endif /* i386 */
#endif /* __GNUC__ */
#endif /* !FT_CONFIG_OPTION_NO_ASSEMBLER */
#ifdef FT_CONFIG_OPTION_INLINE_MULFIX
#ifdef FT_MULFIX_ASSEMBLER
#define FT_MULFIX_INLINED FT_MULFIX_ASSEMBLER
#endif
#endif
#ifdef FT_MAKE_OPTION_SINGLE_OBJECT #ifdef FT_MAKE_OPTION_SINGLE_OBJECT
#define FT_LOCAL( x ) static x #define FT_LOCAL( x ) static x

View File

@ -728,6 +728,7 @@
*/ */
#define FT_GASP_H <freetype/ftgasp.h> #define FT_GASP_H <freetype/ftgasp.h>
/************************************************************************* /*************************************************************************
* *
* @macro: * @macro:
@ -735,9 +736,10 @@
* *
* @description: * @description:
* A macro used in #include statements to name the file containing the * A macro used in #include statements to name the file containing the
* FreeType~2 API which returns individual and ranged glyph advances * FreeType~2 API which returns individual and ranged glyph advances.
*/ */
#define FT_ADVANCES_H <freetype/ftadvanc.h> #define FT_ADVANCES_H <freetype/ftadvanc.h>
/* */ /* */

View File

@ -112,25 +112,26 @@ FT_BEGIN_HEADER
/* file `ftconfig.h' either statically or through the */ /* file `ftconfig.h' either statically or through the */
/* `configure' script on supported platforms. */ /* `configure' script on supported platforms. */
/* */ /* */
#undef FT_CONFIG_OPTION_FORCE_INT64 #undef FT_CONFIG_OPTION_FORCE_INT64
/*************************************************************************/ /*************************************************************************/
/* */ /* */
/* When this macro is defined, do not try to use an assembler version */ /* If this macro is defined, do not try to use an assembler version of */
/* of performance-critical functions (e.g. FT_MulFix). you should only */ /* performance-critical functions (e.g. FT_MulFix). You should only do */
/* do that to verify that the assembler function works properly, or even */ /* that to verify that the assembler function works properly, or to */
/* to benchmarks the various implementations... */ /* execute benchmark tests of the various implementations. */
/* #define FT_CONFIG_OPTION_NO_ASSEMBLER */ /* #define FT_CONFIG_OPTION_NO_ASSEMBLER */
/*************************************************************************/ /*************************************************************************/
/* */ /* */
/* When this macro is defined, try to use an inlined assembler version */ /* If this macro is defined, try to use an inlined assembler version of */
/* of the FT_MulFix function, which appears to be a hotspot when loading */ /* the `FT_MulFix' function, which is a `hotspot' when loading and */
/* and hinting glyphs. */ /* hinting glyphs, and which should be executed as fast as possible. */
/* */ /* */
/* note that if your compiler/cpu isn't supported, this will default to */ /* Note that if your compiler or CPU is not supported, this will default */
/* the standard and portable implementation found in src/base/ftcalc.c */ /* to the standard and portable implementation found in `ftcalc.c'. */
/* */ /* */
#define FT_CONFIG_OPTION_INLINE_MULFIX #define FT_CONFIG_OPTION_INLINE_MULFIX
@ -183,7 +184,7 @@ FT_BEGIN_HEADER
/* Do not #undef this macro here since the build system might define */ /* Do not #undef this macro here since the build system might define */
/* it for certain configurations only. */ /* it for certain configurations only. */
/* */ /* */
/* #define FT_CONFIG_OPTION_SYSTEM_ZLIB */ /* #define FT_CONFIG_OPTION_SYSTEM_ZLIB */
/*************************************************************************/ /*************************************************************************/
@ -224,8 +225,8 @@ FT_BEGIN_HEADER
/* Do not #undef these macros here since the build system might define */ /* Do not #undef these macros here since the build system might define */
/* them for certain configurations only. */ /* them for certain configurations only. */
/* */ /* */
/* #define FT_EXPORT(x) extern x */ /* #define FT_EXPORT(x) extern x */
/* #define FT_EXPORT_DEF(x) x */ /* #define FT_EXPORT_DEF(x) x */
/*************************************************************************/ /*************************************************************************/

View File

@ -1056,8 +1056,6 @@ FT_BEGIN_HEADER
#define FT_FACE_FLAG_HINTER ( 1L << 11 ) #define FT_FACE_FLAG_HINTER ( 1L << 11 )
#define FT_FACE_FLAG_CID_KEYED ( 1L << 12 ) #define FT_FACE_FLAG_CID_KEYED ( 1L << 12 )
/* */
/************************************************************************* /*************************************************************************
* *
@ -1167,8 +1165,6 @@ FT_BEGIN_HEADER
#define FT_HAS_FIXED_SIZES( face ) \ #define FT_HAS_FIXED_SIZES( face ) \
( face->face_flags & FT_FACE_FLAG_FIXED_SIZES ) ( face->face_flags & FT_FACE_FLAG_FIXED_SIZES )
/* */
/************************************************************************* /*************************************************************************
* *
@ -1231,7 +1227,7 @@ FT_BEGIN_HEADER
/*************************************************************************/ /*************************************************************************/
/* */ /* */
/* <Constant> */ /* <Const> */
/* FT_STYLE_FLAG_XXX */ /* FT_STYLE_FLAG_XXX */
/* */ /* */
/* <Description> */ /* <Description> */
@ -2432,13 +2428,13 @@ FT_BEGIN_HEADER
#define FT_LOAD_MONOCHROME 0x1000 #define FT_LOAD_MONOCHROME 0x1000
#define FT_LOAD_LINEAR_DESIGN 0x2000 #define FT_LOAD_LINEAR_DESIGN 0x2000
#define FT_LOAD_NO_AUTOHINT 0x8000U #define FT_LOAD_NO_AUTOHINT 0x8000U
#define FT_LOAD_ADVANCE_ONLY 0x10000U #define FT_LOAD_ADVANCE_ONLY 0x10000UL
/* used internally only by certain font drivers ! */
#define FT_LOAD_SBITS_ONLY 0x4000
/* */ /* */
/* used internally only by certain font drivers! */
#define FT_LOAD_SBITS_ONLY 0x4000
/************************************************************************** /**************************************************************************
* *
@ -3439,6 +3435,12 @@ FT_BEGIN_HEADER
FT_Long c ); FT_Long c );
/* */
/* The following #if 0 ... #endif is for the documentation formatter, */
/* hiding the internal `FT_MULFIX_INLINED' macro. */
#if 0
/*************************************************************************/ /*************************************************************************/
/* */ /* */
/* <Function> */ /* <Function> */
@ -3468,14 +3470,22 @@ FT_BEGIN_HEADER
/* _second_ argument of this function; this can make a great */ /* _second_ argument of this function; this can make a great */
/* difference. */ /* difference. */
/* */ /* */
FT_EXPORT( FT_Long )
FT_MulFix( FT_Long a,
FT_Long b );
/* */
#endif
#ifdef FT_MULFIX_INLINED #ifdef FT_MULFIX_INLINED
# define FT_MulFix(a,b) FT_MULFIX_INLINED(a,b) #define FT_MulFix( a, b ) FT_MULFIX_INLINED( a, b )
#else #else
FT_EXPORT( FT_Long ) FT_EXPORT( FT_Long )
FT_MulFix( FT_Long a, FT_MulFix( FT_Long a,
FT_Long b ); FT_Long b );
#endif #endif
/*************************************************************************/ /*************************************************************************/
/* */ /* */
/* <Function> */ /* <Function> */

View File

@ -2,9 +2,9 @@
/* */ /* */
/* ftadvanc.h */ /* ftadvanc.h */
/* */ /* */
/* FreeType access the glyph advances (specification only). */ /* Quick computation of advance widths (specification only). */
/* */ /* */
/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007 by */ /* Copyright 2008 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */ /* */
/* This file is part of the FreeType project, and may only be used, */ /* This file is part of the FreeType project, and may only be used, */
@ -15,33 +15,64 @@
/* */ /* */
/***************************************************************************/ /***************************************************************************/
#ifndef __FREETYPE_ADVANCE_H__
#define __FREETYPE_ADVANCE_H__ #ifndef __FTADVANC_H__
#define __FTADVANC_H__
#include <ft2build.h> #include <ft2build.h>
#include FT_FREETYPE_H #include FT_FREETYPE_H
#ifdef FREETYPE_H
#error "freetype.h of FreeType 1 has been loaded!"
#error "Please fix the directory search order for header files"
#error "so that freetype.h of FreeType 2 is found first."
#endif
FT_BEGIN_HEADER
/**************************************************************************
*
* @section:
* quick_advance
*
* @title:
* Quick retrieval of advance values
*
* @abstract:
* Retrieve horizontal and vertical advance values without processing
* glyph outlines, if possible.
*
* @description:
* This section contains functions to quickly extract advance values
* without handling glyph outlines, if possible.
*/
/*************************************************************************/ /*************************************************************************/
/* */ /* */
/* <Const> */ /* <Const> */
/* FT_ADVANCE_FLAG_FAST_ONLY */ /* FT_ADVANCE_FLAG_FAST_ONLY */
/* */ /* */
/* <Description> */ /* <Description> */
/* a bit-flag to be or-ed to the 'flags' parameter of the */ /* A bit-flag to be OR-ed with the `flags' parameter of the */
/* @FT_Get_Advance and @FT_Get_Advances. */ /* @FT_Get_Advance and @FT_Get_Advances functions. */
/* */ /* */
/* when set, it indicates that you want these functions to fail */ /* If set, it indicates that you want these functions to fail if the */
/* if the corresponding hinting mode or font driver doesn't */ /* corresponding hinting mode or font driver doesn't allow for very */
/* allow for very quick advance computation. */ /* quick advance computation. */
/* */ /* */
/* typically, unscaled, unhinted, bitmapped and light-hinted glyphs */ /* Typically, glyphs which are either unscaled, unhinted, bitmapped, */
/* can have their advance width(s) computed very quickly. */ /* or light-hinted can have their advance width computed very */
/* quickly. */
/* */ /* */
/* not so for normal and bytecode hinted modes, which require */ /* Normal and bytecode hinted modes, which require loading, scaling, */
/* loading/scaling/hinting the glyph outline instead, which is */ /* and hinting of the glyph outline, are extremely slow by */
/* extremely slow by comparison */ /* comparison. */
/* */ /* */
#define FT_ADVANCE_FLAG_FAST_ONLY 0x20000000U #define FT_ADVANCE_FLAG_FAST_ONLY 0x20000000UL
/*************************************************************************/ /*************************************************************************/
@ -50,33 +81,37 @@
/* FT_Get_Advance */ /* FT_Get_Advance */
/* */ /* */
/* <Description> */ /* <Description> */
/* Retrieve the advance of a given glyph outline in a @FT_Face. */ /* Retrieve the advance value of a given glyph outline in an */
/* by default, the unhinted advance is returned in font units */ /* @FT_Face. By default, the unhinted advance is returned in font */
/* units. */
/* */ /* */
/* <Input> */ /* <Input> */
/* face :: source @FT_Face handle */ /* face :: The source @FT_Face handle. */
/* gindex :: glyph index */ /* */
/* load_flags :: a set of bit-flags similar to those used */ /* gindex :: The glyph index. */
/* when calling @FT_Load_Glyph, used to determine */ /* */
/* what kind of advances you need. */ /* load_flags :: A set of bit flags similar to those used when */
/* calling @FT_Load_Glyph, used to determine what kind */
/* of advances you need. */
/* <Output> */ /* <Output> */
/* padvance :: the advance value, in either font units or 16.16 */ /* padvance :: The advance value, in either font units or 16.16 */
/* format. */ /* format. */
/* */ /* */
/* if @FT_LOAD_VERTICAL_LAYOUT is set, this is the */ /* If @FT_LOAD_VERTICAL_LAYOUT is set, this is the */
/* vertical advance corresponding to a vertical layout. */ /* vertical advance corresponding to a vertical layout. */
/* otherwise, it's the horizontal advance in an */ /* Otherwise, it is the horizontal advance in a */
/* horizontal layout. */ /* horizontal layout. */
/* */
/* <Return> */ /* <Return> */
/* FreeType error code. 0 means success. */ /* FreeType error code. 0 means success. */
/* */ /* */
/* <Note> */ /* <Note> */
/* This function may fail if you use @FT_ADVANCE_FLAG_FAST_ONLY and */ /* This function may fail if you use @FT_ADVANCE_FLAG_FAST_ONLY and */
/* if the corresponding's font backend doesn't have a quick way to */ /* if the corresponding font backend doesn't have a quick way to */
/* retrieve the advances. */ /* retrieve the advances. */
/* */ /* */
/* A scaled advance is returned in 16.16 format, but isn't */ /* A scaled advance is returned in 16.16 format but isn't transformed */
/* transformed by the affine transform specified by @FT_Set_Transform */ /* by the affine transformation specified by @FT_Set_Transform. */
/* */ /* */
FT_EXPORT( FT_Error ) FT_EXPORT( FT_Error )
FT_Get_Advance( FT_Face face, FT_Get_Advance( FT_Face face,
@ -84,40 +119,47 @@
FT_UInt load_flags, FT_UInt load_flags,
FT_Fixed *padvance ); FT_Fixed *padvance );
/*************************************************************************/ /*************************************************************************/
/* */ /* */
/* <Function> */ /* <Function> */
/* FT_Get_Advances */ /* FT_Get_Advances */
/* */ /* */
/* <Description> */ /* <Description> */
/* Retrieve the advance of several glyph outlines in a @FT_Face. */ /* Retrieve the advance values of several glyph outlines in an */
/* by default, the unhinted advances are returned in font units */ /* @FT_Face. By default, the unhinted advances are returned in font */
/* units. */
/* */ /* */
/* <Input> */ /* <Input> */
/* face :: source @FT_Face handle */ /* face :: The source @FT_Face handle. */
/* start :: first glyph index */ /* */
/* count :: number of advances you want to retrieve */ /* start :: The first glyph index. */
/* load_flags :: a set of bit-flags similar to those used when */ /* */
/* count :: The number of advance values you want to retrieve. */
/* */
/* load_flags :: A set of bit flags similar to those used when */
/* calling @FT_Load_Glyph. */ /* calling @FT_Load_Glyph. */
/* */ /* */
/* <Output> */ /* <Output> */
/* padvance :: the advances, in either font units or 16.16 format. */ /* padvance :: The advances, in either font units or 16.16 format. */
/* this array must contain at least 'count' elements */ /* This array must contain at least `count' elements. */
/* */ /* */
/* if @FT_LOAD_VERTICAL_LAYOUT is set, these are the */ /* If @FT_LOAD_VERTICAL_LAYOUT is set, these are the */
/* vertical advances corresponding to a vertical layout. */ /* vertical advances corresponding to a vertical layout. */
/* otherwise, they are the horizontal advances in an */ /* Otherwise, they are the horizontal advances in a */
/* horizontal layout. */ /* horizontal layout. */
/* */
/* <Return> */ /* <Return> */
/* FreeType error code. 0 means success. */ /* FreeType error code. 0 means success. */
/* */ /* */
/* <Note> */ /* <Note> */
/* This function may fail if you use @FT_ADVANCE_FLAG_FAST_ONLY and */ /* This function may fail if you use @FT_ADVANCE_FLAG_FAST_ONLY and */
/* if the corresponding's font backend doesn't have a quick way to */ /* if the corresponding font backend doesn't have a quick way to */
/* retrieve the advances. */ /* retrieve the advances. */
/* */ /* */
/* Scaled advances are returned in 16.16 format, but aren't */ /* Scaled advances are returned in 16.16 format but aren't */
/* transformed by the affine transform specified by @FT_Set_Transform */ /* transformed by the affine transformation specified by */
/* @FT_Set_Transform. */
/* */ /* */
FT_EXPORT( FT_Error ) FT_EXPORT( FT_Error )
FT_Get_Advances( FT_Face face, FT_Get_Advances( FT_Face face,
@ -128,4 +170,10 @@
/* */ /* */
#endif /* __FREETYPE_ADVANCE_H__ */
FT_END_HEADER
#endif /* __FTADVANC_H__ */
/* END */

View File

@ -609,8 +609,8 @@ FT_BEGIN_HEADER
* The source face ID. * The source face ID.
* *
* cmap_index :: * cmap_index ::
* The index of the charmap in the source face. * The index of the charmap in the source face. Any negative value
* Any negative value means to use the cache FT_Face's default charmap. * means to use the cache @FT_Face's default charmap.
* *
* char_code :: * char_code ::
* The character code (in the corresponding charmap). * The character code (in the corresponding charmap).

View File

@ -90,6 +90,7 @@
/* computations */ /* computations */
/* list_processing */ /* list_processing */
/* outline_processing */ /* outline_processing */
/* quick_advance */
/* bitmap_handling */ /* bitmap_handling */
/* raster */ /* raster */
/* glyph_stroker */ /* glyph_stroker */

View File

@ -22,6 +22,13 @@
#include <ft2build.h> #include <ft2build.h>
#include FT_FREETYPE_H #include FT_FREETYPE_H
#ifdef FREETYPE_H
#error "freetype.h of FreeType 1 has been loaded!"
#error "Please fix the directory search order for header files"
#error "so that freetype.h of FreeType 2 is found first."
#endif
/*************************************************************************** /***************************************************************************
* *
* @section: * @section:

View File

@ -23,6 +23,12 @@
#include <ft2build.h> #include <ft2build.h>
#include FT_FREETYPE_H #include FT_FREETYPE_H
#ifdef FREETYPE_H
#error "freetype.h of FreeType 1 has been loaded!"
#error "Please fix the directory search order for header files"
#error "so that freetype.h of FreeType 2 is found first."
#endif
FT_BEGIN_HEADER FT_BEGIN_HEADER

View File

@ -91,12 +91,14 @@ FT_BEGIN_HEADER
(*FT_CharMap_CharNextFunc)( FT_CharMap charmap, (*FT_CharMap_CharNextFunc)( FT_CharMap charmap,
FT_Long charcode ); FT_Long charcode );
typedef FT_Error typedef FT_Error
(*FT_Face_GetKerningFunc)( FT_Face face, (*FT_Face_GetKerningFunc)( FT_Face face,
FT_UInt left_glyph, FT_UInt left_glyph,
FT_UInt right_glyph, FT_UInt right_glyph,
FT_Vector* kerning ); FT_Vector* kerning );
typedef FT_Error typedef FT_Error
(*FT_Face_AttachFunc)( FT_Face face, (*FT_Face_AttachFunc)( FT_Face face,
FT_Stream stream ); FT_Stream stream );

View File

@ -1,6 +1,6 @@
# FreeType 2 src/base Jamfile # FreeType 2 src/base Jamfile
# #
# Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007 by # Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 by
# David Turner, Robert Wilhelm, and Werner Lemberg. # David Turner, Robert Wilhelm, and Werner Lemberg.
# #
# This file is part of the FreeType project, and may only be used, modified, # This file is part of the FreeType project, and may only be used, modified,

View File

@ -1,7 +1,26 @@
/***************************************************************************/
/* */
/* ftadvanc.c */
/* */
/* Quick computation of advance widths (body). */
/* */
/* Copyright 2008 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
/* modified, and distributed under the terms of the FreeType project */
/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
/* this file you indicate that you have read the license and */
/* understand and accept it fully. */
/* */
/***************************************************************************/
#include <ft2build.h> #include <ft2build.h>
#include FT_ADVANCES_H #include FT_ADVANCES_H
#include FT_INTERNAL_OBJECTS_H #include FT_INTERNAL_OBJECTS_H
static FT_Error static FT_Error
_ft_face_scale_advances( FT_Face face, _ft_face_scale_advances( FT_Face face,
FT_Fixed* advances, FT_Fixed* advances,
@ -11,38 +30,43 @@
FT_Fixed scale; FT_Fixed scale;
FT_UInt nn; FT_UInt nn;
if ( (flags & FT_LOAD_NO_SCALE) )
if ( flags & FT_LOAD_NO_SCALE )
return FT_Err_Ok; return FT_Err_Ok;
if ( face->size == NULL ) if ( face->size == NULL )
return FT_Err_Invalid_Size_Handle; return FT_Err_Invalid_Size_Handle;
if ( !(flags & FT_LOAD_VERTICAL_LAYOUT) ) if ( flags & FT_LOAD_VERTICAL_LAYOUT )
scale = face->size->metrics.x_scale;
else
scale = face->size->metrics.y_scale; scale = face->size->metrics.y_scale;
else
scale = face->size->metrics.x_scale;
/* this must be the same computation than to get linearHori/VertAdvance /* this must be the same computation as to get linearHori/VertAdvance */
* (see FT_Load_Glyph() implementation in src/base/ftobjs.c */ /* (see `FT_Load_Glyph' implementation in src/base/ftobjs.c */
for (nn = 0; nn < count; nn++)
for ( nn = 0; nn < count; nn++ )
advances[nn] = FT_MulDiv( advances[nn], scale, 64 ); advances[nn] = FT_MulDiv( advances[nn], scale, 64 );
return 0; return FT_Err_Ok;
} }
/* at the moment, we can perform fast advance retrieval only in /* at the moment, we can perform fast advance retrieval only in */
the following cases: /* the following cases: */
/* */
/* - unscaled load */
/* - unhinted load */
/* - light-hinted load */
- unscaled load #define LOAD_ADVANCE_FAST_CHECK( flags ) \
- unhinted load ( flags & ( FT_LOAD_NO_SCALE | FT_LOAD_NO_HINTING ) || \
- light-hinted load FT_LOAD_TARGET_MODE( flags ) == FT_RENDER_MODE_LIGHT )
*/
#define LOAD_ADVANCE_FAST_CHECK(flags) \
(((flags & (FT_LOAD_NO_SCALE | FT_LOAD_NO_HINTING)) != 0) || \
FT_LOAD_TARGET_MODE(flags) == FT_RENDER_MODE_LIGHT)
FT_EXPORT_DEF(FT_Error)
/* documentation is in ftadvanc.h */
FT_EXPORT_DEF( FT_Error )
FT_Get_Advance( FT_Face face, FT_Get_Advance( FT_Face face,
FT_UInt gindex, FT_UInt gindex,
FT_UInt flags, FT_UInt flags,
@ -50,22 +74,24 @@
{ {
FT_Face_GetAdvancesFunc func; FT_Face_GetAdvancesFunc func;
if ( !face ) if ( !face )
return FT_Err_Invalid_Face_Handle; return FT_Err_Invalid_Face_Handle;
if (gindex >= (FT_UInt) face->num_glyphs ) if ( gindex >= (FT_UInt)face->num_glyphs )
return FT_Err_Invalid_Glyph_Index; return FT_Err_Invalid_Glyph_Index;
func = face->driver->clazz->get_advances; func = face->driver->clazz->get_advances;
if (func != NULL && LOAD_ADVANCE_FAST_CHECK(flags)) if ( func && LOAD_ADVANCE_FAST_CHECK( flags ) )
{ {
FT_Error error; FT_Error error;
error = func( face, gindex, 1, flags, padvance ); error = func( face, gindex, 1, flags, padvance );
if (!error) if ( !error )
return _ft_face_scale_advances( face, padvance, 1, flags ); return _ft_face_scale_advances( face, padvance, 1, flags );
if (error != FT_Err_Unimplemented_Feature) if ( error != FT_Err_Unimplemented_Feature )
return error; return error;
} }
@ -73,7 +99,9 @@
} }
FT_EXPORT_DEF(FT_Error) /* documentation is in ftadvanc.h */
FT_EXPORT_DEF( FT_Error )
FT_Get_Advances( FT_Face face, FT_Get_Advances( FT_Face face,
FT_UInt start, FT_UInt start,
FT_UInt count, FT_UInt count,
@ -82,46 +110,54 @@
{ {
FT_Face_GetAdvancesFunc func; FT_Face_GetAdvancesFunc func;
FT_UInt num, end, nn; FT_UInt num, end, nn;
FT_Error error = 0; FT_Error error = FT_Err_Ok;
if ( !face ) if ( !face )
return FT_Err_Invalid_Face_Handle; return FT_Err_Invalid_Face_Handle;
num = (FT_UInt) face->num_glyphs; num = (FT_UInt)face->num_glyphs;
end = start + count; end = start + count;
if (start >= num || end < start || end > num) if ( start >= num || end < start || end > num )
return FT_Err_Invalid_Glyph_Index; return FT_Err_Invalid_Glyph_Index;
if (count == 0) if ( count == 0 )
return FT_Err_Ok; return FT_Err_Ok;
func = face->driver->clazz->get_advances; func = face->driver->clazz->get_advances;
if (func != NULL && LOAD_ADVANCE_FAST_CHECK(flags)) if ( func && LOAD_ADVANCE_FAST_CHECK( flags ) )
{ {
error = func( face, start, count, flags, padvances ); error = func( face, start, count, flags, padvances );
if (!error) goto Exit; if ( !error )
goto Exit;
if (error != FT_Err_Unimplemented_Feature) if ( error != FT_Err_Unimplemented_Feature )
return error; return error;
} }
error = 0; error = FT_Err_Ok;
if ((flags & FT_ADVANCE_FLAG_FAST_ONLY) != 0) if ( flags & FT_ADVANCE_FLAG_FAST_ONLY )
return FT_Err_Unimplemented_Feature; return FT_Err_Unimplemented_Feature;
flags |= FT_LOAD_ADVANCE_ONLY; flags |= FT_LOAD_ADVANCE_ONLY;
for (nn = 0; nn < count; nn++) for ( nn = 0; nn < count; nn++ )
{ {
error = FT_Load_Glyph( face, start+nn, flags ); error = FT_Load_Glyph( face, start + nn, flags );
if (error) break; if ( error )
break;
padvances[nn] = (flags & FT_LOAD_VERTICAL_LAYOUT) padvances[nn] = ( flags & FT_LOAD_VERTICAL_LAYOUT )
? face->glyph->advance.x ? face->glyph->advance.x
: face->glyph->advance.y; : face->glyph->advance.y;
} }
if (error) return error;
if ( error )
return error;
Exit: Exit:
return _ft_face_scale_advances( face, padvances, count, flags ); return _ft_face_scale_advances( face, padvances, count, flags );
} }
/* END */

View File

@ -38,8 +38,8 @@
#include FT_INTERNAL_DEBUG_H #include FT_INTERNAL_DEBUG_H
#include FT_INTERNAL_OBJECTS_H #include FT_INTERNAL_OBJECTS_H
#ifdef FT_MULFIX_INLINED #ifdef FT_MULFIX_INLINED
#undef FT_MulFix #undef FT_MulFix
#endif #endif
/* we need to define a 64-bits data type here */ /* we need to define a 64-bits data type here */
@ -197,18 +197,32 @@
FT_Long b ) FT_Long b )
{ {
#ifdef FT_MULFIX_ASSEMBLER #ifdef FT_MULFIX_ASSEMBLER
return FT_MULFIX_ASSEMBLER(a,b);
return FT_MULFIX_ASSEMBLER( a, b );
#else #else
FT_Int s = 1; FT_Int s = 1;
FT_Long c; FT_Long c;
if ( a < 0 ) { a = -a; s = -1; } if ( a < 0 )
if ( b < 0 ) { b = -b; s = -s; } {
a = -a;
s = -1;
}
if ( b < 0 )
{
b = -b;
s = -s;
}
c = (FT_Long)( ( (FT_Int64)a * b + 0x8000L ) >> 16 ); c = (FT_Long)( ( (FT_Int64)a * b + 0x8000L ) >> 16 );
return ( s > 0 ) ? c : -c ;
#endif return ( s > 0 ) ? c : -c;
#endif /* FT_MULFIX_ASSEMBLER */
} }
@ -421,7 +435,9 @@
FT_Long b ) FT_Long b )
{ {
#ifdef FT_MULFIX_ASSEMBLER #ifdef FT_MULFIX_ASSEMBLER
return FT_MULFIX_ASSEMBLER(a,b);
return FT_MULFIX_ASSEMBLER( a, b );
#elif 0 #elif 0
/* /*

View File

@ -3,7 +3,7 @@
# #
# Copyright 1996-2000, 2002, 2003, 2004, 2005, 2006, 2007 by # Copyright 1996-2000, 2002, 2003, 2004, 2005, 2006, 2007, 2008 by
# David Turner, Robert Wilhelm, and Werner Lemberg. # David Turner, Robert Wilhelm, and Werner Lemberg.
# #
# This file is part of the FreeType project, and may only be used, modified, # This file is part of the FreeType project, and may only be used, modified,
@ -47,7 +47,6 @@ BASE_SRC := $(BASE_DIR)/ftcalc.c \
$(BASE_DIR)/ftutil.c \ $(BASE_DIR)/ftutil.c \
$(BASE_DIR)/ftadvanc.c $(BASE_DIR)/ftadvanc.c
# Base layer `extensions' sources # Base layer `extensions' sources
# #
# An extension is added to the library file as a separate object. It is # An extension is added to the library file as a separate object. It is

16
src/cache/ftccmap.c vendored
View File

@ -4,7 +4,7 @@
/* */ /* */
/* FreeType CharMap cache (body) */ /* FreeType CharMap cache (body) */
/* */ /* */
/* Copyright 2000-2001, 2002, 2003, 2004, 2005, 2006, 2007 by */ /* Copyright 2000-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */ /* */
/* This file is part of the FreeType project, and may only be used, */ /* This file is part of the FreeType project, and may only be used, */
@ -290,14 +290,14 @@
FT_UInt32 hash; FT_UInt32 hash;
FT_Int no_cmap_change = 0; FT_Int no_cmap_change = 0;
if (cmap_index < 0)
if ( cmap_index < 0 )
{ {
/* treat a negative cmap index as a special value that /* Treat a negative cmap index as a special value, meaning that you */
* means you don't want to change the FT_Face's character /* don't want to change the FT_Face's character map through this */
* map through this call. this can be useful when the /* call. This can be useful if the face requester callback already */
* face requester callback already set the face's charmap /* sets the face's charmap to the appropriate value. */
* to the appropriate value.
*/
no_cmap_change = 1; no_cmap_change = 1;
cmap_index = 0; cmap_index = 0;
} }

View File

@ -4,7 +4,7 @@
/* */ /* */
/* OpenType font driver implementation (body). */ /* OpenType font driver implementation (body). */
/* */ /* */
/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007 by */ /* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */ /* */
/* This file is part of the FreeType project, and may only be used, */ /* This file is part of the FreeType project, and may only be used, */
@ -187,32 +187,36 @@
} }
FT_CALLBACK_DEF(FT_Error) FT_CALLBACK_DEF( FT_Error )
cff_get_advances( FT_Face ftface, cff_get_advances( FT_Face ftface,
FT_UInt start, FT_UInt start,
FT_UInt count, FT_UInt count,
FT_UInt flags, FT_UInt flags,
FT_Fixed* advances ) FT_Fixed* advances )
{ {
CFF_Face face = (CFF_Face) ftface; CFF_Face face = (CFF_Face)ftface;
FT_UInt nn; FT_UInt nn;
FT_Error error = 0; FT_Error error = CFF_Err_Ok;
FT_GlyphSlot slot = face->root.glyph; FT_GlyphSlot slot = face->root.glyph;
flags |= FT_LOAD_ADVANCE_ONLY; flags |= FT_LOAD_ADVANCE_ONLY;
for (nn = 0; nn < count; nn++) for ( nn = 0; nn < count; nn++ )
{ {
error = Load_Glyph( slot, face->root.size, start+nn, flags ); error = Load_Glyph( slot, face->root.size, start+nn, flags );
if (error) break; if ( error )
break;
advances[nn] = (flags & FT_LOAD_VERTICAL_LAYOUT) advances[nn] = ( flags & FT_LOAD_VERTICAL_LAYOUT )
? slot->advance.y ? slot->advance.y
: slot->advance.x; : slot->advance.x;
} }
return error; return error;
} }
/* /*
* GLYPH DICT SERVICE * GLYPH DICT SERVICE
* *

View File

@ -384,12 +384,14 @@
decoder->hint_mode = hint_mode; decoder->hint_mode = hint_mode;
} }
FT_LOCAL_DEF( void ) FT_LOCAL_DEF( void )
cff_decoder_set_width_only( CFF_Decoder* decoder ) cff_decoder_set_width_only( CFF_Decoder* decoder )
{ {
decoder->width_only = 1; decoder->width_only = 1;
} }
/* this function is used to select the subfont */ /* this function is used to select the subfont */
/* and the locals subrs array */ /* and the locals subrs array */
FT_LOCAL_DEF( FT_Error ) FT_LOCAL_DEF( FT_Error )
@ -1205,9 +1207,9 @@
decoder->glyph_width = decoder->nominal_width + decoder->glyph_width = decoder->nominal_width +
( stack[0] >> 16 ); ( stack[0] >> 16 );
if (decoder->width_only) if ( decoder->width_only )
{ {
/* we only want the advance width, stop here */ /* we only want the advance width; stop here */
break; break;
} }
@ -2570,11 +2572,11 @@
cff_decoder_init( &decoder, face, size, glyph, hinting, cff_decoder_init( &decoder, face, size, glyph, hinting,
FT_LOAD_TARGET_MODE( load_flags ) ); FT_LOAD_TARGET_MODE( load_flags ) );
if ((load_flags & FT_LOAD_ADVANCE_ONLY) != 0) if ( load_flags & FT_LOAD_ADVANCE_ONLY )
cff_decoder_set_width_only( &decoder ); cff_decoder_set_width_only( &decoder );
decoder.builder.no_recurse = decoder.builder.no_recurse =
(FT_Bool)( ( load_flags & FT_LOAD_NO_RECURSE ) != 0 ); (FT_Bool)( load_flags & FT_LOAD_NO_RECURSE );
/* now load the unscaled outline */ /* now load the unscaled outline */
error = cff_get_glyph_data( face, glyph_index, error = cff_get_glyph_data( face, glyph_index,
@ -2681,7 +2683,7 @@
has_vertical_info = FT_BOOL( face->vertical_info && has_vertical_info = FT_BOOL( face->vertical_info &&
face->vertical.number_Of_VMetrics > 0 && face->vertical.number_Of_VMetrics > 0 &&
face->vertical.long_metrics != 0 ); face->vertical.long_metrics );
/* get the vertical metrics from the vtmx table if we have one */ /* get the vertical metrics from the vtmx table if we have one */
if ( has_vertical_info ) if ( has_vertical_info )

View File

@ -4,7 +4,7 @@
/* */ /* */
/* TrueType font driver implementation (body). */ /* TrueType font driver implementation (body). */
/* */ /* */
/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007 by */ /* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */ /* */
/* This file is part of the FreeType project, and may only be used, */ /* This file is part of the FreeType project, and may only be used, */
@ -134,33 +134,38 @@
{ {
FT_UInt nn; FT_UInt nn;
TT_Face face = (TT_Face) ttface; TT_Face face = (TT_Face) ttface;
FT_Bool check = FT_BOOL(!(flags & FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH)); FT_Bool check = FT_BOOL(
!( flags & FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH ) );
/* XXX: TODO: check for sbits */ /* XXX: TODO: check for sbits */
if (flags & FT_LOAD_VERTICAL_LAYOUT) if ( flags & FT_LOAD_VERTICAL_LAYOUT )
{ {
for (nn = 0; nn < count; nn++) for ( nn = 0; nn < count; nn++ )
{ {
FT_Short tsb; FT_Short tsb;
FT_UShort ah; FT_UShort ah;
TT_Get_VMetrics( face, start + nn, check, &tsb, &ah ); TT_Get_VMetrics( face, start + nn, check, &tsb, &ah );
advances[nn] = ah; advances[nn] = ah;
} }
} }
else else
{ {
for (nn = 0; nn < count; nn++) for ( nn = 0; nn < count; nn++ )
{ {
FT_Short lsb; FT_Short lsb;
FT_UShort aw; FT_UShort aw;
TT_Get_HMetrics( face, start + nn, check, &lsb, &aw ); TT_Get_HMetrics( face, start + nn, check, &lsb, &aw );
advances[nn] = aw; advances[nn] = aw;
} }
} }
return 0;
return TT_Err_Ok;
} }
/*************************************************************************/ /*************************************************************************/

View File

@ -4,7 +4,7 @@
/* */ /* */
/* TrueType Glyph Loader (specification). */ /* TrueType Glyph Loader (specification). */
/* */ /* */
/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006 by */ /* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2008 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */ /* */
/* This file is part of the FreeType project, and may only be used, */ /* This file is part of the FreeType project, and may only be used, */
@ -34,14 +34,14 @@ FT_BEGIN_HEADER
FT_LOCAL( void ) FT_LOCAL( void )
TT_Init_Glyph_Loading( TT_Face face ); TT_Init_Glyph_Loading( TT_Face face );
FT_LOCAL(void) FT_LOCAL( void )
TT_Get_HMetrics( TT_Face face, TT_Get_HMetrics( TT_Face face,
FT_UInt idx, FT_UInt idx,
FT_Bool check, FT_Bool check,
FT_Short* lsb, FT_Short* lsb,
FT_UShort* aw ); FT_UShort* aw );
FT_LOCAL(void) FT_LOCAL( void )
TT_Get_VMetrics( TT_Face face, TT_Get_VMetrics( TT_Face face,
FT_UInt idx, FT_UInt idx,
FT_Bool check, FT_Bool check,

View File

@ -4,7 +4,7 @@
/* */ /* */
/* Type 1 Glyph Loader (body). */ /* Type 1 Glyph Loader (body). */
/* */ /* */
/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006 by */ /* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2008 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */ /* */
/* This file is part of the FreeType project, and may only be used, */ /* This file is part of the FreeType project, and may only be used, */
@ -215,12 +215,15 @@
FT_UInt nn; FT_UInt nn;
FT_Error error; FT_Error error;
if (load_flags & FT_LOAD_VERTICAL_LAYOUT) FT_UNUSED( load_flags );
{
for (nn = 0; nn < count; nn++)
advances[nn] = 0;
return T1_Err_Ok;
if ( load_flags & FT_LOAD_VERTICAL_LAYOUT )
{
for ( nn = 0; nn < count; nn++ )
advances[nn] = 0;
return T1_Err_Ok;
} }
error = psaux->t1_decoder_funcs->init( &decoder, error = psaux->t1_decoder_funcs->init( &decoder,
@ -235,14 +238,12 @@
if ( error ) if ( error )
return error; return error;
FT_UNUSED(load_flags);
decoder.builder.metrics_only = 1; decoder.builder.metrics_only = 1;
decoder.builder.load_points = 0; decoder.builder.load_points = 0;
decoder.num_subrs = type1->num_subrs; decoder.num_subrs = type1->num_subrs;
decoder.subrs = type1->subrs; decoder.subrs = type1->subrs;
decoder.subrs_len = type1->subrs_len; decoder.subrs_len = type1->subrs_len;
decoder.buildchar = face->buildchar; decoder.buildchar = face->buildchar;
decoder.len_buildchar = face->len_buildchar; decoder.len_buildchar = face->len_buildchar;
@ -250,11 +251,12 @@
for ( nn = 0; nn < count; nn++ ) for ( nn = 0; nn < count; nn++ )
{ {
error = T1_Parse_Glyph( &decoder, first + nn ); error = T1_Parse_Glyph( &decoder, first + nn );
if (!error) if ( !error )
advances[nn] = decoder.builder.advance.x; advances[nn] = decoder.builder.advance.x;
else else
advances[nn] = 0; advances[nn] = 0;
} }
return T1_Err_Ok; return T1_Err_Ok;
} }

View File

@ -4,7 +4,7 @@
/* */ /* */
/* Type 1 Glyph Loader (specification). */ /* Type 1 Glyph Loader (specification). */
/* */ /* */
/* Copyright 1996-2001, 2002, 2003 by */ /* Copyright 1996-2001, 2002, 2003, 2008 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */ /* */
/* This file is part of the FreeType project, and may only be used, */ /* This file is part of the FreeType project, and may only be used, */