* 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
Родитель 8d3e6ecc3c
Коммит b211651ac9
27 изменённых файлов: 693 добавлений и 429 удалений

167
ChangeLog
Просмотреть файл

@ -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>
* 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
FT_SIZEOF_{INT|LONG} from include/freetype/config/ftconfig.h.
If FT_USE_AUTOCONF_SIZEOF_TYPES is defined, the cpp computation
is disabled and the statically configured sizes are used.
This fixes Savannah bug #21250
(FT_USE_AUTOCONF_SIZEOF_TYPES): New macro. If defined, the cpp
computation is disabled and the statically configured sizes are
used. This fixes Savannah bug #21250.
* builds/unix/configure.raw: Add the checks to compare the
cpp computation results of the bit length of int and long
versus the sizes detected by running configure. If the results
are different, FT_USE_AUTOCONF_SIZEOF_TYPES is defined to
prioritize the results detected by running configure.
New option --{enable|disable}-biarch-config is added to
define or undefine FT_USE_AUTOCONF_SIZEOF_TYPES manually.
* builds/unix/configure.raw: Add the checks to compare the cpp
computation results of the bit length of int and long versus the
sizes detected by running `configure'. If the results are
different, FT_USE_AUTOCONF_SIZEOF_TYPES is defined to prioritize the
results.
New option --{enable|disable}-biarch-config is added to define or
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
or ApplicationService framework is missing. Although this
value is not used in building of FreeType2, it is written in
freetype2.pc and freetype-config.
* builds/unix/configure.raw: Clear FT2_EXTRA_LIBS when Carbon or
ApplicationService framework is missing. Although this value is not
used in building of FreeType2, it is written in `freetype2.pc' and
`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:
modify FTC_CMapCache_Lookup to accept a negative cmap index
to mean "use default cached FT_Face's charmap". This fixes
Savannah issue #22625
* src/cache/ftccmap.c (FTC_CMapCache_Lookup): Accept a negative cmap
index to mean `use default cached FT_Face's charmap'. This fixes
Savannah bug #22625.
* include/freetype/ftcache.h: Document it.
* include/freetype/ftoption.h, include/freetype/ftconfig.h,
builds/unix/ftconfig.in, include/freetype/freetype.h,
src/base/ftcalc.c:
Make FT_MulFix an inlined function. Also provide an assembler
implementation for ARM architectures. this is done to speedup
Make FT_MulFix an inlined function. This is done to speed up
FreeType a little (on x86 3% when loading+hinting, 10% when
rendering, ARM savings are more important though).
Disable this by undefining FT_CONFIG_OPTION_INLINE_MULFIX in
ftconfig.h
rendering, ARM savings are more important though). Disable this by
undefining FT_CONFIG_OPTION_INLINE_MULFIX.
* include/freetype/ftadvanc.h, src/base/ftadvanc.c,
include/freetype/config/ftheader.h, include/freetype/freetype.h,
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)
Use of assembler code can now be controlled with
FT_CONFIG_OPTION_NO_ASSEMBLER.
* autogen.sh: add checks for minimum version of the 'autotools'
stuff.
* include/freetype/config/ftconfig.h, builds/unix/ftconfig.in
[!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
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
#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,
even if passed library or arguments are invalid. This fixes a bug
@ -83,7 +150,7 @@
(FT_Open_Face): Ditto (stream).
(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
`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
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,
all-in-one header file `Carbon.h' is replaced by the minimum
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
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.
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
and define HAVE_TYPE_RESOURCE_INDEX if it is defined. Mac OS X 10.5
@ -318,7 +385,7 @@
* 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
but LDFLAGS does not, import it to LDFLAGS. The option is used to
@ -549,7 +616,7 @@
* 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,
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
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
in the TrueType bytecode loader.

Просмотреть файл

@ -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
file permissions for the `configure' and auxiliary scripts.
The autogen.sh script now checks the version of your installed auto tools
to see if they match the numbers above. If not, it will complain and suggest
either upgrading or using an environment variable to point to a more recent
version of the required tool(s).
The autogen.sh script now checks the version of above three packages
whether they match the numbers above. Otherwise it will complain and
suggest either upgrading or using an environment variable to point to
a more recent version of the required tool(s).
Note that 'aclocal' is provided by the 'automake' package on Linux, and
that 'libtoolize' is called 'glibtoolize' on Darwin (OS X)
Note that `aclocal' is provided by the `automake' package on Linux,
and that `libtoolize' is called `glibtoolize' on Darwin (OS X).
For static builds which don't use platform specific optimizations, no

Просмотреть файл

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

Просмотреть файл

@ -126,13 +126,14 @@ AC_CHECK_SIZEOF([int])
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])
orig_CPPFLAGS="${CPPFLAGS}"
CPPFLAGS="-I${srcdir} -I. ${CPPFLAGS}"
ac_clean_files="ft2build.h ftoption.h ftstdlib.h"
touch ft2build.h ftoption.h ftstdlib.h
cat > conftest.c <<\_ACEOF
#include <limits.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 "ac_cpp_ft_sizeof_long="${ac_cv_sizeof_long}
echo >> conftest.c "#endif"
${CPP} ${CPPFLAGS} conftest.c | ${GREP} ac_cpp_ft > conftest.sh
eval `cat conftest.sh`
${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
else
ft_use_autoconf_sizeof_types="yes"
ft_use_autoconf_sizeof_types=yes
fi
AC_ARG_ENABLE(biarch-config,
[ --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
:yes:yes: )
AC_MSG_RESULT([broken but use])
:yes:yes:)
AC_MSG_RESULT([broken but use it])
unset ft_use_autoconf_sizeof_types
;;
::no: )
AC_MSG_RESULT([works but ignore])
ft_use_autoconf_sizeof_types="yes"
::no:)
AC_MSG_RESULT([works but ignore it])
ft_use_autoconf_sizeof_types=yes
;;
::yes: | ::: )
::yes: | :::)
AC_MSG_RESULT([yes])
unset ft_use_autoconf_sizeof_types
;;
* )
*)
AC_MSG_RESULT([no])
ft_use_autoconf_sizeof_types="yes"
ft_use_autoconf_sizeof_types=yes
;;
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])
fi
CPPFLAGS="${orig_CPPFLAGS}"

