Formatting.
Rudimentary support for autoconf (still using GNU make) Say `make unix'.
This commit is contained in:
parent
c49f69cb8c
commit
d060a75b0d
@ -4,11 +4,11 @@
|
||||
/* */
|
||||
/* Memory debugging functions (body only). */
|
||||
/* */
|
||||
/* Copyright 1996-1999 by */
|
||||
/* Copyright 1996-2000 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 */
|
||||
/* 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. */
|
||||
@ -46,9 +46,7 @@
|
||||
{
|
||||
/* Now print the remaining blocks */
|
||||
if ( num_mem_blocks == 0 )
|
||||
{
|
||||
fprintf( stderr, "No memory leaked!\n" );
|
||||
}
|
||||
else
|
||||
{
|
||||
int i;
|
||||
@ -66,6 +64,7 @@
|
||||
(long)mem_blocks[i].base, mem_blocks[i].size );
|
||||
}
|
||||
}
|
||||
|
||||
free( mem_blocks );
|
||||
}
|
||||
|
||||
|
@ -57,6 +57,11 @@
|
||||
# object builds, respectively). Set up cumulatively in
|
||||
# `src/<driver>/rules.mk'.
|
||||
#
|
||||
# CLEAN
|
||||
# DISTCLEAN The sub-makefiles can append additional stuff to these two
|
||||
# variables which is to be removed for the `clean' resp.
|
||||
# `distclean' target.
|
||||
#
|
||||
# TOP, SEP,
|
||||
# LIBRARY, CC,
|
||||
# A, I, O, T Check `config.mk' for details.
|
||||
@ -242,20 +247,20 @@ library: $(FT_LIBRARY)
|
||||
# on all systems though.
|
||||
#
|
||||
clean_freetype_std:
|
||||
-$(DELETE) $(BASE_OBJECTS) $(OBJ_M) $(OBJ_S)
|
||||
-$(DELETE) $(BASE_OBJECTS) $(OBJ_M) $(OBJ_S) $(CLEAN)
|
||||
|
||||
distclean_freetype_std: clean_freetype_std
|
||||
-$(DELETE) $(FT_LIBRARY)
|
||||
-$(DELETE) *.orig *~ core *.core
|
||||
-$(DELETE) *.orig *~ core *.core $(DISTCLEAN)
|
||||
|
||||
# The Dos command shell does not support very long list of arguments, so
|
||||
# we are stuck with wildcards.
|
||||
#
|
||||
clean_freetype_dos:
|
||||
-$(DELETE) $(subst $(SEP),$(HOSTSEP),$(OBJ_))*.$O 2> nul
|
||||
-$(DELETE) $(subst $(SEP),$(HOSTSEP),$(OBJ_))*.$O $(CLEAN) 2> nul
|
||||
|
||||
distclean_freetype_dos: clean_freetype_dos
|
||||
-$(DELETE) $(subst $(SEP),$(HOSTSEP),$(FT_LIBRARY)) 2> nul
|
||||
-$(DELETE) $(subst $(SEP),$(HOSTSEP),$(FT_LIBRARY)) $(DISTCLEAN) 2> nul
|
||||
|
||||
# Remove configuration file (used for distclean).
|
||||
#
|
||||
|
2514
builds/unix/configure
vendored
Normal file
2514
builds/unix/configure
vendored
Normal file
File diff suppressed because it is too large
Load Diff
@ -2,29 +2,23 @@ dnl This file is part of the FreeType project.
|
||||
dnl
|
||||
dnl Process this file with autoconf to produce a configure script.
|
||||
dnl
|
||||
dnl This file must be processed from the top FreeType 2 directory. E.g:
|
||||
dnl
|
||||
dnl % autoconf config/unix/configure.in > config/unix/configure
|
||||
dnl
|
||||
|
||||
AC_INIT(ftconfig.in)
|
||||
|
||||
cnl Configuration file - stay in 8.3 limit
|
||||
dnl Configuration file - stay in 8.3 limit
|
||||
AC_CONFIG_HEADER(ftconfig.h:ftconfig.in)
|
||||
|
||||
dnl Due to a bug in autoconf we must set $srcdir explicitly to an absolute
|
||||
dnl path.
|
||||
srcdir=`pwd`
|
||||
version_info='0:0:0'
|
||||
AC_SUBST(version_info)
|
||||
|
||||
dnl Checks for system type.
|
||||
dnl checks for system type
|
||||
AC_CANONICAL_SYSTEM
|
||||
|
||||
dnl Checks for programs.
|
||||
dnl checks for programs
|
||||
AC_PROG_CC
|
||||
AC_PROG_CPP
|
||||
|
||||
dnl get Compiler flags right.
|
||||
|
||||
if test "x$CC" = xgcc; then
|
||||
XX_CFLAGS="-Wall"
|
||||
XX_ANSIFLAGS="-pedantic -ansi"
|
||||
@ -46,17 +40,12 @@ AC_SUBST(XX_ANSIFLAGS)
|
||||
AC_CHECK_PROG(RMF, rm, rm -f)
|
||||
AC_CHECK_PROG(RMDIR, rmdir, rmdir)
|
||||
AC_PROG_INSTALL
|
||||
AC_PROG_LN_S
|
||||
|
||||
dnl Checks for libraries.
|
||||
sinclude(net.m4)
|
||||
AC_LIBRARY_NET
|
||||
dnl checks for header files
|
||||
AC_HEADER_STDC
|
||||
AC_CHECK_HEADERS(fcntl.h unistd.h)
|
||||
|
||||
dnl Checks for header files.
|
||||
AC_PATH_XTRA
|
||||
AC_CHECK_HEADERS(stdlib.h fcntl.h unistd.h)
|
||||
|
||||
dnl Checks for typedefs, structures, and compiler characteristics.
|
||||
dnl checks for typedefs, structures, and compiler characteristics
|
||||
AC_C_CONST
|
||||
AC_CHECK_SIZEOF(int)
|
||||
AC_CHECK_SIZEOF(long)
|
||||
@ -66,30 +55,20 @@ dnl Checks for library functions.
|
||||
dnl Here we check whether we can use our mmap file component.
|
||||
AC_FUNC_MMAP
|
||||
if test "$ac_cv_func_mmap_fixed_mapped" != yes; then
|
||||
FT_SYSTEM_COMPONENT=ftsystem.c
|
||||
FTSYS_SRC='$(BASE_)ftsystem.c'
|
||||
else
|
||||
FT_SYSTEM_COMPONENT=config/unix/ftsystem.c
|
||||
FTSYS_SRC='$(BUILD)/ftsystem.c'
|
||||
fi
|
||||
AC_SUBST(FT_SYSTEM_COMPONENT)
|
||||
AC_SUBST(FTSYS_SRC)
|
||||
|
||||
AC_CHECK_FUNCS(memcpy memmove)
|
||||
|
||||
# Turn off shared libraries during beta testing, since they
|
||||
# make the build process take too long
|
||||
#
|
||||
# AC_DISABLE_SHARED
|
||||
|
||||
AM_PROG_LIBTOOL
|
||||
|
||||
|
||||
dnl Another bug: to make --srcdir work correctly we have to create the
|
||||
dnl directory hierarchy first since autoconf only uses mkdir.
|
||||
dnl $srcdir/config/unix/mkinstalldirs lib/arch/unix test/arch/unix
|
||||
|
||||
dnl Create the Unix-specific sub-Makefile "config/unix/unix.mk" that will be
|
||||
dnl used by the build system..
|
||||
dnl create the Unix-specific sub-Makefile `builds/unix/unix.mk' that will be
|
||||
dnl used by the build system
|
||||
dnl
|
||||
AC_OUTPUT( unix.mk:unix.in )
|
||||
AC_OUTPUT(unix.mk:unix.in)
|
||||
|
||||
|
||||
dnl end of configure.in
|
||||
|
@ -13,10 +13,6 @@
|
||||
# fully.
|
||||
|
||||
|
||||
# This will probably change a lot in the future if we are going to use
|
||||
# Automake/Autoconf...
|
||||
|
||||
|
||||
ifeq ($(PLATFORM),ansi)
|
||||
|
||||
has_init := $(strip $(wildcard /sbin/init))
|
||||
@ -27,35 +23,47 @@ ifeq ($(PLATFORM),ansi)
|
||||
DELETE := rm -f
|
||||
|
||||
# Test whether we are using gcc. If so, we select the `unix-gcc.mk'
|
||||
# configuration file. Otherwise, the standard `unix.mk' is used which
|
||||
# simply calls `cc -c' with no extra arguments.
|
||||
# configuration file. Otherwise, the configure script is called and
|
||||
# `unix.mk' is created.
|
||||
#
|
||||
# The use of the configure script can be forced by saying `make unix'.
|
||||
#
|
||||
# Feel free to add support for other platform specific compilers in this
|
||||
# directory (e.g. solaris.mk + changes here to detect the platform).
|
||||
#
|
||||
ifeq ($(firstword $(CC)),gcc)
|
||||
is_gcc := 1
|
||||
ifneq ($(findstring unix,$(MAKECMDGOALS)),)
|
||||
CONFIG_FILE := unix.mk
|
||||
setup: unix.mk
|
||||
unix: setup
|
||||
else
|
||||
ifneq ($(findstring gcc,$(shell $(CC) -v 2>&1)),)
|
||||
ifeq ($(firstword $(CC)),gcc)
|
||||
is_gcc := 1
|
||||
else
|
||||
ifneq ($(findstring gcc,$(shell $(CC) -v 2>&1)),)
|
||||
is_gcc := 1
|
||||
endif
|
||||
endif
|
||||
|
||||
ifdef is_gcc
|
||||
CONFIG_FILE := unix-gcc.mk
|
||||
else
|
||||
CONFIG_FILE := unix.mk
|
||||
setup: unix.mk
|
||||
endif
|
||||
|
||||
# If `devel' is the requested target, use the development Makefile.
|
||||
#
|
||||
ifneq ($(findstring devel,$(MAKECMDGOALS)),)
|
||||
CONFIG_FILE := unix-dev.mk
|
||||
devel: setup
|
||||
endif
|
||||
endif
|
||||
|
||||
ifdef is_gcc
|
||||
CONFIG_FILE := unix-gcc.mk
|
||||
else
|
||||
CONFIG_FILE := unix.mk
|
||||
endif
|
||||
|
||||
# If `devel' is the requested target, use the development Makefile.
|
||||
#
|
||||
ifneq ($(findstring devel,$(MAKECMDGOALS)),)
|
||||
CONFIG_FILE := unix-dev.mk
|
||||
devel: setup
|
||||
endif
|
||||
|
||||
setup: std_setup
|
||||
|
||||
unix.mk: builds/unix/unix.in
|
||||
cd builds/unix; ./configure
|
||||
|
||||
endif # test Unix
|
||||
endif # test PLATFORM
|
||||
|
||||
|
@ -1,14 +1,14 @@
|
||||
/***************************************************************************/
|
||||
/* */
|
||||
/* ftconfig.h */
|
||||
/* ftconfig.in */
|
||||
/* */
|
||||
/* ANSI-specific configuration file (specification only). */
|
||||
/* UNIX-specific configuration file (specification only). */
|
||||
/* */
|
||||
/* Copyright 1996-2000 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 */
|
||||
/* 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. */
|
||||
@ -19,26 +19,28 @@
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* This header file contains a number of macro definitions that are used */
|
||||
/* by the rest of the engine. Most of the macros here are automatically */
|
||||
/* by the rest of the engine. Most of the macros here are automatically */
|
||||
/* determined at compile time, and you should not need to change it to */
|
||||
/* port FreeType, except to compile the library with a non ANSI compiler */
|
||||
/* port FreeType, except to compile the library with a non-ANSI */
|
||||
/* compiler. */
|
||||
/* */
|
||||
/* Note however that if some specific modifications are needed, we */
|
||||
/* advise you to place a modified copy in your build directory. */
|
||||
/* */
|
||||
/* The build directory is usually "freetype/config/<system>", and */
|
||||
/* The build directory is usually `freetype/builds/<system>', and */
|
||||
/* contains system-specific files that are always included first when */
|
||||
/* building the library.. */
|
||||
/* */
|
||||
/* This ANSI version should stay in "freetype/config" */
|
||||
/* building the library. */
|
||||
/* */
|
||||
/*************************************************************************/
|
||||
|
||||
|
||||
#ifndef FTCONFIG_H
|
||||
#define FTCONFIG_H
|
||||
|
||||
/* Include the header file containing all developer build options */
|
||||
#include <ftoption.h>
|
||||
|
||||
/* Include the header file containing all developer build options */
|
||||
#include <freetype/config/ftoption.h>
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
@ -47,28 +49,40 @@
|
||||
/* These macros can be toggled to suit a specific system. The current */
|
||||
/* ones are defaults used to compile FreeType in an ANSI C environment */
|
||||
/* (16bit compilers are also supported). Copy this file to your own */
|
||||
/* `freetype/arch/<system>' directory, and edit it to port the engine. */
|
||||
/* `freetype/builds/<system>' directory, and edit it to port the engine. */
|
||||
/* */
|
||||
/*************************************************************************/
|
||||
|
||||
/* the number of bytes in an `int' type. */
|
||||
#define FT_SIZEOF_INT 4
|
||||
|
||||
/* the number of bytes in a `long' type. */
|
||||
#define FT_SIZEOF_LONG 4
|
||||
#define HAVE_UNISTD_H 0
|
||||
#define HAVE_FCNTL_H 0
|
||||
|
||||
/* Preferred alignment of data */
|
||||
#define SIZEOF_INT 2
|
||||
#define SIZEOF_LONG 2
|
||||
|
||||
|
||||
#define FT_SIZEOF_INT SIZEOF_INT
|
||||
#define FT_SIZEOF_LONG SIZEOF_LONG
|
||||
|
||||
|
||||
/* Preferred alignment of data */
|
||||
#define FT_ALIGNMENT 8
|
||||
|
||||
|
||||
/* UNUSED is a macro used to indicate that a given parameter is not used */
|
||||
/* -- this is only used to get rid of unpleasant compiler warnings */
|
||||
#ifndef FT_UNUSED
|
||||
#define FT_UNUSED( arg ) ( (arg) = (arg) )
|
||||
#endif
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* AUTOMATIC CONFIGURATION MACROS */
|
||||
/* */
|
||||
/* These macros are computed from the ones defined above. Don't touch */
|
||||
/* their definition, unless you know precisely what you're doing. No */
|
||||
/* porter should need to mess with them. */
|
||||
/* These macros are computed from the ones defined above. Don't touch */
|
||||
/* their definition, unless you know precisely what you are doing. No */
|
||||
/* porter should need to mess with them. */
|
||||
/* */
|
||||
/*************************************************************************/
|
||||
|
||||
@ -93,12 +107,12 @@
|
||||
typedef unsigned long FT_UInt32;
|
||||
|
||||
#else
|
||||
#error "no 32bit type found - please check your configuration files"
|
||||
#error "no 32bit type found -- please check your configuration files"
|
||||
#endif
|
||||
|
||||
#if FT_SIZEOF_LONG == 8
|
||||
|
||||
/* LONG64 must be defined when a 64-bit type is available */
|
||||
/* FT_LONG64 must be defined if a 64-bit type is available */
|
||||
#define FT_LONG64
|
||||
#define FT_INT64 long
|
||||
|
||||
@ -107,11 +121,13 @@
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* many compilers provide the non-ANSI 'long long' 64-bit type. You can */
|
||||
/* activate it by defining the FTCALC_USE_LONG_LONG macro in `ftoption.h'*/
|
||||
/* Many compilers provide the non-ANSI `long long' 64-bit type. You can */
|
||||
/* activate it by defining the FTCALC_USE_LONG_LONG macro in */
|
||||
/* `ftoption.h'. */
|
||||
/* */
|
||||
/* Note that this will produce many -ansi warnings during library */
|
||||
/* compilation, and that in many cases, the generated code will not be */
|
||||
/* smaller or faster !! */
|
||||
/* compilation, and that in many cases, the generated code will be */
|
||||
/* neither smaller nor faster! */
|
||||
/* */
|
||||
#ifdef FTCALC_USE_LONG_LONG
|
||||
|
||||
@ -119,7 +135,7 @@
|
||||
#define FT_INT64 long long
|
||||
|
||||
#endif /* FTCALC_USE_LONG_LONG */
|
||||
#endif
|
||||
#endif /* FT_SIZEOF_LONG == 8 */
|
||||
|
||||
|
||||
#ifdef FT_MAKE_OPTION_SINGLE_OBJECT
|
||||
@ -131,19 +147,23 @@
|
||||
#endif
|
||||
|
||||
#ifdef FT_MAKE_OPTION_SINGLE_LIBRARY_OBJECT
|
||||
#define BASE_DEF LOCAL_DEF
|
||||
#define BASE_FUNC LOCAL_FUNC
|
||||
#define BASE_DEF( x ) static x
|
||||
#define BASE_FUNC( x ) static x
|
||||
#else
|
||||
#define BASE_DEF extern
|
||||
#define BASE_FUNC /* nothing */
|
||||
#define BASE_DEF( x ) extern x
|
||||
#define BASE_FUNC( x ) extern x
|
||||
#endif
|
||||
|
||||
#ifndef EXPORT_DEF
|
||||
#define EXPORT_DEF extern
|
||||
#ifndef FT_EXPORT_DEF
|
||||
#define FT_EXPORT_DEF( x ) extern x
|
||||
#endif
|
||||
|
||||
#ifndef EXPORT_FUNC
|
||||
#define EXPORT_FUNC /* nothing */
|
||||
#ifndef FT_EXPORT_FUNC
|
||||
#define FT_EXPORT_FUNC( x ) extern x
|
||||
#endif
|
||||
|
||||
#ifndef FT_EXPORT_VAR
|
||||
#define FT_EXPORT_VAR( x ) extern x
|
||||
#endif
|
||||
|
||||
#endif /* FTCONFIG_H */
|
||||
|
@ -1,32 +1,33 @@
|
||||
/**************************************************************************
|
||||
*
|
||||
* ftsystem.c 1.0
|
||||
*
|
||||
* Unix-specific FreeType low-level system interface
|
||||
*
|
||||
* This file contains the definition of interface used by FreeType
|
||||
* to access low-level, i.e. memory management, i/o access as well
|
||||
* as thread synchronisation.
|
||||
*
|
||||
*
|
||||
* Copyright 1996-2000 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.
|
||||
*
|
||||
**************************************************************************/
|
||||
/***************************************************************************/
|
||||
/* */
|
||||
/* ftsystem.c */
|
||||
/* */
|
||||
/* Unix-specific FreeType low-level system interface (body). */
|
||||
/* */
|
||||
/* Copyright 1996-2000 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 <ftsystem.h>
|
||||
#include <fterrors.h>
|
||||
#include <ftconfig.h>
|
||||
#include <ftdebug.h>
|
||||
#include <freetype/internal/ftdebug.h>
|
||||
#include <freetype/ftsystem.h>
|
||||
#include <freetype/fterrors.h>
|
||||
#include <freetype/fttypes.h>
|
||||
|
||||
/* Memory-mapping includes and definitions.. */
|
||||
/* */
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
|
||||
/* memory-mapping includes and definitions */
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
@ -36,155 +37,148 @@
|
||||
#define MAP_FILE 0x00
|
||||
#endif
|
||||
|
||||
/*
|
||||
* The prototype for munmap() is not provided on SunOS. This needs to
|
||||
* have a check added later to see if the GNU C library is being used.
|
||||
* If so, then this prototype is not needed.
|
||||
*/
|
||||
#if defined(__sun__) && !defined(SVR4) && !defined(__SVR4)
|
||||
extern int munmap( caddr_t addr, int len );
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* The prototype for munmap() is not provided on SunOS. This needs to */
|
||||
/* have a check added later to see if the GNU C library is being used. */
|
||||
/* If so, then this prototype is not needed. */
|
||||
/* */
|
||||
#if defined( __sun__ ) && !defined( SVR4 ) && !defined( __SVR4 )
|
||||
extern int munmap( caddr_t addr,
|
||||
int len );
|
||||
#endif
|
||||
|
||||
#include <sys/stat.h>
|
||||
|
||||
#ifdef HAVE_FCNTL_H
|
||||
#include <fcntl.h>
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
/*********************************************************************/
|
||||
/* */
|
||||
/* MEMORY MANAGEMENT INTERFACE */
|
||||
/* */
|
||||
|
||||
/************************************************************************
|
||||
*
|
||||
* <FuncType>
|
||||
* FT_Alloc_Func
|
||||
*
|
||||
* <Description>
|
||||
* The memory allocator function type
|
||||
*
|
||||
* <Input>
|
||||
* system :: pointer to the system object
|
||||
* size :: requested size in bytes
|
||||
*
|
||||
* <Output>
|
||||
* block :: address of newly allocated block
|
||||
*
|
||||
* <Return>
|
||||
* Error code. 0 means success.
|
||||
*
|
||||
* <Note>
|
||||
* If your allocation routine ALWAYS zeroes the new block, you
|
||||
* should set the flag FT_SYSTEM_FLAG_ALLOC_ZEROES in your system
|
||||
* object 'flags' field.
|
||||
*
|
||||
* If you have set the flag FT_SYSTEM_FLAG_REPORT_CURRENT_ALLOC in
|
||||
* your system's "system_flags" field, this function should update
|
||||
* the "current_alloc" field of the system object.
|
||||
*
|
||||
************************************************************************/
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* MEMORY MANAGEMENT INTERFACE */
|
||||
/* */
|
||||
/*************************************************************************/
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* <Function> */
|
||||
/* ft_alloc */
|
||||
/* */
|
||||
/* <Description> */
|
||||
/* The memory allocation function. */
|
||||
/* */
|
||||
/* <Input> */
|
||||
/* memory :: A pointer to the memory object. */
|
||||
/* size :: The requested size in bytes. */
|
||||
/* */
|
||||
/* <Return> */
|
||||
/* block :: The address of newly allocated block. */
|
||||
/* */
|
||||
static
|
||||
void* ft_alloc( FT_Memory memory,
|
||||
long size )
|
||||
{
|
||||
(void)memory;
|
||||
return malloc(size);
|
||||
FT_UNUSED( memory );
|
||||
|
||||
return malloc( size );
|
||||
}
|
||||
|
||||
|
||||
/************************************************************************
|
||||
*
|
||||
* <FuncType>
|
||||
* FT_Realloc_Func
|
||||
*
|
||||
* <Description>
|
||||
* The memory reallocator function type
|
||||
*
|
||||
* <Input>
|
||||
* system :: pointer to the system object
|
||||
* new_size :: new requested size in bytes
|
||||
*
|
||||
* <InOut>
|
||||
* block :: address of block in memory
|
||||
*
|
||||
* <Return>
|
||||
* Error code. 0 means success.
|
||||
*
|
||||
* <Note>
|
||||
* This function is _never_ called when the system flag
|
||||
* FT_SYSTEM_FLAG_NO_REALLOC is set. Instead, the engine will emulate
|
||||
* realloc through "alloc" and "free".
|
||||
*
|
||||
* Note that this is possible due to the fact that FreeType's
|
||||
* "FT_Realloc" always requests the _current_ size of the reallocated
|
||||
* block as a parameter, thus avoiding memory leaks.
|
||||
*
|
||||
* If you have set the flag FT_SYSTEM_FLAG_REPORT_CURRENT_ALLOC in
|
||||
* your system's "system_flags" field, this function should update
|
||||
* the "current_alloc" field of the system object.
|
||||
*
|
||||
************************************************************************/
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* <Function> */
|
||||
/* ft_realloc */
|
||||
/* */
|
||||
/* <Description> */
|
||||
/* The memory reallocation function. */
|
||||
/* */
|
||||
/* <Input> */
|
||||
/* memory :: A pointer to the memory object. */
|
||||
/* */
|
||||
/* cur_size :: The current size of the allocated memory block. */
|
||||
/* */
|
||||
/* new_size :: The newly requested size in bytes. */
|
||||
/* */
|
||||
/* block :: The current address of the block in memory. */
|
||||
/* */
|
||||
/* <Return> */
|
||||
/* The address of the reallocated memory block. */
|
||||
/* */
|
||||
static
|
||||
void* ft_realloc( FT_Memory memory,
|
||||
long cur_size,
|
||||
long new_size,
|
||||
void* block )
|
||||
{
|
||||
(void)memory;
|
||||
(void)cur_size;
|
||||
FT_UNUSED( memory );
|
||||
FT_UNUSED( cur_size );
|
||||
|
||||
return realloc( block, new_size );
|
||||
}
|
||||
|
||||
|
||||
/************************************************************************
|
||||
*
|
||||
* <FuncType>
|
||||
* FT_Free_Func
|
||||
*
|
||||
* <Description>
|
||||
* The memory release function type
|
||||
*
|
||||
* <Input>
|
||||
* system :: pointer to the system object
|
||||
* block :: address of block in memory
|
||||
*
|
||||
* <Note>
|
||||
* If you have set the flag FT_SYSTEM_FLAG_REPORT_CURRENT_ALLOC in
|
||||
* your system's "system_flags" field, this function should update
|
||||
* the "current_alloc" field of the system object.
|
||||
*
|
||||
************************************************************************/
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* <Function> */
|
||||
/* ft_free */
|
||||
/* */
|
||||
/* <Description> */
|
||||
/* The memory release function. */
|
||||
/* */
|
||||
/* <Input> */
|
||||
/* memory :: A pointer to the memory object. */
|
||||
/* */
|
||||
/* block :: The address of block in memory to be freed. */
|
||||
/* */
|
||||
static
|
||||
void ft_free( FT_Memory memory,
|
||||
void* block )
|
||||
{
|
||||
(void)memory;
|
||||
FT_UNUSED( memory );
|
||||
|
||||
free( block );
|
||||
}
|
||||
|
||||
/*********************************************************************/
|
||||
/* */
|
||||
/* RESOURCE MANAGEMENT INTERFACE */
|
||||
/* */
|
||||
|
||||
/* We use the macro STREAM_File as a convenience to extract the */
|
||||
/* system-specific stream handle from a given FreeType stream object */
|
||||
#define STREAM_File(stream) ((void*)stream->descriptor.pointer)
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* RESOURCE MANAGEMENT INTERFACE */
|
||||
/* */
|
||||
/*************************************************************************/
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* The macro FT_COMPONENT is used in trace mode. It is an implicit */
|
||||
/* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */
|
||||
/* messages during execution. */
|
||||
/* */
|
||||
#undef FT_COMPONENT
|
||||
#define FT_COMPONENT trace_io
|
||||
|
||||
/* We use the macro STREAM_FILE for convenience to extract the */
|
||||
/* system-specific stream handle from a given FreeType stream object */
|
||||
#define STREAM_FILE( stream ) ( (FILE*)stream->descriptor.pointer )
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* <Function> */
|
||||
/* ft_close_stream */
|
||||
/* */
|
||||
/* <Description> */
|
||||
/* The function to close a stream. */
|
||||
/* */
|
||||
/* <Input> */
|
||||
/* stream :: A pointer to the stream object. */
|
||||
/* */
|
||||
static
|
||||
void ft_close_stream( FT_Stream stream )
|
||||
{
|
||||
@ -196,46 +190,66 @@
|
||||
}
|
||||
|
||||
|
||||
extern
|
||||
int FT_New_Stream( const char* filepathname,
|
||||
FT_Stream stream )
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* <Function> */
|
||||
/* FT_New_Stream */
|
||||
/* */
|
||||
/* <Description> */
|
||||
/* Creates a new stream object. */
|
||||
/* */
|
||||
/* <Input> */
|
||||
/* filepathname :: The name of the stream (usually a file) to be */
|
||||
/* opened. */
|
||||
/* */
|
||||
/* stream :: A pointer to the stream object. */
|
||||
/* */
|
||||
/* <Return> */
|
||||
/* FreeType error code. 0 means success. */
|
||||
/* */
|
||||
FT_EXPORT_FUNC( FT_Error ) FT_New_Stream( const char* filepathname,
|
||||
FT_Stream stream )
|
||||
{
|
||||
int file;
|
||||
struct stat stat_buf;
|
||||
|
||||
|
||||
if ( !stream )
|
||||
return FT_Err_Invalid_Stream_Handle;
|
||||
|
||||
/* open the file */
|
||||
file = open( filepathname, O_RDONLY );
|
||||
if (file < 0)
|
||||
if ( file < 0 )
|
||||
{
|
||||
FT_ERROR(( "FT.Unix.Open:" ));
|
||||
FT_ERROR(( "FT_New_Stream:" ));
|
||||
FT_ERROR(( " could not open `%s'\n", filepathname ));
|
||||
return FT_Err_Cannot_Open_Stream;
|
||||
return FT_Err_Cannot_Open_Resource;
|
||||
}
|
||||
|
||||
if (fstat( file, &stat_buf ) < 0)
|
||||
if ( fstat( file, &stat_buf ) < 0 )
|
||||
{
|
||||
FT_ERROR(( "FT.Unix.Open:" ));
|
||||
FT_ERROR(( "FT_New_Stream:" ));
|
||||
FT_ERROR(( " could not `fstat' file `%s'\n", filepathname ));
|
||||
goto Fail_Map;
|
||||
}
|
||||
|
||||
stream->size = stat_buf.st_size;
|
||||
stream->pos = 0;
|
||||
stream->base = mmap( NULL,
|
||||
stream->size,
|
||||
PROT_READ,
|
||||
MAP_FILE | MAP_PRIVATE,
|
||||
file,
|
||||
0 );
|
||||
stream->size = stat_buf.st_size;
|
||||
stream->pos = 0;
|
||||
stream->base = mmap( NULL,
|
||||
stream->size,
|
||||
PROT_READ,
|
||||
MAP_FILE | MAP_PRIVATE,
|
||||
file,
|
||||
0 );
|
||||
|
||||
if ( (long)stream->base == -1 )
|
||||
{
|
||||
FT_ERROR(( "FT.Unix.Open:" ));
|
||||
FT_ERROR(( " Could not map file `%s'\n", filepathname ));
|
||||
FT_ERROR(( "FT_New_Stream:" ));
|
||||
FT_ERROR(( " could not `mmap' file `%s'\n", filepathname ));
|
||||
goto Fail_Map;
|
||||
}
|
||||
|
||||
close(file);
|
||||
close( file );
|
||||
|
||||
stream->descriptor.pointer = stream->base;
|
||||
stream->pathname.pointer = (char*)filepathname;
|
||||
@ -243,35 +257,50 @@
|
||||
stream->close = ft_close_stream;
|
||||
stream->read = 0;
|
||||
|
||||
FT_TRACE1(( "FT.Unix.Open:" ));
|
||||
FT_TRACE1(( "FT_New_Stream:" ));
|
||||
FT_TRACE1(( " opened `%s' (%d bytes) successfully\n",
|
||||
filepathname, stream->size ));
|
||||
|
||||
return FT_Err_Ok;
|
||||
|
||||
Fail_Map:
|
||||
close(file);
|
||||
stream->base = NULL;
|
||||
stream->size = 0;
|
||||
stream->pos = 0;
|
||||
close( file );
|
||||
|
||||
stream->base = NULL;
|
||||
stream->size = 0;
|
||||
stream->pos = 0;
|
||||
|
||||
return FT_Err_Cannot_Open_Stream;
|
||||
}
|
||||
|
||||
|
||||
extern
|
||||
FT_Memory FT_New_Memory( void )
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* <Function> */
|
||||
/* FT_New_Memory */
|
||||
/* */
|
||||
/* <Description> */
|
||||
/* Creates a new memory object. */
|
||||
/* */
|
||||
/* <Return> */
|
||||
/* A pointer to the new memory object. 0 in case of error. */
|
||||
/* */
|
||||
FT_EXPORT_FUNC( FT_Memory ) FT_New_Memory( void )
|
||||
{
|
||||
FT_Memory memory;
|
||||
|
||||
memory = (FT_Memory)malloc( sizeof(*memory) );
|
||||
if (memory)
|
||||
|
||||
memory = (FT_Memory)malloc( sizeof ( *memory ) );
|
||||
if ( memory )
|
||||
{
|
||||
memory->user = 0;
|
||||
memory->alloc = ft_alloc;
|
||||
memory->realloc = ft_realloc;
|
||||
memory->free = ft_free;
|
||||
}
|
||||
|
||||
return memory;
|
||||
}
|
||||
|
||||
|
||||
/* END */
|
||||
|
@ -1,55 +0,0 @@
|
||||
dnl
|
||||
dnl The following was written by jhawk@mit.edu
|
||||
dnl
|
||||
dnl AC_LIBRARY_NET: Id: net.m4,v 1.4 1997/10/25 20:49:53 jhawk Exp
|
||||
dnl
|
||||
dnl This test is for network applications that need socket() and
|
||||
dnl gethostbyname() -ish functions. Under Solaris, those applications need to
|
||||
dnl link with "-lsocket -lnsl". Under IRIX, they should *not* link with
|
||||
dnl "-lsocket" because libsocket.a breaks a number of things (for instance:
|
||||
dnl gethostbyname() under IRIX 5.2, and snoop sockets under most versions of
|
||||
dnl IRIX).
|
||||
dnl
|
||||
dnl Unfortunately, many application developers are not aware of this, and
|
||||
dnl mistakenly write tests that cause -lsocket to be used under IRIX. It is
|
||||
dnl also easy to write tests that cause -lnsl to be used under operating
|
||||
dnl systems where neither are necessary (or useful), such as SunOS 4.1.4, which
|
||||
dnl uses -lnsl for TLI.
|
||||
dnl
|
||||
dnl This test exists so that every application developer does not test this in
|
||||
dnl a different, and subtly broken fashion.
|
||||
dnl
|
||||
dnl It has been argued that this test should be broken up into two seperate
|
||||
dnl tests, one for the resolver libraries, and one for the libraries necessary
|
||||
dnl for using Sockets API. Unfortunately, the two are carefully intertwined and
|
||||
dnl allowing the autoconf user to use them independantly potentially results in
|
||||
dnl unfortunate ordering dependancies -- as such, such component macros would
|
||||
dnl have to carefully use indirection and be aware if the other components were
|
||||
dnl executed. Since other autoconf macros do not go to this trouble, and almost
|
||||
dnl no applications use sockets without the resolver, this complexity has not
|
||||
dnl been implemented.
|
||||
dnl
|
||||
dnl The check for libresolv is in case you are attempting to link statically
|
||||
dnl and happen to have a libresolv.a lying around (and no libnsl.a).
|
||||
dnl
|
||||
AC_DEFUN(AC_LIBRARY_NET, [
|
||||
# Most operating systems have gethostbyname() in the default searched
|
||||
# libraries (i.e. libc):
|
||||
AC_CHECK_FUNC(gethostbyname, ,
|
||||
# Some OSes (eg. Solaris) place it in libnsl:
|
||||
AC_CHECK_LIB(nsl, gethostbyname, ,
|
||||
# Some strange OSes (SINIX) have it in libsocket:
|
||||
AC_CHECK_LIB(socket, gethostbyname, ,
|
||||
# Unfortunately libsocket sometimes depends on libnsl.
|
||||
# AC_CHECK_LIB's API is essentially broken so the following
|
||||
# ugliness is necessary:
|
||||
AC_CHECK_LIB(socket, gethostbyname,
|
||||
LIBS="-lsocket -lnsl $LIBS",
|
||||
AC_CHECK_LIB(resolv, gethostbyname),
|
||||
-lnsl)
|
||||
)
|
||||
)
|
||||
)
|
||||
AC_CHECK_FUNC(socket, , AC_CHECK_LIB(socket, socket, ,
|
||||
AC_CHECK_LIB(socket, socket, LIBS="-lsocket -lnsl $LIBS", , -lnsl)))
|
||||
])
|
@ -6,7 +6,7 @@
|
||||
# Copyright 1996-2000 by
|
||||
# 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,
|
||||
# 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
|
||||
@ -17,11 +17,28 @@ ifndef TOP
|
||||
TOP := .
|
||||
endif
|
||||
|
||||
DELETE := @RMF@
|
||||
SEP := /
|
||||
HOSTSEP := $(SEP)
|
||||
BUILD := $(TOP)/builds/unix
|
||||
PLATFORM := unix
|
||||
DELETE := @RMF@
|
||||
DELDIR := @RMDIR@
|
||||
SEP := /
|
||||
HOSTSEP := $(SEP)
|
||||
BUILD := $(TOP)/builds/unix
|
||||
PLATFORM := unix
|
||||
|
||||
FTSYS_SRC := @FTSYS_SRC@
|
||||
|
||||
DISTCLEAN += $(BUILD)/config.cache \
|
||||
$(BUILD)/config.log \
|
||||
$(BUILD)/config.status \
|
||||
$(BUILD)/unix.mk \
|
||||
$(BUILD)/ftconfig.h \
|
||||
$(BUILD)/libtool
|
||||
|
||||
|
||||
prefix := @prefix@
|
||||
exec_prefix := @exec_prefix@
|
||||
libdir := @libdir@
|
||||
version_info := @version_info@
|
||||
|
||||
|
||||
# The directory where all object files are placed.
|
||||
#
|
||||
@ -36,7 +53,7 @@ PLATFORM := unix
|
||||
OBJ_DIR := obj
|
||||
|
||||
|
||||
# The directory where all library files are placed
|
||||
# The directory where all library files are placed.
|
||||
#
|
||||
# By default, this is the same as $(OBJ_DIR), however, this can be changed
|
||||
# to suit particular needs.
|
||||
@ -47,12 +64,12 @@ LIB_DIR := $(OBJ_DIR)
|
||||
# The object file extension. This can be .o, .tco, .obj, etc., depending on
|
||||
# the platform.
|
||||
#
|
||||
O := o
|
||||
O := lo
|
||||
|
||||
# The library file extension. This can be .a, .lib, etc., depending on the
|
||||
# platform.
|
||||
#
|
||||
A := a
|
||||
A := la
|
||||
|
||||
|
||||
# The name of the final library file. Note that the DOS-specific Makefile
|
||||
@ -81,7 +98,7 @@ L := -l
|
||||
|
||||
# Target flag.
|
||||
#
|
||||
T := -o # Don't remove this comment line! We need the space after `-o'.
|
||||
T := -o # Don't remove this comment line! We need the space after `-o'.
|
||||
|
||||
|
||||
# C flags
|
||||
@ -99,7 +116,7 @@ endif
|
||||
#
|
||||
ANSIFLAGS := @XX_ANSIFLAGS@
|
||||
|
||||
# C compiler to use - we do libtool !!
|
||||
# C compiler to use -- we use libtool!
|
||||
#
|
||||
#
|
||||
CC := $(BUILD)/libtool --mode=compile $(CC)
|
||||
@ -109,27 +126,39 @@ ifdef BUILD_FREETYPE
|
||||
# Now include the main sub-makefile. It contains all the rules used to
|
||||
# build the library with the previous variables defined.
|
||||
#
|
||||
include $(TOP)/config/freetype.mk
|
||||
include $(TOP)/builds/freetype.mk
|
||||
|
||||
# The cleanup targets.
|
||||
#
|
||||
clean_freetype: clean_freetype_std
|
||||
distclean_freetype: distclean_freetype_std
|
||||
clean_freetype: clean_freetype_unix
|
||||
distclean_freetype: distclean_freetype_unix
|
||||
|
||||
# Unix cleaning and distclean rules.
|
||||
#
|
||||
clean_freetype_unix:
|
||||
-$(DELETE) $(BASE_OBJECTS) $(OBJ_M) $(OBJ_S)
|
||||
-$(DELETE) $(OBJ_DIR)/*.o $(CLEAN)
|
||||
|
||||
distclean_freetype_unix: clean_freetype_unix
|
||||
-$(DELETE) $(FT_LIBRARY)
|
||||
-$(DELETE) $(OBJ_DIR)/.libs/*
|
||||
-$(DELDIR) $(OBJ_DIR)/.libs
|
||||
-$(DELETE) *.orig *~ core *.core $(DISTCLEAN)
|
||||
|
||||
# Librarian to use to build the static library
|
||||
#
|
||||
FT_LIBRARIAN := $(AR) -r
|
||||
FT_LIBRARIAN := $(BUILD)/libtool --mode=link $(CC)
|
||||
|
||||
|
||||
# This final rule is used to link all object files into a single library.
|
||||
# This final rule is used to link all object files into a single library.
|
||||
# It is part of the system-specific sub-Makefile because not all
|
||||
# librarians accept a simple syntax like:
|
||||
#
|
||||
# librarian library_file {list of object files}
|
||||
# librarian library_file {list of object files}
|
||||
#
|
||||
$(FT_LIBRARY): $(OBJECTS_LIST)
|
||||
-$(DELETE) $@
|
||||
$(FT_LIBRARIAN) $@ $(OBJECTS_LIST)
|
||||
$(FT_LIBRARIAN) -o $@ $(OBJECTS_LIST) \
|
||||
-rpath $(libdir) -version-info $(version_info)
|
||||
|
||||
endif
|
||||
|
||||
|
@ -56,10 +56,10 @@
|
||||
/*************************************************************************/
|
||||
|
||||
|
||||
/* We use <limits.h> values to know the sizes of the types. */
|
||||
/* We use <limits.h> values to know the sizes of the types. */
|
||||
#include <limits.h>
|
||||
|
||||
/* The number of bytes in an `int' type. */
|
||||
/* The number of bytes in an `int' type. */
|
||||
#if UINT_MAX == 0xFFFFFFFF
|
||||
#define FT_SIZEOF_INT 4
|
||||
#elif UINT_MAX == 0xFFFF
|
||||
@ -70,7 +70,7 @@
|
||||
#error "Unsupported number of bytes in `int' type!"
|
||||
#endif
|
||||
|
||||
/* The number of bytes in a `long' type. */
|
||||
/* The number of bytes in a `long' type. */
|
||||
#if ULONG_MAX == 0xFFFFFFFF
|
||||
#define FT_SIZEOF_LONG 4
|
||||
#elif ULONG_MAX > 0xFFFFFFFF && ULONG_MAX == 0xFFFFFFFFFFFFFFFF
|
||||
@ -80,12 +80,12 @@
|
||||
#endif
|
||||
|
||||
|
||||
/* Preferred alignment of data */
|
||||
/* Preferred alignment of data */
|
||||
#define FT_ALIGNMENT 8
|
||||
|
||||
|
||||
/* UNUSED is a macro used to indicate that a given parameter is not used -- */
|
||||
/* this is only used to get rid of unpleasant compiler warnings */
|
||||
/* UNUSED is a macro used to indicate that a given parameter is not used */
|
||||
/* -- this is only used to get rid of unpleasant compiler warnings */
|
||||
#ifndef FT_UNUSED
|
||||
#define FT_UNUSED( arg ) ( (arg) = (arg) )
|
||||
#endif
|
||||
|
@ -278,14 +278,15 @@
|
||||
/* */
|
||||
/* Define TT_CONFIG_OPTION_SFNT_NAMES if your applications need to */
|
||||
/* access the internal name table in a SFNT-based format like TrueType */
|
||||
/* or OpenType. The name table contains various strings used to */
|
||||
/* describe the font, like family name, copyright, version, etc.. */
|
||||
/* It does not contain any glyph name though.. */
|
||||
/* or OpenType. The name table contains various strings used to */
|
||||
/* describe the font, like family name, copyright, version, etc. It */
|
||||
/* does not contain any glyph name though. */
|
||||
/* */
|
||||
/* Accessing sfnt names is done through the functions declared in */
|
||||
/* <freetype/ftnames.h> */
|
||||
/* Accessing SFNT names is done through the functions declared in */
|
||||
/* `freetype/ftnames.h'. */
|
||||
/* */
|
||||
#define TT_CONFIG_OPTION_SFNT_NAMES
|
||||
#define TT_CONFIG_OPTION_SFNT_NAMES
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/*************************************************************************/
|
||||
@ -353,12 +354,14 @@
|
||||
/* */
|
||||
#define T1_MAX_SUBRS_CALLS 8
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* T1_MAX_CHARSTRING_OPERANDS is the charstring stack's capacity. */
|
||||
/* */
|
||||
#define T1_MAX_CHARSTRINGS_OPERANDS 32
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* Define T1_CONFIG_OPTION_DISABLE_HINTER if you want to generate a */
|
||||
@ -376,6 +379,7 @@
|
||||
/* */
|
||||
#undef T1_CONFIG_OPTION_NO_AFM
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* Define this configuration macro if you want to prevent the */
|
||||
|
@ -768,6 +768,7 @@
|
||||
/* */
|
||||
#define FT_FACE_FLAG_MULTIPLE_MASTERS 0x100
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* <Constant> */
|
||||
@ -775,10 +776,11 @@
|
||||
/* */
|
||||
/* <Description> */
|
||||
/* A bit-field constant, used to indicate that the font contains */
|
||||
/* glyph names that can be retrieved through FT_Get_Glyph_Name. */
|
||||
/* glyph names that can be retrieved through FT_Get_Glyph_Name(). */
|
||||
/* */
|
||||
#define FT_FACE_FLAG_GLYPH_NAMES 0x200
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* <Constant> */
|
||||
@ -2054,34 +2056,34 @@
|
||||
/* FT_Get_Glyph_Name */
|
||||
/* */
|
||||
/* <Description> */
|
||||
/* Retrieves the ASCII name of a given glyph in a face. This only */
|
||||
/* works for those faces where FT_HAS_GLYPH_NAME(face) returns */
|
||||
/* true. */
|
||||
/* Retrieves the ASCII name of a given glyph in a face. This only */
|
||||
/* works for those faces where FT_HAS_GLYPH_NAME(face) returns true. */
|
||||
/* */
|
||||
/* <Input> */
|
||||
/* face :: A handle to a source face object. */
|
||||
/* glyph_index :: the glyph index. */
|
||||
/* */
|
||||
/* buffer :: pointer to a target buffer where the name will be */
|
||||
/* copied.. */
|
||||
/* glyph_index :: The glyph index. */
|
||||
/* */
|
||||
/* buffer_max :: the maximal number of bytes available in the buffer */
|
||||
/* buffer :: A pointer to a target buffer where the name will be */
|
||||
/* copied to. */
|
||||
/* */
|
||||
/* buffer_max :: The maximal number of bytes available in the */
|
||||
/* buffer. */
|
||||
/* */
|
||||
/* <Return> */
|
||||
/* FreeType error code. 0 means success. */
|
||||
/* */
|
||||
/* <Note> */
|
||||
/* An error is returned when the face doesn't provide glyph names */
|
||||
/* or when the glyph index is invalid. In all cases of failure, the */
|
||||
/* first byte of "buffer" will be set to 0 to indicate an empty */
|
||||
/* name. */
|
||||
/* An error is returned if the face doesn't provide glyph names or if */
|
||||
/* the glyph index is invalid. In all cases of failure, the first */
|
||||
/* byte of `buffer' will be set to 0 to indicate an empty name. */
|
||||
/* */
|
||||
/* The glyph name is truncated to fit within the buffer if it's too */
|
||||
/* long. The returned string is always zero-terminated */
|
||||
/* The glyph name is truncated to fit within the buffer if it is too */
|
||||
/* long. The returned string is always zero-terminated. */
|
||||
/* */
|
||||
/* This function is not compiled within the library if the config */
|
||||
/* macro FT_CONFIG_OPTION_NO_GLYPH_NAMES is defined in */
|
||||
/* <freetype/config/ftoptions.h> */
|
||||
/* `include/freetype/config/ftoptions.h' */
|
||||
/* */
|
||||
FT_EXPORT_DEF( FT_Error ) FT_Get_Glyph_Name( FT_Face face,
|
||||
FT_UInt glyph_index,
|
||||
|
@ -3,9 +3,9 @@
|
||||
/* ftnames.h */
|
||||
/* */
|
||||
/* Simple interface to access SFNT name tables (which are used */
|
||||
/* to hold font names, copyright info, notices, etc..) */
|
||||
/* to hold font names, copyright info, notices, etc.). */
|
||||
/* */
|
||||
/* This is _not_ used to retrieve glyph names !! */
|
||||
/* This is _not_ used to retrieve glyph names! */
|
||||
/* */
|
||||
/* Copyright 1996-2000 by */
|
||||
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
|
||||
@ -18,12 +18,15 @@
|
||||
/* */
|
||||
/***************************************************************************/
|
||||
|
||||
|
||||
#ifndef FTNAMES_H
|
||||
#define FTNAMES_H
|
||||
|
||||
|
||||
#include <freetype/freetype.h>
|
||||
|
||||
typedef struct FT_SfntName_
|
||||
|
||||
typedef struct FT_SfntName_
|
||||
{
|
||||
FT_UShort platform_id;
|
||||
FT_UShort encoding_id;
|
||||
@ -36,11 +39,14 @@
|
||||
} FT_SfntName;
|
||||
|
||||
|
||||
FT_EXPORT_DEF(FT_UInt) FT_Get_Sfnt_Name_Count( FT_Face face );
|
||||
FT_EXPORT_DEF( FT_UInt ) FT_Get_Sfnt_Name_Count( FT_Face face );
|
||||
|
||||
FT_EXPORT_DEF(FT_Error) FT_Get_Sfnt_Name( FT_Face face,
|
||||
FT_UInt index,
|
||||
FT_SfntName* aname );
|
||||
FT_EXPORT_DEF( FT_Error ) FT_Get_Sfnt_Name( FT_Face face,
|
||||
FT_UInt index,
|
||||
FT_SfntName* aname );
|
||||
|
||||
|
||||
#endif /* FTNAMES_H */
|
||||
|
||||
|
||||
/* END */
|
||||
|
@ -372,7 +372,7 @@
|
||||
/* managing and loading font files of a given format. */
|
||||
/* */
|
||||
/* <Fields> */
|
||||
/* root :: contains the fields of the root module class */
|
||||
/* root :: Contains the fields of the root module class. */
|
||||
/* */
|
||||
/* clazz :: A pointer to the font driver's class. Note that */
|
||||
/* this is NOT root.clazz. `class' wasn't used */
|
||||
@ -454,14 +454,15 @@
|
||||
/* handle to the current renderer for the */
|
||||
/* ft_glyph_format_outline format. */
|
||||
/* */
|
||||
/* raster_pool_size :: size of the render pool in bytes */
|
||||
/* auto_hinter :: XXX */
|
||||
/* */
|
||||
/* raster_pool :: The raster object's render pool. This can */
|
||||
/* ideally be changed dynamically at run-time. */
|
||||
/* */
|
||||
/* raster_pool_size :: The size of the render pool in bytes. */
|
||||
/* */
|
||||
/* debug_hooks :: XXX */
|
||||
/* */
|
||||
|
||||
typedef struct FT_LibraryRec_
|
||||
{
|
||||
FT_Memory memory; /* library's memory manager */
|
||||
|
@ -1,7 +1,7 @@
|
||||
The Catharon Open Source LICENSE
|
||||
----------------------------
|
||||
|
||||
2000-Jul-4
|
||||
2000-Jul-04
|
||||
|
||||
Copyright (C) 2000 by Catharon Productions, Inc.
|
||||
|
||||
@ -10,9 +10,9 @@
|
||||
Introduction
|
||||
============
|
||||
|
||||
This license applies to source files distributed by Catharon
|
||||
Productions, Inc. in several archive packages. This license
|
||||
applies to all files found in such packages which do not fall
|
||||
This license applies to source files distributed by Catharon
|
||||
Productions, Inc. in several archive packages. This license
|
||||
applies to all files found in such packages which do not fall
|
||||
under their own explicit license.
|
||||
|
||||
This license was inspired by the BSD, Artistic, and IJG
|
||||
@ -20,7 +20,7 @@ Introduction
|
||||
and use of free software in commercial and freeware products
|
||||
alike. As a consequence, its main points are that:
|
||||
|
||||
o We don't promise that this software works. However, we are
|
||||
o We don't promise that this software works. However, we are
|
||||
interested in any kind of bug reports. (`as is' distribution)
|
||||
|
||||
o You can use this software for whatever you want, in parts or
|
||||
@ -32,9 +32,9 @@ Introduction
|
||||
Catharon Code. (`credits')
|
||||
|
||||
We specifically permit and encourage the inclusion of this
|
||||
software, with or without modifications, in commercial products.
|
||||
We disclaim all warranties covering the packages distributed by
|
||||
Catharon Productions, Inc. and assume no liability related to
|
||||
software, with or without modifications, in commercial products.
|
||||
We disclaim all warranties covering the packages distributed by
|
||||
Catharon Productions, Inc. and assume no liability related to
|
||||
their use.
|
||||
|
||||
|
||||
@ -44,32 +44,32 @@ Legal Terms
|
||||
0. Definitions
|
||||
--------------
|
||||
|
||||
Throughout this license, the terms `Catharon Package', `package',
|
||||
and `Catharon Code' refer to the set of files originally
|
||||
Throughout this license, the terms `Catharon Package', `package',
|
||||
and `Catharon Code' refer to the set of files originally
|
||||
distributed by Catharon Productions, Inc.
|
||||
|
||||
`You' refers to the licensee, or person using the project, where
|
||||
`You' refers to the licensee, or person using the project, where
|
||||
`using' is a generic term including compiling the project's source
|
||||
code as well as linking it to form a `program' or `executable'.
|
||||
This program is referred to as `a program using one of the
|
||||
code as well as linking it to form a `program' or `executable'.
|
||||
This program is referred to as `a program using one of the
|
||||
Catharon Packages'.
|
||||
|
||||
This license applies to all files distributed in the original
|
||||
Catharon Package(s), including all source code, binaries and
|
||||
This license applies to all files distributed in the original
|
||||
Catharon Package(s), including all source code, binaries and
|
||||
documentation, unless otherwise stated in the file in its
|
||||
original, unmodified form as distributed in the original archive.
|
||||
If you are unsure whether or not a particular file is covered by
|
||||
original, unmodified form as distributed in the original archive.
|
||||
If you are unsure whether or not a particular file is covered by
|
||||
this license, you must contact us to verify this.
|
||||
|
||||
The Catharon Packages are copyright (C) 2000 by Catharon
|
||||
Productions, Inc. All rights reserved except as specified below.
|
||||
The Catharon Packages are copyright (C) 2000 by Catharon
|
||||
Productions, Inc. All rights reserved except as specified below.
|
||||
|
||||
1. No Warranty
|
||||
--------------
|
||||
|
||||
THE CATHARON PACKAGES ARE PROVIDED `AS IS' WITHOUT WARRANTY OF ANY
|
||||
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. IN NO EVENT WILL ANY OF THE AUTHORS OR COPYRIGHT HOLDERS
|
||||
BE LIABLE FOR ANY DAMAGES CAUSED BY THE USE OF OR THE INABILITY TO
|
||||
USE THE CATHARON PACKAGE.
|
||||
@ -77,12 +77,12 @@ Legal Terms
|
||||
2. Redistribution
|
||||
-----------------
|
||||
|
||||
This license grants a worldwide, royalty-free, perpetual and
|
||||
irrevocable right and license to use, execute, perform, compile,
|
||||
display, copy, create derivative works of, distribute and
|
||||
sublicense the Catharon Packages (in both source and object code
|
||||
forms) and derivative works thereof for any purpose; and to
|
||||
authorize others to exercise some or all of the rights granted
|
||||
This license grants a worldwide, royalty-free, perpetual and
|
||||
irrevocable right and license to use, execute, perform, compile,
|
||||
display, copy, create derivative works of, distribute and
|
||||
sublicense the Catharon Packages (in both source and object code
|
||||
forms) and derivative works thereof for any purpose; and to
|
||||
authorize others to exercise some or all of the rights granted
|
||||
herein, subject to the following conditions:
|
||||
|
||||
o Redistribution of source code must retain this license file
|
||||
@ -92,13 +92,13 @@ Legal Terms
|
||||
unaltered, original files must be preserved in all copies of
|
||||
source files.
|
||||
|
||||
o Redistribution in binary form must provide a disclaimer that
|
||||
states that the software is based in part on the work of
|
||||
Catharon Productions, Inc. in the distribution documentation.
|
||||
o Redistribution in binary form must provide a disclaimer that
|
||||
states that the software is based in part on the work of
|
||||
Catharon Productions, Inc. in the distribution documentation.
|
||||
|
||||
These conditions apply to any software derived from or based on
|
||||
These conditions apply to any software derived from or based on
|
||||
the Catharon Packages, not just the unmodified files. If you use
|
||||
our work, you must acknowledge us. However, no fee need be paid
|
||||
our work, you must acknowledge us. However, no fee need be paid
|
||||
to us.
|
||||
|
||||
3. Advertising
|
||||
@ -108,16 +108,16 @@ Legal Terms
|
||||
use the name of the other for commercial, advertising, or
|
||||
promotional purposes without specific prior written permission.
|
||||
|
||||
We suggest, but do not require, that you use the following phrase
|
||||
We suggest, but do not require, that you use the following phrase
|
||||
to refer to this software in your documentation: 'this software is
|
||||
based in part on the Catharon Typography Project'.
|
||||
|
||||
As you have not signed this license, you are not required to
|
||||
accept it. However, as the Catharon Packages are copyrighted
|
||||
material, only this license, or another one contracted with the
|
||||
authors, grants you the right to use, distribute, and modify it.
|
||||
Therefore, by using, distributing, or modifying the Catharon
|
||||
Packages, you indicate that you understand and accept all the
|
||||
As you have not signed this license, you are not required to
|
||||
accept it. However, as the Catharon Packages are copyrighted
|
||||
material, only this license, or another one contracted with the
|
||||
authors, grants you the right to use, distribute, and modify it.
|
||||
Therefore, by using, distributing, or modifying the Catharon
|
||||
Packages, you indicate that you understand and accept all the
|
||||
terms of this license.
|
||||
|
||||
--- end of license.txt ---
|
||||
|
@ -2,89 +2,97 @@
|
||||
/* */
|
||||
/* ahangles.h */
|
||||
/* */
|
||||
/* a routine used to compute vector angles with limited accuracy */
|
||||
/* A routine used to compute vector angles with limited accuracy */
|
||||
/* and very high speed. */
|
||||
/* */
|
||||
/* Copyright 2000: Catharon Productions Inc. */
|
||||
/* Copyright 2000 Catharon Productions Inc. */
|
||||
/* Author: David Turner */
|
||||
/* */
|
||||
/* This file is part of the Catharon Typography Project and shall only */
|
||||
/* be used, modified, and distributed under the terms of the Catharon */
|
||||
/* Open Source License that should come with this file under the name */
|
||||
/* "CatharonLicense.txt". By continuing to use, modify, or distribute */
|
||||
/* `CatharonLicense.txt'. By continuing to use, modify, or distribute */
|
||||
/* this file you indicate that you have read the license and */
|
||||
/* understand and accept it fully. */
|
||||
/* */
|
||||
/* Note that this license is compatible with the FreeType license */
|
||||
/* Note that this license is compatible with the FreeType license. */
|
||||
/* */
|
||||
/***************************************************************************/
|
||||
|
||||
|
||||
#ifdef FT_FLAT_COMPILE
|
||||
|
||||
#include "ahangles.h"
|
||||
|
||||
#else
|
||||
|
||||
#include <autohint/ahangles.h>
|
||||
|
||||
#endif
|
||||
|
||||
/* the following two tables are automatically generated with */
|
||||
/* the "mather.py" Python script.. */
|
||||
|
||||
static const AH_Angle ah_arctan[ 1L << AH_ATAN_BITS ] =
|
||||
{
|
||||
0, 0, 1, 1, 1, 2, 2, 2,
|
||||
3, 3, 3, 3, 4, 4, 4, 5,
|
||||
5, 5, 6, 6, 6, 7, 7, 7,
|
||||
8, 8, 8, 9, 9, 9, 10, 10,
|
||||
10, 10, 11, 11, 11, 12, 12, 12,
|
||||
13, 13, 13, 14, 14, 14, 14, 15,
|
||||
15, 15, 16, 16, 16, 17, 17, 17,
|
||||
18, 18, 18, 18, 19, 19, 19, 20,
|
||||
20, 20, 21, 21, 21, 21, 22, 22,
|
||||
22, 23, 23, 23, 24, 24, 24, 24,
|
||||
25, 25, 25, 26, 26, 26, 26, 27,
|
||||
27, 27, 28, 28, 28, 28, 29, 29,
|
||||
29, 30, 30, 30, 30, 31, 31, 31,
|
||||
31, 32, 32, 32, 33, 33, 33, 33,
|
||||
34, 34, 34, 34, 35, 35, 35, 35,
|
||||
36, 36, 36, 36, 37, 37, 37, 38,
|
||||
38, 38, 38, 39, 39, 39, 39, 40,
|
||||
40, 40, 40, 41, 41, 41, 41, 42,
|
||||
42, 42, 42, 42, 43, 43, 43, 43,
|
||||
44, 44, 44, 44, 45, 45, 45, 45,
|
||||
46, 46, 46, 46, 46, 47, 47, 47,
|
||||
47, 48, 48, 48, 48, 48, 49, 49,
|
||||
49, 49, 50, 50, 50, 50, 50, 51,
|
||||
51, 51, 51, 51, 52, 52, 52, 52,
|
||||
52, 53, 53, 53, 53, 53, 54, 54,
|
||||
54, 54, 54, 55, 55, 55, 55, 55,
|
||||
56, 56, 56, 56, 56, 57, 57, 57,
|
||||
57, 57, 57, 58, 58, 58, 58, 58,
|
||||
59, 59, 59, 59, 59, 59, 60, 60,
|
||||
60, 60, 60, 61, 61, 61, 61, 61,
|
||||
61, 62, 62, 62, 62, 62, 62, 63,
|
||||
63, 63, 63, 63, 63, 64, 64, 64
|
||||
};
|
||||
/* the following table has been automatically generated with */
|
||||
/* the `mather.py' Python script */
|
||||
|
||||
const AH_Angle ah_arctan[1L << AH_ATAN_BITS] =
|
||||
{
|
||||
0, 0, 1, 1, 1, 2, 2, 2,
|
||||
3, 3, 3, 3, 4, 4, 4, 5,
|
||||
5, 5, 6, 6, 6, 7, 7, 7,
|
||||
8, 8, 8, 9, 9, 9, 10, 10,
|
||||
10, 10, 11, 11, 11, 12, 12, 12,
|
||||
13, 13, 13, 14, 14, 14, 14, 15,
|
||||
15, 15, 16, 16, 16, 17, 17, 17,
|
||||
18, 18, 18, 18, 19, 19, 19, 20,
|
||||
20, 20, 21, 21, 21, 21, 22, 22,
|
||||
22, 23, 23, 23, 24, 24, 24, 24,
|
||||
25, 25, 25, 26, 26, 26, 26, 27,
|
||||
27, 27, 28, 28, 28, 28, 29, 29,
|
||||
29, 30, 30, 30, 30, 31, 31, 31,
|
||||
31, 32, 32, 32, 33, 33, 33, 33,
|
||||
34, 34, 34, 34, 35, 35, 35, 35,
|
||||
36, 36, 36, 36, 37, 37, 37, 38,
|
||||
38, 38, 38, 39, 39, 39, 39, 40,
|
||||
40, 40, 40, 41, 41, 41, 41, 42,
|
||||
42, 42, 42, 42, 43, 43, 43, 43,
|
||||
44, 44, 44, 44, 45, 45, 45, 45,
|
||||
46, 46, 46, 46, 46, 47, 47, 47,
|
||||
47, 48, 48, 48, 48, 48, 49, 49,
|
||||
49, 49, 50, 50, 50, 50, 50, 51,
|
||||
51, 51, 51, 51, 52, 52, 52, 52,
|
||||
52, 53, 53, 53, 53, 53, 54, 54,
|
||||
54, 54, 54, 55, 55, 55, 55, 55,
|
||||
56, 56, 56, 56, 56, 57, 57, 57,
|
||||
57, 57, 57, 58, 58, 58, 58, 58,
|
||||
59, 59, 59, 59, 59, 59, 60, 60,
|
||||
60, 60, 60, 61, 61, 61, 61, 61,
|
||||
61, 62, 62, 62, 62, 62, 62, 63,
|
||||
63, 63, 63, 63, 63, 64, 64, 64
|
||||
};
|
||||
|
||||
|
||||
LOCAL_FUNC
|
||||
AH_Angle ah_angle( FT_Vector* v )
|
||||
AH_Angle ah_angle( FT_Vector* v )
|
||||
{
|
||||
FT_Pos dx, dy;
|
||||
AH_Angle angle;
|
||||
|
||||
dx = v->x;
|
||||
dy = v->y;
|
||||
|
||||
dx = v->x;
|
||||
dy = v->y;
|
||||
|
||||
/* check trivial cases */
|
||||
if (dy == 0)
|
||||
if ( dy == 0 )
|
||||
{
|
||||
angle = 0;
|
||||
if (dx < 0)
|
||||
if ( dx < 0 )
|
||||
angle = AH_PI;
|
||||
return angle;
|
||||
}
|
||||
else if (dx == 0)
|
||||
else if ( dx == 0 )
|
||||
{
|
||||
angle = AH_HALF_PI;
|
||||
if (dy < 0)
|
||||
if ( dy < 0 )
|
||||
angle = -AH_HALF_PI;
|
||||
return angle;
|
||||
}
|
||||
@ -100,26 +108,30 @@ static const AH_Angle ah_arctan[ 1L << AH_ATAN_BITS ] =
|
||||
if ( dy < 0 )
|
||||
{
|
||||
FT_Pos tmp;
|
||||
|
||||
|
||||
tmp = dx;
|
||||
dx = -dy;
|
||||
dy = tmp;
|
||||
angle -= AH_HALF_PI;
|
||||
}
|
||||
|
||||
if (dx == 0 && dy == 0)
|
||||
if ( dx == 0 && dy == 0 )
|
||||
return 0;
|
||||
|
||||
if (dx == dy)
|
||||
angle += AH_PI/4;
|
||||
else if (dx > dy)
|
||||
angle += ah_arctan[ FT_DivFix( dy, dx ) >> (16-AH_ATAN_BITS) ];
|
||||
if ( dx == dy )
|
||||
angle += AH_PI / 4;
|
||||
else if ( dx > dy )
|
||||
angle += ah_arctan[FT_DivFix( dy, dx ) >> ( 16 - AH_ATAN_BITS )];
|
||||
else
|
||||
angle += AH_HALF_PI - ah_arctan[ FT_DivFix( dx, dy ) >> (16-AH_ATAN_BITS) ];
|
||||
angle += AH_HALF_PI -
|
||||
ah_arctan[FT_DivFix( dx, dy ) >> ( 16 - AH_ATAN_BITS )];
|
||||
|
||||
if (angle > AH_PI)
|
||||
if ( angle > AH_PI )
|
||||
angle -= AH_2PI;
|
||||
|
||||
return angle;
|
||||
}
|
||||
|
||||
|
||||
/* END */
|
||||
|
@ -2,46 +2,62 @@
|
||||
/* */
|
||||
/* ahangles.h */
|
||||
/* */
|
||||
/* a routine used to compute vector angles with limited accuracy */
|
||||
/* A routine used to compute vector angles with limited accuracy */
|
||||
/* and very high speed. */
|
||||
/* */
|
||||
/* Copyright 2000: Catharon Productions Inc. */
|
||||
/* Copyright 2000 Catharon Productions Inc. */
|
||||
/* Author: David Turner */
|
||||
/* */
|
||||
/* This file is part of the Catharon Typography Project and shall only */
|
||||
/* be used, modified, and distributed under the terms of the Catharon */
|
||||
/* Open Source License that should come with this file under the name */
|
||||
/* "CatharonLicense.txt". By continuing to use, modify, or distribute */
|
||||
/* `CatharonLicense.txt'. By continuing to use, modify, or distribute */
|
||||
/* this file you indicate that you have read the license and */
|
||||
/* understand and accept it fully. */
|
||||
/* */
|
||||
/* Note that this license is compatible with the FreeType license */
|
||||
/* Note that this license is compatible with the FreeType license. */
|
||||
/* */
|
||||
/***************************************************************************/
|
||||
|
||||
|
||||
#ifndef AGANGLES_H
|
||||
#define AGANGLES_H
|
||||
|
||||
|
||||
#ifdef FT_FLAT_COMPILE
|
||||
|
||||
#include "ahtypes.h"
|
||||
|
||||
#else
|
||||
|
||||
#include <autohint/ahtypes.h>
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#include <freetype/internal/ftobjs.h>
|
||||
|
||||
/* PI expressed in ah_angles - we don't really need an important */
|
||||
/* precision, so 256 should be enough.. */
|
||||
#define AH_PI 256
|
||||
#define AH_2PI (AH_PI*2)
|
||||
#define AH_HALF_PI (AH_PI/2)
|
||||
#define AH_2PIMASK (AH_2PI-1)
|
||||
|
||||
/* the number of bits to use to express an arc tangent */
|
||||
/* see the structure of the lookup table.. */
|
||||
/* PI expressed in ah_angles -- we don't really need an important */
|
||||
/* precision, so 256 should be enough */
|
||||
#define AH_PI 256
|
||||
#define AH_2PI ( AH_PI * 2 )
|
||||
#define AH_HALF_PI ( AH_PI / 2 )
|
||||
#define AH_2PIMASK ( AH_2PI - 1 )
|
||||
|
||||
/* the number of bits used to express an arc tangent; */
|
||||
/* see the structure of the lookup table */
|
||||
#define AH_ATAN_BITS 8
|
||||
|
||||
LOCAL_DEF const AH_Angle ah_arctan[ 1L << AH_ATAN_BITS ];
|
||||
extern
|
||||
const AH_Angle ah_arctan[1L << AH_ATAN_BITS];
|
||||
|
||||
|
||||
LOCAL_DEF
|
||||
AH_Angle ah_angle( FT_Vector* v );
|
||||
|
||||
LOCAL_DEF AH_Angle ah_angle( FT_Vector* v );
|
||||
|
||||
#endif /* AGANGLES_H */
|
||||
|
||||
|
||||
/* END */
|
||||
|
@ -2,56 +2,67 @@
|
||||
/* */
|
||||
/* ahglobal.c */
|
||||
/* */
|
||||
/* routines used to compute global metrics automatically */
|
||||
/* Routines used to compute global metrics automatically. */
|
||||
/* */
|
||||
/* Copyright 2000: Catharon Productions Inc. */
|
||||
/* Copyright 2000 Catharon Productions Inc. */
|
||||
/* Author: David Turner */
|
||||
/* */
|
||||
/* This file is part of the Catharon Typography Project and shall only */
|
||||
/* be used, modified, and distributed under the terms of the Catharon */
|
||||
/* Open Source License that should come with this file under the name */
|
||||
/* "CatharonLicense.txt". By continuing to use, modify, or distribute */
|
||||
/* `CatharonLicense.txt'. By continuing to use, modify, or distribute */
|
||||
/* this file you indicate that you have read the license and */
|
||||
/* understand and accept it fully. */
|
||||
/* */
|
||||
/* Note that this license is compatible with the FreeType license */
|
||||
/* Note that this license is compatible with the FreeType license. */
|
||||
/* */
|
||||
/***************************************************************************/
|
||||
|
||||
|
||||
#ifdef FT_FLAT_COMPILE
|
||||
|
||||
#include "ahglobal.h"
|
||||
#include "ahglyph.h"
|
||||
|
||||
#else
|
||||
|
||||
#include <autohint/ahglobal.h>
|
||||
#include <autohint/ahglyph.h>
|
||||
|
||||
#endif
|
||||
|
||||
#define MAX_TEST_CHARACTERS 12
|
||||
|
||||
static const char* blue_chars[ ah_blue_max ] =
|
||||
{
|
||||
"THEZOCQS",
|
||||
"HEZLOCUS",
|
||||
"xzroesc",
|
||||
"xzroesc",
|
||||
"pqgjy"
|
||||
};
|
||||
#define MAX_TEST_CHARACTERS 12
|
||||
|
||||
static
|
||||
const char* blue_chars[ah_blue_max] =
|
||||
{
|
||||
"THEZOCQS",
|
||||
"HEZLOCUS",
|
||||
"xzroesc",
|
||||
"xzroesc",
|
||||
"pqgjy"
|
||||
};
|
||||
|
||||
|
||||
/* simple insertion sort */
|
||||
static
|
||||
void sort_values( FT_Int count, FT_Pos* table )
|
||||
void sort_values( FT_Int count,
|
||||
FT_Pos* table )
|
||||
{
|
||||
FT_Int i, j, swap;
|
||||
|
||||
|
||||
for ( i = 1; i < count; i++ )
|
||||
{
|
||||
for ( j = i; j > 1; j-- )
|
||||
{
|
||||
if ( table[j] > table[j-1] )
|
||||
if ( table[j] > table[j - 1] )
|
||||
break;
|
||||
|
||||
swap = table[j];
|
||||
table[j] = table[j-1];
|
||||
table[j-1] = swap;
|
||||
swap = table[j];
|
||||
table[j] = table[j - 1];
|
||||
table[j - 1] = swap;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -60,31 +71,33 @@
|
||||
static
|
||||
FT_Error ah_hinter_compute_blues( AH_Hinter* hinter )
|
||||
{
|
||||
AH_Blue blue;
|
||||
AH_Globals* globals = &hinter->globals->design;
|
||||
FT_Pos flats [ MAX_TEST_CHARACTERS ];
|
||||
FT_Pos rounds[ MAX_TEST_CHARACTERS ];
|
||||
FT_Int num_flats;
|
||||
FT_Int num_rounds;
|
||||
AH_Blue blue;
|
||||
AH_Globals* globals = &hinter->globals->design;
|
||||
FT_Pos flats [MAX_TEST_CHARACTERS];
|
||||
FT_Pos rounds[MAX_TEST_CHARACTERS];
|
||||
FT_Int num_flats;
|
||||
FT_Int num_rounds;
|
||||
|
||||
FT_Face face;
|
||||
FT_GlyphSlot glyph;
|
||||
FT_Error error;
|
||||
FT_CharMap charmap;
|
||||
|
||||
|
||||
face = hinter->face;
|
||||
glyph = face->glyph;
|
||||
|
||||
/* save current charmap */
|
||||
charmap = face->charmap;
|
||||
|
||||
/* do we have a Unicode charmap in there ?? */
|
||||
/* do we have a Unicode charmap in there? */
|
||||
error = FT_Select_Charmap( face, ft_encoding_unicode );
|
||||
if (error) goto Exit;
|
||||
if ( error )
|
||||
goto Exit;
|
||||
|
||||
/* we compute the blues simply by loading each character from the */
|
||||
/* 'blue_chars[blues]' string, then compute its top-most and bottom-most */
|
||||
/* points */
|
||||
/* we compute the blues simply by loading each character from the */
|
||||
/* 'blue_chars[blues]' string, then compute its top-most and */
|
||||
/* bottom-most points */
|
||||
|
||||
AH_LOG(( "blue zones computation\n" ));
|
||||
AH_LOG(( "------------------------------------------------\n" ));
|
||||
@ -93,33 +106,38 @@
|
||||
{
|
||||
const char* p = blue_chars[blue];
|
||||
const char* limit = p + MAX_TEST_CHARACTERS;
|
||||
FT_Pos *blue_ref, *blue_shoot;
|
||||
FT_Pos *blue_ref, *blue_shoot;
|
||||
|
||||
AH_LOG(( "blue %3d : ", (int)blue ));
|
||||
|
||||
AH_LOG(( "blue %3d: ", (int)blue ));
|
||||
|
||||
num_flats = 0;
|
||||
num_rounds = 0;
|
||||
|
||||
for ( ; p < limit; p++ )
|
||||
{
|
||||
FT_UInt glyph_index;
|
||||
FT_Vector* extremum;
|
||||
FT_Vector* points;
|
||||
FT_Vector* point_limit;
|
||||
FT_Vector* point;
|
||||
FT_Bool round;
|
||||
FT_UInt glyph_index;
|
||||
FT_Vector* extremum;
|
||||
FT_Vector* points;
|
||||
FT_Vector* point_limit;
|
||||
FT_Vector* point;
|
||||
FT_Bool round;
|
||||
|
||||
|
||||
/* exit if we reach the end of the string */
|
||||
if (!*p) break;
|
||||
if ( !*p )
|
||||
break;
|
||||
|
||||
AH_LOG(( "'%c'", *p ));
|
||||
AH_LOG(( "`%c'", *p ));
|
||||
|
||||
/* load the character in the face - skip unknown or empty ones */
|
||||
/* load the character in the face -- skip unknown or empty ones */
|
||||
glyph_index = FT_Get_Char_Index( face, (FT_UInt)*p );
|
||||
if (glyph_index == 0) continue;
|
||||
if ( glyph_index == 0 )
|
||||
continue;
|
||||
|
||||
error = FT_Load_Glyph( face, glyph_index, FT_LOAD_NO_SCALE );
|
||||
if (error || glyph->outline.n_points <= 0) continue;
|
||||
|
||||
if ( error || glyph->outline.n_points <= 0 )
|
||||
continue;
|
||||
|
||||
/* now compute min or max point indices and coordinates */
|
||||
points = glyph->outline.points;
|
||||
@ -128,7 +146,7 @@
|
||||
extremum = point;
|
||||
point++;
|
||||
|
||||
if ( AH_IS_TOP_BLUE(blue) )
|
||||
if ( AH_IS_TOP_BLUE( blue ) )
|
||||
{
|
||||
for ( ; point < point_limit; point++ )
|
||||
if ( point->y > extremum->y )
|
||||
@ -143,18 +161,19 @@
|
||||
|
||||
AH_LOG(( "%5d", (int)extremum->y ));
|
||||
|
||||
/* now, see if the point belongs to a straight or round segment */
|
||||
/* we first need to find in which contour the extremum lies then */
|
||||
/* see its previous and next points.. */
|
||||
/* now, check whether the point belongs to a straight or round */
|
||||
/* segment; we first need to find in which contour the extremum */
|
||||
/* lies, then see its previous and next points */
|
||||
{
|
||||
FT_Int index = extremum - points;
|
||||
FT_Int n;
|
||||
FT_Int first = 0;
|
||||
FT_Int last, prev, next, end;
|
||||
FT_Int first, last, prev, next, end;
|
||||
FT_Pos dist;
|
||||
|
||||
|
||||
last = -1;
|
||||
first = 0;
|
||||
|
||||
for ( n = 0; n < glyph->outline.n_contours; n++ )
|
||||
{
|
||||
end = glyph->outline.contours[n];
|
||||
@ -163,58 +182,64 @@
|
||||
last = end;
|
||||
break;
|
||||
}
|
||||
first = end+1;
|
||||
first = end + 1;
|
||||
}
|
||||
|
||||
/* XXX : should never happen !!! */
|
||||
/* XXX: should never happen! */
|
||||
if ( last < 0 )
|
||||
continue;
|
||||
|
||||
/* now look for the previous and next points that are not on the */
|
||||
/* same Y coordinate. Threshold the "closeness" .. */
|
||||
/* same Y coordinate. Threshold the `closeness'... */
|
||||
|
||||
prev = index;
|
||||
next = prev;
|
||||
|
||||
do
|
||||
{
|
||||
if (prev > first) prev--;
|
||||
else prev = last;
|
||||
if ( prev > first )
|
||||
prev--;
|
||||
else
|
||||
prev = last;
|
||||
|
||||
dist = points[prev].y - extremum->y;
|
||||
if ( dist < -5 || dist > 5 )
|
||||
break;
|
||||
|
||||
} while (prev != index);
|
||||
} while ( prev != index );
|
||||
|
||||
do
|
||||
{
|
||||
if (next < last) next++;
|
||||
else next = first;
|
||||
if ( next < last )
|
||||
next++;
|
||||
else
|
||||
next = first;
|
||||
|
||||
dist = points[next].y - extremum->y;
|
||||
if ( dist < -5 || dist > 5 )
|
||||
break;
|
||||
|
||||
} while (next != index);
|
||||
} while ( next != index );
|
||||
|
||||
/* now, set the "round" flag depending on the segment's kind */
|
||||
round = FT_CURVE_TAG(glyph->outline.tags[prev]) != FT_Curve_Tag_On ||
|
||||
FT_CURVE_TAG(glyph->outline.tags[next]) != FT_Curve_Tag_On ;
|
||||
/* now, set the `round' flag depending on the segment's kind */
|
||||
round =
|
||||
FT_CURVE_TAG( glyph->outline.tags[prev] ) != FT_Curve_Tag_On ||
|
||||
FT_CURVE_TAG( glyph->outline.tags[next] ) != FT_Curve_Tag_On ;
|
||||
|
||||
AH_LOG(( "%c ", round ? 'r' : 'f' ));
|
||||
}
|
||||
|
||||
if (round)
|
||||
rounds[ num_rounds++ ] = extremum->y;
|
||||
if ( round )
|
||||
rounds[num_rounds++] = extremum->y;
|
||||
else
|
||||
flats[ num_flats++ ] = extremum->y;
|
||||
flats[num_flats++] = extremum->y;
|
||||
}
|
||||
|
||||
AH_LOG(( "\n" ));
|
||||
/* we have computed the contents of the 'rounds' and 'flats' tables */
|
||||
/* now determine the reference and overshoot position of the blue */
|
||||
/* we simply take the median value after a simple short.. */
|
||||
|
||||
/* we have computed the contents of the `rounds' and `flats' tables, */
|
||||
/* now determine the reference and overshoot position of the blue; */
|
||||
/* we simply take the median value after a simple short */
|
||||
sort_values( num_rounds, rounds );
|
||||
sort_values( num_flats, flats );
|
||||
|
||||
@ -228,31 +253,33 @@
|
||||
else if ( num_flats == 0 )
|
||||
{
|
||||
*blue_ref =
|
||||
*blue_shoot = rounds[ num_rounds/2 ];
|
||||
*blue_shoot = rounds[num_rounds / 2];
|
||||
}
|
||||
else if ( num_rounds == 0 )
|
||||
{
|
||||
*blue_ref =
|
||||
*blue_shoot = flats[ num_flats/2 ];
|
||||
*blue_shoot = flats[num_flats / 2];
|
||||
}
|
||||
else
|
||||
{
|
||||
*blue_ref = flats[ num_flats/2 ];
|
||||
*blue_shoot = rounds[ num_rounds/2 ];
|
||||
*blue_ref = flats[num_flats / 2];
|
||||
*blue_shoot = rounds[num_rounds / 2];
|
||||
}
|
||||
|
||||
/* there are sometimes problems, when the overshoot position of top */
|
||||
/* zones is under its reference position, or the opposite for bottom */
|
||||
/* zones. We must thus check everything there.. and correct the errors */
|
||||
/* there are sometimes problems: if the overshoot position of top */
|
||||
/* zones is under its reference position, or the opposite for bottom */
|
||||
/* zones. We must thus check everything there and correct the errors */
|
||||
if ( *blue_shoot != *blue_ref )
|
||||
{
|
||||
FT_Pos ref = *blue_ref;
|
||||
FT_Pos shoot = *blue_shoot;
|
||||
FT_Pos ref = *blue_ref;
|
||||
FT_Pos shoot = *blue_shoot;
|
||||
FT_Bool over_ref = ( shoot > ref );
|
||||
|
||||
if ( AH_IS_TOP_BLUE(blue) ^ over_ref )
|
||||
*blue_shoot = *blue_ref = (shoot+ref)/2;
|
||||
|
||||
if ( AH_IS_TOP_BLUE( blue ) ^ over_ref )
|
||||
*blue_shoot = *blue_ref = ( shoot + ref ) / 2;
|
||||
}
|
||||
|
||||
AH_LOG(( "-- ref = %ld, shoot = %ld\n", *blue_ref, *blue_shoot ));
|
||||
}
|
||||
|
||||
@ -269,34 +296,39 @@
|
||||
FT_Error ah_hinter_compute_widths( AH_Hinter* hinter )
|
||||
{
|
||||
/* scan the array of segments in each direction */
|
||||
AH_Outline* outline = hinter->glyph;
|
||||
AH_Segment* segments;
|
||||
AH_Segment* limit;
|
||||
AH_Globals* globals = &hinter->globals->design;
|
||||
FT_Pos* widths;
|
||||
FT_Int dimension;
|
||||
FT_Int* p_num_widths;
|
||||
FT_Error error = 0;
|
||||
FT_Pos edge_distance_threshold = 32000;
|
||||
AH_Outline* outline = hinter->glyph;
|
||||
AH_Segment* segments;
|
||||
AH_Segment* limit;
|
||||
AH_Globals* globals = &hinter->globals->design;
|
||||
FT_Pos* widths;
|
||||
FT_Int dimension;
|
||||
FT_Int* p_num_widths;
|
||||
FT_Error error = 0;
|
||||
FT_Pos edge_distance_threshold = 32000;
|
||||
|
||||
|
||||
globals->num_widths = 0;
|
||||
globals->num_heights = 0;
|
||||
|
||||
/* for now, compute the standard width and height from the "o" character */
|
||||
/* I started computing the stem width of the "i" and the stem height of */
|
||||
/* the "-", but it wasn't too good.. Moreover, we now have a single */
|
||||
/* character that gives us standard width and height */
|
||||
/* For now, compute the standard width and height from the `o' */
|
||||
/* character. I started computing the stem width of the `i' and the */
|
||||
/* stem height of the "-", but it wasn't too good. Moreover, we now */
|
||||
/* have a single character that gives us standard width and height. */
|
||||
{
|
||||
FT_UInt glyph_index;
|
||||
|
||||
|
||||
glyph_index = FT_Get_Char_Index( hinter->face, 'o' );
|
||||
if (glyph_index == 0) return 0;
|
||||
if ( glyph_index == 0 )
|
||||
return 0;
|
||||
|
||||
error = FT_Load_Glyph( hinter->face, glyph_index, FT_LOAD_NO_SCALE );
|
||||
if (error) goto Exit;
|
||||
if ( error )
|
||||
goto Exit;
|
||||
|
||||
error = ah_outline_load( hinter->glyph, hinter->face );
|
||||
if (error) goto Exit;
|
||||
if ( error )
|
||||
goto Exit;
|
||||
|
||||
ah_outline_compute_segments( hinter->glyph );
|
||||
ah_outline_link_segments( hinter->glyph );
|
||||
@ -313,19 +345,22 @@
|
||||
AH_Segment* link;
|
||||
FT_Int num_widths = 0;
|
||||
|
||||
|
||||
for ( ; seg < limit; seg++ )
|
||||
{
|
||||
link = seg->link;
|
||||
/* we only consider the stem segments there ! */
|
||||
if (link && link->link == seg && link > seg)
|
||||
/* we only consider stem segments there! */
|
||||
if ( link && link->link == seg && link > seg )
|
||||
{
|
||||
FT_Int dist;
|
||||
|
||||
|
||||
dist = seg->pos - link->pos;
|
||||
if (dist < 0) dist = -dist;
|
||||
if ( dist < 0 )
|
||||
dist = -dist;
|
||||
|
||||
if ( num_widths < 12 )
|
||||
widths[ num_widths++ ] = dist;
|
||||
widths[num_widths++] = dist;
|
||||
}
|
||||
}
|
||||
|
||||
@ -333,7 +368,7 @@
|
||||
*p_num_widths = num_widths;
|
||||
|
||||
/* we will now try to find the smallest width */
|
||||
if (num_widths > 0 && widths[0] < edge_distance_threshold )
|
||||
if ( num_widths > 0 && widths[0] < edge_distance_threshold )
|
||||
edge_distance_threshold = widths[0];
|
||||
|
||||
segments = outline->vert_segments;
|
||||
@ -343,13 +378,13 @@
|
||||
|
||||
}
|
||||
|
||||
/* now, compute the edge distance threshold as a fraction of the */
|
||||
/* smallest width in the font.. Set it in "hinter.glyph" too !! */
|
||||
if ( edge_distance_threshold == 32000)
|
||||
/* Now, compute the edge distance threshold as a fraction of the */
|
||||
/* smallest width in the font. Set it in `hinter.glyph' too! */
|
||||
if ( edge_distance_threshold == 32000 )
|
||||
edge_distance_threshold = 50;
|
||||
|
||||
/* let's try 20% */
|
||||
hinter->glyph->edge_distance_threshold = edge_distance_threshold/5;
|
||||
hinter->glyph->edge_distance_threshold = edge_distance_threshold / 5;
|
||||
|
||||
Exit:
|
||||
return error;
|
||||
@ -363,3 +398,5 @@
|
||||
ah_hinter_compute_blues ( hinter );
|
||||
}
|
||||
|
||||
|
||||
/* END */
|
||||
|
@ -2,37 +2,50 @@
|
||||
/* */
|
||||
/* ahglobal.h */
|
||||
/* */
|
||||
/* routines used to compute global metrics automatically */
|
||||
/* Routines used to compute global metrics automatically. */
|
||||
/* */
|
||||
/* Copyright 2000: Catharon Productions Inc. */
|
||||
/* Copyright 2000 Catharon Productions Inc. */
|
||||
/* Author: David Turner */
|
||||
/* */
|
||||
/* This file is part of the Catharon Typography Project and shall only */
|
||||
/* be used, modified, and distributed under the terms of the Catharon */
|
||||
/* Open Source License that should come with this file under the name */
|
||||
/* "CatharonLicense.txt". By continuing to use, modify, or distribute */
|
||||
/* `CatharonLicense.txt'. By continuing to use, modify, or distribute */
|
||||
/* this file you indicate that you have read the license and */
|
||||
/* understand and accept it fully. */
|
||||
/* */
|
||||
/* Note that this license is compatible with the FreeType license */
|
||||
/* Note that this license is compatible with the FreeType license. */
|
||||
/* */
|
||||
/***************************************************************************/
|
||||
|
||||
|
||||
#ifndef AGGLOBAL_H
|
||||
#define AGGLOBAL_H
|
||||
|
||||
#ifdef FT_FLAT_COMPILE
|
||||
|
||||
#include "ahtypes.h"
|
||||
|
||||
#else
|
||||
|
||||
#include <autohint/ahtypes.h>
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#include <freetype/internal/ftobjs.h> /* for LOCAL_DEF/LOCAL_FUNC */
|
||||
|
||||
#define AH_IS_TOP_BLUE(b) ( (b) == ah_blue_capital_top || \
|
||||
|
||||
#define AH_IS_TOP_BLUE( b ) ( (b) == ah_blue_capital_top || \
|
||||
(b) == ah_blue_small_top )
|
||||
|
||||
/* compute global metrics automatically */
|
||||
|
||||
/* compute global metrics automatically */
|
||||
LOCAL_DEF
|
||||
FT_Error ah_hinter_compute_globals( AH_Hinter* hinter );
|
||||
|
||||
|
||||
#endif /* AGGLOBAL_H */
|
||||
|
||||
|
||||
/* END */
|
||||
|
@ -1,33 +1,54 @@
|
||||
/***************************************************************************/
|
||||
/* */
|
||||
/* ftnames.c */
|
||||
/* */
|
||||
/* Simple interface to access SFNT name tables (which are used */
|
||||
/* to hold font names, copyright info, notices, etc.). */
|
||||
/* */
|
||||
/* This is _not_ used to retrieve glyph names! */
|
||||
/* */
|
||||
/* Copyright 1996-2000 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 <freetype/ftnames.h>
|
||||
#include <freetype/internal/tttypes.h>
|
||||
|
||||
#ifdef FT_CONFIG_OPTION_GLYPH_NAMES
|
||||
#endif /* FT_CONFIG_OPTION_GLYPH_NAMES */
|
||||
|
||||
|
||||
|
||||
|
||||
#ifdef FT_CONFIG_OPTION_SFNT_NAMES
|
||||
FT_EXPORT_FUNC(FT_UInt) FT_Get_Sfnt_Name_Count( FT_Face face )
|
||||
|
||||
|
||||
FT_EXPORT_FUNC( FT_UInt ) FT_Get_Sfnt_Name_Count( FT_Face face )
|
||||
{
|
||||
return ( face && FT_IS_SFNT(face) ? ((TT_Face)face)->num_names : 0 );
|
||||
return face && ( FT_IS_SFNT( face ) ? ((TT_Face)face)->num_names : 0 );
|
||||
}
|
||||
|
||||
|
||||
FT_EXPORT_FUNC(FT_Error) FT_Get_Sfnt_Name( FT_Face face,
|
||||
FT_UInt index,
|
||||
FT_SfntName* aname )
|
||||
FT_EXPORT_FUNC( FT_Error ) FT_Get_Sfnt_Name( FT_Face face,
|
||||
FT_UInt index,
|
||||
FT_SfntName* aname )
|
||||
{
|
||||
FT_Error error = FT_Err_Invalid_Argument;
|
||||
|
||||
if ( face && FT_IS_SFNT(face) )
|
||||
|
||||
if ( aname && face && FT_IS_SFNT( face ) )
|
||||
{
|
||||
TT_Face ttface = (TT_Face)face;
|
||||
|
||||
if (index < ttface->num_names)
|
||||
|
||||
if ( index < ttface->num_names )
|
||||
{
|
||||
TT_NameRec* name = ttface->name_table.names + index;
|
||||
|
||||
|
||||
aname->platform_id = name->platformID;
|
||||
aname->encoding_id = name->encodingID;
|
||||
aname->language_id = name->languageID;
|
||||
@ -41,4 +62,9 @@
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
|
||||
#endif /* FT_CONFIG_OPTION_SFNT_NAMES */
|
||||
|
||||
|
||||
/* END */
|
||||
|
@ -1031,7 +1031,7 @@
|
||||
( load_flags & FT_LOAD_MONOCHROME )
|
||||
? ft_render_mode_mono
|
||||
: ft_render_mode_normal );
|
||||
}
|
||||
}
|
||||
|
||||
Exit:
|
||||
return error;
|
||||
@ -1120,6 +1120,7 @@
|
||||
{
|
||||
FT_Driver_Class* clazz = driver->clazz;
|
||||
|
||||
|
||||
/* discard auto-hinting data */
|
||||
if ( face->autohint.finalizer )
|
||||
face->autohint.finalizer( face->autohint.data );
|
||||
@ -2259,34 +2260,34 @@
|
||||
/* FT_Get_Glyph_Name */
|
||||
/* */
|
||||
/* <Description> */
|
||||
/* Retrieves the ASCII name of a given glyph in a face. This only */
|
||||
/* works for those faces where FT_HAS_GLYPH_NAME(face) returns */
|
||||
/* true. */
|
||||
/* Retrieves the ASCII name of a given glyph in a face. This only */
|
||||
/* works for those faces where FT_HAS_GLYPH_NAME(face) returns true. */
|
||||
/* */
|
||||
/* <Input> */
|
||||
/* face :: A handle to a source face object. */
|
||||
/* glyph_index :: the glyph index. */
|
||||
/* */
|
||||
/* buffer :: pointer to a target buffer where the name will be */
|
||||
/* copied.. */
|
||||
/* glyph_index :: The glyph index. */
|
||||
/* */
|
||||
/* buffer_max :: the maximal number of bytes available in the buffer */
|
||||
/* buffer :: A pointer to a target buffer where the name will be */
|
||||
/* copied to. */
|
||||
/* */
|
||||
/* buffer_max :: The maximal number of bytes available in the */
|
||||
/* buffer. */
|
||||
/* */
|
||||
/* <Return> */
|
||||
/* FreeType error code. 0 means success. */
|
||||
/* */
|
||||
/* <Note> */
|
||||
/* An error is returned when the face doesn't provide glyph names */
|
||||
/* or when the glyph index is invalid. In all cases of failure, the */
|
||||
/* first byte of "buffer" will be set to 0 to indicate an empty */
|
||||
/* name. */
|
||||
/* An error is returned if the face doesn't provide glyph names or if */
|
||||
/* the glyph index is invalid. In all cases of failure, the first */
|
||||
/* byte of `buffer' will be set to 0 to indicate an empty name. */
|
||||
/* */
|
||||
/* The glyph name is truncated to fit within the buffer if it's too */
|
||||
/* long. The returned string is always zero-terminated */
|
||||
/* The glyph name is truncated to fit within the buffer if it is too */
|
||||
/* long. The returned string is always zero-terminated. */
|
||||
/* */
|
||||
/* This function is not compiled within the library if the config */
|
||||
/* macro FT_CONFIG_OPTION_NO_GLYPH_NAMES is defined in */
|
||||
/* <freetype/config/ftoptions.h> */
|
||||
/* `include/freetype/config/ftoptions.h' */
|
||||
/* */
|
||||
FT_EXPORT_FUNC( FT_Error ) FT_Get_Glyph_Name( FT_Face face,
|
||||
FT_UInt glyph_index,
|
||||
@ -2295,26 +2296,32 @@
|
||||
{
|
||||
FT_Error error = FT_Err_Invalid_Argument;
|
||||
|
||||
|
||||
/* clean up buffer */
|
||||
if (buffer && buffer_max > 0)
|
||||
if ( buffer && buffer_max > 0 )
|
||||
((FT_Byte*)buffer)[0] = 0;
|
||||
|
||||
if ( face && glyph_index < (FT_UInt)face->num_glyphs && FT_HAS_GLYPH_NAMES(face) )
|
||||
if ( face &&
|
||||
glyph_index < (FT_UInt)face->num_glyphs &&
|
||||
FT_HAS_GLYPH_NAMES( face ) )
|
||||
{
|
||||
/* now, lookup for glyph name */
|
||||
FT_Driver driver = face->driver;
|
||||
FT_Module_Class* clazz = FT_MODULE_CLASS(driver);
|
||||
FT_Module_Class* clazz = FT_MODULE_CLASS( driver );
|
||||
|
||||
if (clazz->get_interface)
|
||||
|
||||
if ( clazz->get_interface )
|
||||
{
|
||||
FT_Glyph_Name_Requester requester;
|
||||
|
||||
requester = (FT_Glyph_Name_Requester)
|
||||
clazz->get_interface( FT_MODULE(driver), "glyph_name" );
|
||||
if (requester)
|
||||
|
||||
requester = (FT_Glyph_Name_Requester)clazz->get_interface(
|
||||
FT_MODULE( driver ), "glyph_name" );
|
||||
if ( requester )
|
||||
error = requester( face, glyph_index, buffer, buffer_max );
|
||||
}
|
||||
}
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
|
@ -61,6 +61,7 @@
|
||||
/* */
|
||||
/* <Input> */
|
||||
/* memory :: A pointer to the memory object. */
|
||||
/* */
|
||||
/* size :: The requested size in bytes. */
|
||||
/* */
|
||||
/* <Return> */
|
||||
|
@ -90,22 +90,26 @@
|
||||
|
||||
|
||||
#ifdef TT_CONFIG_OPTION_POSTSCRIPT_NAMES
|
||||
|
||||
|
||||
static
|
||||
FT_Error get_sfnt_glyph_name( TT_Face face,
|
||||
FT_UInt glyph_index,
|
||||
FT_Pointer buffer,
|
||||
FT_UInt buffer_max )
|
||||
FT_Error get_sfnt_glyph_name( TT_Face face,
|
||||
FT_UInt glyph_index,
|
||||
FT_Pointer buffer,
|
||||
FT_UInt buffer_max )
|
||||
{
|
||||
FT_String* gname;
|
||||
FT_Error error;
|
||||
|
||||
|
||||
error = TT_Get_PS_Name( face, glyph_index, &gname );
|
||||
if (!error && buffer_max > 0)
|
||||
if ( !error && buffer_max > 0 )
|
||||
{
|
||||
FT_UInt len = strlen( gname );
|
||||
|
||||
if (len >= buffer_max)
|
||||
len = buffer_max-1;
|
||||
|
||||
if ( len >= buffer_max )
|
||||
len = buffer_max - 1;
|
||||
|
||||
MEM_Copy( buffer, gname, len );
|
||||
((FT_Byte*)buffer)[len] = 0;
|
||||
@ -113,7 +117,10 @@
|
||||
|
||||
return error;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* TT_CONFIG_OPTION_POSTSCRIPT_NAMES */
|
||||
|
||||
|
||||
static
|
||||
FT_Module_Interface SFNT_Get_Interface( FT_Module module,
|
||||
|
@ -319,8 +319,8 @@
|
||||
FT_FACE_FLAG_HORIZONTAL; /* horizontal data */
|
||||
|
||||
#ifdef TT_CONFIG_OPTION_POSTSCRIPT_NAMES
|
||||
/* might need more polish to detect the presence of a Postscript name */
|
||||
/* table in the font.. */
|
||||
/* might need more polish to detect the presence of a Postscript */
|
||||
/* name table in the font */
|
||||
flags |= FT_FACE_FLAG_GLYPH_NAMES;
|
||||
#endif
|
||||
|
||||
|
@ -107,26 +107,29 @@
|
||||
|
||||
|
||||
static
|
||||
FT_Error get_t1_glyph_name( T1_Face face,
|
||||
FT_UInt glyph_index,
|
||||
FT_Pointer buffer,
|
||||
FT_UInt buffer_max )
|
||||
FT_Error get_t1_glyph_name( T1_Face face,
|
||||
FT_UInt glyph_index,
|
||||
FT_Pointer buffer,
|
||||
FT_UInt buffer_max )
|
||||
{
|
||||
FT_String* gname;
|
||||
|
||||
|
||||
gname = face->type1.glyph_names[glyph_index];
|
||||
if (buffer_max > 0)
|
||||
|
||||
if ( buffer_max > 0 )
|
||||
{
|
||||
FT_UInt len = strlen( gname );
|
||||
|
||||
if (len >= buffer_max)
|
||||
len = buffer_max-1;
|
||||
|
||||
if ( len >= buffer_max )
|
||||
len = buffer_max - 1;
|
||||
|
||||
MEM_Copy( buffer, gname, len );
|
||||
((FT_Byte*)buffer)[len] = 0;
|
||||
}
|
||||
|
||||
return 0;
|
||||
return T1_Err_Ok;
|
||||
}
|
||||
|
||||
|
||||
|
@ -50,28 +50,30 @@
|
||||
#define FT_COMPONENT trace_z1driver
|
||||
|
||||
|
||||
|
||||
static
|
||||
FT_Error get_z1_glyph_name( T1_Face face,
|
||||
FT_UInt glyph_index,
|
||||
FT_Pointer buffer,
|
||||
FT_UInt buffer_max )
|
||||
FT_Error get_z1_glyph_name( T1_Face face,
|
||||
FT_UInt glyph_index,
|
||||
FT_Pointer buffer,
|
||||
FT_UInt buffer_max )
|
||||
{
|
||||
FT_String* gname;
|
||||
|
||||
|
||||
gname = face->type1.glyph_names[glyph_index];
|
||||
if (buffer_max > 0)
|
||||
|
||||
if ( buffer_max > 0 )
|
||||
{
|
||||
FT_UInt len = strlen( gname );
|
||||
|
||||
|
||||
if (len >= buffer_max)
|
||||
len = buffer_max-1;
|
||||
len = buffer_max - 1;
|
||||
|
||||
MEM_Copy( buffer, gname, len );
|
||||
((FT_Byte*)buffer)[len] = 0;
|
||||
}
|
||||
|
||||
return 0;
|
||||
return T1_Err_Ok;
|
||||
}
|
||||
|
||||
|
||||
|
@ -482,7 +482,7 @@
|
||||
|
||||
char_code -= first;
|
||||
if ( char_code < count )
|
||||
result = char_code+1;
|
||||
result = char_code + 1;
|
||||
else
|
||||
result = 0;
|
||||
}
|
||||
@ -515,7 +515,7 @@
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
if (glyph_index > 0)
|
||||
if ( glyph_index > 0 )
|
||||
glyph_index--;
|
||||
else
|
||||
glyph_index = font->header.default_char - font->header.first_char;
|
||||
|
Loading…
Reference in New Issue
Block a user