Просмотреть файл

@ -4,7 +4,7 @@
/* */
/* 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. */
/* */
/* 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
#ifdef FT_USE_AUTOCONF_SIZEOF_TYPES
#undef SIZEOF_INT
#undef SIZEOF_LONG
#define FT_SIZEOF_INT SIZEOF_INT
#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 */
/* is copied from default include/freetype/config/ftconfig.h. */
@ -112,7 +114,8 @@ FT_BEGIN_HEADER
#error "Unsupported size of `long' type!"
#endif
#endif /* ! FT_USE_AUTOCONF_SIZEOF_TYPES */
#endif /* !FT_USE_AUTOCONF_SIZEOF_TYPES */
/* Preferred alignment of data */
#define FT_ALIGNMENT 8
@ -242,79 +245,13 @@ FT_BEGIN_HEADER
#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 */
/* in strict ANSI mode. To avoid them, we disable their use if */
/* __STDC__ is defined. You can however ignore this rule by */
/* defining the FT_CONFIG_OPTION_FORCE_INT64 configuration macro. */
/* in strict ANSI mode. To avoid them, we disable its use if __STDC__ */
/* is defined. You can however ignore this rule by defining the */
/* FT_CONFIG_OPTION_FORCE_INT64 configuration macro. */
/* */
#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 */
#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
#define FT_LOCAL( x ) static x

Просмотреть файл

@ -115,6 +115,27 @@ FT_BEGIN_HEADER
#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. */

Просмотреть файл

@ -4,7 +4,7 @@
/* */
/* 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. */
/* */
/* 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_STANDARD_LIBRARY_H
FT_BEGIN_HEADER
@ -212,6 +213,7 @@ FT_BEGIN_HEADER
#error "no 32bit type found -- please check your configuration files"
#endif
/* look up an integer type that is at least 32 bits */
#if FT_SIZEOF_INT >= (32 / FT_CHAR_BIT)
@ -225,67 +227,6 @@ FT_BEGIN_HEADER
#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 */
/* Autoconf */
@ -328,17 +269,12 @@ FT_BEGIN_HEADER
#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 */
/* in strict ANSI mode. To avoid them, we disable their use if */
/* __STDC__ is defined. You can however ignore this rule by */
/* defining the FT_CONFIG_OPTION_FORCE_INT64 configuration macro. */
/* in strict ANSI mode. To avoid them, we disable its use if __STDC__ */
/* is defined. You can however ignore this rule by defining the */
/* FT_CONFIG_OPTION_FORCE_INT64 configuration macro. */
/* */
#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 */
#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
#define FT_LOCAL( x ) static x

Просмотреть файл

@ -728,6 +728,7 @@
*/
#define FT_GASP_H <freetype/ftgasp.h>
/*************************************************************************
*
* @macro:
@ -735,9 +736,10 @@
*
* @description:
* 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>
/* */

Просмотреть файл

@ -112,25 +112,26 @@ FT_BEGIN_HEADER
/* file `ftconfig.h' either statically or through the */
/* `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 */
/* of performance-critical functions (e.g. FT_MulFix). you should only */
/* do that to verify that the assembler function works properly, or even */
/* to benchmarks the various implementations... */
/* 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 */
/*************************************************************************/
/* */
/* When this macro is defined, try to use an inlined assembler version */
/* of the FT_MulFix function, which appears to be a hotspot when loading */
/* and hinting glyphs. */
/* 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/cpu isn't supported, this will default to */
/* the standard and portable implementation found in src/base/ftcalc.c */
/* 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
@ -183,7 +184,7 @@ FT_BEGIN_HEADER
/* Do not #undef this macro here since the build system might define */
/* 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 */
/* them for certain configurations only. */
/* */
/* #define FT_EXPORT(x) extern x */
/* #define FT_EXPORT_DEF(x) x */
/* #define FT_EXPORT(x) extern x */
/* #define FT_EXPORT_DEF(x) x */
/*************************************************************************/

Просмотреть файл

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

Просмотреть файл

@ -2,9 +2,9 @@
/* */
/* 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. */
/* */
/* 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 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> */
/* FT_ADVANCE_FLAG_FAST_ONLY */
/* */
/* <Description> */
/* a bit-flag to be or-ed to the 'flags' parameter of the */
/* @FT_Get_Advance and @FT_Get_Advances. */
/* A bit-flag to be OR-ed with the `flags' parameter of the */
/* @FT_Get_Advance and @FT_Get_Advances functions. */
/* */
/* when set, it indicates that you want these functions to fail */
/* if the corresponding hinting mode or font driver doesn't */
/* allow for very quick advance computation. */
/* If set, it indicates that you want these functions to fail if the */
/* corresponding hinting mode or font driver doesn't allow for very */
/* quick advance computation. */
/* */
/* typically, unscaled, unhinted, bitmapped and light-hinted glyphs */
/* can have their advance width(s) computed very quickly. */
/* Typically, glyphs which are either unscaled, unhinted, bitmapped, */
/* or light-hinted can have their advance width computed very */
/* quickly. */
/* */
/* not so for normal and bytecode hinted modes, which require */
/* loading/scaling/hinting the glyph outline instead, which is */
/* extremely slow by comparison */
/* Normal and bytecode hinted modes, which require loading, scaling, */
/* and hinting of the glyph outline, are extremely slow by */
/* comparison. */
/* */
#define FT_ADVANCE_FLAG_FAST_ONLY 0x20000000U
#define FT_ADVANCE_FLAG_FAST_ONLY 0x20000000UL
/*************************************************************************/
@ -50,33 +81,37 @@
/* FT_Get_Advance */
/* */
/* <Description> */
/* Retrieve the advance of a given glyph outline in a @FT_Face. */
/* by default, the unhinted advance is returned in font units */
/* Retrieve the advance value of a given glyph outline in an */
/* @FT_Face. By default, the unhinted advance is returned in font */
/* units. */
/* */
/* <Input> */
/* face :: source @FT_Face handle */
/* gindex :: glyph index */
/* 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. */
/* face :: The source @FT_Face handle. */
/* */
/* gindex :: The glyph index. */
/* */
/* 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> */
/* padvance :: the advance value, in either font units or 16.16 */
/* padvance :: The advance value, in either font units or 16.16 */
/* 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. */
/* otherwise, it's the horizontal advance in an */
/* Otherwise, it is the horizontal advance in a */
/* horizontal layout. */
/* */
/* <Return> */
/* FreeType error code. 0 means success. */
/* */
/* <Note> */
/* 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. */
/* */
/* A scaled advance is returned in 16.16 format, but isn't */
/* transformed by the affine transform specified by @FT_Set_Transform */
/* A scaled advance is returned in 16.16 format but isn't transformed */
/* by the affine transformation specified by @FT_Set_Transform. */
/* */
FT_EXPORT( FT_Error )
FT_Get_Advance( FT_Face face,
@ -84,40 +119,47 @@
FT_UInt load_flags,
FT_Fixed *padvance );
/*************************************************************************/
/* */
/* <Function> */
/* FT_Get_Advances */
/* */
/* <Description> */
/* Retrieve the advance of several glyph outlines in a @FT_Face. */
/* by default, the unhinted advances are returned in font units */
/* Retrieve the advance values of several glyph outlines in an */
/* @FT_Face. By default, the unhinted advances are returned in font */
/* units. */
/* */
/* <Input> */
/* face :: source @FT_Face handle */
/* start :: first glyph index */
/* count :: number of advances you want to retrieve */
/* load_flags :: a set of bit-flags similar to those used when */
/* face :: The source @FT_Face handle. */
/* */
/* start :: The first glyph index. */
/* */
/* 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. */
/* */
/* <Output> */
/* padvance :: the advances, in either font units or 16.16 format. */
/* this array must contain at least 'count' elements */
/* padvance :: The advances, in either font units or 16.16 format. */
/* 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. */
/* otherwise, they are the horizontal advances in an */
/* Otherwise, they are the horizontal advances in a */
/* horizontal layout. */
/* */
/* <Return> */
/* FreeType error code. 0 means success. */
/* */
/* <Note> */
/* 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. */
/* */
/* Scaled advances are returned in 16.16 format, but aren't */
/* transformed by the affine transform specified by @FT_Set_Transform */
/* Scaled advances are returned in 16.16 format but aren't */
/* transformed by the affine transformation specified by */
/* @FT_Set_Transform. */
/* */
FT_EXPORT( FT_Error )
FT_Get_Advances( FT_Face face,
@ -128,4 +170,10 @@
/* */
#endif /* __FREETYPE_ADVANCE_H__ */
FT_END_HEADER
#endif /* __FTADVANC_H__ */
/* END */

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

@ -22,6 +22,13 @@
#include <ft2build.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:

Просмотреть файл

@ -23,6 +23,12 @@
#include <ft2build.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

Просмотреть файл

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

Просмотреть файл

@ -1,6 +1,6 @@
# 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.
#
# This file is part of the FreeType project, and may only be used, modified,

Просмотреть файл

@ -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 FT_ADVANCES_H
#include FT_INTERNAL_OBJECTS_H
static FT_Error
_ft_face_scale_advances( FT_Face face,
FT_Fixed* advances,
@ -11,38 +30,43 @@
FT_Fixed scale;
FT_UInt nn;
if ( (flags & FT_LOAD_NO_SCALE) )
if ( flags & FT_LOAD_NO_SCALE )
return FT_Err_Ok;
if ( face->size == NULL )
return FT_Err_Invalid_Size_Handle;
if ( !(flags & FT_LOAD_VERTICAL_LAYOUT) )
scale = face->size->metrics.x_scale;
else
if ( flags & FT_LOAD_VERTICAL_LAYOUT )
scale = face->size->metrics.y_scale;
else
scale = face->size->metrics.x_scale;
/* this must be the same computation than to get linearHori/VertAdvance
* (see FT_Load_Glyph() implementation in src/base/ftobjs.c */
for (nn = 0; nn < count; nn++)
/* this must be the same computation as to get linearHori/VertAdvance */
/* (see `FT_Load_Glyph' implementation in src/base/ftobjs.c */
for ( nn = 0; nn < count; nn++ )
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
the following cases:
/* at the moment, we can perform fast advance retrieval only in */
/* the following cases: */
/* */
/* - unscaled load */
/* - unhinted load */
/* - light-hinted load */
- unscaled load
- unhinted load
- light-hinted load
*/
#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)
#define LOAD_ADVANCE_FAST_CHECK( flags ) \
( flags & ( FT_LOAD_NO_SCALE | FT_LOAD_NO_HINTING ) || \
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_UInt gindex,
FT_UInt flags,
@ -50,22 +74,24 @@
{
FT_Face_GetAdvancesFunc func;
if ( !face )
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;
func = face->driver->clazz->get_advances;
if (func != NULL && LOAD_ADVANCE_FAST_CHECK(flags))
if ( func && LOAD_ADVANCE_FAST_CHECK( flags ) )
{
FT_Error error;
error = func( face, gindex, 1, flags, padvance );
if (!error)
if ( !error )
return _ft_face_scale_advances( face, padvance, 1, flags );
if (error != FT_Err_Unimplemented_Feature)
if ( error != FT_Err_Unimplemented_Feature )
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_UInt start,
FT_UInt count,
@ -82,46 +110,54 @@
{
FT_Face_GetAdvancesFunc func;
FT_UInt num, end, nn;
FT_Error error = 0;
FT_Error error = FT_Err_Ok;
if ( !face )
return FT_Err_Invalid_Face_Handle;
num = (FT_UInt) face->num_glyphs;
num = (FT_UInt)face->num_glyphs;
end = start + count;
if (start >= num || end < start || end > num)
if ( start >= num || end < start || end > num )
return FT_Err_Invalid_Glyph_Index;
if (count == 0)
return FT_Err_Ok;
if ( count == 0 )
return FT_Err_Ok;
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 );
if (!error) goto Exit;
if ( !error )
goto Exit;
if (error != FT_Err_Unimplemented_Feature)
if ( error != FT_Err_Unimplemented_Feature )
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;
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 );
if (error) break;
error = FT_Load_Glyph( face, start + nn, flags );
if ( error )
break;
padvances[nn] = (flags & FT_LOAD_VERTICAL_LAYOUT)
? face->glyph->advance.x
: face->glyph->advance.y;
padvances[nn] = ( flags & FT_LOAD_VERTICAL_LAYOUT )
? face->glyph->advance.x
: face->glyph->advance.y;
}
if (error) return error;
if ( error )
return error;
Exit:
return _ft_face_scale_advances( face, padvances, count, flags );
}
/* END */

Просмотреть файл

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

Просмотреть файл

@ -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.
#
# 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)/ftadvanc.c
# Base layer `extensions' sources
#
# An extension is added to the library file as a separate object. It is

16
src/cache/ftccmap.c поставляемый
Просмотреть файл

@ -4,7 +4,7 @@
/* */
/* 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. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@ -290,14 +290,14 @@
FT_UInt32 hash;
FT_Int no_cmap_change = 0;
if (cmap_index < 0)
if ( cmap_index < 0 )
{
/* treat a negative cmap index as a special value that
* means you don't want to change the FT_Face's character
* map through this call. this can be useful when the
* face requester callback already set the face's charmap
* to the appropriate value.
*/
/* Treat a negative cmap index as a special value, meaning that you */
/* don't want to change the FT_Face's character map through this */
/* call. This can be useful if the face requester callback already */
/* sets the face's charmap to the appropriate value. */
no_cmap_change = 1;
cmap_index = 0;
}

Просмотреть файл

@ -4,7 +4,7 @@
/* */
/* 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. */
/* */
/* 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,
FT_UInt start,
FT_UInt count,
FT_UInt flags,
FT_Fixed* advances )
{
CFF_Face face = (CFF_Face) ftface;
CFF_Face face = (CFF_Face)ftface;
FT_UInt nn;
FT_Error error = 0;
FT_GlyphSlot slot = face->root.glyph;
FT_Error error = CFF_Err_Ok;
FT_GlyphSlot slot = face->root.glyph;
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 );
if (error) break;
if ( error )
break;
advances[nn] = (flags & FT_LOAD_VERTICAL_LAYOUT)
? slot->advance.y
: slot->advance.x;
advances[nn] = ( flags & FT_LOAD_VERTICAL_LAYOUT )
? slot->advance.y
: slot->advance.x;
}
return error;
}
/*
* GLYPH DICT SERVICE
*

Просмотреть файл

@ -384,12 +384,14 @@
decoder->hint_mode = hint_mode;
}
FT_LOCAL_DEF( void )
cff_decoder_set_width_only( CFF_Decoder* decoder )
{
decoder->width_only = 1;
}
/* this function is used to select the subfont */
/* and the locals subrs array */
FT_LOCAL_DEF( FT_Error )
@ -1205,9 +1207,9 @@
decoder->glyph_width = decoder->nominal_width +
( 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;
}
@ -2570,11 +2572,11 @@
cff_decoder_init( &decoder, face, size, glyph, hinting,
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 );
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 */
error = cff_get_glyph_data( face, glyph_index,
@ -2681,7 +2683,7 @@
has_vertical_info = FT_BOOL( face->vertical_info &&
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 */
if ( has_vertical_info )

Просмотреть файл

@ -4,7 +4,7 @@
/* */
/* 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. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@ -134,33 +134,38 @@
{
FT_UInt nn;
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 */
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_UShort ah;
TT_Get_VMetrics( face, start + nn, check, &tsb, &ah );
advances[nn] = ah;
}
}
else
{
for (nn = 0; nn < count; nn++)
for ( nn = 0; nn < count; nn++ )
{
FT_Short lsb;
FT_UShort aw;
TT_Get_HMetrics( face, start + nn, check, &lsb, &aw );
advances[nn] = aw;
}
}
return 0;
return TT_Err_Ok;
}
/*************************************************************************/

Просмотреть файл

@ -4,7 +4,7 @@
/* */
/* 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. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@ -34,14 +34,14 @@ FT_BEGIN_HEADER
FT_LOCAL( void )
TT_Init_Glyph_Loading( TT_Face face );
FT_LOCAL(void)
FT_LOCAL( void )
TT_Get_HMetrics( TT_Face face,
FT_UInt idx,
FT_Bool check,
FT_Short* lsb,
FT_UShort* aw );
FT_LOCAL(void)
FT_LOCAL( void )
TT_Get_VMetrics( TT_Face face,
FT_UInt idx,
FT_Bool check,

Просмотреть файл

@ -4,7 +4,7 @@
/* */
/* 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. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@ -215,12 +215,15 @@
FT_UInt nn;
FT_Error error;
if (load_flags & FT_LOAD_VERTICAL_LAYOUT)
{
for (nn = 0; nn < count; nn++)
advances[nn] = 0;
FT_UNUSED( load_flags );
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,
@ -235,14 +238,12 @@
if ( error )
return error;
FT_UNUSED(load_flags);
decoder.builder.metrics_only = 1;
decoder.builder.load_points = 0;
decoder.num_subrs = type1->num_subrs;
decoder.subrs = type1->subrs;
decoder.subrs_len = type1->subrs_len;
decoder.num_subrs = type1->num_subrs;
decoder.subrs = type1->subrs;
decoder.subrs_len = type1->subrs_len;
decoder.buildchar = face->buildchar;
decoder.len_buildchar = face->len_buildchar;
@ -250,11 +251,12 @@
for ( nn = 0; nn < count; nn++ )
{
error = T1_Parse_Glyph( &decoder, first + nn );
if (!error)
if ( !error )
advances[nn] = decoder.builder.advance.x;
else
advances[nn] = 0;
}
return T1_Err_Ok;
}

Просмотреть файл

@ -4,7 +4,7 @@
/* */
/* 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. */
/* */
/* This file is part of the FreeType project, and may only be used, */