FreeType 1.31.1

This commit is contained in:
2023-08-27 18:03:45 +02:00
commit 5edbb7a80a
454 changed files with 173977 additions and 0 deletions

3
lib/.cvsignore Normal file
View File

@@ -0,0 +1,3 @@
.libs
*.lo
libttf.la

View File

@@ -0,0 +1,69 @@
# This file is part of the FreeType project.
#
# It builds the library and test programs for amiga using ADE Enviroment.
#
# You will need GNU make.
#
# Use this file while in the lib directory with the following statement:
#
# make -f arch/amigaos/Makefile.gcc
ARCH = arch/amigaos
FT_MAKEFILE = $(ARCH)/Makefile.gcc
AR = ar
RM = rm
CC = gcc
CFLAGS = -Wall -pedantic -ansi -O2 -g -noixemul -I$(ARCH) -I. -Iextend
SRC_X = extend/ftxgasp.c extend/ftxkern.c extend/ftxpost.c \
extend/ftxcmap.c extend/ftxwidth.c extend/ftxsbit.c \
extend/ftxgsub.c extend/ftxgpos.c extend/ftxgdef.c \
extend/ftxopen.c
OBJS_X = $(SRC_X:.c=.o)
SRC_M = ttapi.c ttcache.c ttcalc.c ttcmap.c ttdebug.c \
ttextend.c ttfile.c ttgload.c ttinterp.c ttload.c \
ttmemory.c ttmutex.c ttobjs.c ttraster.c
OBJS_M = $(SRC_M:.c=.o) $(OBJS_X)
SRC_S = $(ARCH)/freetype.c
OBJ_S = $(SRC_S:.c=.o)
OBJS_S = $(OBJ_S) $(OBJS_X)
%.o: %.c
$(CC) $(CFLAGS) -c -o $@ $<
.PHONY: all debug clean distclean
all:
$(MAKE) -f $(FT_MAKEFILE) LIB_FILES=OBJS_S libttf.a
debug:
$(MAKE) -f $(FT_MAKEFILE) LIB_FILES=OBJS_M libttf.a
$(OBJ_S): $(SRC_S) $(SRC_M)
libttf.a: $($(LIB_FILES))
$(AR) src $@ $^
clean:
$(RM) $($(LIB_FILES))
distclean: clean
$(RM) dep.end libttf.a
depend: $(SRC_S) $(SRC_M) $(SRC_X)
$(CC) -E -M $^ > dep.end
ifeq (dep.end,$(wildcard dep.end))
include dep.end
endif
# end of Makefile.gcc

View File

@@ -0,0 +1,25 @@
/* This file is part of the FreeType project */
/* Single object library component for AmigaOS */
#define TT_MAKE_OPTION_SINGLE_OBJECT
#include "ttapi.c"
#include "ttcache.c"
#include "ttcalc.c"
#include "ttcmap.c"
#include "ttdebug.c"
#include "ttfile.c"
#include "ttgload.c"
#include "ttinterp.c"
#include "ttload.c"
#include "ttmemory.c"
#include "ttmutex.c"
#include "ttobjs.c"
#include "ttraster.c"
#ifdef TT_CONFIG_OPTION_EXTEND_ENGINE
#include "ttextend.c"
#endif
/* END */

220
lib/arch/amigaos/ft_conf.h Normal file
View File

@@ -0,0 +1,220 @@
/* This file is part of the FreeType project */
/* ft_conf.h for AmigaOS using ADE enviroment */
/* we need the following because there are some typedefs in this file */
#ifndef FT_CONF_H
#define FT_CONF_H
/* Define to empty if the keyword does not work. */
/* #undef const */
/* Define if you have a working `mmap' system call. */
/* #undef HAVE_MMAP */
/* Define if you have the <stdlib.h> header file. */
#define HAVE_STDLIB_H
/* Define if the X Window System is missing or not being used. */
#define X_DISPLAY_MISSING
/* The number of bytes in a int. */
#define SIZEOF_INT 4
/* The number of bytes in a long. */
#define SIZEOF_LONG 4
/* Define if you have the getpagesize function. */
#define HAVE_GETPAGESIZE
/* Define if you have the memcpy function. */
#define HAVE_MEMCPY
/* Define if you have the memmove function. */
#define HAVE_MEMMOVE
/* Define if you have the valloc function. */
#define HAVE_VALLOC
/* Define if you have the <fcntl.h> header file. */
#define HAVE_FCNTL_H
/* Define if you have the <unistd.h> header file. */
#define HAVE_UNISTD_H
/**********************************************************************/
/* */
/* The following configuration macros can be tweaked manually by */
/* a developer to turn on or off certain features or options in the */
/* TrueType engine. This may be useful to tune it for specific */
/* purposes.. */
/* */
/**********************************************************************/
/*************************************************************************/
/* Define this if the underlying operating system uses a different */
/* character width than 8bit for file names. You must then also supply */
/* a typedef declaration for defining 'TT_Text'. Default is off. */
/* #define HAVE_TT_TEXT */
/*************************************************************************/
/* Define this if you want to generate code to support engine extensions */
/* Default is on, but if you're satisfied by the basic services provided */
/* by the engine and need no extensions, undefine this configuration */
/* macro to save a few more bytes. */
#define TT_CONFIG_OPTION_EXTEND_ENGINE
/*************************************************************************/
/* Define this if you want to generate code to support gray-scaling, */
/* a.k.a. font-smoothing or anti-aliasing. Default is on, but you can */
/* disable it if you don't need it. */
#define TT_CONFIG_OPTION_GRAY_SCALING
/*************************************************************************/
/* Define this if you want to completely disable the use of the bytecode */
/* interpreter. Doing so will produce a much smaller library, but the */
/* quality of the rendered glyphs will enormously suffer from this. */
/* */
/* This switch was introduced due to the Apple patents issue which */
/* emerged recently on the FreeType lists. We still do not have Apple's */
/* opinion on the subject and will change this as soon as we have. */
#undef TT_CONFIG_OPTION_NO_INTERPRETER
/*************************************************************************/
/* Define this if you want to use a big 'switch' statement within the */
/* bytecode interpreter. Because some non-optimizing compilers are not */
/* able to produce jump tables from such statements, undefining this */
/* configuration macro will generate the appropriate C jump table in */
/* ttinterp.c. If you use an optimizing compiler, you should leave it */
/* defined for better performance and code compactness.. */
#define TT_CONFIG_OPTION_INTERPRETER_SWITCH
/*************************************************************************/
/* Define this if you want to build a 'static' version of the TrueType */
/* bytecode interpreter. This will produce much bigger code, which */
/* _may_ be faster on some architectures.. */
/* */
/* Do NOT DEFINE THIS is you build a thread-safe version of the engine */
/* */
#undef TT_CONFIG_OPTION_STATIC_INTERPRETER
/*************************************************************************/
/* Define this if you want to build a 'static' version of the scan-line */
/* converter (the component which in charge of converting outlines into */
/* bitmaps). This will produce a bigger object file for "ttraster.c", */
/* which _may_ be faster on some architectures.. */
/* */
/* Do NOT DEFINE THIS is you build a thread-safe version of the engine */
/* */
#undef TT_CONFIG_OPTION_STATIC_RASTER
/*************************************************************************/
/* Define TT_CONFIG_THREAD_SAFE if you want to build a thread-safe */
/* version of the library. */
#undef TT_CONFIG_OPTION_THREAD_SAFE
/**********************************************************************/
/* */
/* The following macros are used to define the debug level, as well */
/* as individual tracing levels for each component. There are */
/* currently three modes of operation : */
/* */
/* - trace mode (define DEBUG_LEVEL_TRACE) */
/* */
/* The engine prints all error messages, as well as tracing */
/* ones, filtered by each component's level */
/* */
/* - debug mode (define DEBUG_LEVEL_ERROR) */
/* */
/* Disable tracing, but keeps error output and assertion */
/* checks. */
/* */
/* - release mode (don't define anything) */
/* */
/* Don't include error-checking or tracing code in the */
/* engine's code. Ideal for releases. */
/* */
/* NOTE : */
/* */
/* Each component's tracing level is defined in its own source. */
/* */
/**********************************************************************/
/* Define if you want to use the tracing debug mode */
#undef DEBUG_LEVEL_TRACE
/* Define if you want to use the error debug mode - ignored if */
/* DEBUG_LEVEL_TRACE is defined */
#undef DEBUG_LEVEL_ERROR
/**************************************************************************/
/* Definition of various integer sizes. These types are used by ttcalc */
/* and ttinterp (for the 64-bit integers) only.. */
#if SIZEOF_INT == 4
typedef signed int TT_Int32;
typedef unsigned int TT_Word32;
#elif SIZEOF_LONG == 4
typedef signed long TT_Int32;
typedef unsigned long TT_Word32;
#else
#error "no 32bit type found"
#endif
#if SIZEOF_LONG == 8
/* LONG64 must be defined when a 64-bit type is available */
/* INT64 must then be defined to this type.. */
#define LONG64
#define INT64 long
#else
/* GCC provides the non-ANSI 'long long' 64-bit type. You can activate */
/* by defining the TT_USE_LONG_LONG macro in 'ft_conf.h'. Note that this */
/* will produce many -ansi warnings during library compilation. */
#ifdef TT_USE_LONG_LONG
#define LONG64
#define INT64 long long
#endif /* TT_USE_LONG_LONG */
#endif
#endif /* FT_CONF_H */
/* END */

32
lib/arch/ansi/freetype.c Normal file
View File

@@ -0,0 +1,32 @@
/* This file is part of the FreeType project */
/* Single file library component for the ANSI target */
#define TT_MAKE_OPTION_SINGLE_OBJECT
/* first include common core components */
#include "ttapi.c"
#include "ttcache.c"
#include "ttcalc.c"
#include "ttcmap.c"
#include "ttdebug.c"
#include "ttgload.c"
#include "ttinterp.c"
#include "ttload.c"
#include "ttobjs.c"
#include "ttraster.c"
/* then system-specific (or ANSI) components */
#include "ttfile.c"
#include "ttmemory.c"
#include "ttmutex.c"
/* the extensions are compiled separately, but we need to */
/* include the file ttextend.c if we want to support them */
#ifdef TT_CONFIG_OPTION_EXTEND_ENGINE
#include "ttextend.c"
#endif
/* END */

227
lib/arch/ansi/ft_conf.h Normal file
View File

@@ -0,0 +1,227 @@
/* This file is part of the FreeType project */
/* ft_conf.h for the ANSI Build */
/* we need the following because there are some typedefs in this file */
#ifndef FT_CONF_H
#define FT_CONF_H
/* Define to empty if the keyword does not work. */
/* #undef const */
/* Define if you have a working `mmap' system call. */
#undef HAVE_MMAP
/* Define if you have the <stdlib.h> header file. */
#define HAVE_STDLIB_H
/* Define if you have the getpagesize function. */
#undef HAVE_GETPAGESIZE
/* Define if you have the memcpy function. */
#define HAVE_MEMCPY
/* Define if you have the memmove function. */
#define HAVE_MEMMOVE
/* Define if you have the valloc function. */
#undef HAVE_VALLOC
/* Define if you have the <fcntl.h> header file. Unix-specific */
#undef HAVE_FCNTL_H
/* command.com can't pipe stderr into a file; any message would be */
/* written into the graphics screen. */
#define HAVE_PRINT_FUNCTION 1
#define Print( format, ap ) vfprintf( stdout, (format), (ap) )
/* The number of bytes in a int. We use the ANSI header file limits.h */
/* for determining it since there is no easy way to guess. */
/* */
#include <limits.h>
#if UINT_MAX == 0xFFFF
#define SIZEOF_INT 2
#elif UINT_MAX == 0xFFFFFFFF
#define SIZEOF_INT 4
#else
#error "Unsupported number of bytes in `int' type!"
#endif
/* We now try to guess the size of longs in the same way */
/* */
#if ULONG_MAX == 0xFFFFFFFF
#define SIZEOF_LONG 4
#elif ULONG_MAX == 0xFFFFFFFFFFFFFFFF
#define SIZEOF_LONG 8
#else
#error "Unsupported number of bytes in `long' type!"
#endif
/**********************************************************************/
/* */
/* The following configuration macros can be tweaked manually by */
/* a developer to turn on or off certain features or options in the */
/* TrueType engine. This may be useful to tune it for specific */
/* purposes.. */
/* */
/**********************************************************************/
/*************************************************************************/
/* Define this if the underlying operating system uses a different */
/* character width than 8bit for file names. You must then also supply */
/* a typedef declaration for defining 'TT_Text'. Default is off. */
/* #define HAVE_TT_TEXT */
/*************************************************************************/
/* Define this if you want to generate code to support engine extensions */
/* Default is on, but if you're satisfied by the basic services provided */
/* by the engine and need no extensions, undefine this configuration */
/* macro to save a few more bytes. */
#define TT_CONFIG_OPTION_EXTEND_ENGINE
/*************************************************************************/
/* Define this if you want to generate code to support gray-scaling, */
/* a.k.a. font-smoothing or anti-aliasing. Default is on, but you can */
/* disable it if you don't need it. */
#define TT_CONFIG_OPTION_GRAY_SCALING
/*************************************************************************/
/* Define this if you want to completely disable the use of the bytecode */
/* interpreter. Doing so will produce a much smaller library, but the */
/* quality of the rendered glyphs will enormously suffer from this. */
/* */
/* This switch was introduced due to the Apple patents issue which */
/* emerged recently on the FreeType lists. We still do not have Apple's */
/* opinion on the subject and will change this as soon as we have. */
#undef TT_CONFIG_OPTION_NO_INTERPRETER
/*************************************************************************/
/* Define this if you want to use a big 'switch' statement within the */
/* bytecode interpreter. Because some non-optimizing compilers are not */
/* able to produce jump tables from such statements, undefining this */
/* configuration macro will generate the appropriate C jump table in */
/* ttinterp.c. If you use an optimizing compiler, you should leave it */
/* defined for better performance and code compactness.. */
#define TT_CONFIG_OPTION_INTERPRETER_SWITCH
/*************************************************************************/
/* Define this if you want to build a 'static' version of the TrueType */
/* bytecode interpreter. This will produce much bigger code, which */
/* _may_ be faster on some architectures.. */
/* */
/* Do NOT DEFINE THIS is you build a thread-safe version of the engine */
/* */
#undef TT_CONFIG_OPTION_STATIC_INTERPRETER
/*************************************************************************/
/* Define this if you want to build a 'static' version of the scan-line */
/* converter (the component which in charge of converting outlines into */
/* bitmaps). This will produce a bigger object file for "ttraster.c", */
/* which _may_ be faster on some architectures.. */
/* */
/* Do NOT DEFINE THIS is you build a thread-safe version of the engine */
/* */
#define TT_CONFIG_OPTION_STATIC_RASTER
/*************************************************************************/
/* Define TT_CONFIG_THREAD_SAFE if you want to build a thread-safe */
/* version of the library. */
#undef TT_CONFIG_OPTION_THREAD_SAFE
/**********************************************************************/
/* */
/* The following macros are used to define the debug level, as well */
/* as individual tracing levels for each component. There are */
/* currently three modes of operation : */
/* */
/* - trace mode (define DEBUG_LEVEL_TRACE) */
/* */
/* The engine prints all error messages, as well as tracing */
/* ones, filtered by each component's level */
/* */
/* - debug mode (define DEBUG_LEVEL_ERROR) */
/* */
/* Disable tracing, but keeps error output and assertion */
/* checks. */
/* */
/* - release mode (don't define anything) */
/* */
/* Don't include error-checking or tracing code in the */
/* engine's code. Ideal for releases. */
/* */
/* NOTE : */
/* */
/* Each component's tracing level is defined in its own source. */
/* */
/**********************************************************************/
/* Define if you want to use the tracing debug mode */
#undef DEBUG_LEVEL_TRACE
/* Define if you want to use the error debug mode - ignored if */
/* DEBUG_LEVEL_TRACE is defined */
#undef DEBUG_LEVEL_ERROR
/**************************************************************************/
/* Definition of various integer sizes. These types are used by ttcalc */
/* and ttinterp (for the 64-bit integers) only.. */
#if SIZEOF_INT == 4
typedef signed int TT_Int32;
typedef unsigned int TT_Word32;
#elif SIZEOF_LONG == 4
typedef signed long TT_Int32;
typedef unsigned long TT_Word32;
#else
#error "no 32bit type found"
#endif
#if SIZEOF_LONG == 8
/* LONG64 must be defined when a 64-bit type is available */
/* INT64 must then be defined to this type.. */
#define LONG64
#define INT64 long
#else
/* GCC provides the non-ANSI 'long long' 64-bit type. You can activate */
/* by defining the TT_USE_LONG_LONG macro in 'ft_conf.h'. Note that this */
/* will produce many -ansi warnings during library compilation. */
#ifdef TT_USE_LONG_LONG
#define LONG64
#define INT64 long long
#endif /* TT_USE_LONG_LONG */
#endif
#endif /* FT_CONF_H */
/* END */

View File

@@ -0,0 +1,96 @@
# This file is part of the FreeType project.
#
# It builds the library and test programs for emx-gcc under OS/2 or under
# Unix with extra debugging capabilities.
#
# You will need GNU make.
#
# Use this file while in the lib directory with the following statement:
#
# make -f arch/debugger/Makefile
ARCH = arch/debugger
FT_MAKEFILE = $(ARCH)/Makefile
CC = gcc
#CFLAGS = -W -Wall -O0 -g -ansi -pedantic -I$(ARCH) -I. -Iextend
CFLAGS = -Wall -O0 -g -ansi -I$(ARCH) -I. -Iextend
#CFLAGS = -Wall -ansi -pedantic -O2 -s -I$(ARCH) -I. -Iextend
# Detect OS/2 to add the flag -DOS2 when compiling ttinterp.c
#
ifdef OS2_SHELL
OS := OS2
RM := del
else
OS := UNIX # Unix build otherwise
RM := rm -f
endif
TTFILE = ./ttfile.c
TTMEMORY = ./ttmemory.c
TTMUTEX = ./ttmutex.c
PORT = $(TTFILE) $(TTMEMORY) $(TTMUTEX)
SRC_X = extend/ftxgasp.c extend/ftxkern.c extend/ftxpost.c \
extend/ftxcmap.c extend/ftxwidth.c extend/ftxsbit.c \
extend/ftxgsub.c extend/ftxgpos.c extend/ftxopen.c \
extend/ftxgdef.c
OBJS_X = $(SRC_X:.c=.o)
SRC_M = ttapi.c ttcache.c ttcalc.c ttcmap.c ttdebug.c \
ttgload.c ttinterp.c ttload.c ttobjs.c \
ttraster.c ttextend.c $(PORT)
OBJS_M = $(SRC_M:.c=.o) $(OBJS_X)
SRC_S = $(ARCH)/freetype.c
OBJ_S = $(SRC_S:.c=.o)
OBJS_S = $(OBJ_S) $(OBJS_X)
# We place the library file in the ARCH directory, so that it doesn't
# interfere with the normal build.
#
LIBTTF_A = $(ARCH)/libttf.a
%.o: %.c
$(CC) $(CFLAGS) -c -o $@ $< -D$(OS)
.PHONY: all debug clean distclean depend
all:
$(MAKE) -f $(FT_MAKEFILE) LIB_FILES=OBJS_S $(LIBTTF_A)
debug:
$(MAKE) -f $(FT_MAKEFILE) LIB_FILES=OBJS_M $(LIBTTF_A)
$(OBJ_S): $(SRC_S) $(SRC_M)
$(LIBTTF_A): $($(LIB_FILES))
-$(RM) $@
ar src $@ $^
clean:
ifdef OS2_SHELL
-$(RM) $(subst /,\,$(LIBTTF_A))
-$(RM) $(subst /,\,$(OBJS_S))
else
-$(RM) $(LIBTTF_A)
-$(RM) $(OBJS_S)
endif
distclean: clean
-$(RM) dep.end
depend: $(SRC_S) $(SRC_M) $(SRC_X)
$(CC) $(CFLAGS) -E -M $^ > dep.end
ifeq (dep.end,$(wildcard dep.end))
include dep.end
endif
# end of Makefile

View File

@@ -0,0 +1,32 @@
/* This file is part of the FreeType project */
/* Single file library component for the debugging target */
#define TT_MAKE_OPTION_SINGLE_OBJECT
/* first include common core components */
#include "ttapi.c"
#include "ttcache.c"
#include "ttcalc.c"
#include "ttcmap.c"
#include "ttdebug.c"
#include "ttgload.c"
#include "ttinterp.c"
#include "ttload.c"
#include "ttobjs.c"
#include "ttraster.c"
/* then system-specific (or ANSI) components */
#include "ttfile.c"
#include "ttmemory.c"
#include "ttmutex.c"
/* the extensions are compiled separately, but we need to */
/* include the file ttextend.c if we want to support them */
#ifdef TT_CONFIG_OPTION_EXTEND_ENGINE
#include "ttextend.c"
#endif
/* END */

236
lib/arch/debugger/ft_conf.h Normal file
View File

@@ -0,0 +1,236 @@
/* This file is part of the FreeType project */
/* ft_conf.h for a debugging build */
/* we need the following because there are some typedefs in this file */
#ifndef FT_CONF_H
#define FT_CONF_H
/* Define to empty if the keyword does not work. */
/* #undef const */
/* Define if you have a working `mmap' system call. */
#undef HAVE_MMAP
/* Define if you have the <stdlib.h> header file. */
#define HAVE_STDLIB_H
/* Define if you have the getpagesize function. */
#undef HAVE_GETPAGESIZE
/* Define if you have the memcpy function. */
#define HAVE_MEMCPY
/* Define if you have the memmove function. */
#define HAVE_MEMMOVE
/* Define if you have the valloc function. */
#undef HAVE_VALLOC
/* Define if you have the <fcntl.h> header file. Unix-specific */
#undef HAVE_FCNTL_H
/* command.com can't pipe stderr into a file; any message would be */
/* written into the graphics screen. */
#define HAVE_PRINT_FUNCTION 1
#define Print( format, ap ) vfprintf( stdout, (format), (ap) )
/* The number of bytes in a int. We use the ANSI header file limits.h */
/* for determining it since there is no easy way to guess. */
/* */
#include <limits.h>
#if UINT_MAX == 0xFFFF
#define SIZEOF_INT 2
#elif UINT_MAX == 0xFFFFFFFF
#define SIZEOF_INT 4
#else
#error "Unsupported number of bytes in `int' type!"
#endif
/* We now try to guess the size of longs in the same way */
/* */
#if ULONG_MAX == 0xFFFFFFFF
#define SIZEOF_LONG 4
#elif ULONG_MAX == 0xFFFFFFFFFFFFFFFF
#define SIZEOF_LONG 8
#else
#error "Unsupported number of bytes in `long' type!"
#endif
/**********************************************************************/
/* */
/* The following configuration macros can be tweaked manually by */
/* a developer to turn on or off certain features or options in the */
/* TrueType engine. This may be useful to tune it for specific */
/* purposes.. */
/* */
/**********************************************************************/
/*************************************************************************/
/* Define this if the underlying operating system uses a different */
/* character width than 8bit for file names. You must then also supply */
/* a typedef declaration for defining 'TT_Text'. Default is off. */
/* #define HAVE_TT_TEXT */
/*************************************************************************/
/* Define this if you want to generate code to support engine extensions */
/* Default is on, but if you're satisfied by the basic services provided */
/* by the engine and need no extensions, undefine this configuration */
/* macro to save a few more bytes. */
#define TT_CONFIG_OPTION_EXTEND_ENGINE
/*************************************************************************/
/* Define this if you want to generate code to support gray-scaling, */
/* a.k.a. font-smoothing or anti-aliasing. Default is on, but you can */
/* disable it if you don't need it. */
#define TT_CONFIG_OPTION_GRAY_SCALING
/*************************************************************************/
/* Define this if you want to completely disable the use of the bytecode */
/* interpreter. Doing so will produce a much smaller library, but the */
/* quality of the rendered glyphs will enormously suffer from this. */
/* */
/* This switch was introduced due to the Apple patents issue which */
/* emerged recently on the FreeType lists. We still do not have Apple's */
/* opinion on the subject and will change this as soon as we have. */
#undef TT_CONFIG_OPTION_NO_INTERPRETER
/*************************************************************************/
/* Define this if you want to use a big 'switch' statement within the */
/* bytecode interpreter. Because some non-optimizing compilers are not */
/* able to produce jump tables from such statements, undefining this */
/* configuration macro will generate the appropriate C jump table in */
/* ttinterp.c. If you use an optimizing compiler, you should leave it */
/* defined for better performance and code compactness.. */
/* */
/* For debugging, we use a jump table; this allows some interesting */
/* things during development. */
#undef TT_CONFIG_OPTION_INTERPRETER_SWITCH
/*************************************************************************/
/* Define this if you want to build a `static' version of the TrueType */
/* bytecode interpreter. This will produce much bigger code, which */
/* _may_ be faster on some architectures. */
/* */
/* Do NOT DEFINE THIS is you build a thread-safe version of the engine. */
/* */
/* We use a static interpreter in the debugger; this helps in setting */
/* data breakpoints to fixed memory addresses. */
#define TT_CONFIG_OPTION_STATIC_INTERPRETER
/* an extra for the debugger */
#define DEBUG_INTERPRETER
/*************************************************************************/
/* Define this if you want to build a 'static' version of the scan-line */
/* converter (the component which in charge of converting outlines into */
/* bitmaps). This will produce a bigger object file for "ttraster.c", */
/* which _may_ be faster on some architectures.. */
/* */
/* Do NOT DEFINE THIS is you build a thread-safe version of the engine */
#define TT_CONFIG_OPTION_STATIC_RASTER
/*************************************************************************/
/* Define TT_CONFIG_THREAD_SAFE if you want to build a thread-safe */
/* version of the library. */
#undef TT_CONFIG_OPTION_THREAD_SAFE
/**********************************************************************/
/* */
/* The following macros are used to define the debug level, as well */
/* as individual tracing levels for each component. There are */
/* currently three modes of operation : */
/* */
/* - trace mode (define DEBUG_LEVEL_TRACE) */
/* */
/* The engine prints all error messages, as well as tracing */
/* ones, filtered by each component's level */
/* */
/* - debug mode (define DEBUG_LEVEL_ERROR) */
/* */
/* Disable tracing, but keeps error output and assertion */
/* checks. */
/* */
/* - release mode (don't define anything) */
/* */
/* Don't include error-checking or tracing code in the */
/* engine's code. Ideal for releases. */
/* */
/* NOTE : */
/* */
/* Each component's tracing level is defined in its own source. */
/* */
/**********************************************************************/
/* Define if you want to use the tracing debug mode. */
/* Set to DEBUG_LEVEL_TRACE for the debugger. */
#define DEBUG_LEVEL_TRACE
/* Define if you want to use the error debug mode - ignored if */
/* DEBUG_LEVEL_TRACE is defined */
#undef DEBUG_LEVEL_ERROR
/**************************************************************************/
/* Definition of various integer sizes. These types are used by ttcalc */
/* and ttinterp (for the 64-bit integers) only.. */
#if SIZEOF_INT == 4
typedef signed int TT_Int32;
typedef unsigned int TT_Word32;
#elif SIZEOF_LONG == 4
typedef signed long TT_Int32;
typedef unsigned long TT_Word32;
#else
#error "no 32bit type found"
#endif
#if SIZEOF_LONG == 8
/* LONG64 must be defined when a 64-bit type is available */
/* INT64 must then be defined to this type.. */
#define LONG64
#define INT64 long
#else
/* GCC provides the non-ANSI 'long long' 64-bit type. You can activate */
/* by defining the TT_USE_LONG_LONG macro in 'ft_conf.h'. Note that this */
/* will produce many -ansi warnings during library compilation. */
#ifdef TT_USE_LONG_LONG
#define LONG64
#define INT64 long long
#endif /* TT_USE_LONG_LONG */
#endif
#endif /* FT_CONF_H */
/* END */

47
lib/arch/mac/README Normal file
View File

@@ -0,0 +1,47 @@
This is the readme of the freetype.hqx archive in the contrib/mac
subdirectory. Please note that the FreeType team does *not* support the
Macintosh platform due to lack of knowledge. All questions regarding the
code should be sent to both David Williss and the freetype-devel list.
----------------------------------------------------------------------------
These are CodeWarrior projects for building the FreeType library on a Macintosh
I've only provided PPC projects here, but building for 68K shouldn't be hard.
There are two directories here (OK, "folders"). One contains a project for
building freetype.ppc.lib and the other is for freetype.ppc.dll. (I havn't
actually tested the DLL yet.)
The Macintosh stores TrueType fonts in a "Fonts" folder under the "System"
folder. There is a standard MacOS API for finding this folder, so I use it.
However, the fonts aren't normal flat files. They have all the data in
resources in the resource fork. Each font is an 'sfnt' resource, and each
file can have more than one 'sfnt' resource.
To get at them, I made a copy of ttmmap.c from the Unix implementation and
modified it to load/release the resource and lock/unlock the handle as needed.
This only required a change to the open and close functions. After that, it
works just as if it was using Unix memory mapping.
One thing however. Because of the bizarre scheme for storing the fonts, I
made up a way of specifying the font filename.
fonts:/fontfile/fontname
Where fonts:/ is a literal string that means "the fonts folder", fontfile is
the name of the actual file and fontname is the name of the 'sfnt' resource.
Currently, this is the only thing it understands. It might be nice if some
day (2.0 maybe?) ttfile.c and ttmmap.c wern't mutialy exclusive and it could
decide which method to use based on the filename or something.
Another thing that I had to change to make this work. It seems that Macintosh
TrueType fonts have no OS/2 table, so ttload.c needs to be modified to make
that nonfatal, at least on a Macintosh.
---
David Williss
MicroImages, Inc.
dwilliss@microimages.com

48
lib/arch/mac/freetype.c Normal file
View File

@@ -0,0 +1,48 @@
/* This file is *not* part of the FreeType project, because the team */
/* lacks the necessary expertise to support it. */
/* freetype.c for MacOS */
/* single object library component for MacOS */
/* Written by Dave Willis <dwilliss@microimages.com> on 1998-07-30. */
/* Modified by Antoine Leca for the 1.3 release, but untested. */
#define TT_MAKE_OPTION_SINGLE_OBJECT
/* Note, you should define the EXPORT_DEF and EXPORT_FUNC macros here */
/* if you want to build a DLL. If undefined, the macros are defined */
/* as "export" and "" (i.e. nothing), which is the normal behaviour. */
/* The macros are placed before each high-level API function */
/* declaration. You can then use them to take any compiler-specific */
/* pragma for DLL-exported symbols. See 'ttconfig.h' for details. */
/* first include common core components */
#define MAC_MAIN_OBJECT
#include "ttapi.c"
#include "ttcache.c"
#include "ttcalc.c"
#include "ttcmap.c"
#include "ttdebug.c"
#include "ttgload.c"
#include "ttinterp.c"
#include "ttload.c"
#include "ttobjs.c"
#include "ttobjs.c"
#include "ttraster.c"
/* then system-specific (or ANSI) components */
#include "ttmmap.c" /* Was "ttfile.c" */
#include "ttmemory.c"
#include "ttmutex.c"
/* finally, add some extensions */
#ifdef TT_CONFIG_OPTION_EXTEND_ENGINE
#include "ttextend.c"
#endif
/* END */

211
lib/arch/mac/ft_conf.h Normal file
View File

@@ -0,0 +1,211 @@
/* This file is *not* part of the FreeType project, because the team */
/* lacks the necessary expertise to support it. */
/* ft_conf.h for MacOS */
/* Written by Dave Willis <dwilliss@microimages.com> on 1998-07-30. */
/* Modified by Antoine Leca for the 1.3 release, but untested. */
/* we need the following because there are some typedefs in this file */
#ifndef FT_CONF_H
#define FT_CONF_H
/* Define to empty if the 'const' keyword does not work. */
/* #undef const */
/* Define if you have a working `mmap' system call. */
#undef HAVE_MMAP
/* Define if you have the <stdlib.h> header file. */
#define HAVE_STDLIB_H
/* Define if you have the getpagesize function. */
#undef HAVE_GETPAGESIZE
/* Define if you have the memcpy function. */
#define HAVE_MEMCPY
/* Define if you have the memmove function. */
#define HAVE_MEMMOVE
/* Define if you have the valloc function. */
#undef HAVE_VALLOC
/* Define if you have the <fcntl.h> header file. */
#undef HAVE_FCNTL_H
/* Define if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
/* The number of bytes in a int. */
#define SIZEOF_INT 4
/* The number of bytes in a long. */
#define SIZEOF_LONG 4
/**********************************************************************/
/* */
/* The following configuration macros can be tweaked manually by */
/* a developer to turn on or off certain features or options in the */
/* TrueType engine. This may be useful to tune it for specific */
/* purposes.. */
/* */
/**********************************************************************/
/*************************************************************************/
/* Define this if the underlying operating system uses a different */
/* character width than 8bit for file names. You must then also supply */
/* a typedef declaration for defining 'TT_Text'. Default is off. */
/* #define HAVE_TT_TEXT */
/*************************************************************************/
/* Define this if you want to generate code to support engine extensions */
/* Default is on, but if you're satisfied by the basic services provided */
/* by the engine and need no extensions, undefine this configuration */
/* macro to save a few more bytes. */
#define TT_CONFIG_OPTION_EXTEND_ENGINE
/*************************************************************************/
/* Define this if you want to generate code to support gray-scaling, */
/* a.k.a. font-smoothing or anti-aliasing. Default is on, but you can */
/* disable it if you don't need it. */
#define TT_CONFIG_OPTION_GRAY_SCALING
/*************************************************************************/
/* Define this if you want to completely disable the use of the bytecode */
/* interpreter. Doing so will produce a much smaller library, but the */
/* quality of the rendered glyphs will enormously suffer from this. */
/* */
/* This switch was introduced due to the Apple patents issue which */
/* emerged recently on the FreeType lists. We still do not have Apple's */
/* opinion on the subject and will change this as soon as we have. */
#undef TT_CONFIG_OPTION_NO_INTERPRETER
/*************************************************************************/
/* Define this if you want to use a big 'switch' statement within the */
/* bytecode interpreter. Because some non-optimizing compilers are not */
/* able to produce jump tables from such statements, undefining this */
/* configuration macro will generate the appropriate C jump table in */
/* ttinterp.c. If you use an optimizing compiler, you should leave it */
/* defined for better performance and code compactness.. */
#define TT_CONFIG_OPTION_INTERPRETER_SWITCH
/*************************************************************************/
/* Define this if you want to build a 'static' version of the TrueType */
/* bytecode interpreter. This will produce much bigger code, which */
/* _may_ be faster on some architectures.. */
/* */
/* Do NOT DEFINE THIS is you build a thread-safe version of the engine */
/* */
#undef TT_CONFIG_OPTION_STATIC_INTERPRETER
/*************************************************************************/
/* Define this if you want to build a 'static' version of the scan-line */
/* converter (the component which in charge of converting outlines into */
/* bitmaps). This will produce a bigger object file for "ttraster.c", */
/* which _may_ be faster on some architectures.. */
/* */
/* Do NOT DEFINE THIS is you build a thread-safe version of the engine */
/* */
#undef TT_CONFIG_OPTION_STATIC_RASTER
/*************************************************************************/
/* Define TT_CONFIG_THREAD_SAFE if you want to build a thread-safe */
/* version of the library. */
#undef TT_CONFIG_OPTION_THREAD_SAFE
/**********************************************************************/
/* */
/* The following macros are used to define the debug level, as well */
/* as individual tracing levels for each component. There are */
/* currently three modes of operation : */
/* */
/* - trace mode (define DEBUG_LEVEL_TRACE) */
/* */
/* The engine prints all error messages, as well as tracing */
/* ones, filtered by each component's level */
/* */
/* - debug mode (define DEBUG_LEVEL_ERROR) */
/* */
/* Disable tracing, but keeps error output and assertion */
/* checks. */
/* */
/* - release mode (don't define anything) */
/* */
/* Don't include error-checking or tracing code in the */
/* engine's code. Ideal for releases. */
/* */
/* NOTE : */
/* */
/* Each component's tracing level is defined in its own source. */
/* */
/**********************************************************************/
/* Define if you want to use the tracing debug mode */
#undef DEBUG_LEVEL_TRACE
/* Define if you want to use the error debug mode - ignored if */
/* DEBUG_LEVEL_TRACE is defined */
#undef DEBUG_LEVEL_ERROR
/**************************************************************************/
/* Definition of various integer sizes. These types are used by ttcalc */
/* and ttinterp (for the 64-bit integers) only.. */
#if SIZEOF_INT == 4
typedef signed int TT_Int32;
typedef unsigned int TT_Word32;
#elif SIZEOF_LONG == 4
typedef signed long TT_Int32;
typedef unsigned long TT_Word32;
#else
#error "no 32bit type found"
#endif
#if SIZEOF_LONG == 8
/* LONG64 must be defined when a 64-bit type is available */
/* INT64 must then be defined to this type.. */
#define LONG64
#define INT64 long
#else
/* GCC provides the non-ANSI 'long long' 64-bit type. You can activate */
/* by defining the TT_USE_LONG_LONG macro in 'ft_conf.h'. Note that this */
/* will produce many -ansi warnings during library compilation. */
#ifdef TT_USE_LONG_LONG
#define LONG64
#define INT64 long long
#endif /* TT_USE_LONG_LONG */
#endif
#endif /* FT_CONF_H */
/* END */

1069
lib/arch/mac/ttmmap.c Normal file

File diff suppressed because it is too large Load Diff

132
lib/arch/msdos/Makefile.BC Normal file
View File

@@ -0,0 +1,132 @@
# This file is part of the FreeType project.
#
# It builds the library for Borland C++ for MS-DOS, large model.
# Due to size constraints, it does not try to pack all modules into one
# (`single-object mode').
#
# You will need Borland MAKE.
# Tested with Borland C++ v.3.1, 4.02, 5.0.
#
# Use this file while in the lib directory with the following statement:
#
# make -farch/msdos/Makefile.BC
#
#
# A debug version can be obtained with
#
# make -DDEBUG -farch/msdos/Makefile.BC
#
# A special version enabled to handle big fonts (with more than 16,384
# glyphs) can be obtained with
#
# make -DBIGFONTS -farch/msdos/Makefile.BC
ARCH = arch\msdos
FT_MAKEFILE = $(ARCH)\Makefile.BC
CC = bcc
LIB = tlib /c /e
# Credits go to Dave Hoo <dhoo@flash.net> for pointing out that modern
# Borland compilers (from BC++ 3.1 on) can increase the limit on
# the length of identifiers.
!if ! $d(DEBUG)
CFLAGS = -ml -A -O2 -3 -i40 -w-nak -w-par -w-use -w-aus -w-stu -w-stv -w-cln -w-sig -I$(ARCH);.;extend
!else
CFLAGS = -v -N -ml -A -i40 -w-nak -w-par -w-use -w-aus -w-stu -w-stv -w-cln -w-sig -I$(ARCH);.;extend
!endif
!if $d(BIGFONTS)
CFLAGS = $(CFLAGS) -DTT_HUGE_PTR=__huge
TTFILE = $(ARCH)\.\hugefile.c
TTMEMORY = $(ARCH)\.\hugemem.c
!else
TTFILE = .\ttfile.c
TTMEMORY = .\ttmemory.c
!endif
TTMUTEX = .\ttmutex.c
PORT = $(TTFILE) $(TTMEMORY) $(TTMUTEX)
# Do not insert spaces before the \ at end of line,
# otherwise the substitution for TLIB command line will fail.
SRC_X = extend\ftxgasp.c extend\ftxkern.c extend\ftxpost.c\
extend\ftxcmap.c extend\ftxwidth.c extend\ftxerr18.c\
extend\ftxsbit.c extend\ftxgsub.c extend\ftxgpos.c\
extend\ftxopen.c extend\ftxgdef.c
OBJS_X = $(SRC_X:.c=.obj)
SRC_M = ttapi.c ttcache.c ttcalc.c ttcmap.c\
ttgload.c ttinterp.c ttload.c ttobjs.c\
ttraster.c ttextend.c ttdebug.c $(PORT)
OBJS_M = $(SRC_M:.c=.obj) $(OBJS_X)
SRC_S = $(ARCH)\.\freetype.c
OBJ_S = $(SRC_S:.c=.obj)
OBJS_S = $(OBJ_S) $(OBJS_X)
# Since Borland's make does not handle $($(LIB_FILES)), and using
# -DLIB_FILES="$(OBJS_S)" will excess the capacity of COMMAND.COM, we cheat
# by constructing TLIB's response file directly in the `all' target.
#
# Another solution, useful during debugging of part of the library,
# would be to include each .obj in the library as soon as it is compiled.
# It is commented out below. See Makefile.TC for an application.
.c.obj:
$(CC) -c -o$* @&&|
$(CFLAGS) $<
|
# $(LIB) libttf +-$*.obj
!if !$d(DEBUG)
# Skipped if DEBUG build
# (but it changes nothing, since we always build in multiple parts).
all: $(OBJS_M)
-del libttf.lib
$(LIB) libttf.lib @&&|
+ $(OBJS_M: = + )
|
!endif
debug: $(OBJS_M)
-del libttf.lib
$(LIB) libttf.lib @&&|
+ $(OBJS_M: = + )
|
$(OBJ_S): $(SRC_S) $(SRC_M)
# Not used here because it excesses the capacity of COMMAND.COM...
libttf.lib: $(LIB_FILES)
-del libttf.lib
$(LIB) libttf.lib @&&|
+ $(**: = + )
|
!if $d(BIGFONTS)
$(TTMEMORY:.c=.obj): $(TTMEMORY)
$(CC) -c -o$* @&&|
$(CFLAGS) -A- $*.c
|
!endif
clean:
-del *.obj
-del extend\*.obj
-del $(ARCH)\*.obj
-del libttf.bak
-del response
distclean: clean
-del libttf.lib
!include "$(ARCH)\depend.dos"
# end of Makefile

117
lib/arch/msdos/Makefile.MS Normal file
View File

@@ -0,0 +1,117 @@
# This file is part of the FreeType project.
#
# It builds the library for Microsoft C for MS-DOS, large model.
# It also works for Visual C++ 1.x 16-bits compiler, but you should
# instead use the Makefile customized for it, Makefile.VC.
# Due to size constraints, it does not try to pack all modules into one.
#
# You will need NMAKE.
#
# Use this file while in the lib directory with the following statement:
#
# nmake /f arch\msdos\Makefile.MS
#
#
# A debug version can be obtained with
#
# nmake DEBUG=1 /f arch\msdos\Makefile.MS
#
# A special version enabled to handle big fonts (with more than 16,384
# glyphs) can be obtained with
#
# nmake BIGFONTS=1 /f arch\msdos\Makefile.MS
ARCH = arch\msdos
FT_MAKEFILE = $(ARCH)\Makefile.MS
CC = cl /nologo
LIB = lib /noignorecase /nologo
!ifndef DEBUG
CFLAGS = /Ox /AL /W2 /G2 /I$(ARCH) /I. /Iextend
!else
CFLAGS = /Zi /AL /W2 /G2 /I$(ARCH) /I. /Iextend
!endif
!ifndef BIGFONTS
CFLAGS = $(CFLAGS) /Za
TTFILE = .\ttfile.c
TTMEMORY = .\ttmemory.c
!else
CFLAGS = $(CFLAGS) /DTT_HUGE_PTR=__huge /Ze
TTFILE = $(ARCH)\hugefile.c
TTMEMORY = $(ARCH)\hugemem.c
!endif
TTMUTEX = .\ttmutex.c
PORT = $(TTFILE) $(TTMEMORY) $(TTMUTEX)
# Do not insert spaces between the file names or at end of line, otherwise
# the substitution for LIB command line will fail. Thank you.
#
SRC_X = extend\ftxgasp.c extend\ftxkern.c extend\ftxpost.c\
extend\ftxcmap.c extend\ftxwidth.c extend\ftxerr18.c extend\ftxsbit.c\
extend\ftxopen.c extend\ftxgsub.c extend\ftxgpos.c extend\ftxgdef.c
OBJS_X = $(SRC_X:.c=.obj)
SRC_M = ttapi.c ttcache.c ttcalc.c ttcmap.c ttdebug.c\
ttgload.c ttinterp.c ttload.c ttobjs.c ttraster.c ttextend.c $(PORT)
OBJS_M = $(SRC_M:.c=.obj) $(OBJS_X)
SRC_S = $(ARCH)\freetype.c
OBJ_S = $(SRC_S:.c=.obj)
OBJS_S = $(OBJ_S) $(OBJS_X)
# Since Microsoft's NMAKE does not handle $($(LIB_FILES)), and using
# LIB_FILES="$(OBJS_S)" will excess the capacity of COMMAND.COM, we cheat
# by constructing LIB's response file directly in the `all' target.
#
# Another solution, useful during debugging of part of the library,
# would be to include each .obj in the library as soon as it is compiled.
# It is commented out below. See Makefile.TC for an application.
.c.obj:
@$(CC) /c /Fo$@ @<<
$(CFLAGS) $*.c
<<
# $(LIB) libttf +-$*.obj
!ifndef DEBUG
# Skipped if DEBUG build
# (but it changes nothing, since we always build in multiple parts).
all: $(OBJS_M)
-del libttf.lib
$(LIB) libttf.lib @<<response
+ $(OBJS_M: = ^ );
<<KEEP
!endif
debug: $(OBJS_M)
-del libttf.lib
$(LIB) libttf.lib @<<response
+ $(OBJS_M: = ^ );
<<KEEP
$(OBJ_S): $(SRC_S) $(SRC_M)
# Not used here because it excesses the capacity of COMMAND.COM...
libttf.lib: $(LIB_FILES)
$(LIB) $@ +-$(?: =-+);
clean:
-del *.obj
-del extend\*.obj
-del $(ARCH)\*.obj
-del response
distclean: clean
-del libttf.lib
!include "$(ARCH)\depend.dos"
# end of Makefile.MS

View File

@@ -0,0 +1,86 @@
# This file is part of the FreeType project.
#
# It builds the library for Turbo C for MS-DOS, large model.
# Due to size constraints, it does not try to pack all modules into one.
#
# You will need Borland MAKE.
# Tested with Turbo C v.1.5, v.2.0, Turbo C++ v.1.0
# Turbo C v.1.0 (May '87) is too old (lack of structure assignment)
# to compile FreeType. Update your compiler. ;-)
#
# Use this file while in the lib directory with the following statement:
#
# make -farch/msdos/Makefile.TC
#
#
# A debug version can be obtained (except for TC1.5) with
#
# make -DDEBUG -farch/msdos/Makefile.TC
ARCH = arch\msdos
FT_MAKEFILE = $(ARCH)\Makefile.TC
CC = tcc
LIB = tlib /c
!if ! $d(DEBUG)
CFLAGS = -ml -A -a -G -w-par -w-use -w-aus -w-stu -w-stv -w-cln -w-sig -I$(ARCH);.;extend
!else
# For Turbo C v.1.5, replace the -v option below by -y.
CFLAGS = -v -N -ml -A -w-par -w-use -w-aus -w-stu -w-stv -w-cln -w-sig -I$(ARCH);.;extend
!endif
TTFILE = .\ttfile.obj
TTMEMORY = .\ttmemory.obj
TTMUTEX = .\ttmutex.obj
PORT = $(TTFILE) $(TTMEMORY) $(TTMUTEX)
OBJS_X = extend\ftxgasp.obj extend\ftxkern.obj extend\ftxpost.obj \
extend\ftxcmap.obj extend\ftxwidth.obj extend\ftxerr18.obj \
extend\ftxsbit.obj extend\ftxopen.obj extend\ftxgsub.obj \
extend\ftxgpos.obj extend\ftxgdef.obj
# the line below does not work with these old versions of make...
# OBJS_X = $(SRC_X:.c=.obj)
OBJS_M = ttapi.obj ttcache.obj ttcalc.obj ttcmap.obj ttdebug.obj \
ttgload.obj ttinterp.obj ttload.obj ttobjs.obj \
ttraster.obj ttextend.obj $(PORT) $(OBJS_X)
# OBJS_M = $(SRC_M:.c=.obj) $(OBJS_X)
# Not used here because the compiler runs out of memory...
OBJ_S = $(ARCH)\freetype.obj
OBJS_S = $(OBJ_S) $(OBJS_X)
# Since Borland's make is very primitive, we include each .obj
# in the library as soon as it is compiled.
.c.obj:
$(CC) $(CFLAGS) -c -o$* $<
$(LIB) libttf +-$*.obj
!if !$d(DEBUG)
# Skipped if DEBUG build
# (but it changes nothing, since we always build in multiple parts).
all: $(OBJS_M)
!endif
debug: $(OBJS_M)
clean:
-del *.obj
-del extend\*.obj
-del $(ARCH)\*.obj
-del libttf.bak
# -del response
distclean: clean
-del libttf.lib
!include "$(ARCH)\depend.dos"
# end of Makefile

117
lib/arch/msdos/Makefile.VC Normal file
View File

@@ -0,0 +1,117 @@
# This file is part of the FreeType project.
#
# It builds the library for Microsoft Visual C++ 1.x for MS-DOS, large model.
# It also works for Microsoft C/C++ v.7.0 16-bit compiler, but not for
# previous versions (use Makefile.MS instead).
#
# You will need NMAKE.
#
# Use this file while in the lib directory with the following statement:
#
# nmake /f arch\msdos\Makefile.VC
#
#
# A debug version can be obtained with
#
# nmake DEBUG=1 /f arch\msdos\Makefile.VC
#
# A special version enabled to handle big fonts (with more than 16,384
# glyphs) can be obtained with
#
# nmake BIGFONTS=1 /f arch\msdos\Makefile.VC
ARCH = arch\msdos
FT_MAKEFILE = $(ARCH)\Makefile.VC
CC = cl /nologo
LIB = lib /noignorecase /nologo
# One can also consider using "set MSC_CMD_FLAGS=/Gr /Op- /Gy /YX".
# With Microsoft C/C++ 7.0, use /G2 instead of /G3.
!ifndef DEBUG
CFLAGS = $(CFLAGS) /Ox /AL /W2 /G3 /I$(ARCH) /I. /Iextend
!else
CFLAGS = $(CFLAGS) /Zi /Ge /AL /W2 /G3 /I$(ARCH) /I. /Iextend
!endif
!ifndef BIGFONTS
CFLAGS = $(CFLAGS) /Za
TTFILE = .\ttfile.c
TTMEMORY = .\ttmemory.c
!else
CFLAGS = $(CFLAGS) /DTT_HUGE_PTR=__huge /Ze
TTFILE = $(ARCH)\hugefile.c
TTMEMORY = $(ARCH)\hugemem.c
!endif
TTMUTEX = .\ttmutex.c
PORT = $(TTFILE) $(TTMEMORY) $(TTMUTEX)
# Do not insert spaces between the file names or at end of line, otherwise
# the substitution for LIB command line will fail. Thank you.
#
SRC_X = extend\ftxgasp.c extend\ftxkern.c extend\ftxpost.c\
extend\ftxcmap.c extend\ftxwidth.c extend\ftxerr18.c extend\ftxsbit.c\
extend\ftxopen.c extend\ftxgsub.c extend\ftxgpos.c extend\ftxgdef.c
OBJS_X = $(SRC_X:.c=.obj)
SRC_M = ttapi.c ttcache.c ttcalc.c ttcmap.c ttdebug.c\
ttgload.c ttinterp.c ttload.c ttobjs.c ttraster.c ttextend.c $(PORT)
OBJS_M = $(SRC_M:.c=.obj) $(OBJS_X)
SRC_S = $(ARCH)\freetype.c
OBJ_S = $(SRC_S:.c=.obj)
OBJS_S = $(OBJ_S) $(OBJS_X)
# Since Microsoft's NMAKE does not handle $($(LIB_FILES)), and using
# LIB_FILES="$(OBJS_S)" will excess the capacity of COMMAND.COM, we cheat
# by constructing LIB's response file directly in the `all' target.
#
# Another solution, useful during debugging of part of the library,
# would be to include each .obj in the library as soon as it is compiled.
# It is commented out below. See Makefile.TC for an application.
.c.obj:
@$(CC) /c /Fo$@ @<<
$(CFLAGS) $*.c
<<
# $(LIB) libttf +-$*.obj
!ifndef DEBUG
# Skipped if DEBUG build
all: $(OBJS_S)
-del libttf.lib
$(LIB) libttf.lib @<<response
+ $(OBJS_S: = + );
<<KEEP
!endif
debug: $(OBJS_M)
-del libttf.lib
$(LIB) libttf.lib @<<response
+ $(OBJS_M: = + );
<<KEEP
$(OBJ_S): $(SRC_S) $(SRC_M)
# Not used here because it excesses the capacity of COMMAND.COM...
libttf.lib: $(LIB_FILES)
$(LIB) $@ +-$(?: =-+);
clean:
-del *.obj
-del extend\*.obj
-del $(ARCH)\*.obj
-del response
distclean: clean
-del libttf.lib
!include "$(ARCH)\depend.dos"
# end of Makefile.VC

View File

@@ -0,0 +1,84 @@
# This file is part of the FreeType project.
#
# It builds the library and test programs for emx-gcc or djgpp under MSDOS.
#
# You will need dmake.
#
# Use this file while in the lib directory with the following statement:
#
# dmake -r -f arch/msdos/Makefile.dm
ARCH = arch/msdos
FT_MAKEFILE = $(ARCH)/Makefile.dm
FT_MAKE = dmake -r
.IMPORT: COMSPEC
SHELL := $(COMSPEC)
SHELLFLAGS := /c
GROUPSHELL := $(SHELL)
GROUPFLAGS := $(SHELLFLAGS)
GROUPSUFFIX := .bat
SHELLMETAS := *"?<>&|
CC = gcc
CFLAGS = -Wall -O2 -g -ansi -pedantic -I$(ARCH) -I. -Iextend
# CFLAGS = -Wall -ansi -O2 -s -I$(ARCH) -I. -Iextend
SRC_X = extend/ftxgasp.c extend/ftxkern.c extend/ftxpost.c \
extend/ftxcmap.c extend/ftxwidth.c extend/ftxsbit.c \
extend/ftxgsub.c extend/ftxgpos.c extend/ftxopen.c \
extend/ftxgdef.c extend/ftxerr18.c
OBJS_X = $(SRC_X:.c=.o)
SRC_M = ttapi.c ttcache.c ttcalc.c ttcmap.c ttdebug.c \
ttfile.c ttgload.c ttinterp.c ttload.c \
ttmemory.c ttmutex.c ttobjs.c ttraster.c ttextend.c
OBJS_M = $(SRC_M:.c=.o) $(OBJS_X)
SRC_S = $(ARCH)/freetype.c
OBJ_S = $(SRC_S:.c=.o)
OBJS_S = $(OBJ_S) $(OBJS_X)
%.o: %.c
$(CC) $(CFLAGS) -c -o $@ $<
.PHONY: all debug clean distclean depend
all:
$(FT_MAKE) -f $(FT_MAKEFILE) LIB_FILES=OBJS_S libttf.a
debug:
$(FT_MAKE) -f $(FT_MAKEFILE) LIB_FILES=OBJS_M libttf.a
$(OBJ_S): $(SRC_S) $(SRC_M)
$(CC) $(CFLAGS) -c -o $@ $(SRC_S)
libttf.a: $($(LIB_FILES))
+-del $@
ar src $@ @$(mktmp $(<:t"\n")\n)
clean:
-[
del *.o
del extend\*.o
del $(ARCH)\*.o
]
distclean: clean
-[
del dep.end
del libttf.a
]
# depend: $(SRC_S) $(SRC_M) $(SRC_X)
# $(CC) -E -M @$(mktmp $(<:t"\n")\n) > dep.end
# ifeq (dep.end,$(wildcard dep.end))
# include dep.end
# endif
# end of Makefile.dm

View File

@@ -0,0 +1,92 @@
# This file is part of the FreeType project.
#
# It builds the library for emx-gcc or djgpp under MSDOS.
#
# You will need GNU make.
#
# Use this file while in the lib directory with the following statement:
#
# make -f arch/msdos/Makefile.gcc
#
# If you have the GNU gettext package installed with DJGPP, you can also try
#
# make -f arch/msdos/Makefile.gcc HAVE_GETTEXT
ARCH = arch/msdos
FT_MAKEFILE = $(ARCH)/Makefile.gcc
CC = gcc
ifndef GETTEXT
GETTEXT=NO_GETTEXT
endif
ifdef DEBUG
CFLAGS = -Wall -O2 -g -ansi -pedantic -I$(ARCH) -I. -Iextend -D$(GETTEXT)
else
CFLAGS = -Wall -ansi -pedantic -O2 -s -I$(ARCH) -I. -Iextend -D$(GETTEXT)
endif
TTFILE = ./ttfile.c
TTMEMORY = ./ttmemory.c
TTMUTEX = ./ttmutex.c
PORT = $(TTFILE) $(TTMEMORY) $(TTMUTEX)
SRC_X = extend/ftxgasp.c extend/ftxkern.c extend/ftxpost.c \
extend/ftxcmap.c extend/ftxwidth.c extend/ftxsbit.c \
extend/ftxgsub.c extend/ftxgpos.c extend/ftxgdef.c \
extend/ftxopen.c extend/ftxerr18.c
OBJS_X = $(SRC_X:.c=.o)
SRC_M = ttapi.c ttcache.c ttcalc.c ttcmap.c ttdebug.c \
ttgload.c ttinterp.c ttload.c ttobjs.c \
ttraster.c ttextend.c $(PORT)
OBJS_M = $(SRC_M:.c=.o) $(OBJS_X)
SRC_S = $(ARCH)/freetype.c
OBJ_S = $(SRC_S:.c=.o)
OBJS_S = $(OBJ_S) $(OBJS_X)
%.o: %.c
$(CC) $(CFLAGS) -c -o $@ $<
.PHONY: all debug clean distclean depend
all:
$(MAKE) -f $(FT_MAKEFILE) LIB_FILES=OBJS_S libttf.a
debug:
$(MAKE) -f $(FT_MAKEFILE) LIB_FILES=OBJS_M DEBUG=1 libttf.a
HAVE_GETTEXT:
$(MAKE) -f $(FT_MAKEFILE) LIB_FILES=OBJS_S GETTEXT=HAVE_GETTEXT \
libttf.a
$(OBJ_S): $(SRC_S) $(SRC_M)
libttf.a: $($(LIB_FILES))
-del $@
ar src $@ $^
clean:
-del *.o
-del extend\*.o
-del $(ARCH)\*.o
-del response
distclean: clean
-del dep.end
-del libttf.a
depend: $(SRS_S) $(SRC_M) $(SRC_X)
$(CC) -E -M $^ > dep.end
ifeq (dep.end,$(wildcard dep.end))
include dep.end
endif
# end of Makefile.gcc

View File

@@ -0,0 +1,88 @@
# This file is part of the FreeType project
#
# This builds the Watcom library with Watcom's wcc386 under DOS
#
# You'll need Watcom's wmake
#
#
# Invoke by "wmake -f arch\msdos\Makefile.wat" while in the "lib" directory
#
# This will build "freetype\lib\libttf.lib"
#
ARCH = arch\msdos
FT_MAKEFILE = $(ARCH)\Makefile.wat
FT_MAKE = wmake -h
.EXTENSIONS:
.EXTENSIONS: .lib .obj .c .h
.obj:.;.\extend;.\$(ARCH)
.c:.;.\extend;.\$(ARCH)
.h:.;.\extend;.\$(ARCH)
CC = wcc386
CCFLAGS = /otexanl+ /s /w4 /zq /d3 -I$(ARCH) -I. -Iextend
# FIXME: should use something like OBJ = $(SRC:.c=.obj)
SRC_X = ftxgasp.c ftxkern.c ftxpost.c &
ftxcmap.c ftxwidth.c ftxsbit.c ftxerr18.c &
ftxgsub.c ftxgpos.c ftxopen.c ftxgdef.c
OBJS_X = ftxgasp.obj ftxkern.obj ftxpost.obj &
ftxcmap.obj ftxwidth.obj ftxsbit.obj ftxerr18.obj &
ftxgsub.obj ftxgpos.obj ftxopen.obj ftxgdef.obj
SRC_M = ttapi.c ttcache.c ttcalc.c ttcmap.c ttdebug.c &
ttfile.c ttgload.c ttinterp.c &
ttload.c ttmemory.c ttmutex.c ttobjs.c ttraster.c &
ttextend.c
OBJS_M = ttapi.obj ttcache.obj ttcalc.obj ttcmap.obj ttdebug.obj &
ttfile.obj ttgload.obj ttinterp.obj &
ttload.obj ttmemory.obj ttmutex.obj ttobjs.obj ttraster.obj &
ttextend.obj $(OBJS_X)
SRC_S = freetype.c
OBJ_S = freetype.obj
OBJS_S = $(OBJ_S) $(OBJ_X)
.c.obj:
$(CC) $(CCFLAGS) $[* /fo=$[*.obj
libname = libttf
libfile = $(libname).lib
cmdfile = $(libname).lst
all: .symbolic
$(FT_MAKE) -f $(FT_MAKEFILE) LIB_FILES=OBJS_S $(libfile)
debug: .symbolic
$(FT_MAKE) -f $(FT_MAKEFILE) LIB_FILES=OBJS_M $(libfile)
$(libfile): $($(LIB_FILES))
wlib -q -n $(libfile) @$(cmdfile)
# is this correct? Know nothing about wmake and the Watcom compiler...
$(OBJ_S): $(SRC_S) $(SRC_M)
$(CC) $(CCFLAGS) $(SRC_S) /fo=$(OBJ_S)
$(cmdfile): $($(LIB_FILES))
@for %i in ($($(LIB_FILES))) do @%append $(cmdfile) +-%i
clean: .symbolic
@-erase $(OBJ_S)
@-erase $(OBJS_M)
@-erase $(cmdfile)
distclean: .symbolic clean
@-erase $(libfile)
new: .symbolic
@-wtouch *.c
# end of Makefile.wat

107
lib/arch/msdos/depend.dos Normal file
View File

@@ -0,0 +1,107 @@
# This dependency file to be used with various MS-DOS compilers
# has been generated automatically with the script `makedep' on
# 03-Sep-1999.
ttapi.obj: ttapi.c ttconfig.h arch\msdos\ft_conf.h freetype.h fterrid.h \
ftnameid.h ttengine.h tttypes.h ttmutex.h ttcalc.h ttmemory.h \
ttcache.h ttfile.h ttdebug.h ttobjs.h tttables.h ttcmap.h ttload.h \
ttgload.h ttraster.h ttextend.h
ttcache.obj: ttcache.c ttengine.h tttypes.h ttconfig.h \
arch\msdos\ft_conf.h freetype.h fterrid.h ftnameid.h ttmutex.h \
ttmemory.h ttcache.h ttobjs.h tttables.h ttcmap.h ttdebug.h
ttcalc.obj: ttcalc.c ttcalc.h ttconfig.h arch\msdos\ft_conf.h freetype.h \
fterrid.h ftnameid.h ttdebug.h tttypes.h tttables.h
ttcmap.obj: ttcmap.c ttobjs.h ttconfig.h arch\msdos\ft_conf.h ttengine.h \
tttypes.h freetype.h fterrid.h ftnameid.h ttmutex.h ttcache.h \
tttables.h ttcmap.h ttdebug.h ttfile.h ttmemory.h ttload.h
ttdebug.obj: ttdebug.c ttdebug.h ttconfig.h arch\msdos\ft_conf.h \
tttypes.h freetype.h fterrid.h ftnameid.h tttables.h ttobjs.h \
ttengine.h ttmutex.h ttcache.h ttcmap.h
ttextend.obj: ttextend.c ttextend.h ttconfig.h arch\msdos\ft_conf.h \
tttypes.h freetype.h fterrid.h ftnameid.h ttobjs.h ttengine.h \
ttmutex.h ttcache.h tttables.h ttcmap.h ttmemory.h
ttfile.obj: ttfile.c ttconfig.h arch\msdos\ft_conf.h freetype.h \
fterrid.h ftnameid.h tttypes.h ttdebug.h ttengine.h ttmutex.h \
ttmemory.h ttfile.h
ttgload.obj: ttgload.c tttypes.h ttconfig.h arch\msdos\ft_conf.h \
freetype.h fterrid.h ftnameid.h ttdebug.h ttcalc.h ttfile.h \
ttengine.h ttmutex.h tttables.h ttobjs.h ttcache.h ttcmap.h ttgload.h \
ttmemory.h tttags.h ttload.h
ttinterp.obj: ttinterp.c freetype.h fterrid.h ftnameid.h tttypes.h \
ttconfig.h arch\msdos\ft_conf.h ttdebug.h ttcalc.h ttmemory.h \
ttinterp.h ttobjs.h ttengine.h ttmutex.h ttcache.h tttables.h \
ttcmap.h
ttload.obj: ttload.c tttypes.h ttconfig.h arch\msdos\ft_conf.h \
freetype.h fterrid.h ftnameid.h ttdebug.h ttcalc.h ttfile.h \
ttengine.h ttmutex.h tttables.h ttobjs.h ttcache.h ttcmap.h \
ttmemory.h tttags.h ttload.h
ttmemory.obj: ttmemory.c ttdebug.h ttconfig.h arch\msdos\ft_conf.h \
tttypes.h freetype.h fterrid.h ftnameid.h ttmemory.h ttengine.h \
ttmutex.h
ttmutex.obj: ttmutex.c ttmutex.h ttconfig.h arch\msdos\ft_conf.h
ttobjs.obj: ttobjs.c ttobjs.h ttconfig.h arch\msdos\ft_conf.h ttengine.h \
tttypes.h freetype.h fterrid.h ftnameid.h ttmutex.h ttcache.h \
tttables.h ttcmap.h ttfile.h ttdebug.h ttcalc.h ttmemory.h ttload.h \
ttinterp.h ttextend.h
ttraster.obj: ttraster.c ttraster.h ttconfig.h arch\msdos\ft_conf.h \
freetype.h fterrid.h ftnameid.h ttengine.h tttypes.h ttmutex.h \
ttdebug.h ttcalc.h ttmemory.h
extend\ftxcmap.obj: extend\ftxcmap.c extend\ftxcmap.h freetype.h fterrid.h \
ftnameid.h tttypes.h ttconfig.h arch\msdos\ft_conf.h ttobjs.h \
ttengine.h ttmutex.h ttcache.h tttables.h ttcmap.h
extend\ftxerr18.obj: extend\ftxerr18.c ttconfig.h arch\msdos\ft_conf.h \
extend\ftxerr18.h freetype.h fterrid.h ftnameid.h extend\ftxkern.h \
extend\ftxpost.h extend\ftxopen.h extend\ftxgdef.h extend\ftxgsub.h \
extend\ftxgpos.h
extend\ftxgasp.obj: extend\ftxgasp.c extend\ftxgasp.h freetype.h fterrid.h \
ftnameid.h tttypes.h ttconfig.h arch\msdos\ft_conf.h ttobjs.h \
ttengine.h ttmutex.h ttcache.h tttables.h ttcmap.h
extend\ftxgdef.obj: extend\ftxgdef.c tttypes.h ttconfig.h arch\msdos\ft_conf.h \
freetype.h fterrid.h ftnameid.h tttags.h ttload.h ttobjs.h ttengine.h \
ttmutex.h ttcache.h tttables.h ttcmap.h ttextend.h ttmemory.h \
ttfile.h ttdebug.h extend\ftxopen.h extend\ftxgdef.h extend\ftxgsub.h \
extend\ftxgpos.h extend\ftxopenf.h
extend\ftxgpos.obj: extend\ftxgpos.c tttypes.h ttconfig.h arch\msdos\ft_conf.h \
freetype.h fterrid.h ftnameid.h tttags.h ttload.h ttobjs.h ttengine.h \
ttmutex.h ttcache.h tttables.h ttcmap.h ttextend.h ttmemory.h \
ttfile.h ttdebug.h extend\ftxopen.h extend\ftxgdef.h extend\ftxgsub.h \
extend\ftxgpos.h extend\ftxopenf.h
extend\ftxgsub.obj: extend\ftxgsub.c tttypes.h ttconfig.h arch\msdos\ft_conf.h \
freetype.h fterrid.h ftnameid.h tttags.h ttload.h ttobjs.h ttengine.h \
ttmutex.h ttcache.h tttables.h ttcmap.h ttextend.h ttmemory.h \
ttfile.h ttdebug.h extend\ftxopen.h extend\ftxgdef.h extend\ftxgsub.h \
extend\ftxgpos.h extend\ftxopenf.h
extend\ftxkern.obj: extend\ftxkern.c extend\ftxkern.h freetype.h fterrid.h \
ftnameid.h ttextend.h ttconfig.h arch\msdos\ft_conf.h tttypes.h \
ttobjs.h ttengine.h ttmutex.h ttcache.h tttables.h ttcmap.h ttdebug.h \
ttmemory.h ttfile.h ttload.h tttags.h
extend\ftxopen.obj: extend\ftxopen.c tttypes.h ttconfig.h arch\msdos\ft_conf.h \
freetype.h fterrid.h ftnameid.h ttload.h ttobjs.h ttengine.h \
ttmutex.h ttcache.h tttables.h ttcmap.h ttextend.h ttmemory.h \
ttfile.h ttdebug.h extend\ftxopen.h extend\ftxgdef.h extend\ftxgsub.h \
extend\ftxgpos.h extend\ftxopenf.h
extend\ftxpost.obj: extend\ftxpost.c extend\ftxpost.h freetype.h fterrid.h \
ftnameid.h tttypes.h ttconfig.h arch\msdos\ft_conf.h ttobjs.h \
ttengine.h ttmutex.h ttcache.h tttables.h ttcmap.h ttload.h ttfile.h \
ttdebug.h tttags.h ttmemory.h ttextend.h
extend\ftxsbit.obj: extend\ftxsbit.c extend\ftxsbit.h freetype.h fterrid.h \
ftnameid.h ttobjs.h ttconfig.h arch\msdos\ft_conf.h ttengine.h \
tttypes.h ttmutex.h ttcache.h tttables.h ttcmap.h ttfile.h ttdebug.h \
ttload.h ttmemory.h tttags.h ttextend.h
extend\ftxwidth.obj: extend\ftxwidth.c extend\ftxwidth.h freetype.h fterrid.h \
ftnameid.h ttdebug.h ttconfig.h arch\msdos\ft_conf.h tttypes.h \
ttobjs.h ttengine.h ttmutex.h ttcache.h tttables.h ttcmap.h ttfile.h \
tttags.h ttload.h
arch\msdos\freetype.obj: arch\msdos\freetype.c ttapi.c ttconfig.h \
arch\msdos\ft_conf.h freetype.h fterrid.h ftnameid.h ttengine.h \
tttypes.h ttmutex.h ttcalc.h ttmemory.h ttcache.h ttfile.h ttdebug.h \
ttobjs.h tttables.h ttcmap.h ttload.h ttgload.h ttraster.h ttextend.h \
ttcache.c ttcalc.c ttcmap.c ttdebug.c ttgload.c tttags.h ttinterp.c \
ttinterp.h ttload.c ttobjs.c ttraster.c arch\msdos\hugefile.c \
ttfile.c arch\msdos\hugemem.c ttmutex.c ttextend.c
arch\msdos\hugefile.obj: arch\msdos\hugefile.c ttconfig.h arch\msdos\ft_conf.h \
tttypes.h freetype.h fterrid.h ftnameid.h ttfile.c ttdebug.h \
ttengine.h ttmutex.h ttmemory.h ttfile.h
arch\msdos\hugemem.obj: arch\msdos\hugemem.c ttdebug.h ttconfig.h \
arch\msdos\ft_conf.h tttypes.h freetype.h fterrid.h ftnameid.h \
ttmemory.h ttengine.h ttmutex.h

39
lib/arch/msdos/freetype.c Normal file
View File

@@ -0,0 +1,39 @@
/* This file is part of the FreeType project */
/* Single object library component for MSDOS. */
/* Note that low-optimizing 16-bit compilers (such as Borland ones) can't */
/* successfully compile this file, because it exceeds 64K of code size. */
#define TT_MAKE_OPTION_SINGLE_OBJECT
/* first include common core components */
#include "ttapi.c"
#include "ttcache.c"
#include "ttcalc.c"
#include "ttcmap.c"
#include "ttdebug.c"
#include "ttgload.c"
#include "ttinterp.c"
#include "ttload.c"
#include "ttobjs.c"
#include "ttraster.c"
/* then system-specific (or ANSI) components */
#ifdef TT_HUGE_PTR
#include "arch/msdos/hugefile.c"
#include "arch/msdos/hugemem.c"
#else
#include "ttfile.c"
#include "ttmemory.c"
#endif
#include "ttmutex.c"
/* finally, add some extensions */
#ifdef TT_CONFIG_OPTION_EXTEND_ENGINE
#include "ttextend.c"
#endif
/* END */

253
lib/arch/msdos/ft_conf.h Normal file
View File

@@ -0,0 +1,253 @@
/* This file is part of the FreeType project */
/* ft_conf.h for MSDOS */
/* we need the following because there are some typedefs in this file */
#ifndef FT_CONF_H
#define FT_CONF_H
/* Define to empty if the keyword does not work. */
/* #undef const */
/* Define if you have a working `mmap' system call. */
#undef HAVE_MMAP
/* Define if you have the <stdlib.h> header file. */
#define HAVE_STDLIB_H
/* Define if you have the getpagesize function. */
#undef HAVE_GETPAGESIZE
/* Define if you have the memcpy function. */
#define HAVE_MEMCPY
/* Define if you have the memmove function. */
#define HAVE_MEMMOVE
/* Define if you have the valloc function. */
#undef HAVE_VALLOC
/* Define if you have the <fcntl.h> header file. */
#define HAVE_FCNTL_H
/* Define if you have the <unistd.h> header file. */
#if defined( __EMX__ ) || defined( __DJGPP__ ) || defined( __GO32__ )
/* some compilers are known to have <unistd.h>; */
/* add yours if needed, and report to us the update. */
#define HAVE_UNISTD_H
#else
/* most MS-DOS compilers lack <unistd.h> */
#undef HAVE_UNISTD_H
#endif
/* Define if you need <conio.h> for console I/O functions. */
#ifdef __EMX__
#define HAVE_CONIO_H
#endif
/* Define if you have the <locale.h> header file. */
#undef HAVE_LOCALE_H
/* Define if you have the <libintl.h> header file. */
#undef HAVE_LIBINTL_H
/* Define if you have the libintl library. */
#undef HAVE_LIBINTL
/* DJGPP v.2 may feature the GNU gettext package, with some subtleties. */
/* The macro HAVE_GETTEXT has to be set in the makefile. */
#ifdef HAVE_GETTEXT
#define HAVE_LOCALE_H
#define HAVE_LIBINTL_H
#define HAVE_LIBINTL
#define LOCALEDIR "/usr/djgpp/share/locale"
/* Due to a name conflict, gettext is renamed gettext__ in DJGPP */
#define gettext( str ) gettext__( str )
#endif
/* command.com can't pipe stderr into a file; any message would be */
/* written into the graphics screen. */
#define HAVE_PRINT_FUNCTION 1
#define Print( format, ap ) vfprintf( stdout, (format), (ap) )
/* The number of bytes in a int. We use the ANSI header file limits.h */
/* for determining it since there is no easy way to guess. */
#include <limits.h>
#if UINT_MAX == 0xFFFF
#define SIZEOF_INT 2
#elif UINT_MAX == 0xFFFFFFFF
#define SIZEOF_INT 4
#else
#error "Unsupported number of bytes in `int' type!"
#endif
/* The number of bytes in a long. */
#define SIZEOF_LONG 4
/**********************************************************************/
/* */
/* The following configuration macros can be tweaked manually by */
/* a developer to turn on or off certain features or options in the */
/* TrueType engine. This may be useful to tune it for specific */
/* purposes.. */
/* */
/**********************************************************************/
/*************************************************************************/
/* Define this if the underlying operating system uses a different */
/* character width than 8bit for file names. You must then also supply */
/* a typedef declaration for defining 'TT_Text'. Default is off. */
/* #define HAVE_TT_TEXT */
/*************************************************************************/
/* Define this if you want to generate code to support engine extensions */
/* Default is on, but if you're satisfied by the basic services provided */
/* by the engine and need no extensions, undefine this configuration */
/* macro to save a few more bytes. */
#define TT_CONFIG_OPTION_EXTEND_ENGINE
/*************************************************************************/
/* Define this if you want to generate code to support gray-scaling, */
/* a.k.a. font-smoothing or anti-aliasing. Default is on, but you can */
/* disable it if you don't need it. */
#define TT_CONFIG_OPTION_GRAY_SCALING
/*************************************************************************/
/* Define this if you want to completely disable the use of the bytecode */
/* interpreter. Doing so will produce a much smaller library, but the */
/* quality of the rendered glyphs will enormously suffer from this. */
/* */
/* This switch was introduced due to the Apple patents issue which */
/* emerged recently on the FreeType lists. We still do not have Apple's */
/* opinion on the subject and will change this as soon as we have. */
#undef TT_CONFIG_OPTION_NO_INTERPRETER
/*************************************************************************/
/* Define this if you want to use a big 'switch' statement within the */
/* bytecode interpreter. Because some non-optimizing compilers are not */
/* able to produce jump tables from such statements, undefining this */
/* configuration macro will generate the appropriate C jump table in */
/* ttinterp.c. If you use an optimizing compiler, you should leave it */
/* defined for better performance and code compactness.. */
#define TT_CONFIG_OPTION_INTERPRETER_SWITCH
/*************************************************************************/
/* Define this if you want to build a 'static' version of the TrueType */
/* bytecode interpreter. This will produce much bigger code, which */
/* _may_ be faster on some architectures.. */
/* */
/* Do NOT DEFINE THIS is you build a thread-safe version of the engine */
/* */
#undef TT_CONFIG_OPTION_STATIC_INTERPRETER
/*************************************************************************/
/* Define this if you want to build a 'static' version of the scan-line */
/* converter (the component which in charge of converting outlines into */
/* bitmaps). This will produce a bigger object file for "ttraster.c", */
/* which _may_ be faster on some architectures.. */
/* */
/* Do NOT DEFINE THIS is you build a thread-safe version of the engine */
/* */
#undef TT_CONFIG_OPTION_STATIC_RASTER
/*************************************************************************/
/* Define TT_CONFIG_THREAD_SAFE if you want to build a thread-safe */
/* version of the library. */
#undef TT_CONFIG_OPTION_THREAD_SAFE
/**********************************************************************/
/* */
/* The following macros are used to define the debug level, as well */
/* as individual tracing levels for each component. There are */
/* currently three modes of operation : */
/* */
/* - trace mode (define DEBUG_LEVEL_TRACE) */
/* */
/* The engine prints all error messages, as well as tracing */
/* ones, filtered by each component's level */
/* */
/* - debug mode (define DEBUG_LEVEL_ERROR) */
/* */
/* Disable tracing, but keeps error output and assertion */
/* checks. */
/* */
/* - release mode (don't define anything) */
/* */
/* Don't include error-checking or tracing code in the */
/* engine's code. Ideal for releases. */
/* */
/* NOTE : */
/* */
/* Each component's tracing level is defined in its own source. */
/* */
/**********************************************************************/
/* Define if you want to use the tracing debug mode */
#undef DEBUG_LEVEL_TRACE
/* Define if you want to use the error debug mode - ignored if */
/* DEBUG_LEVEL_TRACE is defined */
#undef DEBUG_LEVEL_ERROR
/**************************************************************************/
/* Definition of various integer sizes. These types are used by ttcalc */
/* and ttinterp (for the 64-bit integers) only.. */
#if SIZEOF_INT == 4
typedef signed int TT_Int32;
typedef unsigned int TT_Word32;
#elif SIZEOF_LONG == 4
typedef signed long TT_Int32;
typedef unsigned long TT_Word32;
#else
#error "no 32bit type found"
#endif
#if SIZEOF_LONG == 8
/* LONG64 must be defined when a 64-bit type is available */
/* INT64 must then be defined to this type.. */
#define LONG64
#define INT64 long
#else
/* GCC provides the non-ANSI 'long long' 64-bit type. You can activate */
/* by defining the TT_USE_LONG_LONG macro in 'ft_conf.h'. Note that this */
/* will produce many -ansi warnings during library compilation. */
#ifdef TT_USE_LONG_LONG
#define LONG64
#define INT64 long long
#endif /* TT_USE_LONG_LONG */
#endif
#endif /* FT_CONF_H */
/* END */

84
lib/arch/msdos/hugefile.c Normal file
View File

@@ -0,0 +1,84 @@
/*******************************************************************
*
* hugefile.c
*
* File I/O Component (body) for dealing with "huge" objects under
* MS-DOS. Relies on the "default" version, with a small hook.
*
* Written by Antoine Leca based on ideas from Dave Hoo.
* Copyright 1999 by Dave Hoo, Antoine Leca,
* 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.
*
* NOTE
*
* This file #includes the normal version, to avoid discrepancies
* between versions. It uses only ANSI-mandated "tricks", so
* any ANSI-compliant compiler should be able to compile this file.
*
******************************************************************/
#include "ttconfig.h"
#include "tttypes.h"
/* Here we include <stdio.h>, to have the proper definition of fread */
#include <stdio.h>
/* Then, we divert the use of fread to our version */
#undef fread
#define fread(ptr, size, n, stream) huge_fread(ptr, size, n, stream)
LOCAL_FUNC
Long huge_fread ( void *ptr, size_t size, Long n, FILE *stream );
/* Now, we include the "normal" version of ttfile.c */
/* The ANSI/ISO standard mandates that the include of <stdio.h> */
/* there have no bad effects. */
#include "ttfile.c"
/* Then, we define our implementation of fread that makes use of */
/* "huge"-allocated memory. */
/*******************************************************************
*
* Function : huge_fread
*
* Description : replacement version of fread that handles
* "huge"-allocated memory.
*
* Input : See the reference for the runtime library function fread
*
* Output : See the reference for the runtime library function fread
*
* Notes :
*
******************************************************************/
LOCAL_DEF
Long huge_fread ( void *ptr, size_t size, Long n, FILE *stream )
{
char TT_HUGE_PTR * p = (char TT_HUGE_PTR *) ptr;
ULong left = (ULong)n * size;
size_t toRead;
while ( left )
{
toRead = (left > 0x8000) ? 0x8000 : left;
if ( (fread)( p, 1, toRead, stream ) != toRead)
return -1;
else
{
left -= (ULong) toRead;
p += toRead;
}
}
return n * size;
}
/* END */

496
lib/arch/msdos/hugemem.c Normal file
View File

@@ -0,0 +1,496 @@
/*******************************************************************
*
* hugemem.c
*
* Memory management component (body)
* for dealing with "huge" objects with 16-bit MS-DOS.
*
* Written by Dave Hoo and Antoine Leca.
* Copyright 1999 by Dave Hoo, Antoine Leca,
* 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 <limits.h>
#include "ttdebug.h"
#include "ttmemory.h"
#include "ttengine.h"
#ifndef TT_HUGE_PTR
#error "This component needs TT_HUGE_PTR to be #defined."
#endif
/* ---- Microsoft C compilers support ------------------------------------ */
#if defined( M_I86 ) || defined( _M_I86 )
#include <malloc.h>
#define huge_alloc( size ) _halloc ( size, 1 )
#define huge_free( block ) _hfree ( block )
#endif /* Microsoft compilers */
/* ---- Borland C compiler support --------------------------------------- */
#ifdef __TURBOC__
#include <alloc.h>
#define huge_alloc( size ) farmalloc ( size )
#define huge_free( block ) farfree ( block )
#endif
#if !defined( huge_alloc ) || !defined( huge_free )
#error "Your compiler is not (yet) supported. Check the source file!"
#endif
#ifdef TT_CONFIG_OPTION_THREAD_SAFE
#error "This component needs static allocation and is not re-entrant."
#endif
/* required by the tracing mode */
#undef TT_COMPONENT
#define TT_COMPONENT trace_memory
#ifdef DEBUG_MEMORY
#include <stdio.h>
#define MAX_TRACKED_BLOCKS 1024
struct TMemRec_
{
void* base;
Long size;
};
typedef struct TMemRec_ TMemRec;
static TMemRec pointers[MAX_TRACKED_BLOCKS + 1];
static Int num_alloc;
static Int num_free;
static Int num_realloc; /* counts only `real' reallocations
(i.e., an existing buffer will be resized
to a value larger than zero */
static Int fail_alloc;
static Int fail_realloc;
static Int fail_free;
#else
/* We need a tracing stack of the calls to big chunks of memory, */
/* in order to call the matching version of free(). */
#define MAX_TRACKED_BIGCHUNKS 16
struct TMemRec_
{
void* base;
Long size;
};
typedef struct TMemRec_ TMemRec;
static TMemRec pointers[MAX_TRACKED_BIGCHUNKS + 1];
#endif /* DEBUG_MEMORY */
#ifndef TT_CONFIG_OPTION_THREAD_SAFE
Long TTMemory_Allocated;
Long TTMemory_MaxAllocated;
#endif
/*******************************************************************
*
* Function : TT_Alloc
*
* Description : Allocates memory from the heap buffer.
*
* Input : Size size of the memory to be allocated
* P pointer to a buffer pointer
*
* Output : Error code.
*
* NOTE : The newly allocated block should _always_ be zeroed
* on return. Many parts of the engine rely on this to
* work properly.
*
******************************************************************/
EXPORT_FUNC
TT_Error TT_Alloc( ULong Size, void** P )
{
Int i;
if ( !P )
return TT_Err_Invalid_Argument;
/* Also see below for another case of "invalid argument". */
if ( Size > 0 )
{
if ( Size > ( UINT_MAX & ~0xFu ) )
*P = (void*)huge_alloc( Size );
else
*P = (void*)malloc( Size );
if ( !*P )
return TT_Err_Out_Of_Memory;
#ifndef TT_CONFIG_OPTION_THREAD_SAFE
TTMemory_Allocated += Size;
TTMemory_MaxAllocated += Size;
#endif
#ifdef DEBUG_MEMORY
num_alloc++;
i = 0;
while ( i < MAX_TRACKED_BLOCKS && pointers[i].base != NULL )
i++;
if ( i >= MAX_TRACKED_BLOCKS )
fail_alloc++;
else
{
pointers[i].base = *P;
pointers[i].size = Size;
}
#else
if ( Size > ( UINT_MAX & ~0xFu ) )
{
i = 0;
while ( i < MAX_TRACKED_BIGCHUNKS && pointers[i].base != NULL )
i++;
if ( i >= MAX_TRACKED_BIGCHUNKS )
/* We fail badly here. Increase MAX_TRACKED_BIGCHUNKS if needed. */
return TT_Err_Invalid_Argument;
else
{
pointers[i].base = *P;
pointers[i].size = Size;
}
}
#endif /* DEBUG_MEMORY */
if ( Size > ( UINT_MAX & ~0xFu ) )
{
char TT_HUGE_PTR * p = (char TT_HUGE_PTR *) *P;
ULong left = (ULong)Size;
size_t toClear;
while ( left )
{
toClear = (left > 0xFF00) ? 0xFF00 : left;
MEM_Set( p, 0, toClear );
left -= (ULong) toClear;
p += toClear;
}
}
else
MEM_Set( *P, 0, Size );
}
else
*P = NULL;
return TT_Err_Ok;
}
#ifdef TT_CONFIG_OPTION_EXTEND_ENGINE
/*******************************************************************
*
* Function : TT_Realloc
*
* Description : Reallocates memory from the heap buffer.
*
* Input : Size new size of the memory to be allocated;
* if zero, TT_Free() will be called
* P pointer to a buffer pointer; if *P == NULL,
* TT_Alloc() will be called
*
* Output : Error code.
*
* NOTES : It's not necessary to zero the memory in case the
* reallocated buffer is larger than before -- the
* application has to take care of this.
*
* If the memory request fails, TT_Free() will be
* called on *P, and TT_Err_Out_Of_Memory returned.
*
******************************************************************/
EXPORT_FUNC
TT_Error TT_Realloc( ULong Size, void** P )
{
void* Q;
#ifdef DEBUG_MEMORY
Int i;
#endif
if ( !P )
return TT_Err_Invalid_Argument;
if ( !*P )
return TT_Alloc( Size, P );
if ( Size == 0 )
return TT_Free( P );
if ( Size > ( UINT_MAX & ~0xFu ) )
Q = NULL; /* Do not even try to deal with big chunks of memory. */
else
Q = (void*)realloc( *P, Size );
if ( !Q )
{
TT_Free( *P );
return TT_Err_Out_Of_Memory;
}
#ifdef DEBUG_MEMORY
num_realloc++;
i = 0;
while ( i < MAX_TRACKED_BLOCKS && pointers[i].base != *P )
i++;
if ( i >= MAX_TRACKED_BLOCKS )
fail_realloc++;
else
{
#ifndef TT_CONFIG_OPTION_THREAD_SAFE
TTMemory_Allocated += Size - pointers[i].size;
if ( Size > pointers[i].size )
TTMemory_MaxAllocated += Size - pointers[i].size;
#endif
pointers[i].base = Q;
pointers[i].size = Size;
}
#endif /* DEBUG_MEMORY */
*P = Q;
return TT_Err_Ok;
}
#endif /* TT_CONFIG_OPTION_EXTEND_ENGINE */
/*******************************************************************
*
* Function : TT_Free
*
* Description : Releases a previously allocated block of memory.
*
* Input : P pointer to memory block
*
* Output : Always SUCCESS.
*
* Note : The pointer must _always_ be set to NULL by this function.
*
******************************************************************/
EXPORT_FUNC
TT_Error TT_Free( void** P )
{
Int i;
Long Size = 0;
if ( !P || !*P )
return TT_Err_Ok;
#ifdef DEBUG_MEMORY
num_free++;
i = 0;
while ( i < MAX_TRACKED_BLOCKS && pointers[i].base != *P )
i++;
if ( i >= MAX_TRACKED_BLOCKS )
fail_free++;
else
{
#ifndef TT_CONFIG_OPTION_THREAD_SAFE
TTMemory_Allocated -= pointers[i].size;
#endif
Size = pointers[i].size;
pointers[i].base = NULL;
pointers[i].size = 0;
}
#else
i = 0;
while ( i < MAX_TRACKED_BIGCHUNKS && pointers[i].base != *P )
i++;
/* If we did not found the pointer, then this is a "small" chunk. */
if ( i < MAX_TRACKED_BIGCHUNKS )
{
Size = pointers[i].size;
pointers[i].base = NULL;
pointers[i].base = NULL;
}
#endif /* DEBUG_MEMORY */
if ( Size > ( UINT_MAX & ~0xFu ) )
huge_free( *P );
else
free( *P );
*P = NULL;
return TT_Err_Ok;
}
/*******************************************************************
*
* Function : TTMemory_Init
*
* Description : Initializes the memory.
*
* Output : Always SUCCESS.
*
******************************************************************/
LOCAL_FUNC
TT_Error TTMemory_Init( void )
{
#ifdef DEBUG_MEMORY
Int i;
for ( i = 0; i < MAX_TRACKED_BLOCKS; i++ )
{
pointers[i].base = NULL;
pointers[i].size = 0;
}
num_alloc = 0;
num_realloc = 0;
num_free = 0;
fail_alloc = 0;
fail_realloc = 0;
fail_free = 0;
#else
Int i;
for ( i = 0; i < MAX_TRACKED_BIGCHUNKS; i++ )
{
pointers[i].base = NULL;
pointers[i].size = 0;
}
#endif
#ifndef TT_CONFIG_OPTION_THREAD_SAFE
TTMemory_Allocated = 0;
TTMemory_MaxAllocated = 0;
#endif
return TT_Err_Ok;
}
/*******************************************************************
*
* Function : TTMemory_Done
*
* Description : Finalizes memory usage.
*
* Output : Always SUCCESS.
*
******************************************************************/
LOCAL_FUNC
TT_Error TTMemory_Done( void )
{
#ifdef DEBUG_MEMORY
Int i, num_leaked, tot_leaked;
num_leaked = 0;
tot_leaked = 0;
for ( i = 0; i < MAX_TRACKED_BLOCKS; i++ )
{
if ( pointers[i].base )
{
num_leaked ++;
tot_leaked += pointers[i].size;
}
}
fprintf( stderr,
"%d memory allocations, of which %d failed\n",
num_alloc,
fail_alloc );
fprintf( stderr,
"%d memory reallocations, of which %d failed\n",
num_realloc,
fail_realloc );
fprintf( stderr,
"%d memory frees, of which %d failed\n",
num_free,
fail_free );
if ( num_leaked > 0 )
{
fprintf( stderr,
"There are %d leaked memory blocks, totalizing %d bytes\n",
num_leaked, tot_leaked );
for ( i = 0; i < MAX_TRACKED_BLOCKS; i++ )
{
if ( pointers[i].base )
{
fprintf( stderr,
"index: %4d (base: $%08lx, size: %08ld)\n",
i,
(long)pointers[i].base,
pointers[i].size );
}
}
}
else
fprintf( stderr, "No memory leaks !\n" );
#endif /* DEBUG_MEMORY */
return TT_Err_Ok;
}
/* END */

26
lib/arch/msdos/makedep Normal file
View File

@@ -0,0 +1,26 @@
# makedep
#
# This shell script creates a dependency file necessary for older compilers
# on the MS-DOS platform.
echo "\
# This dependency file to be used with various MS-DOS compilers
# has been generated automatically with the script \`makedep' on
# `date +%d-%b-%Y`.
" > depend.dos
(cd ../..
gcc -MM -Iarch/msdos -I. *.c | \
sed -e "s/\.o:/.obj:/" -e "s:/:\\\\:g") >> depend.dos
(cd ../..
gcc -MM -Iarch/msdos -I. -Iextend extend/*.c | \
sed -e "s/^\(.*\)\.o:/extend\\\\\1.obj:/" -e "s:/:\\\\:g") >> depend.dos
(cd ../..
gcc -MM -Iarch/msdos -I. -Iextend \
-DTT_HUGE_PTR -Dhuge_alloc -Dhuge_free arch/msdos/*.c | \
sed -e "s/^\(.*\)\.o:/arch\\\\msdos\\\\\1.obj:/" \
-e "s:/:\\\\:g") >> depend.dos
# eof

84
lib/arch/os2/Makefile.dm Normal file
View File

@@ -0,0 +1,84 @@
# This file is part of the FreeType project.
#
# It builds the library and test programs for emx-gcc under OS/2
#
# You will need dmake.
#
# Use this file while in the lib directory with the following statement:
#
# dmake -r -f arch/os2/Makefile.dm
ARCH = arch/os2
FT_MAKEFILE = $(ARCH)/Makefile.dm
FT_MAKE = dmake -r
.IMPORT: COMSPEC
SHELL := $(COMSPEC)
SHELLFLAGS := /c
GROUPSHELL := $(SHELL)
GROUPFLAGS := $(SHELLFLAGS)
GROUPSUFFIX := .cmd
SHELLMETAS := *"?<>&|
CC = gcc
CFLAGS = -Wall -O2 -g -ansi -pedantic -I$(ARCH) -I. -Iextend
# CFLAGS = -Wall -ansi -O2 -s -I$(ARCH) -I. -Iextend
TTFILE = $(ARCH)/os2file.c
TTMEMORY = ./ttmemory.c
TTMUTEX = ./ttmutex.c
PORT = $(TTFILE) $(TTMEMORY) $(TTMUTEX)
SRC_X = extend/ftxgasp.c extend/ftxkern.c extend/ftxpost.c \
extend/ftxcmap.c extend/ftxwidth.c extend/ftxsbit.c \
extend/ftxgsub.c extend/ftxgpos.c extend/ftxopen.c \
extend/ftxgdef.c
OBJS_X = $(SRC_X:.c=.o)
SRC_M = ttapi.c ttcache.c ttcalc.c ttcmap.c ttdebug.c \
ttgload.c ttinterp.c ttload.c ttobjs.c \
ttraster.c ttextend.c $(PORT)
OBJS_M = $(SRC_M:.c=.o) $(OBJS_X)
SRC_S = $(ARCH)/freetype.c
OBJ_S = $(SRC_S:.c=.o)
OBJS_S = $(OBJ_S) $(OBJS_X)
%.o: %.c
$(CC) $(CFLAGS) -c -o $@ $<
.PHONY: all debug clean distclean depend
all:
$(FT_MAKE) -f $(FT_MAKEFILE) LIB_FILES=OBJS_S libttf.a
debug:
$(FT_MAKE) -f $(FT_MAKEFILE) LIB_FILES=OBJS_M libttf.a
$(OBJ_S): $(SRC_S) $(SRC_M)
$(CC) $(CFLAGS) -c -o $@ $(SRC_S)
libttf.a: $($(LIB_FILES))
+-del $@
ar src $@ @$(mktmp $(<:t"\n")\n)
clean:
-+del $(subst,/,\ $($(LIB_FILES)))
distclean: clean
-+del dep.end libttf.a
# depend: $(SRC_S) $(SRC_M) $(SRC_X)
# $(CC) -E -M @$(mktmp $(<:t"\n")\n) > dep.end
# ifeq (dep.end,$(wildcard dep.end))
# include dep.end
# endif
# end of Makefile.dm

91
lib/arch/os2/Makefile.emx Normal file
View File

@@ -0,0 +1,91 @@
# This file is part of the FreeType project.
#
# It builds the library and test programs for emx-gcc under OS/2.
#
# You will need GNU make.
#
# Use this file while in the lib directory with the following statement:
#
# make -f arch/os2/Makefile.emx
ARCH = arch/os2
FT_MAKEFILE = $(ARCH)/Makefile.emx
CC = gcc
#CFLAGS = -W -Wall -O0 -g -ansi -pedantic -I$(ARCH) -I. -Iextend
CFLAGS = -Wall -O3 -fno-inline -fomit-frame-pointer \
-g -ansi -pedantic -I$(ARCH) -I. -Iextend
#CFLAGS = -Wall -ansi -pedantic -O2 -s -I$(ARCH) -I. -Iextend
TTFILE = $(ARCH)/os2file.c
TTMEMORY = ./ttmemory.c
TTMUTEX = ./ttmutex.c
PORT = $(TTFILE) $(TTMEMORY) $(TTMUTEX)
SRC_X = extend/ftxgasp.c extend/ftxkern.c extend/ftxpost.c \
extend/ftxcmap.c extend/ftxwidth.c extend/ftxsbit.c \
extend/ftxgsub.c extend/ftxgpos.c extend/ftxopen.c \
extend/ftxgdef.c
OBJS_X = $(SRC_X:.c=.o)
SRC_M = ttapi.c ttcache.c ttcalc.c ttcmap.c ttdebug.c \
ttgload.c ttinterp.c ttload.c ttobjs.c \
ttraster.c ttextend.c $(PORT)
OBJS_M = $(SRC_M:.c=.o) $(OBJS_X)
SRC_S = $(ARCH)/freetype.c
OBJ_S = $(SRC_S:.c=.o)
OBJS_S = $(OBJ_S) $(OBJS_X)
SRCD_S = $(ARCH)/freetypd.c
OBJD_S = $(SRCD_S:.c=.o)
OBJDS_S = $(OBJD_S) $(OBJS_X)
%.o: %.c
$(CC) $(CFLAGS) -c -o $@ $<
.PHONY: all debug clean distclean depend
all:
$(MAKE) -f $(FT_MAKEFILE) LIB_FILES=OBJS_S libttf.a
debug:
$(MAKE) -f $(FT_MAKEFILE) LIB_FILES=OBJS_M libttf.a
debugger:
$(MAKE) -f $(FT_MAKEFILE) LIB_FILES=OBJDS_S libttfd.a
$(OBJ_S): $(SRC_S) $(SRC_M)
$(OBJD_S): $(SRCD_S) $(SRC_M)
libttf.a: $($(LIB_FILES))
-del $@
ar src $@ $^
libttfd.a: $(OBJDS)
libttfd.a: $(OBJDS)
-del $@
ar src $@ $^
clean:
-del $(subst /,\,$(OBJS_S))
-del $(subst /,\,$(OBJS_M))
distclean: clean
-del dep.end
-del libttf.a
depend: $(SRC_S) $(SRC_M) $(SRC_X)
$(CC) -E -M $^ > dep.end
ifeq (dep.end,$(wildcard dep.end))
include dep.end
endif
# end of Makefile.emx

73
lib/arch/os2/Makefile.icc Normal file
View File

@@ -0,0 +1,73 @@
# This file is part of the FreeType project.
#
# It builds the library and test programs for IBM VisualAge C++ under OS/2.
#
# You will need nmake.
#
# Use this file while in the lib directory with the following statement:
#
# nmake -f arch\os2\Makefile.icc
#
ARCH = arch\os2
FT_MAKEFILE = $(ARCH)\Makefile.icc
FT_MAKE = $(MAKE) -nologo
CC = icc
CFLAGS = -O+ -Ti- -Tm- -Sa -W3 -Wpro- -Wcnd- -Q+ -Iarch\os2 -I. -Iextend
# NOTE: Optimizations are discarded, as it seems that Visual Age
# is buggy when producing ttraster.obj. The resulting code
# crashes under some circumstances (performing vertical dropout
# control when rendering smoothed outlines)!
TTFILE = $(ARCH)\os2file.c
TTMEMORY = .\ttmemory.c
TTMUTEX = .\ttmutex.c
PORT = $(TTFILE) $(TTMEMORY) $(TTMUTEX)
SRC_X = extend\ftxgasp.c extend\ftxkern.c extend\ftxpost.c \
extend\ftxcmap.c extend\ftxwidth.c extend\ftxsbit.c \
extend\ftxgsub.c extend\ftxgpos.c extend\ftxopen.c \
extend\ftxgdef.c
OBJS_X = $(SRC_X:.c=.obj)
SRC_M = ttapi.c ttcache.c ttcalc.c ttcmap.c ttdebug.c \
ttgload.c ttinterp.c ttload.c ttobjs.c ttraster.c \
ttextend.c $(PORT)
OBJS_M = $(SRC_M:.c=.obj) $(OBJS_X)
SRC_S = $(ARCH)\freetype.c
OBJ_S = $(SRC_S:.c=.obj)
OBJS_S = $(OBJ_S) $(OBJS_X)
all:
$(FT_MAKE) -f $(FT_MAKEFILE) LIB_FILES="$(OBJS_S)" libttf.lib
debug:
$(FT_MAKE) -f $(FT_MAKEFILE) LIB_FILES="$(OBJS_M)" libttf.lib
$(OBJ_S): $(SRC_S) $(SRC_M)
$(CC) -C $(CFLAGS) /Fo$@ $*.c
$(OBJS_X):
$(CC) -C $(CFLAGS) /Fo$@ $*.c
$(ARCH)\os2file.obj:
$(CC) -C $(CFLAGS) /Fo$@ $*.c
libttf.lib: $(LIB_FILES)
!ilib /nologo /noignorecase /nobackup $@ +$?,,
clean:
-del *.obj
-del extend\*.obj
-del arch\os2\*.obj
distclean: clean
-del libttf.lib
# end of Makefile.icc

88
lib/arch/os2/Makefile.wat Normal file
View File

@@ -0,0 +1,88 @@
# This file is part of the FreeType project.
#
# This builds the Watcom library with Watcom's wcc386 under OS/2.
#
# You'll need Watcom's wmake.
#
#
# Invoke by "wmake -f arch\os2\Makefile.wat" when in the "lib" directory
#
# This will build "freetype\lib\libttf.lib"
ARCH = arch\os2
FT_MAKEFILE = $(ARCH)\Makefile.wat
FT_MAKE = wmake -h
.EXTENSIONS:
.EXTENSIONS: .lib .obj .c .h
.obj:.;.\extend;.\$(ARCH)
.c:.;.\extend;.\$(ARCH)
.h:.;.\extend;.\$(ARCH)
CC = wcc386
CCFLAGS = /otexanl+ /s /w5 /zq -Iarch\os2 -I. -Iextend
TTFILE = .\ttfile.c
TTMEMORY = .\ttmemory.c
TTMUTEX = .\ttmutex.c
TTFILE_OBJ = ttfile.obj
TTMEMORY_OBJ = ttmemory.obj
TTMUTEX_OBJ = ttmutex.obj
PORT = $(TTFILE) $(TTMEMORY) $(TTMUTEX)
PORT_OBJS = $(TTFILE_OBJ) $(TTMEMORY_OBJ) $(TTMUTEX_OBJ)
SRC_X = extend\ftxgasp.c extend\ftxkern.c extend\ftxpost.c &
extend\ftxcmap.c extend\ftxwidth.c extend\ftxsbit.c &
extend\ftxgsub.c extend\ftxgpos.c extend\ftxopen.c &
extend\ftxgdef.c
OBJS_X = extend\ftxgasp.obj extend\ftxkern.obj extend\ftxpost.obj &
extend\ftxcmap.obj extend\ftxwidth.obj extend\ftxsbit.obj &
extend\ftxgsub.obj extend\ftxgpos.obj extend\ftxopen.obj &
extend\ftxgdef.obj
SRC_M = ttapi.c ttcache.c ttcalc.c ttcmap.c &
ttgload.c ttinterp.c ttload.c ttobjs.c &
ttraster.c ttextend.c $(PORT)
OBJS_M = ttapi.obj ttcache.obj ttcalc.obj ttcmap.obj &
ttgload.obj ttinterp.obj ttload.obj ttobjs.obj &
ttraster.obj ttextend.obj $(PORT_OBJS) $(OBJS_X)
SRC_S = freetype.c
OBJ_S = freetype.obj
OBJS_S = $(OBJ_S) $(OBJS_X)
.c.obj:
$(CC) $(CCFLAGS) $[* /fo=$[*.obj
all: .symbolic
$(FT_MAKE) -f $(FT_MAKEFILE) libttf.lib
debug: .symbolic
$(FT_MAKE) -f $(FT_MAKEFILE) LIB_FILES="$(OBJS_M)" libttf.lib
libttf.lib: $(OBJS_M)
wlib -q -n libttf.lib $(OBJS_M)
# is this correct? Know nothing about wmake and the Watcom compiler...
$(OBJ_S): $(SRC_S) $(SRC_M)
$(CC) $(CCFLAGS) $(SRC_S) /fo=$(OBJ_S)
clean: .symbolic
@-erase $(OBJS_M)
@-erase *.err
distclean: .symbolic clean
@-erase libttf.lib
new: .symbolic
@-wtouch *.c
# end of Makefile.wat

32
lib/arch/os2/freetype.c Normal file
View File

@@ -0,0 +1,32 @@
/* This file is part of the FreeType project */
/* Single file library component for OS/2 */
#define TT_MAKE_OPTION_SINGLE_OBJECT
/* first include common core components */
#include "ttapi.c"
#include "ttcache.c"
#include "ttcalc.c"
#include "ttcmap.c"
#include "ttdebug.c"
#include "ttgload.c"
#include "ttinterp.c"
#include "ttload.c"
#include "ttobjs.c"
#include "ttraster.c"
/* then system-specific (or ANSI) components */
#include "os2file.c"
#include "ttmemory.c"
#include "ttmutex.c"
/* the extensions are compiled separately, but we need to */
/* include the file ttextend.c if we want to support them */
#ifdef TT_CONFIG_OPTION_EXTEND_ENGINE
#include "ttextend.c"
#endif
/* END */

239
lib/arch/os2/ft_conf.h Normal file
View File

@@ -0,0 +1,239 @@
/*******************************************************************
*
* ft_conf.h (OS/2 version)
*
* High-level interface specification.
*
* Copyright 1996-1998 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.
*
*
* This file is used to contain the definition of several
* configuration-specific macros.
*
******************************************************************/
/* we need the following because there are some typedefs in this file */
#ifndef FT_CONF_H
#define FT_CONF_H
/**********************************************************************/
/* */
/* We begin by a series of macros that are automatically set by the */
/* 'configure' script on Unix. They must be set manually on OS/2, */
/* so here they are : */
/* */
/**********************************************************************/
#define OS2
/* Define to empty if the keyword "const" does not work. */
/* #undef const */
/* The number of bytes in a int. */
#define SIZEOF_INT 4
/* The number of bytes in a long. */
#define SIZEOF_LONG 4
/* Define if you have the memcpy function. */
#define HAVE_MEMCPY
/* Define if you have the memmove function. */
#define HAVE_MEMMOVE
/* Define if you have the <stdlib.h> header file. */
#define HAVE_STDLIB_H
/* Define if you have the <fcntl.h> header file. */
#undef HAVE_FCNTL_H
/* Define if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
/* Define if you need <conio.h> for console I/O functions. */
#if defined(__EMX__) || defined(__IBMC__)
#define HAVE_CONIO_H
#endif
/* Define if you have the valloc function. */
#undef HAVE_VALLOC
/* Define if you have the getpagesize function. */
#undef HAVE_GETPAGESIZE
/* Define if you have a working `mmap' system call. */
#undef HAVE_MMAP
/**********************************************************************/
/* */
/* The following configuration macros can be tweaked manually by */
/* a developer to turn on or off certain features or options in the */
/* TrueType engine. This may be useful to tune it for specific */
/* purposes.. */
/* */
/**********************************************************************/
/*************************************************************************/
/* Define this if the underlying operating system uses a different */
/* character width than 8bit for file names. You must then also supply */
/* a typedef declaration for defining 'TT_Text'. Default is off. */
/* #define HAVE_TT_TEXT */
/*************************************************************************/
/* Define this if you want to generate code to support engine extensions */
/* Default is on, but if you're satisfied by the basic services provided */
/* by the engine and need no extensions, undefine this configuration */
/* macro to save a few more bytes. */
#define TT_CONFIG_OPTION_EXTEND_ENGINE
/*************************************************************************/
/* Define this if you want to generate code to support gray-scaling, */
/* a.k.a. font-smoothing or anti-aliasing. Default is on, but you can */
/* disable it if you don't need it. */
#define TT_CONFIG_OPTION_GRAY_SCALING
/*************************************************************************/
/* Define this if you want to completely disable the use of the bytecode */
/* interpreter. Doing so will produce a much smaller library, but the */
/* quality of the rendered glyphs will enormously suffer from this. */
/* */
/* This switch was introduced due to the Apple patents issue which */
/* emerged recently on the FreeType lists. We still do not have Apple's */
/* opinion on the subject and will change this as soon as we have. */
#undef TT_CONFIG_OPTION_NO_INTERPRETER
/*************************************************************************/
/* Define this if you want to use a big 'switch' statement within the */
/* bytecode interpreter. Because some non-optimizing compilers are not */
/* able to produce jump tables from such statements, undefining this */
/* configuration macro will generate the appropriate C jump table in */
/* ttinterp.c. If you use an optimizing compiler, you should leave it */
/* defined for better performance and code compactness.. */
#define TT_CONFIG_OPTION_INTERPRETER_SWITCH
/*************************************************************************/
/* Define this if you want to build a 'static' version of the TrueType */
/* bytecode interpreter. This will produce much bigger code, which */
/* _may_ be faster on some architectures.. */
/* */
/* Do NOT DEFINE THIS is you build a thread-safe version of the engine */
/* */
#undef TT_CONFIG_OPTION_STATIC_INTERPRETER
/*************************************************************************/
/* Define this if you want to build a 'static' version of the scan-line */
/* converter (the component which in charge of converting outlines into */
/* bitmaps). This will produce a bigger object file for "ttraster.c", */
/* which _may_ be faster on some architectures.. */
/* */
/* Do NOT DEFINE THIS is you build a thread-safe version of the engine */
/* */
#undef TT_CONFIG_OPTION_STATIC_RASTER
/*************************************************************************/
/* Define TT_CONFIG_THREAD_SAFE if you want to build a thread-safe */
/* version of the library. */
#undef TT_CONFIG_OPTION_THREAD_SAFE
/**********************************************************************/
/* */
/* The following macros are used to define the debug level, as well */
/* as individual tracing levels for each component. There are */
/* currently three modes of operation : */
/* */
/* - trace mode (define DEBUG_LEVEL_TRACE) */
/* */
/* The engine prints all error messages, as well as tracing */
/* ones, filtered by each component's level */
/* */
/* - debug mode (define DEBUG_LEVEL_ERROR) */
/* */
/* Disable tracing, but keeps error output and assertion */
/* checks. */
/* */
/* - release mode (don't define anything) */
/* */
/* Don't include error-checking or tracing code in the */
/* engine's code. Ideal for releases. */
/* */
/* NOTE : */
/* */
/* Each component's tracing level is defined in its own source. */
/* */
/**********************************************************************/
/* Define if you want to use the tracing debug mode */
#undef DEBUG_LEVEL_TRACE
/* Define if you want to use the error debug mode - ignored if */
/* DEBUG_LEVEL_TRACE is defined */
#undef DEBUG_LEVEL_ERROR
/**************************************************************************/
/* Definition of various integer sizes. These types are used by ttcalc */
/* and ttinterp (for the 64-bit integers) only.. */
#if SIZEOF_INT == 4
typedef signed int TT_Int32;
typedef unsigned int TT_Word32;
#elif SIZEOF_LONG == 4
typedef signed long TT_Int32;
typedef unsigned long TT_Word32;
#else
#error "no 32bit type found"
#endif
#if SIZEOF_LONG == 8
/* LONG64 must be defined when a 64-bit type is available */
/* INT64 must then be defined to this type.. */
#define LONG64
#define INT64 long
#else
/* GCC provides the non-ANSI 'long long' 64-bit type. You can activate */
/* by defining the TT_USE_LONG_LONG macro in 'ft_conf.h'. Note that this */
/* will produce many -ansi warnings during library compilation. */
#ifdef TT_USE_LONG_LONG
#define LONG64
#define INT64 long long
#endif /* TT_USE_LONG_LONG */
#endif
#endif /* FT_CONF_H */
/* END */

1237
lib/arch/os2/os2file.c Normal file

File diff suppressed because it is too large Load Diff

1
lib/arch/unix/.cvsignore Normal file
View File

@@ -0,0 +1 @@
Makefile

244
lib/arch/unix/Makefile.in Normal file
View File

@@ -0,0 +1,244 @@
# This file is part of the FreeType project.
#
# lib/arch/unix/Makefile.in
ARCH = arch/unix
FT_MAKEFILE = $(ARCH)/Makefile
RM = @RM@
RMF = @RM@ -f
RMDIR = @RMDIR@
LN_S = @LN_S@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
VPATH = @srcdir@/../..
srcdir = @srcdir@/../..
top_builddir=..
CC = @CC@
CPP = @CPP@
LIBTOOL = $(top_builddir)/libtool
MKINSTALLDIRS = $(srcdir)/../mkinstalldirs
version_info = @version_info@
include $(top_builddir)/MakeSub
############### PORTABILITY COMPONENTS ########################
# location of memory component
MEMSRC = ttmemory.c
# location of file component
FILESRC = @TT_FILE_COMPONENT@
# location of mutex component
MUTEXSRC = ttmutex.c
# location of default extensions
FTEXTDIR = $(srcdir)/extend
# default extensions sources
EXTSRC = $(FTEXTDIR)/ftxkern.c \
$(FTEXTDIR)/ftxgasp.c \
$(FTEXTDIR)/ftxpost.c \
$(FTEXTDIR)/ftxcmap.c \
$(FTEXTDIR)/ftxsbit.c \
$(FTEXTDIR)/ftxwidth.c \
$(FTEXTDIR)/ftxerr18.c \
$(FTEXTDIR)/ftxgsub.c \
$(FTEXTDIR)/ftxgpos.c \
$(FTEXTDIR)/ftxgdef.c \
$(FTEXTDIR)/ftxopen.c
EXTOBJ = ftxkern.lo \
ftxgasp.lo \
ftxpost.lo \
ftxcmap.lo \
ftxsbit.lo \
ftxwidth.lo \
ftxerr18.lo \
ftxgsub.lo \
ftxgpos.lo \
ftxgdef.lo \
ftxopen.lo
# all engine sources
SRC_M = $(srcdir)/ttapi.c \
$(srcdir)/ttcache.c \
$(srcdir)/ttcalc.c \
$(srcdir)/ttcmap.c \
$(srcdir)/ttdebug.c \
$(srcdir)/ttextend.c \
$(srcdir)/ttgload.c \
$(srcdir)/ttinterp.c \
$(srcdir)/ttload.c \
$(srcdir)/ttobjs.c \
$(srcdir)/ttraster.c \
$(srcdir)/$(FILESRC) \
$(srcdir)/$(MEMSRC) \
$(srcdir)/$(MUTEXSRC)
SRC_S = $(srcdir)/$(ARCH)/freetype.c
# all header files
HEADERS = $(srcdir)/freetype.h \
$(srcdir)/fterrid.h \
$(srcdir)/ftnameid.h \
$(FTEXTDIR)/ftxkern.h \
$(FTEXTDIR)/ftxgasp.h \
$(FTEXTDIR)/ftxcmap.h \
$(FTEXTDIR)/ftxsbit.h \
$(FTEXTDIR)/ftxpost.h \
$(FTEXTDIR)/ftxwidth.h \
$(FTEXTDIR)/ftxerr18.h \
$(FTEXTDIR)/ftxgsub.h \
$(FTEXTDIR)/ftxgpos.h \
$(FTEXTDIR)/ftxgdef.h \
$(FTEXTDIR)/ftxopen.h
# all engine objects
OBJ_M = ttapi.lo \
ttcache.lo \
ttcalc.lo \
ttcmap.lo \
ttdebug.lo \
ttextend.lo \
ttgload.lo \
ttinterp.lo \
ttload.lo \
ttobjs.lo \
ttraster.lo \
file.lo \
memory.lo \
mutex.lo \
$(EXTOBJ)
OBJ_S = freetype.lo $(EXTOBJ)
# include paths
INCLUDES = -I. -I$(top_builddir) -I$(srcdir) -I$(FTEXTDIR)
# C flags
CFLAGS = @CFLAGS@ @XX_CFLAGS@
CPPFLAGS = @CPPFLAGS@
FT_CFLAGS = $(CFLAGS) $(INCLUDES)
# linker flags
FT_LIBS = @LIBS@
# i18n stuff
LOCALEDIR = @LOCALEDIR@
all: do_link
$(MAKE) -f $(FT_MAKEFILE) LIB_FILES="$(OBJ_S)" libttf.la
debug: do_link
$(MAKE) -f $(FT_MAKEFILE) LIB_FILES="$(OBJ_M)" libttf.la
do_link:
-$(RMF) memory.c file.c mutex.c
$(LN_S) $(srcdir)/$(MEMSRC) memory.c
$(LN_S) $(srcdir)/$(FILESRC) file.c
$(LN_S) $(srcdir)/$(MUTEXSRC) mutex.c
.SUFFIXES: .lo
.c.lo:
$(LIBTOOL) --mode=compile $(CC) -c $(FT_CFLAGS) $<
ftxkern.lo: $(FTEXTDIR)/ftxkern.c
$(LIBTOOL) --mode=compile $(CC) -c $(FT_CFLAGS) $(FTEXTDIR)/ftxkern.c
ftxgasp.lo: $(FTEXTDIR)/ftxgasp.c
$(LIBTOOL) --mode=compile $(CC) -c $(FT_CFLAGS) $(FTEXTDIR)/ftxgasp.c
ftxpost.lo: $(FTEXTDIR)/ftxpost.c
$(LIBTOOL) --mode=compile $(CC) -c $(FT_CFLAGS) $(FTEXTDIR)/ftxpost.c
ftxcmap.lo: $(FTEXTDIR)/ftxcmap.c
$(LIBTOOL) --mode=compile $(CC) -c $(FT_CFLAGS) $(FTEXTDIR)/ftxcmap.c
ftxsbit.lo: $(FTEXTDIR)/ftxsbit.c
$(LIBTOOL) --mode=compile $(CC) -c $(FT_CFLAGS) $(FTEXTDIR)/ftxsbit.c
ftxwidth.lo: $(FTEXTDIR)/ftxwidth.c
$(LIBTOOL) --mode=compile $(CC) -c $(FT_CFLAGS) $(FTEXTDIR)/ftxwidth.c
ftxerr18.lo: $(FTEXTDIR)/ftxerr18.c
$(LIBTOOL) --mode=compile $(CC) -c $(FT_CFLAGS) \
-DLOCALEDIR='"$(LOCALEDIR)"' \
$(FTEXTDIR)/ftxerr18.c
ftxgsub.lo: $(FTEXTDIR)/ftxgsub.c
$(LIBTOOL) --mode=compile $(CC) -c $(FT_CFLAGS) $(FTEXTDIR)/ftxgsub.c
ftxgpos.lo: $(FTEXTDIR)/ftxgpos.c
$(LIBTOOL) --mode=compile $(CC) -c $(FT_CFLAGS) $(FTEXTDIR)/ftxgpos.c
ftxgdef.lo: $(FTEXTDIR)/ftxgdef.c
$(LIBTOOL) --mode=compile $(CC) -c $(FT_CFLAGS) $(FTEXTDIR)/ftxgdef.c
ftxopen.lo: $(FTEXTDIR)/ftxopen.c
$(LIBTOOL) --mode=compile $(CC) -c $(FT_CFLAGS) $(FTEXTDIR)/ftxopen.c
freetype.lo: $(SRC_S) $(SRC_M)
$(LIBTOOL) --mode=compile $(CC) -c $(FT_CFLAGS) \
-DLOCALEDIR='"$(LOCALEDIR)"' \
-DTT_MAKE_OPTION_SINGLE_OBJECT \
$(SRC_S)
libttf.la: $(LIB_FILES)
$(LIBTOOL) --mode=link $(CC) -o libttf.la $(LIB_FILES) \
-rpath $(libdir) \
-version-info $(version_info) $(FT_LIBS)
install: libttf.la
$(MKINSTALLDIRS) $(libdir) $(includedir)/freetype
$(LIBTOOL) --mode=install $(INSTALL) libttf.la $(libdir)
-for P in $(HEADERS) ; do \
$(INSTALL_DATA) $$P $(includedir)/freetype ; \
done
uninstall:
-$(LIBTOOL) --mode=uninstall $(RM) $(libdir)/libttf.la
-$(RMF) $(includedir)/freetype/*
-$(RMDIR) $(includedir)/freetype
clean:
-$(RMF) $(OBJ_S) $(OBJ_M) *.o
distclean: clean
-$(RMF) file.c memory.c mutex.c
-$(RMF) libttf.la
-$(RMF) *.orig *~ core *.core
-$(RMF) $(ARCH)/Makefile
-$(RMF) .libs/*
-$(RMDIR) .libs
depend: do_link
(echo '/^#.* PUT NO STUFF BELOW/,$$d' ; echo w ; echo q) | \
ed - $(ARCH)/Makefile
echo '# Dependencies generated by make depend: PUT NO STUFF BELOW' \
>> $(ARCH)/Makefile
for file in $(SRC_S) $(SRC_M) $(EXTSRC) ; do \
$(CPP) $(CPPFLAGS) $(INCLUDES) $$file | \
sed -n -e 's|^# [1-9][0-9]* "\([^/].*\.h\)".*|\1|p' \
-e 's|^# [1-9][0-9]* "\($(srcdir)/.*\.h\)".*|\1|p' | \
sed -e 's|/\./|.|g' -e "s/^/`basename $$file .c`.lo: /" ; \
done | \
sort -u | \
awk '{ if (LINE == 1) \
{ line = last = $$1 } \
else if ($$1 != last) \
{ print line ; line = last = $$1 } \
line = line " " $$2 } \
END { print line }' >> $(ARCH)/Makefile
# Dependencies generated by make depend: PUT NO STUFF BELOW

27
lib/arch/unix/freetype.c Normal file
View File

@@ -0,0 +1,27 @@
/* This file is part of the FreeType project */
/* Single object library component for Unix */
#include "ttapi.c"
#include "ttcache.c"
#include "ttcalc.c"
#include "ttcmap.c"
#include "ttdebug.c"
#include "ttgload.c"
#include "ttinterp.c"
#include "ttload.c"
#include "ttobjs.c"
#include "ttraster.c"
/* The Makefile creates proper links to following three files */
#include "file.c"
#include "memory.c"
#include "mutex.c"
#ifdef TT_CONFIG_OPTION_EXTEND_ENGINE
#include "ttextend.c"
#endif
/* END */

1027
lib/arch/unix/ttmmap.c Normal file

File diff suppressed because it is too large Load Diff

20
lib/arch/vms/README Normal file
View File

@@ -0,0 +1,20 @@
This directory contains two files for compiling the FreeType library under
VMS:
ft_conf.h the configuration file for the FreeType library
descrip.mms a makefile to be used with either MMS or MMK
The files are such designed that after unpacking of freetype-1.2 one can
give the command
MMS/DESCR=[.LIB.ARCH.VMS]
to build the libraries. (Of course, for MMK use `MMK' on the command line
instead of `MMS'.) The makefile contains a `clean' target, but no `install'
target since I'm note sure where to install the library and the include
files.
I did NOT do the test programs but I tested it with my own programs.
Jouk Jansen <joukj@hrem.stm.tudelft.nl>

155
lib/arch/vms/descrip.mms Normal file
View File

@@ -0,0 +1,155 @@
# This file is part of the FreeType project.
#
# DESCRIP.MMS: Make file for VMS using MMS or MMK
# Created by Jouk Jansen (joukj@hrem.stm.tudelft.nl)
ARCH = arch.unix
CC = cc
############### PORTABILITY COMPONENTS ########################
# location of memory component
MEMSRC = ttmemory.c
# location of file component
FILESRC = ttfile.c
# location of mutex component
MUTEXSRC = ttmutex.c
# location of default extensions
FTEXTDIR = [.lib.extend]
# default extensions sources
EXTSRC = $(FTEXTDIR)ftxkern.c \
$(FTEXTDIR)ftxgasp.c \
$(FTEXTDIR)ftxpost.c \
$(FTEXTDIR)ftxcmap.c \
$(FTEXTDIR)ftxsbit.c \
$(FTEXTDIR)ftxwidth.c \
$(FTEXTDIR)ftxerr18.c \
$(FTEXTDIR)ftxgsub.c \
$(FTEXTDIR)ftxgpos.c \
$(FTEXTDIR)ftxopen.c \
$(FTEXTDIR)ftxgdef.c
EXTOBJ = [.lib]ftxkern.obj, \
[.lib]ftxgasp.obj, \
[.lib]ftxpost.obj, \
[.lib]ftxcmap.obj, \
[.lib]ftxsbit.obj, \
[.lib]ftxwidth.obj, \
[.lib]ftxerr18.obj, \
[.lib]ftxgsub.obj, \
[.lib]ftxgpos.obj, \
[.lib]ftxopen.obj, \
[.lib]ftxgdef.obj
# all engine sources
SRC_M = [.lib]ttapi.c \
[.lib]ttcache.c \
[.lib]ttcalc.c \
[.lib]ttcmap.c \
[.lib]ttdebug.c \
[.lib]ttextend.c \
[.lib]ttgload.c \
[.lib]ttinterp.c \
[.lib]ttload.c \
[.lib]ttobjs.c \
[.lib]ttraster.c \
[.lib]$(FILESRC) \
[.lib]$(MEMSRC) \
[.lib]$(MUTEXSRC)
SRC_S = [.lib.$(ARCH)]freetype.c
# all header files with path
HEADERS = [.lib]freetype.h \
[.lib]fterrid.h \
[.lib]ftnameid.h \
$(FTEXTDIR)ftxkern.h \
$(FTEXTDIR)ftxgasp.h \
$(FTEXTDIR)ftxcmap.h \
$(FTEXTDIR)ftxsbit.h \
$(FTEXTDIR)ftxpost.h \
$(FTEXTDIR)ftxwidth.h \
$(FTEXTDIR)ftxerr18.h \
$(FTEXTDIR)ftxgsub.h \
$(FTEXTDIR)ftxgpos.h \
$(FTEXTDIR)ftxgdef.h \
$(FTEXTDIR)ftxopen.h
# all engine objects
OBJ_M = [.lib]ttapi.obj, \
[.lib]ttcache.obj, \
[.lib]ttcalc.obj, \
[.lib]ttcmap.obj, \
[.lib]ttdebug.obj, \
[.lib]ttextend.obj, \
[.lib]ttgload.obj, \
[.lib]ttinterp.obj, \
[.lib]ttload.obj, \
[.lib]ttobjs.obj, \
[.lib]ttraster.obj, \
[.lib]file.obj, \
[.lib]memory.obj, \
[.lib]mutex.obj, \
$(EXTOBJ)
OBJ_S = [.lib]freetype.obj
# include paths
INCLUDES = /include=([.lib],[],$(FTEXTDIR))
# C flags
CFLAGS = $(INCLUDES)/obj=[.lib]
all : do_link [.lib]libttf.olb
library/compress [.lib]libttf.olb
do_link :
if f$search( "[.lib]memory.c" ) .nes. "" then set file/remove [.lib]memory.c;
if f$search( "[.lib]file.c" ) .nes. "" then set file/remove [.lib]file.c;
if f$search( "[.lib]mutex.c" ) .nes. "" then set file/remove [.lib]mutex.c;
if f$search( "[.lib]ft_conf.h" ) .nes. "" then set file/remove [.lib]ft_conf.h;
set file/enter=[.lib]memory.c [.lib]$(MEMSRC)
set file/enter=[.lib]file.c [.lib]$(FILESRC)
set file/enter=[.lib]mutex.c [.lib]$(MUTEXSRC)
set file/enter=[.lib]ft_conf.h [.lib.arch.vms]ft_conf.h
[.lib]ftxkern.obj : $(FTEXTDIR)ftxkern.c
[.lib]ftxgasp.obj : $(FTEXTDIR)ftxgasp.c
[.lib]ftxpost.obj : $(FTEXTDIR)ftxpost.c
[.lib]ftxcmap.obj : $(FTEXTDIR)ftxcmap.c
[.lib]ftxsbit.obj : $(FTEXTDIR)ftxsbit.c
[.lib]ftxwidth.obj : $(FTEXTDIR)ftxwidth.c
[.lib]ftxerr18.obj : $(FTEXTDIR)ftxerr18.c
[.lib]ftxgsub.obj : $(FTEXTDIR)ftxgsub.c
[.lib]ftxgpos.obj : $(FTEXTDIR)ftxgpos.c
[.lib]ftxgdef.obj : $(FTEXTDIR)ftxgdef.c
[.lib]ftxopen.obj : $(FTEXTDIR)ftxopen.c
[.lib]freetype.obj : $(SRC_S) $(SRC_M)
[.lib]libttf.olb : $(OBJ_M)
library/create [.lib]libttf.olb $(OBJ_M)
clean :
delete [.lib]*.obj;*
delete [.lib]*.olb;*
if f$search( "[.lib]memory.c" ) .nes. "" then set file/remove [.lib]memory.c;
if f$search( "[.lib]file.c" ) .nes. "" then set file/remove [.lib]file.c;
if f$search( "[.lib]mutex.c" ) .nes. "" then set file/remove [.lib]mutex.c;
if f$search( "[.lib]ft_conf.h" ) .nes. "" then set file/remove [.lib]ft_conf.h;

215
lib/arch/vms/ft_conf.h Normal file
View File

@@ -0,0 +1,215 @@
/* This file is part of the FreeType project */
/* ft_conf.h for VMS using MMS or MMK */
/* we need the following because there are some typedefs in this file */
#ifndef FT_CONF_H
#define FT_CONF_H
/* Define to empty if the keyword does not work. */
/* #undef const */
/* Define if you have a working `mmap' system call. */
/* #undef HAVE_MMAP */
/* Define if you have the <stdlib.h> header file. */
#define HAVE_STDLIB_H 1
/* Define if the X Window System is missing or not being used. */
/* #undef X_DISPLAY_MISSING */
/* The number of bytes in a int. */
#define SIZEOF_INT 4
/* The number of bytes in a long. */
#define SIZEOF_LONG 4
/* Define if you have the getpagesize function. */
#define HAVE_GETPAGESIZE 1
/* Define if you have the memcpy function. */
#define HAVE_MEMCPY 1
/* Define if you have the memmove function. */
#define HAVE_MEMMOVE 1
/* Define if you have the <fcntl.h> header file. */
#define HAVE_FCNTL_H 1
/* Define if you have the <unistd.h> header file. */
#define HAVE_UNISTD_H 1
/* Define if you have the <locale.h> header file. */
#define HAVE_LOCALE_H 1
/* Define if you have the <libintl.h> header file. */
/* #undef HAVE_LIBINTL_H */
/* Define if you have the libintl library. */
/* #undef HAVE_LIBINTL */
/**********************************************************************/
/* */
/* The following configuration macros can be tweaked manually by */
/* a developer to turn on or off certain features or options in the */
/* TrueType engine. This may be useful to tune it for specific */
/* purposes.. */
/* */
/**********************************************************************/
/*************************************************************************/
/* Define this if the underlying operating system uses a different */
/* character width than 8bit for file names. You must then also supply */
/* a typedef declaration for defining 'TT_Text'. Default is off. */
/* #undef HAVE_TT_TEXT */
/*************************************************************************/
/* Define this if you want to generate code to support engine extensions */
/* Default is on, but if you're satisfied by the basic services provided */
/* by the engine and need no extensions, undefine this configuration */
/* macro to save a few more bytes. */
#define TT_CONFIG_OPTION_EXTEND_ENGINE
/*************************************************************************/
/* Define this if you want to generate code to support gray-scaling, */
/* a.k.a. font-smoothing or anti-aliasing. Default is on, but you can */
/* disable it if you don't need it. */
#define TT_CONFIG_OPTION_GRAY_SCALING
/*************************************************************************/
/* Define this if you want to completely disable the use of the bytecode */
/* interpreter. Doing so will produce a much smaller library, but the */
/* quality of the rendered glyphs will enormously suffer from this. */
/* */
/* This switch was introduced due to the Apple patents issue which */
/* emerged recently on the FreeType lists. We still do not have Apple's */
/* opinion on the subject and will change this as soon as we have. */
#undef TT_CONFIG_OPTION_NO_INTERPRETER
/*************************************************************************/
/* Define this if you want to use a big 'switch' statement within the */
/* bytecode interpreter. Because some non-optimizing compilers are not */
/* able to produce jump tables from such statements, undefining this */
/* configuration macro will generate the appropriate C jump table in */
/* ttinterp.c. If you use an optimizing compiler, you should leave it */
/* defined for better performance and code compactness.. */
#define TT_CONFIG_OPTION_INTERPRETER_SWITCH
/*************************************************************************/
/* Define this if you want to build a 'static' version of the TrueType */
/* bytecode interpreter. This will produce much bigger code, which */
/* _may_ be faster on some architectures.. */
/* */
/* Do NOT DEFINE THIS is you build a thread-safe version of the engine */
/* */
#undef TT_CONFIG_OPTION_STATIC_INTERPRETER
/*************************************************************************/
/* Define this if you want to build a 'static' version of the scan-line */
/* converter (the component which in charge of converting outlines into */
/* bitmaps). This will produce a bigger object file for "ttraster.c", */
/* which _may_ be faster on some architectures.. */
/* */
/* Do NOT DEFINE THIS is you build a thread-safe version of the engine */
/* */
#undef TT_CONFIG_OPTION_STATIC_RASTER
/*************************************************************************/
/* Define TT_CONFIG_THREAD_SAFE if you want to build a thread-safe */
/* version of the library. */
/* #undef TT_CONFIG_OPTION_THREAD_SAFE */
/**********************************************************************/
/* */
/* The following macros are used to define the debug level, as well */
/* as individual tracing levels for each component. There are */
/* currently three modes of operation : */
/* */
/* - trace mode (define DEBUG_LEVEL_TRACE) */
/* */
/* The engine prints all error messages, as well as tracing */
/* ones, filtered by each component's level */
/* */
/* - debug mode (define DEBUG_LEVEL_ERROR) */
/* */
/* Disable tracing, but keeps error output and assertion */
/* checks. */
/* */
/* - release mode (don't define anything) */
/* */
/* Don't include error-checking or tracing code in the */
/* engine's code. Ideal for releases. */
/* */
/* NOTE : */
/* */
/* Each component's tracing level is defined in its own source. */
/* */
/**********************************************************************/
/* Define if you want to use the tracing debug mode */
/* #undef DEBUG_LEVEL_TRACE */
/* Define if you want to use the error debug mode - ignored if */
/* DEBUG_LEVEL_TRACE is defined */
/* #undef DEBUG_LEVEL_ERROR */
/**************************************************************************/
/* Definition of various integer sizes. These types are used by ttcalc */
/* and ttinterp (for the 64-bit integers) only.. */
#if SIZEOF_INT == 4
typedef signed int TT_Int32;
typedef unsigned int TT_Word32;
#elif SIZEOF_LONG == 4
typedef signed long TT_Int32;
typedef unsigned long TT_Word32;
#else
#error "no 32bit type found"
#endif
#if SIZEOF_LONG == 8
/* LONG64 must be defined when a 64-bit type is available */
/* INT64 must then be defined to this type.. */
#define LONG64
#define INT64 long
#else
/* GCC provides the non-ANSI 'long long' 64-bit type. You can activate */
/* by defining the TT_USE_LONG_LONG macro in 'ft_conf.h'. Note that this */
/* will produce many -ansi warnings during library compilation. */
#ifdef TT_USE_LONG_LONG
#define LONG64
#define INT64 long long
#endif /* TT_USE_LONG_LONG */
#endif
#endif /* FT_CONF_H */
/* END */

180
lib/arch/win16/Makefile.BC Normal file
View File

@@ -0,0 +1,180 @@
# This file is part of the FreeType project.
#
# It builds the library for Borland C++ for 16-bit Windows, large model.
# Due to size constraints, it does not try to pack all modules into one.
#
# You will need Borland MAKE.
# Tested with Borland C++ v.4.0 and 5.0.
#
# Use this file while in the lib directory with the following statement:
#
# make -farch/win16/Makefile.BC
#
#
# A DLL version of the library can be built with
#
# make -DDLL -farch/win16/Makefile.BC dll
#
# Debug versions can be obtained with
#
# make -DDEBUG -farch\win16\Makefile.BC
#
# Special versions enabled to handle big fonts (with more than 16,384
# glyphs) can be obtained with
#
# make -DBIGFONTS -farch/win16/Makefile.BC
ARCH = arch\win16
FT_MAKEFILE = $(ARCH)\Makefile.BC
FT_DLL = ft13_16.dll
CC = bcc
LIB = tlib /c /e
IMPLIB = implib -c -o
SPURIOUS_WARNINGS = -w-nak -w-par -w-use -w-aus -w-stu -w-stv -w-cln -w-sig
# Credits go to Dave Hoo <dhoo@flash.net> for pointing out that modern
# Borland compilers (from BC++ 3.1 on) can increase the limit on
# the length of identifiers.
!if ! $d(DEBUG)
CFLAGS = -O2 -3 -ml -A -i40 -I$(ARCH);.;extend $(SPURIOUS_WARNINGS)
DLLFLAGS = -ml -WD -lC
!else
CFLAGS = -v -N -ml -A -i40 -I$(ARCH);.;extend $(SPURIOUS_WARNINGS)
DLLFLAGS = -v -ml -WD -lC
!endif
CFLAGS = $(CFLAGS) -W
FT_DEF = $(FT_DLL:.dll=.def)
!if $d(DLL)
CFLAGS = $(CFLAGS) -WD
!endif
!if $d(BIGFONTS)
CFLAGS = $(CFLAGS) -DTT_HUGE_PTR=__huge
TTFILE = $(ARCH)\hugefile.c
TTMEMORY = $(ARCH)\hugemem.c
!else
TTFILE = .\ttfile.c
TTMEMORY = .\ttmemory.c
!endif
TTMUTEX = .\ttmutex.c
PORT = $(TTFILE) $(TTMEMORY) $(TTMUTEX)
# Do not insert spaces before the \ at end of line,
# otherwise the substitution for TLIB command line will fail.
SRC_X = extend\ftxgasp.c extend\ftxkern.c extend\ftxpost.c\
extend\ftxcmap.c extend\ftxwidth.c extend\ftxerr18.c\
extend\ftxsbit.c extend\ftxgsub.c extend\ftxgpos.c\
extend\ftxopen.c extend\ftxgdef.c
OBJS_X = $(SRC_X:.c=.obj)
SRC_M = ttapi.c ttcache.c ttcalc.c ttcmap.c\
ttgload.c ttinterp.c ttload.c ttobjs.c\
ttraster.c ttextend.c ttdebug.c $(PORT)
OBJS_M = $(SRC_M:.c=.obj) $(OBJS_X)
SRC_S = $(ARCH)\freetype.c
OBJ_S = $(SRC_S:.c=.obj)
OBJS_S = $(OBJ_S) $(OBJS_X)
# Since Borland make does not handle $($(LIB_FILES)), and using
# -DLIB_FILES="$(OBJS_S)" will excess the capacity of COMMAND.COM, we cheat
# by constructing TLIB's response file directly in the `all' target.
#
# Another solution, useful during debugging of part of the library,
# would be to include each .obj in the library as soon as it is compiled.
# See ../msdos/Makefile.TC for an application.
.c.obj:
@$(CC) -c -o$* @&&|
$(CFLAGS) $<
|
!if ! $d(DEBUG)
# Skipped if DEBUG build
# (but it changes nothing, since we always build in multiple parts).
all: $(OBJS_M)
-del libttf.lib
$(LIB) libttf.lib @&&|
+ $(OBJS_M: = + )
|
!endif
debug: $(OBJS_M)
-del libttf.lib
$(LIB) libttf.lib @&&|
+ $(OBJS_M: = + )
|
$(FT_DEF): $(ARCH)\ttf.def
-copy $(ARCH)\ttf.def $(FT_DEF)
dll $(FT_DLL): $(OBJS_M) $(FT_DEF)
!if $d(DLL)
$(CC) -e$(FT_DLL) @&&|
$(DLLFLAGS) $(OBJS_M)
|
$(IMPLIB) libttf $(FT_DEF)
!else
# Re-invoke with flag set. Unfortunately, this discards the other flags.
make -DDLL -f$(ARCH)/Makefile.BC dll
!endif
install: $(FT_DLL)
!if $d(INSTALL_DIR)
copy $(FT_DLL) $(INSTALL_DIR)
!else
copy $(FT_DLL) C:\WINDOWS
!endif
$(OBJ_S): $(SRC_S) $(SRC_M)
# Not used here because it excesses the capacity of COMMAND.COM...
libttf.lib: $(LIB_FILES)
-del libttf.lib
echo -+$(**: =-+)> response
$(LIB) libttf.lib @&&|
+ $(**: = + )
|
!if $d(BIGFONTS)
$(TTMEMORY:.c=.obj): $(TTMEMORY)
$(CC) -c -o$* @&&|
$(CFLAGS) -A- $*.c
|
$(TTFILE:.c=.obj): $(TTFILE)
$(CC) -c -o$* @&&|
$(CFLAGS) -A- $*.c
|
!endif
clean:
-del *.obj
-del extend\*.obj
-del $(ARCH)\*.obj
-del libttf.bak
-del response
-del *.def
distclean: clean
-del libttf.lib
-del *.dll
-del $(FT_DEF)
-del C:\WINDOWS\$(FT_DLL)
!if $d(INSTALL_DIR)
-del $(INSTALL_DIR)\$(FT_DLL)
!endif
!include "$(ARCH)\depend.win"
# end of Makefile

106
lib/arch/win16/Makefile.MS Normal file
View File

@@ -0,0 +1,106 @@
# This file is part of the FreeType project.
#
# It builds the library for Microsoft C for Windows, large model.
# It also works for Visual C++ 1.x 16-bit compilers, but you should
# instead use the Makefile customized for it, Makefile.VC.
# Due to size constraints, it does not try to pack all modules into one.
#
# You will need NMAKE.
#
# Use this file while in the lib directory with the following statement:
#
# nmake /f arch\win16\Makefile.MS
#
#
# A debug version can be obtained with
#
# nmake DEBUG=1 /f arch\win16\Makefile.MS
ARCH = arch\win16
FT_MAKEFILE = $(ARCH)\Makefile.MS
CC = cl /nologo
LIB = lib /noignorecase /nologo
!ifndef DEBUG
CFLAGS = /Ox /AL /Za /W2 /G2 -I$(ARCH) -I. -Iextend
!else
CFLAGS = /Zi /AL /Za /W2 /G2 -I$(ARCH) -I. -Iextend
!endif
# Use /Gw instead with Microsoft C version 6
CFLAGS = $(CFLAGS) /GA
TTFILE = .\ttfile.c
TTMEMORY = .\ttmemory.c
TTMUTEX = .\ttmutex.c
PORT = $(TTFILE) $(TTMEMORY) $(TTMUTEX)
# Do not insert spaces between the file names or at end of line, otherwise
# the substitution for LIB command line will fail. Thank you.
#
SRC_X = extend\ftxgasp.c extend\ftxkern.c extend\ftxpost.c\
extend\ftxcmap.c extend\ftxwidth.c extend\ftxerr18.c extend\ftxsbit.c\
extend\ftxopen.c extend\ftxgsub.c extend\ftxgpos.c extend\ftxgdef.c
OBJS_X = $(SRC_X:.c=.obj)
SRC_M = ttapi.c ttcache.c ttcalc.c ttcmap.c ttdebug.c\
ttgload.c ttinterp.c ttload.c ttobjs.c ttraster.c ttextend.c $(PORT)
OBJS_M = $(SRC_M:.c=.obj) $(OBJS_X)
SRC_S = $(ARCH)\freetype.c
OBJ_S = $(SRC_S:.c=.obj)
OBJS_S = $(OBJ_S) $(OBJS_X)
# Since Microsoft's NMAKE does not handle $($(LIB_FILES)), and using
# LIB_FILES="$(OBJS_S)" will excess the capacity of COMMAND.COM, we cheat
# by constructing LIB's response file directly in the `all' target.
#
# Another solution, useful during debugging of part of the library,
# would be to include each .obj in the library as soon as it is compiled.
# See ..\msdos\Makefile.TC for an application.
.c.obj:
$(CC) /c /Fo$@ @<<
$(CFLAGS) $*.c
<<
!ifndef DEBUG
# Skipped if DEBUG build
# (but it changes nothing, since we always build in multiple parts).
all: $(OBJS_M)
-del libttf.lib
$(LIB) libttf.lib @<<response
+ $(OBJS_M: = ^ );
<<KEEP
!endif
debug: $(OBJS_M)
-del libttf.lib
$(LIB) libttf.lib @<<response
+ $(OBJS_M: = ^ );
<<KEEP
$(OBJ_S): $(SRC_S) $(SRC_M)
# Not used here because it excesses the capacity of COMMAND.COM...
libttf.lib: $(LIB_FILES)
$(LIB) $@ +-$(?: =-+);
clean:
-del *.obj
-del extend\*.obj
-del $(ARCH)\*.obj
-del response
distclean: clean
-del libttf.lib
!include "$(ARCH)\depend.win"
# end of Makefile.MS

175
lib/arch/win16/Makefile.VC Normal file
View File

@@ -0,0 +1,175 @@
# This file is part of the FreeType project.
#
# It builds the library for Microsoft Visual C++ 1.x for 16-bit Windows,
# large model. It also works for Microsoft C/C++ v.7.0 16-bit compiler,
# but not for previous versions (see Makefile.MS instead).
#
# You will need NMAKE.
#
# Use this file while in the lib directory with the following statement:
#
# nmake /f arch\win16\Makefile.VC
#
#
# A DLL version of the library can be built with
#
# nmake DLL=1 /f arch\win16\Makefile.VC dll
#
# Debug versions can be obtained with
#
# nmake DEBUG=1 /f arch\win16\Makefile.VC
#
# Special versions enabled to handle big fonts (with more than 16,384
# glyphs) can be obtained with
#
# nmake BIGFONTS=1 /f arch\win16\Makefile.VC
ARCH = arch\win16
FT_MAKEFILE = $(ARCH)\Makefile.VC
FT_DLL = ft13_16.dll
CC = cl /nologo
LIB = lib /noignorecase /nologo
IMPLIB = implib /noignorecase /nologo
# One can also consider using "set MSC_CMD_FLAGS=/Gr /Op- /Gy /YX".
# With Microsoft C/C++ 7.0, use /G2 instead of /G3.
!ifndef DEBUG
CFLAGS = /Ox /AL /Za /W2 /G3 -I$(ARCH) -I. -Iextend
DLLFLAGS = /AL /Ld
!else
CFLAGS = /Zi /Ge /AL /Za /W2 /G3 -I$(ARCH) -I. -Iextend
DLLFLAGS = /AL /Lw /Zi
!endif
FT_DEF = $(FT_DLL:.dll=.def)
!ifdef DLL
CFLAGS = $(CFLAGS) /GD /GEf
!else
CFLAGS = $(CFLAGS) /GA
!endif
!ifdef BIGFONTS
CFLAGS = $(CFLAGS) /DTT_HUGE_PTR=__huge
TTFILE = $(ARCH)\hugefile.c
TTMEMORY = $(ARCH)\hugemem.c
!else
TTFILE = .\ttfile.c
TTMEMORY = .\ttmemory.c
!endif
TTMUTEX = .\ttmutex.c
PORT = $(TTFILE) $(TTMEMORY) $(TTMUTEX)
# Do not insert spaces between the file names or at end of line, otherwise
# the substitution for LIB command line will fail. Thank you.
#
SRC_X = extend\ftxgasp.c extend\ftxkern.c extend\ftxpost.c\
extend\ftxcmap.c extend\ftxwidth.c extend\ftxerr18.c extend\ftxsbit.c\
extend\ftxopen.c extend\ftxgsub.c extend\ftxgpos.c extend\ftxgdef.c
OBJS_X = $(SRC_X:.c=.obj)
SRC_M = ttapi.c ttcache.c ttcalc.c ttcmap.c ttdebug.c\
ttgload.c ttinterp.c ttload.c ttobjs.c ttraster.c ttextend.c $(PORT)
OBJS_M = $(SRC_M:.c=.obj) $(OBJS_X)
SRC_S = $(ARCH)\freetype.c
OBJ_S = $(SRC_S:.c=.obj)
OBJS_S = $(OBJ_S) $(OBJS_X)
# Since Microsoft's NMAKE does not handle $($(LIB_FILES)), and using
# LIB_FILES="$(OBJS_S)" will excess the capacity of COMMAND.COM, we cheat
# by constructing LIB's response file directly in the `all' target.
#
# Another solution, useful during debugging of part of the library,
# would be to include each .obj in the library as soon as it is compiled.
# See ..\msdos\Makefile.TC for an application.
.c.obj:
@$(CC) /c /Fo$@ @<<
$(CFLAGS) $*.c
<<
!ifndef DEBUG
# Skipped if DEBUG build
all: $(OBJS_S)
-del libttf.lib
$(LIB) libttf.lib @<<response
+ $(OBJS_S: = + );
<<KEEP
!endif
debug: $(OBJS_M)
-del libttf.lib
$(LIB) libttf.lib @<<response
+ $(OBJS_M: = + );
<<KEEP
$(FT_DEF): $(ARCH)\ttf.def
-copy $(ARCH)\ttf.def $(FT_DEF)
dll $(FT_DLL): $(OBJS_M) $(FT_DEF)
!ifdef DLL
$(CC) /Fe$(FT_DLL) @<<
$(DLLFLAGS) $**
<<
$(IMPLIB) libttf.lib $(FT_DEF)
!else
# Re-invoke with flag set. Unfortunately, this discards the other flags.
$(MAKE) DLL=1 /f $(ARCH)/Makefile.VC dll
!endif
install: $(FT_DLL)
!ifdef INSTALL_DIR
copy $(FT_DLL) $(INSTALL_DIR)
!else
copy $(FT_DLL) C:\WINDOWS
!endif
$(OBJ_S): $(SRC_S) $(SRC_M)
# Not used here because it excesses the capacity of COMMAND.COM...
libttf.lib: $(LIB_FILES)
$(LIB) $@ +-$(?: =-+);
!ifdef BIGFONTS
$(TTFILE:.c=.obj):
$(CC) /c /Fo$@ @<<
$(CFLAGS) /Ze $*.c
$(TTMEMORY:.c=.obj):
$(CC) /c /Fo$@ @<<
$(CFLAGS) /Ze $*.c
<<
$(OBJ_S):
$(CC) /c /Fo$@ @<<
$(CFLAGS) /Ze $*.c
<<
!endif
clean:
-del *.obj
-del extend\*.obj
-del $(ARCH)\*.obj
-del libttf.bak
-del response
distclean: clean
-del libttf.lib
-del *.dll
-del $(FT_DLL:.dll=.def)
-del C:\WINDOWS\$(FT_DLL)
!ifdef INSTALL_DIR
-del $(INSTALL_DIR)\$(FT_DLL)
!endif
!include "$(ARCH)\depend.win"
# end of Makefile.VC

109
lib/arch/win16/depend.win Normal file
View File

@@ -0,0 +1,109 @@
# This dependency file to be used with various Windows compilers
# has been generated automatically with the script `makedep' on
# 02-Sep-1999.
ttapi.obj: ttapi.c ttconfig.h arch\win16\ft_conf.h freetype.h fterrid.h \
ftnameid.h ttengine.h tttypes.h ttmutex.h ttcalc.h ttmemory.h \
ttcache.h ttfile.h ttdebug.h ttobjs.h tttables.h ttcmap.h ttload.h \
ttgload.h ttraster.h ttextend.h
ttcache.obj: ttcache.c ttengine.h tttypes.h ttconfig.h \
arch\win16\ft_conf.h freetype.h fterrid.h ftnameid.h ttmutex.h \
ttmemory.h ttcache.h ttobjs.h tttables.h ttcmap.h ttdebug.h
ttcalc.obj: ttcalc.c ttcalc.h ttconfig.h arch\win16\ft_conf.h freetype.h \
fterrid.h ftnameid.h ttdebug.h tttypes.h tttables.h
ttcmap.obj: ttcmap.c ttobjs.h ttconfig.h arch\win16\ft_conf.h ttengine.h \
tttypes.h freetype.h fterrid.h ftnameid.h ttmutex.h ttcache.h \
tttables.h ttcmap.h ttdebug.h ttfile.h ttmemory.h ttload.h
ttdebug.obj: ttdebug.c ttdebug.h ttconfig.h arch\win16\ft_conf.h \
tttypes.h freetype.h fterrid.h ftnameid.h tttables.h ttobjs.h \
ttengine.h ttmutex.h ttcache.h ttcmap.h
ttextend.obj: ttextend.c ttextend.h ttconfig.h arch\win16\ft_conf.h \
tttypes.h freetype.h fterrid.h ftnameid.h ttobjs.h ttengine.h \
ttmutex.h ttcache.h tttables.h ttcmap.h ttmemory.h
ttfile.obj: ttfile.c ttconfig.h arch\win16\ft_conf.h freetype.h \
fterrid.h ftnameid.h tttypes.h ttdebug.h ttengine.h ttmutex.h \
ttmemory.h ttfile.h
ttgload.obj: ttgload.c tttypes.h ttconfig.h arch\win16\ft_conf.h \
freetype.h fterrid.h ftnameid.h ttdebug.h ttcalc.h ttfile.h \
ttengine.h ttmutex.h tttables.h ttobjs.h ttcache.h ttcmap.h ttgload.h \
ttmemory.h tttags.h ttload.h
ttinterp.obj: ttinterp.c freetype.h fterrid.h ftnameid.h tttypes.h \
ttconfig.h arch\win16\ft_conf.h ttdebug.h ttcalc.h ttmemory.h \
ttinterp.h ttobjs.h ttengine.h ttmutex.h ttcache.h tttables.h \
ttcmap.h
ttload.obj: ttload.c tttypes.h ttconfig.h arch\win16\ft_conf.h \
freetype.h fterrid.h ftnameid.h ttdebug.h ttcalc.h ttfile.h \
ttengine.h ttmutex.h tttables.h ttobjs.h ttcache.h ttcmap.h \
ttmemory.h tttags.h ttload.h
ttmemory.obj: ttmemory.c ttdebug.h ttconfig.h arch\win16\ft_conf.h \
tttypes.h freetype.h fterrid.h ftnameid.h ttmemory.h ttengine.h \
ttmutex.h
ttmutex.obj: ttmutex.c ttmutex.h ttconfig.h arch\win16\ft_conf.h
ttobjs.obj: ttobjs.c ttobjs.h ttconfig.h arch\win16\ft_conf.h ttengine.h \
tttypes.h freetype.h fterrid.h ftnameid.h ttmutex.h ttcache.h \
tttables.h ttcmap.h ttfile.h ttdebug.h ttcalc.h ttmemory.h ttload.h \
ttinterp.h ttextend.h
ttraster.obj: ttraster.c ttraster.h ttconfig.h arch\win16\ft_conf.h \
freetype.h fterrid.h ftnameid.h ttengine.h tttypes.h ttmutex.h \
ttdebug.h ttcalc.h ttmemory.h
extend\ftxcmap.obj: extend\ftxcmap.c extend\ftxcmap.h freetype.h fterrid.h \
ftnameid.h tttypes.h ttconfig.h arch\win16\ft_conf.h ttobjs.h \
ttengine.h ttmutex.h ttcache.h tttables.h ttcmap.h
extend\ftxerr18.obj: extend\ftxerr18.c ttconfig.h arch\win16\ft_conf.h \
extend\ftxerr18.h freetype.h fterrid.h ftnameid.h extend\ftxkern.h \
extend\ftxpost.h extend\ftxopen.h extend\ftxgdef.h extend\ftxgsub.h \
extend\ftxgpos.h
extend\ftxgasp.obj: extend\ftxgasp.c extend\ftxgasp.h freetype.h fterrid.h \
ftnameid.h tttypes.h ttconfig.h arch\win16\ft_conf.h ttobjs.h \
ttengine.h ttmutex.h ttcache.h tttables.h ttcmap.h
extend\ftxgdef.obj: extend\ftxgdef.c tttypes.h ttconfig.h arch\win16\ft_conf.h \
freetype.h fterrid.h ftnameid.h tttags.h ttload.h ttobjs.h ttengine.h \
ttmutex.h ttcache.h tttables.h ttcmap.h ttextend.h ttmemory.h \
ttfile.h ttdebug.h extend\ftxopen.h extend\ftxgdef.h extend\ftxgsub.h \
extend\ftxgpos.h extend\ftxopenf.h
extend\ftxgpos.obj: extend\ftxgpos.c tttypes.h ttconfig.h arch\win16\ft_conf.h \
freetype.h fterrid.h ftnameid.h tttags.h ttload.h ttobjs.h ttengine.h \
ttmutex.h ttcache.h tttables.h ttcmap.h ttextend.h ttmemory.h \
ttfile.h ttdebug.h extend\ftxopen.h extend\ftxgdef.h extend\ftxgsub.h \
extend\ftxgpos.h extend\ftxopenf.h
extend\ftxgsub.obj: extend\ftxgsub.c tttypes.h ttconfig.h arch\win16\ft_conf.h \
freetype.h fterrid.h ftnameid.h tttags.h ttload.h ttobjs.h ttengine.h \
ttmutex.h ttcache.h tttables.h ttcmap.h ttextend.h ttmemory.h \
ttfile.h ttdebug.h extend\ftxopen.h extend\ftxgdef.h extend\ftxgsub.h \
extend\ftxgpos.h extend\ftxopenf.h
extend\ftxkern.obj: extend\ftxkern.c extend\ftxkern.h freetype.h fterrid.h \
ftnameid.h ttextend.h ttconfig.h arch\win16\ft_conf.h tttypes.h \
ttobjs.h ttengine.h ttmutex.h ttcache.h tttables.h ttcmap.h ttdebug.h \
ttmemory.h ttfile.h ttload.h tttags.h
extend\ftxopen.obj: extend\ftxopen.c tttypes.h ttconfig.h arch\win16\ft_conf.h \
freetype.h fterrid.h ftnameid.h ttload.h ttobjs.h ttengine.h \
ttmutex.h ttcache.h tttables.h ttcmap.h ttextend.h ttmemory.h \
ttfile.h ttdebug.h extend\ftxopen.h extend\ftxgdef.h extend\ftxgsub.h \
extend\ftxgpos.h extend\ftxopenf.h
extend\ftxpost.obj: extend\ftxpost.c extend\ftxpost.h freetype.h fterrid.h \
ftnameid.h tttypes.h ttconfig.h arch\win16\ft_conf.h ttobjs.h \
ttengine.h ttmutex.h ttcache.h tttables.h ttcmap.h ttload.h ttfile.h \
ttdebug.h tttags.h ttmemory.h ttextend.h
extend\ftxsbit.obj: extend\ftxsbit.c extend\ftxsbit.h freetype.h fterrid.h \
ftnameid.h ttobjs.h ttconfig.h arch\win16\ft_conf.h ttengine.h \
tttypes.h ttmutex.h ttcache.h tttables.h ttcmap.h ttfile.h ttdebug.h \
ttload.h ttmemory.h tttags.h ttextend.h
extend\ftxwidth.obj: extend\ftxwidth.c extend\ftxwidth.h freetype.h fterrid.h \
ftnameid.h ttdebug.h ttconfig.h arch\win16\ft_conf.h tttypes.h \
ttobjs.h ttengine.h ttmutex.h ttcache.h tttables.h ttcmap.h ttfile.h \
tttags.h ttload.h
!ifndef __MAKE__
arch\win16\freetype.obj: arch\win16\freetype.c ttapi.c ttconfig.h \
arch\win16\ft_conf.h freetype.h fterrid.h ftnameid.h ttengine.h \
tttypes.h ttmutex.h ttcalc.h ttmemory.h ttcache.h ttfile.h ttdebug.h \
ttobjs.h tttables.h ttcmap.h ttload.h ttgload.h ttraster.h ttextend.h \
ttcache.c ttcalc.c ttcmap.c ttdebug.c ttgload.c tttags.h ttinterp.c \
ttinterp.h ttload.c ttobjs.c ttraster.c arch\win16\hugefile.c \
ttfile.c arch\win16\hugemem.c ttmutex.c ttextend.c
arch\win16\hugefile.obj: arch\win16\hugefile.c ttconfig.h arch\win16\ft_conf.h \
tttypes.h freetype.h fterrid.h ftnameid.h ttfile.c ttdebug.h \
ttengine.h ttmutex.h ttmemory.h ttfile.h
arch\win16\hugemem.obj: arch\win16\hugemem.c ttdebug.h ttconfig.h \
arch\win16\ft_conf.h tttypes.h freetype.h fterrid.h ftnameid.h \
ttmemory.h ttengine.h ttmutex.h
!endif

39
lib/arch/win16/freetype.c Normal file
View File

@@ -0,0 +1,39 @@
/* This file is part of the FreeType project */
/* Single object library component for 16-bit Windows. */
/* Note that low-optimizing compilers (such as Borland ones) cannot */
/* successfully compile this file, because it exceeds 64K of code size. */
#define TT_MAKE_OPTION_SINGLE_OBJECT
/* first include common core components */
#include "ttapi.c"
#include "ttcache.c"
#include "ttcalc.c"
#include "ttcmap.c"
#include "ttdebug.c"
#include "ttgload.c"
#include "ttinterp.c"
#include "ttload.c"
#include "ttobjs.c"
#include "ttraster.c"
/* then system-specific (or ANSI) components */
#ifdef TT_HUGE_PTR
#include "arch/win16/hugefile.c"
#include "arch/win16/hugemem.c"
#else
#include "ttfile.c"
#include "ttmemory.c"
#endif
#include "ttmutex.c"
/* finally, add some extensions */
#ifdef TT_CONFIG_OPTION_EXTEND_ENGINE
#include "ttextend.c"
#endif
/* END */

209
lib/arch/win16/ft_conf.h Normal file
View File

@@ -0,0 +1,209 @@
/* This file is part of the FreeType project */
/* ft_conf.h for 16-bit Windows */
/* we need the following because there are some typedefs in this file */
#ifndef FT_CONF_H
#define FT_CONF_H
/* Define to empty if the keyword does not work. */
/* #undef const */
/* Define if you have a working `mmap' system call. */
#undef HAVE_MMAP
/* Define if you have the <stdlib.h> header file. */
#define HAVE_STDLIB_H
/* Define if you have the getpagesize function. */
#undef HAVE_GETPAGESIZE
/* Define if you have the memcpy function. */
#define HAVE_MEMCPY
/* Define if you have the memmove function. */
#define HAVE_MEMMOVE
/* Define if you have the valloc function. */
#undef HAVE_VALLOC
/* Define if you have the <fcntl.h> header file. */
#define HAVE_FCNTL_H
/* Define if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
/* Define if you need <conio.h> for console I/O functions. */
#undef HAVE_CONIO_H
/* Define if you have the <locale.h> header file. */
#undef HAVE_LOCALE_H
/* Define if you have the <libintl.h> header file. */
#undef HAVE_LIBINTL_H
/* Define if you have the libintl library. */
#undef HAVE_LIBINTL
/* command.com can't pipe stderr into a file; any message would be */
/* written into the graphics screen. */
#define HAVE_PRINT_FUNCTION 1
#define Print( format, ap ) vfprintf( stdout, (format), (ap) )
/* The number of bytes in a int. */
#define SIZEOF_INT 2
/* The number of bytes in a long. */
#define SIZEOF_LONG 4
/**********************************************************************/
/* */
/* The following configuration macros can be tweaked manually by */
/* a developer to turn on or off certain features or options in the */
/* TrueType engine. This may be useful to tune it for specific */
/* purposes.. */
/* */
/**********************************************************************/
/*************************************************************************/
/* Define this if the underlying operating system uses a different */
/* character width than 8bit for file names. You must then also supply */
/* a typedef declaration for defining 'TT_Text'. Default is off. */
/* #define HAVE_TT_TEXT */
/*************************************************************************/
/* Define this if you want to generate code to support engine extensions */
/* Default is on, but if you're satisfied by the basic services provided */
/* by the engine and need no extensions, undefine this configuration */
/* macro to save a few more bytes. */
#define TT_CONFIG_OPTION_EXTEND_ENGINE
/*************************************************************************/
/* Define this if you want to generate code to support gray-scaling, */
/* a.k.a. font-smoothing or anti-aliasing. Default is on, but you can */
/* disable it if you don't need it. */
#define TT_CONFIG_OPTION_GRAY_SCALING
/*************************************************************************/
/* Define this if you want to completely disable the use of the bytecode */
/* interpreter. Doing so will produce a much smaller library, but the */
/* quality of the rendered glyphs will enormously suffer from this. */
/* */
/* This switch was introduced due to the Apple patents issue which */
/* emerged recently on the FreeType lists. We still do not have Apple's */
/* opinion on the subject and will change this as soon as we have. */
#undef TT_CONFIG_OPTION_NO_INTERPRETER
/*************************************************************************/
/* Define this if you want to use a big 'switch' statement within the */
/* bytecode interpreter. Because some non-optimizing compilers are not */
/* able to produce jump tables from such statements, undefining this */
/* configuration macro will generate the appropriate C jump table in */
/* ttinterp.c. If you use an optimizing compiler, you should leave it */
/* defined for better performance and code compactness.. */
#define TT_CONFIG_OPTION_INTERPRETER_SWITCH
/*************************************************************************/
/* Define this if you want to build a 'static' version of the TrueType */
/* bytecode interpreter. This will produce much bigger code, which */
/* _may_ be faster on some architectures.. */
/* */
/* Do NOT DEFINE THIS is you build a thread-safe version of the engine */
/* */
#undef TT_CONFIG_OPTION_STATIC_INTERPRETER
/*************************************************************************/
/* Define this if you want to build a 'static' version of the scan-line */
/* converter (the component which in charge of converting outlines into */
/* bitmaps). This will produce a bigger object file for "ttraster.c", */
/* which _may_ be faster on some architectures.. */
/* */
/* Do NOT DEFINE THIS is you build a thread-safe version of the engine */
/* */
#undef TT_CONFIG_OPTION_STATIC_RASTER
/*************************************************************************/
/* Define TT_CONFIG_THREAD_SAFE if you want to build a thread-safe */
/* version of the library. */
#undef TT_CONFIG_OPTION_THREAD_SAFE
/**********************************************************************/
/* */
/* The following macros are used to define the debug level, as well */
/* as individual tracing levels for each component. There are */
/* currently three modes of operation : */
/* */
/* - trace mode (define DEBUG_LEVEL_TRACE) */
/* */
/* The engine prints all error messages, as well as tracing */
/* ones, filtered by each component's level */
/* */
/* - debug mode (define DEBUG_LEVEL_ERROR) */
/* */
/* Disable tracing, but keeps error output and assertion */
/* checks. */
/* */
/* - release mode (don't define anything) */
/* */
/* Don't include error-checking or tracing code in the */
/* engine's code. Ideal for releases. */
/* */
/* NOTE : */
/* */
/* Each component's tracing level is defined in its own source. */
/* */
/**********************************************************************/
/* Define if you want to use the tracing debug mode */
#undef DEBUG_LEVEL_TRACE
/* Define if you want to use the error debug mode - ignored if */
/* DEBUG_LEVEL_TRACE is defined */
#undef DEBUG_LEVEL_ERROR
/**************************************************************************/
/* Definition of various integer sizes. These types are used by ttcalc */
/* and ttinterp (for the 64-bit integers) only.. */
#if SIZEOF_INT == 4
typedef signed int TT_Int32;
typedef unsigned int TT_Word32;
#elif SIZEOF_LONG == 4
typedef signed long TT_Int32;
typedef unsigned long TT_Word32;
#else
#error "no 32bit type found"
#endif
/* LONG64 must be defined when a 64-bit type is available */
/* INT64 must then be defined to this type.. */
#undef LONG64
#undef INT64
#endif /* FT_CONF_H */
/* End of ft_conf.h */

51
lib/arch/win16/hugefile.c Normal file
View File

@@ -0,0 +1,51 @@
/*******************************************************************
*
* hugefile.c
*
* File I/O Component (body) for dealing with "huge" objects
* under 16-bit Windows. Relies on the "default" version, with
* a small hook. Requires Windows 3.1+.
*
* Written by Antoine Leca based on ideas from Dave Hoo.
* Copyright 1999 by Dave Hoo, Antoine Leca,
* 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.
*
* NOTE
*
* This file #includes the normal version, to avoid discrepancies
* between versions. It uses only ANSI-mandated "tricks", so
* any ANSI-compliant compiler should be able to compile this file.
*
******************************************************************/
#include "ttconfig.h"
#include "tttypes.h"
#include <windows.h>
/* Here we include <stdio.h>, to have the proper definition of fread */
#include <stdio.h>
/* Some compilers define fileno(), some define _fileno()... */
#ifndef _fileno
#define _fileno(stream) fileno(stream)
#endif
/* Then, we divert the use of fread to the Windows version */
#undef fread
#define fread(ptr, size, n, stream) \
_hread( _fileno(stream), (char TT_HUGE_PTR *) ptr, (ULong)n * size )
/* Now, we include the "normal" version of `ttfile.c' */
/* The ANSI/ISO standard mandates that the include of <stdio.h> */
/* there have no bad effects. */
#include "ttfile.c"
/* END */

539
lib/arch/win16/hugemem.c Normal file
View File

@@ -0,0 +1,539 @@
/*******************************************************************
*
* hugemem.c
*
* Memory management component (body)
* for dealing with "huge" objects with 16-bit Windows.
*
* Written by Antoine Leca based on ideas from Dave Hoo.
* Copyright 1999 by Dave Hoo, Antoine Leca,
* 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 <limits.h>
#include <windows.h>
#include "ttdebug.h"
#include "ttmemory.h"
#include "ttengine.h"
#ifndef TT_HUGE_PTR
#error "This component needs TT_HUGE_PTR to be #defined."
#endif
#ifdef TT_CONFIG_OPTION_THREAD_SAFE
#error "This component needs static allocation and is not re-entrant."
#endif
/* If the memory reclaimed is abobve this limit, alloc directly from */
/* global heap. Else, alloc using malloc (using suballocation). */
#ifndef MEMORY_MIN_GLOBAL
#define MEMORY_MIN_GLOBAL 4096
#endif
/* required by the tracing mode */
#undef TT_COMPONENT
#define TT_COMPONENT trace_memory
#ifdef DEBUG_MEMORY
#include <stdio.h>
#define MAX_TRACKED_BLOCKS 1024
struct TMemRec_
{
void* base;
Long size;
};
typedef struct TMemRec_ TMemRec;
static TMemRec pointers[MAX_TRACKED_BLOCKS + 1];
static Int num_alloc;
static Int num_free;
static Int num_realloc; /* counts only `real' reallocations
(i.e., an existing buffer will be resized
to a value larger than zero */
static Int fail_alloc;
static Int fail_realloc;
static Int fail_free;
#else
/* We need a tracing stack of the calls to big chunks of memory, */
/* in order to call the matching version of free(). */
#define MAX_TRACKED_BIGCHUNKS 64
struct TMemRec_
{
void* base;
};
typedef struct TMemRec_ TMemRec;
static TMemRec pointers[MAX_TRACKED_BIGCHUNKS + 1];
#endif /* DEBUG_MEMORY */
#ifndef TT_CONFIG_REENTRANT
Long TTMemory_Allocated;
Long TTMemory_MaxAllocated;
#endif
/*******************************************************************
*
* Function : TT_Alloc
*
* Description : Allocates memory from the heap buffer.
*
* Input : Size size of the memory to be allocated
* P pointer to a buffer pointer
*
* Output : Error code.
*
* NOTE : The newly allocated block should _always_ be zeroed
* on return. Many parts of the engine rely on this to
* work properly.
*
******************************************************************/
EXPORT_FUNC
TT_Error TT_Alloc( ULong Size, void** P )
{
Int i;
if ( !P )
return TT_Err_Invalid_Argument;
/* Also see below for another case of "invalid argument". */
if ( Size > 0 )
{
if ( Size >= MEMORY_MIN_GLOBAL )
{
HANDLE hMem;
hMem = GlobalAlloc( GMEM_ZEROINIT, Size );
if ( !hMem )
return TT_Err_Out_Of_Memory;
*P = (void*)GlobalLock( hMem );
}
else
*P = (void*)malloc( Size );
if ( !*P )
return TT_Err_Out_Of_Memory;
#ifndef TT_CONFIG_REENTRANT
TTMemory_MaxAllocated += Size;
TTMemory_Allocated += Size;
#endif
#ifdef DEBUG_MEMORY
num_alloc++;
i = 0;
while ( i < MAX_TRACKED_BLOCKS && pointers[i].base != NULL )
i++;
if ( i >= MAX_TRACKED_BLOCKS )
fail_alloc++;
else
{
pointers[i].base = *P;
pointers[i].size = Size;
}
#else
if ( Size >= MEMORY_MIN_GLOBAL )
{
i = 0;
while ( i < MAX_TRACKED_BIGCHUNKS && pointers[i].base != NULL )
i++;
if ( i >= MAX_TRACKED_BIGCHUNKS )
/* We fail badly here. Increase MAX_TRACKED_BIGCHUNKS if needed. */
return TT_Err_Invalid_Argument;
else
pointers[i].base = *P;
}
#endif /* DEBUG_MEMORY */
/* The nice thing about GlobalAlloc is that it zeroes the memory. */
if ( Size < MEMORY_MIN_GLOBAL )
MEM_Set( *P, 0, Size );
}
else
*P = NULL;
return TT_Err_Ok;
}
#ifdef TT_CONFIG_OPTION_EXTEND_ENGINE
/*******************************************************************
*
* Function : TT_Realloc
*
* Description : Reallocates memory from the heap buffer.
*
* Input : Size new size of the memory to be allocated;
* if zero, TT_Free() will be called
* P pointer to a buffer pointer; if *P == NULL,
* TT_Alloc() will be called
*
* Output : Error code.
*
* NOTES : It's not necessary to zero the memory in case the
* reallocated buffer is larger than before -- the
* application has to take care of this.
*
* If the memory request fails, TT_Free() will be
* called on *P, and TT_Err_Out_Of_Memory returned.
*
******************************************************************/
EXPORT_FUNC
TT_Error TT_Realloc( ULong Size, void** P )
{
ULong oldSize;
void* Q;
Int i;
if ( !P )
return TT_Err_Invalid_Argument;
if ( !*P )
return TT_Alloc( Size, P );
if ( Size == 0 )
return TT_Free( P );
#ifdef DEBUG_MEMORY
num_realloc++;
i = 0;
while ( i < MAX_TRACKED_BLOCKS && pointers[i].base != *P )
i++;
if ( i >= MAX_TRACKED_BLOCKS )
fail_realloc++;
else
oldSize = pointers[i].size;
#else
i = 0;
while ( i < MAX_TRACKED_BIGCHUNKS && pointers[i].base != *P )
i++;
/* If we did not found the pointer, then this is a "small" chunk. */
if ( i < MAX_TRACKED_BIGCHUNKS )
{
/* Signal we found a big one. Real size does not matter. */
oldSize = MEMORY_MIN_GLOBAL;
}
#endif /* DEBUG_MEMORY */
if ( oldSize >= MEMORY_MIN_GLOBAL )
{
/* Deal with a big chunk. */
HANDLE hMem, hNewMem;
hMem = GlobalHandle ( (ULong)*P >> 16 ) & 0xFFFF;
if ( !hMem ) /* Bad call... */
return TT_Err_Invalid_Argument;
GlobalUnlock( hMem );
hNewMem = GlobalReAlloc( hMem, Size, 0 );
if ( hNewMem )
*P = (void*)GlobalLock( hNewMem );
}
if ( Size >= MEMORY_MIN_GLOBAL )
{
/* A small chunk crosses the limit... */
if( TT_Alloc( Size, &Q ) != TT_Err_Ok )
Q = NULL; /* Failed to create the new block. */
else
MEM_Copy( Q, *P, oldSize );
/* We need to register the new entry. */
#ifndef DEBUG_MEMORY
i = 0;
while ( i < MAX_TRACKED_BIGCHUNKS && pointers[i].base != NULL )
i++;
if ( i >= MAX_TRACKED_BIGCHUNKS )
/* We fail badly here. Increase MAX_TRACKED_BIGCHUNKS if needed. */
return TT_Err_Invalid_Argument;
#endif /* DEBUG_MEMORY */
}
else
Q = (void*)realloc( *P, Size );
if ( !Q )
{
TT_Free( *P );
return TT_Err_Out_Of_Memory;
}
#ifdef DEBUG_MEMORY
if ( i < MAX_TRACKED_BLOCKS )
{
#ifndef TT_CONFIG_REENTRANT
TTMemory_Allocated += Size - pointers[i].size;
if ( Size > pointers[i].size )
TTMemory_MaxAllocated += Size - pointers[i].size;
#endif
pointers[i].base = Q;
pointers[i].size = Size;
}
#else
if ( i < MAX_TRACKED_BIGCHUNKS )
{
pointers[i].base = Q;
}
#endif /* DEBUG_MEMORY */
*P = Q;
return TT_Err_Ok;
}
#endif /* TT_CONFIG_OPTION_EXTEND_ENGINE */
/*******************************************************************
*
* Function : TT_Free
*
* Description : Releases a previously allocated block of memory.
*
* Input : P pointer to memory block
*
* Output : Always SUCCESS.
*
* Note : The pointer must _always_ be set to NULL by this function.
*
******************************************************************/
EXPORT_FUNC
TT_Error TT_Free( void** P )
{
Int i;
Long Size = 0;
if ( !P || !*P )
return TT_Err_Ok;
#ifdef DEBUG_MEMORY
num_free++;
i = 0;
while ( i < MAX_TRACKED_BLOCKS && pointers[i].base != *P )
i++;
if ( i >= MAX_TRACKED_BLOCKS )
fail_free++;
else
{
#ifndef TT_CONFIG_REENTRANT
TTMemory_Allocated -= pointers[i].size;
#endif
Size = pointers[i].size;
pointers[i].base = NULL;
pointers[i].size = 0;
}
#else
i = 0;
while ( i < MAX_TRACKED_BIGCHUNKS && pointers[i].base != *P )
i++;
/* If we did not found the pointer, then this is a "small" chunk. */
if ( i < MAX_TRACKED_BIGCHUNKS )
{
pointers[i].base = NULL;
/* Signal we found a big one. Real size does not matter. */
Size = MEMORY_MIN_GLOBAL;
}
#endif /* DEBUG_MEMORY */
if ( Size >= MEMORY_MIN_GLOBAL )
{
HANDLE hMem;
hMem = GlobalHandle ( (ULong)*P >> 16 ) & 0xFFFF;
if ( !hMem ) /* Bad call... */
return TT_Err_Invalid_Argument;
GlobalUnlock( hMem );
GlobalFree ( hMem );
}
else
free( *P );
*P = NULL;
return TT_Err_Ok;
}
/*******************************************************************
*
* Function : TTMemory_Init
*
* Description : Initializes the memory.
*
* Output : Always SUCCESS.
*
******************************************************************/
LOCAL_FUNC
TT_Error TTMemory_Init( void )
{
#ifdef DEBUG_MEMORY
Int i;
for ( i = 0; i < MAX_TRACKED_BLOCKS; i++ )
{
pointers[i].base = NULL;
pointers[i].size = 0;
}
num_alloc = 0;
num_realloc = 0;
num_free = 0;
fail_alloc = 0;
fail_realloc = 0;
fail_free = 0;
#else
Int i;
for ( i = 0; i < MAX_TRACKED_BIGCHUNKS; i++ )
{
pointers[i].base = NULL;
}
#endif
#ifndef TT_CONFIG_REENTRANT
TTMemory_Allocated = 0;
TTMemory_MaxAllocated = 0;
#endif
return TT_Err_Ok;
}
/*******************************************************************
*
* Function : TTMemory_Done
*
* Description : Finalizes memory usage.
*
* Output : Always SUCCESS.
*
******************************************************************/
LOCAL_FUNC
TT_Error TTMemory_Done( void )
{
#ifdef DEBUG_MEMORY
Int i, num_leaked, tot_leaked;
num_leaked = 0;
tot_leaked = 0;
for ( i = 0; i < MAX_TRACKED_BLOCKS; i++ )
{
if ( pointers[i].base )
{
num_leaked ++;
tot_leaked += pointers[i].size;
}
}
fprintf( stderr,
"%d memory allocations, of which %d failed\n",
num_alloc,
fail_alloc );
fprintf( stderr,
"%d memory reallocations, of which %d failed\n",
num_realloc,
fail_realloc );
fprintf( stderr,
"%d memory frees, of which %d failed\n",
num_free,
fail_free );
if ( num_leaked > 0 )
{
fprintf( stderr,
"There are %d leaked memory blocks, totalizing %d bytes\n",
num_leaked, tot_leaked );
for ( i = 0; i < MAX_TRACKED_BLOCKS; i++ )
{
if ( pointers[i].base )
{
fprintf( stderr,
"index: %4d (base: $%08lx, size: %08ld)\n",
i,
(long)pointers[i].base,
pointers[i].size );
}
}
}
else
fprintf( stderr, "No memory leaks !\n" );
#endif /* DEBUG_MEMORY */
return TT_Err_Ok;
}
/* END */

24
lib/arch/win16/makedef Normal file
View File

@@ -0,0 +1,24 @@
# makedef
#
# This shell script creates a .DEF file necessary for building as DLL
# on the Windows 16-bit platform.
echo "\
; This definition file to be used to built the library as DLL
; has been generated automatically with the script \`makedef' on
; `date +%d-%b-%Y`.
LIBRARY ft13_16
DESCRIPTION 'FreeType 1.3 16-bit DLL <20> 1996-1999 Turner, Wilhelm, Lemberg'
EXETYPE WINDOWS
CODE PRELOAD MOVEABLE DISCARDABLE
DATA PRELOAD MOVEABLE SINGLE
EXPORTS
" > ttf.def
(cd ../..
sed -n -e "/^ *EXPORT_DEF/!d ; n ; s/(.*$//" \
-e "s/;$//" -e "s/ const / /" -e "s/ *[a-zA-Z][a-zA-Z_\*]* //" \
-e "s/ *//g" -e "s/^\(.*\)/ _\1/" -e "p" *.h extend/*.h) >> ttf.def
# eof

32
lib/arch/win16/makedep Normal file
View File

@@ -0,0 +1,32 @@
# makedep
#
# This shell script creates a dependency file necessary for older compilers
# on the Windows 16-bit platform.
echo "\
# This dependency file to be used with various Windows compilers
# has been generated automatically with the script \`makedep' on
# `date +%d-%b-%Y`.
" > depend.win
(cd ../..
gcc -MM -Iarch/win16 -I. \
*.c | \
sed -e "s/\.o:/.obj:/" -e "s:/:\\\\:g") >> depend.win
(cd ../..
gcc -MM -Iarch/win16 -I. -Iextend \
extend/*.c | \
sed -e "s/^\(.*\)\.o:/extend\\\\\1.obj:/" -e "s:/:\\\\:g") >> depend.win
echo "!ifndef __MAKE__" >> depend.win
(cd ../..
gcc -MM -Iarch/win16 -I. -Iextend -DTT_HUGE_PTR \
arch/win16/*.c | \
sed -e "s/^\(.*\)\.o:/arch\\\\win16\\\\\1.obj:/" \
-e "s:/:\\\\:g") >> depend.win
echo "!endif" >> depend.win
# eof

127
lib/arch/win16/ttf.def Normal file
View File

@@ -0,0 +1,127 @@
; This definition file to be used to built the library as DLL
; has been generated automatically with the script `makedef' on
; 02-Sep-1999.
LIBRARY ft13_16
DESCRIPTION 'FreeType 1.3 16-bit DLL <EFBFBD> 1996-1999 Turner, Wilhelm, Lemberg'
EXETYPE WINDOWS
CODE PRELOAD MOVEABLE DISCARDABLE
DATA PRELOAD MOVEABLE SINGLE
EXPORTS
_TT_FreeType_Version
_TT_Init_FreeType
_TT_Done_FreeType
_TT_Set_Raster_Gray_Palette
_TT_Open_Face
_TT_Open_Collection
_TT_Get_Face_Properties
_TT_Set_Face_Pointer
_TT_Get_Face_Pointer
_TT_Flush_Face
_TT_Get_Face_Metrics
_TT_Close_Face
_TT_Get_Font_Data
_TT_New_Instance
_TT_Set_Instance_Resolutions
_TT_Set_Instance_CharSize
_TT_Set_Instance_CharSizes
_TT_Set_Instance_PixelSizes
_TT_Set_Instance_Transform_Flags
_TT_Get_Instance_Metrics
_TT_Set_Instance_Pointer
_TT_Get_Instance_Pointer
_TT_Done_Instance
_TT_New_Glyph
_TT_Done_Glyph
_TT_Load_Glyph
_TT_Get_Glyph_Outline
_TT_Get_Glyph_Metrics
_TT_Get_Glyph_Big_Metrics
_TT_Get_Glyph_Bitmap
_TT_Get_Glyph_Pixmap
_TT_New_Outline
_TT_Done_Outline
_TT_Copy_Outline
_TT_Get_Outline_Bitmap
_TT_Get_Outline_Pixmap
_TT_Get_Outline_BBox
_TT_Transform_Outline
_TT_Translate_Outline
_TT_Transform_Vector
_TT_MulDiv
_TT_MulFix
_TT_Get_CharMap_Count
_TT_Get_CharMap_ID
_TT_Get_CharMap
_TT_Char_Index
_TT_Get_Name_Count
_TT_Get_Name_ID
_TT_Get_Name_String
_TT_Register_Extension
_TT_Extension_Get
_TT_Use_Stream
_TT_Done_Stream
_TT_Flush_Stream
_TT_Read_File
_TT_Seek_File
_TT_Skip_File
_TT_Read_At_File
_TT_File_Pos
_TT_Stream_Size
_TT_Null_FileFrame
_TT_Access_Frame
_TT_Check_And_Access_Frame
_TT_Forget_Frame
_TT_Get_Char
_TT_Get_Short
_TT_Get_Long
_TT_LookUp_Table
_TT_Alloc
_TT_Realloc
_TT_Free
_TT_CharMap_First
_TT_CharMap_Next
_TT_CharMap_Last
_TT_ErrToString18
_TT_Get_Face_Gasp_Flags
_TT_Init_GDEF_Extension
_TT_Load_GDEF_Table
_TT_GDEF_Get_Glyph_Property
_TT_GDEF_Build_ClassDefinition
_TT_Init_GPOS_Extension
_TT_Load_GPOS_Table
_TT_GPOS_Select_Script
_TT_GPOS_Select_Language
_TT_GPOS_Select_Feature
_TT_GPOS_Query_Scripts
_TT_GPOS_Query_Languages
_TT_GPOS_Query_Features
_TT_GPOS_Add_Feature
_TT_GPOS_Clear_Features
_TT_Init_GSUB_Extension
_TT_Load_GSUB_Table
_TT_GSUB_Select_Script
_TT_GSUB_Select_Language
_TT_GSUB_Select_Feature
_TT_GSUB_Query_Scripts
_TT_GSUB_Query_Languages
_TT_GSUB_Query_Features
_TT_GSUB_Add_Feature
_TT_GSUB_Clear_Features
_TT_GSUB_Register_Alternate_Function
_TT_GSUB_Apply_String
_TT_GSUB_Add_String
_TT_Init_Kerning_Extension
_TT_Get_Kerning_Directory
_TT_Load_Kerning_Table
_TT_Init_Post_Extension
_TT_Load_PS_Names
_TT_Get_PS_Name
_TT_Init_SBit_Extension
_TT_Get_Face_Bitmaps
_TT_New_SBit_Image
_TT_Done_SBit_Image
_TT_Get_SBit_Strike
_TT_Load_Glyph_Bitmap
_TT_Get_Face_Widths

161
lib/arch/win32/Makefile.BC Normal file
View File

@@ -0,0 +1,161 @@
# This file is part of the FreeType project.
#
# It builds the library for Borland C++ for Win32.
#
# You will need Borland MAKE.
# Tested with Borland C++ v.5.0 and Borland C++ builder 4.0.
# Does not work with Borland C++ 4.0, since it needs __declspec.
#
# Use this file while in the lib directory with the following statement:
#
# make -farch/win32/Makefile.BC
#
#
# A DLL version of the library can be built with
#
# make -DDLL -farch/win32/Makefile.BC dll
#
# A debug version can be obtained with
#
# make -DDEBUG -farch/win32/Makefile.BC
ARCH = arch\win32
FT_MAKEFILE = $(ARCH)\Makefile.BC
FT_DLL = ft13_32.dll
CC = bcc32
LIB = tlib /c /e
IMPLIB = implib -c
SPURIOUS_WARNINGS = -w-nak -w-par -w-use -w-aus -w-stu -w-stv -w-cln -w-sig
!if ! $d(DEBUG)
CFLAGS = -O2 -A -i40 -I$(ARCH);.;extend $(SPURIOUS_WARNINGS)
DLLFLAGS = -WD
!else
CFLAGS = -v -A -i40 -I$(ARCH);.;extend $(SPURIOUS_WARNINGS)
DLLFLAGS = -v -WD
!endif
FT_DEF = $(FT_DLL:.dll=.def)
!if $d(DLL)
CFLAGS = $(CFLAGS) \
-DEXPORT_DEF=__declspec(dllexport) -DEXPORT_FUNC=__declspec(dllexport)
!endif
TTFILE = .\ttfile.c
TTMEMORY = .\ttmemory.c
TTMUTEX = .\ttmutex.c
PORT = $(TTFILE) $(TTMEMORY) $(TTMUTEX)
# Do not insert spaces before the \ at end of line,
# otherwise the substitution for TLIB command line will fail.
SRC_X = extend\ftxgasp.c extend\ftxkern.c extend\ftxpost.c\
extend\ftxcmap.c extend\ftxwidth.c extend\ftxerr18.c\
extend\ftxsbit.c extend\ftxgsub.c extend\ftxgpos.c\
extend\ftxopen.c extend\ftxgdef.c
OBJS_X = $(SRC_X:.c=.obj)
SRC_M = ttapi.c ttcache.c ttcalc.c ttcmap.c\
ttgload.c ttinterp.c ttload.c ttobjs.c\
ttraster.c ttextend.c ttdebug.c $(PORT)
OBJS_M = $(SRC_M:.c=.obj) $(OBJS_X)
SRC_S = $(ARCH)\freetype.c
OBJ_S = $(SRC_S:.c=.obj)
OBJS_S = $(OBJ_S) $(OBJS_X)
# Since Borland make does not handle $($(LIB_FILES)), and using
# -DLIB_FILES="$(OBJS_S)" will excess the capacity of COMMAND.COM, we cheat
# by constructing TLIB's response file directly in the `all' target.
#
# Another solution, useful during debugging of part of the library,
# would be to include each .obj in the library as soon as it is compiled.
# See ../msdos/Makefile.TC for an application.
.c.obj:
$(CC) -c -o$* @&&|
$(CFLAGS) $<
|
!if ! $d(DEBUG)
# Skipped if DEBUG build
all: $(OBJS_S)
-del libttf.lib
$(LIB) libttf.lib @&&|
+ $(OBJS_S: = + )
|
dll $(FT_DLL): $(OBJS_S) $(FT_DEF)
!if $d(DLL)
$(CC) @&&|
$(DLLFLAGS) -e$(FT_DLL) $(OBJS_S)
|
$(IMPLIB) libttf $(FT_DLL)
!else
$(MAKE) -DDLL -f$(FT_MAKEFILE) dll # Re-invoke with flag set.
!endif
!endif
debug: $(OBJS_M)
-del libttf.lib
$(LIB) libttf.lib @&&|
+ $(OBJS_M: = + )
|
!ifdef DEBUG
dll $(FT_DLL): $(OBJS_M) $(FT_DEF)
!if $d(DLL)
$(CC) @&&|
$(DLLFLAGS) -e$(FT_DLL) $(OBJS_M)
|
$(IMPLIB) libttf $(FT_DLL)
!else
$(MAKE) -DDEBUG -DDLL -f$(FT_MAKEFILE) dll
!endif
!endif
install: $(FT_DLL)
!ifdef INSTALL_DIR
copy $(FT_DLL) $(INSTALL_DIR)
!else
copy $(FT_DLL) C:\WINDOWS
!endif
$(OBJ_S): $(SRC_S) $(SRC_M)
# Not used here because it excesses the capacity of COMMAND.COM...
libttf.lib: $(LIB_FILES)
-del libttf.lib
echo -+$(**: =-+)> response
$(LIB) libttf.lib @&&|
+ $(**: = + )
|
$(FT_DEF): $(ARCH)\ttf.def
-copy $(ARCH)\ttf.def $(FT_DEF)
clean:
-del *.obj
-del extend\*.obj
-del $(ARCH)\*.obj
-del libttf.bak
-del response
-del *.def
-del *.tds
distclean: clean
-del libttf.lib
-del *.dll
-del $(FT_DEF)
-del C:\WINDOWS\$(FT_DLL)
!if $d(INSTALL_DIR)
-del $(INSTALL_DIR)\$(FT_DLL)
!endif
!include "$(ARCH)\depend.win"
# end of Makefile

165
lib/arch/win32/Makefile.CL Normal file
View File

@@ -0,0 +1,165 @@
# This file is part of the FreeType project.
#
# It builds the library for Microsoft Visual C++ for 32-bit Windows.
#
# You will need NMAKE.
#
# Use this file while in the lib directory with the following statement:
#
# nmake /f arch\win32\Makefile.CL
#
#
# A DLL version of the library can be built with
#
# nmake DLL=1 /f arch\win32\Makefile.CL dll
#
# Debug versions can be obtained with
#
# nmake DEBUG=1 /f arch\win32\Makefile.CL
ARCH = arch\win32
FT_MAKEFILE = $(ARCH)\Makefile.CL
FT_DLL = ft13_32.dll
CC = cl /nologo
LIB = lib /nologo
LINK = link /nologo
CFLAGS = /Za /W2 -I$(ARCH) -I. -Iextend
!ifndef DEBUG
CFLAGS = $(CFLAGS) /Ox
DLLFLAGS = /RELEASE
!else
CFLAGS = $(CFLAGS) /Zi /Ge
DLLFLAGS = /DEBUG
!endif
!ifdef DLL
CFLAGS = $(CFLAGS) /GD \
/DEXPORT_DEF=__declspec(dllexport) /DEXPORT_FUNC=__declspec(dllexport)
!else
CFLAGS = $(CFLAGS) /GA
!endif
TTFILE = .\ttfile.c
TTMEMORY = .\ttmemory.c
TTMUTEX = .\ttmutex.c
PORT = $(TTFILE) $(TTMEMORY) $(TTMUTEX)
# Do not insert spaces between the file names or at end of line, otherwise
# the substitution for LIB command line will fail. Thank you.
#
SRC_X = extend\ftxgasp.c extend\ftxkern.c extend\ftxpost.c\
extend\ftxcmap.c extend\ftxwidth.c extend\ftxerr18.c extend\ftxsbit.c\
extend\ftxopen.c extend\ftxgsub.c extend\ftxgpos.c extend\ftxgdef.c
OBJS_X = $(SRC_X:.c=.obj)
SRC_M = ttapi.c ttcache.c ttcalc.c ttcmap.c ttdebug.c\
ttgload.c ttinterp.c ttload.c ttobjs.c ttraster.c ttextend.c $(PORT)
OBJS_M = $(SRC_M:.c=.obj) $(OBJS_X)
SRC_S = $(ARCH)\freetype.c
OBJ_S = $(SRC_S:.c=.obj)
OBJS_S = $(OBJ_S) $(OBJS_X)
# Since Microsoft's NMAKE does not handle $($(LIB_FILES)), and using
# LIB_FILES="$(OBJS_S)" will excess the capacity of COMMAND.COM, we cheat
# by constructing LIB's response file directly in the `all' target.
#
# Another solution, useful during debugging of part of the library,
# would be to include each .obj in the library as soon as it is compiled.
# See ..\msdos\Makefile.TC for an application.
.c.obj:
@$(CC) /c /Fo$@ @<<
$(CFLAGS) $*.c
<<
!ifndef DEBUG
# Skipped if DEBUG build
all: $(OBJS_S)
-del libttf.lib
$(LIB) /OUT:libttf.lib @<<response
+ $(OBJS_S: = + );
<<KEEP
dll $(FT_DLL): $(OBJS_S)
!ifdef DLL
$(LINK) @<<response
$(DLLFLAGS)
/DLL
/OUT:$(FT_DLL)
/IMPLIB:libttf.lib
/DEF:$(ARCH)\ttf.def
$**
<<KEEP
!else
$(MAKE) DLL=1 /f $(FT_MAKEFILE) dll # Re-invoke with flag set.
!endif
!endif
debug: $(OBJS_M)
-del libttf.lib
$(LIB) /OUT:libttf.lib @<<response
+ $(OBJS_M: = + );
<<KEEP
!ifdef DEBUG
dll $(FT_DLL): $(OBJS_M)
!ifdef DLL
$(LINK) @<<response
$(DLLFLAGS)
/DLL
/OUT:$(FT_DLL)
/IMPLIB:libttf.lib
/DEF:$(ARCH)\ttf.def
$**
<<KEEP
!else
$(MAKE) DLL=1 DEBUG=1 /f $(FT_MAKEFILE) dll # Re-invoke with flag set.
!endif
!endif
install: $(FT_DLL)
!ifdef INSTALL_DIR
copy $(FT_DLL) $(INSTALL_DIR)
!else
copy $(FT_DLL) C:\WINDOWS
!endif
$(OBJ_S): $(SRC_S) $(SRC_M)
# Not used here because it excesses the capacity of COMMAND.COM...
libttf.lib: $(LIB_FILES)
$(LIB) $@ +-$(?: =-+);
clean:
-del *.obj
-del extend\*.obj
-del $(ARCH)\*.obj
-del libttf.bak
-del response
-del *.exp
-del *.pch
-del *.ilk
distclean: clean
-del libttf.lib
-del *.dll
-del *.pdb
-del C:\WINDOWS\$(FT_DLL)
!ifdef INSTALL_DIR
-del $(INSTALL_DIR)\$(FT_DLL)
!endif
!include "$(ARCH)\depend.win"
# end of Makefile.CL

View File

@@ -0,0 +1,98 @@
# This file is part of the FreeType project.
#
# It builds the library for MinGW32 gcc under Win9x.
#
# You will need a port of GNU make; the MinGW32 port works.
#
# Use this file while in the lib directory with the following statement:
#
# make -f arch/win32/Makefile.Min
#
#
# When compared to the other Makefiles for gcc, there is a difference
# here, because COMMAND.COM on Win 9x is not able to process more than
# 126 characters. So the command line for ar use the * shell character.
#
# This is not as safe as normal, because unnecessary files may be
# included by mistake in the library.
# The normal behaviour can be restored by defining NON_LIMITED_SHELL=1
ARCH = arch/win32
FT_MAKEFILE = $(ARCH)/Makefile.Min
CC = gcc
ifdef DEBUG
CFLAGS = -Wall -O2 -g -ansi -pedantic -I$(ARCH) -I. -Iextend
else
CFLAGS = -Wall -ansi -pedantic -O2 -s -I$(ARCH) -I. -Iextend
endif
TTFILE = ./ttfile.c
TTMEMORY = ./ttmemory.c
TTMUTEX = ./ttmutex.c
PORT = $(TTFILE) $(TTMEMORY) $(TTMUTEX)
SRC_X = extend/ftxgasp.c extend/ftxkern.c extend/ftxpost.c \
extend/ftxcmap.c extend/ftxwidth.c extend/ftxsbit.c \
extend/ftxgsub.c extend/ftxgpos.c extend/ftxgdef.c \
extend/ftxopen.c extend/ftxerr18.c
OBJS_X = $(SRC_X:.c=.o)
SRC_M = ttapi.c ttcache.c ttcalc.c ttcmap.c ttdebug.c \
ttgload.c ttinterp.c ttload.c ttobjs.c \
ttraster.c ttextend.c $(PORT)
OBJS_M = $(SRC_M:.c=.o) $(OBJS_X)
SRC_S = $(ARCH)/freetype.c
OBJ_S = $(SRC_S:.c=.o)
OBJS_S = $(OBJ_S) $(OBJS_X)
%.o: %.c
$(CC) $(CFLAGS) -c -o $@ $<
.PHONY: all debug clean distclean depend
all:
$(MAKE) -f $(FT_MAKEFILE) LIB_FILES=$(OBJS_S) OBJ_LOC=$(ARCH) libttf.a
debug:
$(MAKE) -f $(FT_MAKEFILE) LIB_FILES=$(OBJS_M) DEBUG=1 OBJ_LOC=. libttf.a
$(OBJ_S): $(SRC_S) $(SRC_M)
ifdef NOT_LIMITED_SHELL
libttf.a: $(LIB_FILES)
-del $@
ar src $@ $^
else
# The previous command exceeds the capacity of COMMAND.COM,
# so we cheat by passing * character to ar
libttf.a: $(LIB_FILES)
-del $@
ar src $@ $(OBJ_LOC)/*.o extend/*.o
endif
clean:
-del *.o
-del extend\*.o
-del $(subst /,\,$(ARCH)\*.o)
-del response
distclean: clean
-del dep.end
-del libttf.a
depend: $(SRS_S) $(SRC_M) $(SRC_X)
$(CC) -E -M $^ > dep.end
ifeq (dep.end,$(wildcard dep.end))
include dep.end
endif
# end of Makefile.Min

195
lib/arch/win32/Makefile.VC Normal file
View File

@@ -0,0 +1,195 @@
# Visual C++ 2.x, 4.x, 5.0 and 6.0 makefile for freetype
# adapted from suns example makefile (related to the TCL script language)
# Does not depend on the presence of any environment variables in
# order to compile freetype; all needed information is derived from
# location of the compiler directories.
#
# Project directories
#
# ROOT = top of source tree
#
# TMPDIR = location where .obj files should be stored during build
#
# TOOLS32 = location of VC++ 32-bit development tools. Note that the
# VC++ 2.0 header files are broken, so you need to use the
# ones that come with the developer network CD's, or later
# versions of VC++.
#
ROOT = ..\..
TMPDIR = .
#TOOLS32 = c:\msdev # VC++ 2.x,4.x
#TOOLS32 = c:\Program Files\devstudio\vc # VC++ 5.x
TOOLS32 = c:\Program Files\Microsoft Visual Studio\Vc98 # VC++ 6.x
INSTALLDIR = c:\WINNT\SYSTEM32
# Set this to the appropriate value of /MACHINE: for your platform
MACHINE = IX86
# Comment the following line to compile with symbols
NODEBUG=1
######################################################################
# Do not modify below this line
######################################################################
TTF = ttf
TTFLIB = $(TTF).lib
TTFDLL = $(TTF).dll
TTFOBJS = \
$(TMPDIR)\ttapi.obj \
$(TMPDIR)\ttcache.obj \
$(TMPDIR)\ttcalc.obj \
$(TMPDIR)\ttcmap.obj \
$(TMPDIR)\ttdebug.obj \
$(TMPDIR)\ttfile.obj \
$(TMPDIR)\ttgload.obj \
$(TMPDIR)\ttinterp.obj \
$(TMPDIR)\ttload.obj \
$(TMPDIR)\ttmemory.obj \
$(TMPDIR)\ttmutex.obj \
$(TMPDIR)\ttobjs.obj \
$(TMPDIR)\ttraster.obj \
$(TMPDIR)\ttextend.obj \
$(TMPDIR)\ftxcmap.obj \
$(TMPDIR)\ftxgasp.obj \
$(TMPDIR)\ftxkern.obj \
$(TMPDIR)\ftxpost.obj \
$(TMPDIR)\ftxwidth.obj \
$(TMPDIR)\ftxerr18.obj
PATH=$(TOOLS32)\bin;$(PATH)
cc32 = "$(TOOLS32)\bin\cl.exe"
link32 = "$(TOOLS32)\bin\link.exe"
include32 = "-I$(TOOLS32)\include" -I$(ROOT)\arch\win32
CP = copy
RM = del
TTF_INCLUDES = -I$(ROOT)
TTF_DEFINES = -nologo -D__WIN32__ -D__WIN32DLL__
TTF_CFLAGS = $(cdebug) $(cflags) $(cvarsdll) $(include32) \
$(TTF_INCLUDES) $(TTF_DEFINES)
CON_CFLAGS = $(cdebug) $(cflags) $(cvars) $(include32) -DCONSOLE
DOS_CFLAGS = $(cdebug) $(cflags) $(include16) -AL
######################################################################
# Link flags
######################################################################
!IFDEF NODEBUG
ldebug = /RELEASE
!ELSE
ldebug = -debug:full -debugtype:cv
!ENDIF
# declarations common to all linker options
lcommon = /NODEFAULTLIB /RELEASE /NOLOGO
# declarations for use on Intel i386, i486, and Pentium systems
!IF "$(MACHINE)" == "IX86"
DLLENTRY = @12
lflags = $(lcommon) /MACHINE:$(MACHINE)
!ELSE
lflags = $(lcommon) /MACHINE:$(MACHINE)
!ENDIF
conlflags = $(lflags) -subsystem:console -entry:mainCRTStartup
guilflags = $(lflags) -subsystem:windows -entry:WinMainCRTStartup
dlllflags = $(lflags) -entry:_DllMainCRTStartup$(DLLENTRY) -dll
!IF "$(MACHINE)" == "PPC"
libc = libc.lib
libcdll = crtdll.lib
!ELSE
libc = libc.lib oldnames.lib
libcdll = msvcrt.lib oldnames.lib
!ENDIF
baselibs = kernel32.lib $(optlibs) advapi32.lib
winlibs = $(baselibs) user32.lib gdi32.lib comdlg32.lib winspool.lib
guilibs = $(libc) $(winlibs)
conlibs = $(libc) $(baselibs)
guilibsdll = $(libcdll) $(winlibs)
conlibsdll = $(libcdll) $(baselibs)
######################################################################
# Compile flags
######################################################################
!IFDEF NODEBUG
cdebug = -O2 -Gs -GD
!ELSE
cdebug = -Z7 -Od -WX
!ENDIF
# declarations common to all compiler options
ccommon = -c -W3 -nologo -YX -Dtry=__try -Dexcept=__except
# NEED BYTEORDER INFORMATION HERE !!
!IF "$(MACHINE)" == "IX86"
cflags = $(ccommon) -D_X86_=1
!ELSE
!IF "$(MACHINE)" == "MIPS"
cflags = $(ccommon) -D_MIPS_=1
!ELSE
!IF "$(MACHINE)" == "PPC"
cflags = $(ccommon) -D_PPC_=1
!ELSE
!IF "$(MACHINE)" == "ALPHA"
cflags = $(ccommon) -D_ALPHA_=1
!ENDIF
!ENDIF
!ENDIF
!ENDIF
cvars = -DWIN32 -D_WIN32
cvarsmt = $(cvars) -D_MT
cvarsdll = $(cvarsmt) -D_DLL
######################################################################
# Project specific targets
######################################################################
release: $(TTFDLL)
all: $(TTFDLL)
install: $(TTFDLL)
-@md $(INSTALLDIR)
-@$(CP) $(TTFDLL) $(INSTALLDIR)
$(TTFDLL): $(TTFOBJS) ttf.def
$(link32) $(ldebug) $(dlllflags) \
$(guilibsdll) -out:$(TTFDLL) -def:ttf.def $(TTFOBJS)
#ttf.def: $(TTFOBJS)
# ..\..\tcl8.0.4\win\release\dumpexts -o $@ ttf.dll $(TTFOBJS)
#
# Implicit rules
#
{$(ROOT)\extend}.c{$(TMPDIR)}.obj:
$(cc32) $(TTF_CFLAGS) -Fo$(TMPDIR)\ $<
{$(ROOT)}.c{$(TMPDIR)}.obj:
$(cc32) $(TTF_CFLAGS) -Fo$(TMPDIR)\ $<
clean:
-@del *.exp
-@del *.lib
-@del *.dll
-@del $(TMPDIR)\*.obj
-@del *.pch
-@del *.pdb

View File

@@ -0,0 +1,96 @@
# This file is part of the FreeType project.
#
# It builds the library for gcc under Win32.
# This Makefile will fail with MinGW32 ports of gcc and make under
# bare-bones Windows 9X, because of the limitations of command.com.
# Use Makefile.min instead.
#
# You will need GNU make.
#
# Use this file while in the lib directory with the following statement:
#
# make -f arch/win32/Makefile.gcc
#
#
# If you have the GNU gettext package installed, you can also try
#
# make -f arch/win32/Makefile.gcc HAVE_GETTEXT
ARCH = arch/win32
FT_MAKEFILE = $(ARCH)/Makefile.gcc
CC = gcc
ifndef GETTEXT
GETTEXT=NO_GETTEXT
endif
ifdef DEBUG
CFLAGS = -Wall -O2 -g -ansi -pedantic -I$(ARCH) -I. -Iextend -D$(GETTEXT)
else
CFLAGS = -Wall -ansi -pedantic -O2 -s -I$(ARCH) -I. -Iextend -D$(GETTEXT)
endif
TTFILE = ./ttfile.c
TTMEMORY = ./ttmemory.c
TTMUTEX = ./ttmutex.c
PORT = $(TTFILE) $(TTMEMORY) $(TTMUTEX)
SRC_X = extend/ftxgasp.c extend/ftxkern.c extend/ftxpost.c \
extend/ftxcmap.c extend/ftxwidth.c extend/ftxsbit.c \
extend/ftxgsub.c extend/ftxgpos.c extend/ftxgdef.c \
extend/ftxopen.c extend/ftxerr18.c
OBJS_X = $(SRC_X:.c=.o)
SRC_M = ttapi.c ttcache.c ttcalc.c ttcmap.c ttdebug.c \
ttgload.c ttinterp.c ttload.c ttobjs.c \
ttraster.c ttextend.c $(PORT)
OBJS_M = $(SRC_M:.c=.o) $(OBJS_X)
SRC_S = $(ARCH)/freetype.c
OBJ_S = $(SRC_S:.c=.o)
OBJS_S = $(OBJ_S) $(OBJS_X)
%.o: %.c
$(CC) $(CFLAGS) -c -o $@ $<
.PHONY: all debug clean distclean depend
all:
$(MAKE) -f $(FT_MAKEFILE) LIB_FILES=OBJS_S libttf.a
debug:
$(MAKE) -f $(FT_MAKEFILE) LIB_FILES=OBJS_M DEBUG=1 libttf.a
HAVE_GETTEXT:
$(MAKE) -f $(FT_MAKEFILE) LIB_FILES=OBJS_S GETTEXT=HAVE_GETTEXT \
libttf.a
$(OBJ_S): $(SRC_S) $(SRC_M)
libttf.a: $($(LIB_FILES))
-del $@
ar src $@ $^
clean:
-del *.o
-del extend\*.o
-del $(subst /,\,$(ARCH)/*.o)
-del response
distclean: clean
-del dep.end
-del libttf.a
depend: $(SRS_S) $(SRC_M) $(SRC_X)
$(CC) -E -M $^ > dep.end
ifeq (dep.end,$(wildcard dep.end))
include dep.end
endif
# end of Makefile.gcc

103
lib/arch/win32/depend.win Normal file
View File

@@ -0,0 +1,103 @@
# This dependency file to be used with various Win32 compilers
# has been generated automatically with the script `makedep' on
# 03-Sep-1999.
ttapi.obj: ttapi.c ttconfig.h arch\win32\ft_conf.h freetype.h fterrid.h \
ftnameid.h ttengine.h tttypes.h ttmutex.h ttcalc.h ttmemory.h \
ttcache.h ttfile.h ttdebug.h ttobjs.h tttables.h ttcmap.h ttload.h \
ttgload.h ttraster.h ttextend.h
ttcache.obj: ttcache.c ttengine.h tttypes.h ttconfig.h \
arch\win32\ft_conf.h freetype.h fterrid.h ftnameid.h ttmutex.h \
ttmemory.h ttcache.h ttobjs.h tttables.h ttcmap.h ttdebug.h
ttcalc.obj: ttcalc.c ttcalc.h ttconfig.h arch\win32\ft_conf.h freetype.h \
fterrid.h ftnameid.h ttdebug.h tttypes.h tttables.h
ttcmap.obj: ttcmap.c ttobjs.h ttconfig.h arch\win32\ft_conf.h ttengine.h \
tttypes.h freetype.h fterrid.h ftnameid.h ttmutex.h ttcache.h \
tttables.h ttcmap.h ttdebug.h ttfile.h ttmemory.h ttload.h
ttdebug.obj: ttdebug.c ttdebug.h ttconfig.h arch\win32\ft_conf.h \
tttypes.h freetype.h fterrid.h ftnameid.h tttables.h ttobjs.h \
ttengine.h ttmutex.h ttcache.h ttcmap.h
ttextend.obj: ttextend.c ttextend.h ttconfig.h arch\win32\ft_conf.h \
tttypes.h freetype.h fterrid.h ftnameid.h ttobjs.h ttengine.h \
ttmutex.h ttcache.h tttables.h ttcmap.h ttmemory.h
ttfile.obj: ttfile.c ttconfig.h arch\win32\ft_conf.h freetype.h \
fterrid.h ftnameid.h tttypes.h ttdebug.h ttengine.h ttmutex.h \
ttmemory.h ttfile.h
ttgload.obj: ttgload.c tttypes.h ttconfig.h arch\win32\ft_conf.h \
freetype.h fterrid.h ftnameid.h ttdebug.h ttcalc.h ttfile.h \
ttengine.h ttmutex.h tttables.h ttobjs.h ttcache.h ttcmap.h ttgload.h \
ttmemory.h tttags.h ttload.h
ttinterp.obj: ttinterp.c freetype.h fterrid.h ftnameid.h tttypes.h \
ttconfig.h arch\win32\ft_conf.h ttdebug.h ttcalc.h ttmemory.h \
ttinterp.h ttobjs.h ttengine.h ttmutex.h ttcache.h tttables.h \
ttcmap.h
ttload.obj: ttload.c tttypes.h ttconfig.h arch\win32\ft_conf.h \
freetype.h fterrid.h ftnameid.h ttdebug.h ttcalc.h ttfile.h \
ttengine.h ttmutex.h tttables.h ttobjs.h ttcache.h ttcmap.h \
ttmemory.h tttags.h ttload.h
ttmemory.obj: ttmemory.c ttdebug.h ttconfig.h arch\win32\ft_conf.h \
tttypes.h freetype.h fterrid.h ftnameid.h ttmemory.h ttengine.h \
ttmutex.h
ttmutex.obj: ttmutex.c ttmutex.h ttconfig.h arch\win32\ft_conf.h
ttobjs.obj: ttobjs.c ttobjs.h ttconfig.h arch\win32\ft_conf.h ttengine.h \
tttypes.h freetype.h fterrid.h ftnameid.h ttmutex.h ttcache.h \
tttables.h ttcmap.h ttfile.h ttdebug.h ttcalc.h ttmemory.h ttload.h \
ttinterp.h ttextend.h
ttraster.obj: ttraster.c ttraster.h ttconfig.h arch\win32\ft_conf.h \
freetype.h fterrid.h ftnameid.h ttengine.h tttypes.h ttmutex.h \
ttdebug.h ttcalc.h ttmemory.h
extend\ftxcmap.obj: extend\ftxcmap.c extend\ftxcmap.h freetype.h fterrid.h \
ftnameid.h tttypes.h ttconfig.h arch\win32\ft_conf.h ttobjs.h \
ttengine.h ttmutex.h ttcache.h tttables.h ttcmap.h
extend\ftxerr18.obj: extend\ftxerr18.c ttconfig.h arch\win32\ft_conf.h \
extend\ftxerr18.h freetype.h fterrid.h ftnameid.h extend\ftxkern.h \
extend\ftxpost.h extend\ftxopen.h extend\ftxgdef.h extend\ftxgsub.h \
extend\ftxgpos.h
extend\ftxgasp.obj: extend\ftxgasp.c extend\ftxgasp.h freetype.h fterrid.h \
ftnameid.h tttypes.h ttconfig.h arch\win32\ft_conf.h ttobjs.h \
ttengine.h ttmutex.h ttcache.h tttables.h ttcmap.h
extend\ftxgdef.obj: extend\ftxgdef.c tttypes.h ttconfig.h arch\win32\ft_conf.h \
freetype.h fterrid.h ftnameid.h tttags.h ttload.h ttobjs.h ttengine.h \
ttmutex.h ttcache.h tttables.h ttcmap.h ttextend.h ttmemory.h \
ttfile.h ttdebug.h extend\ftxopen.h extend\ftxgdef.h extend\ftxgsub.h \
extend\ftxgpos.h extend\ftxopenf.h
extend\ftxgpos.obj: extend\ftxgpos.c tttypes.h ttconfig.h arch\win32\ft_conf.h \
freetype.h fterrid.h ftnameid.h tttags.h ttload.h ttobjs.h ttengine.h \
ttmutex.h ttcache.h tttables.h ttcmap.h ttextend.h ttmemory.h \
ttfile.h ttdebug.h extend\ftxopen.h extend\ftxgdef.h extend\ftxgsub.h \
extend\ftxgpos.h extend\ftxopenf.h
extend\ftxgsub.obj: extend\ftxgsub.c tttypes.h ttconfig.h arch\win32\ft_conf.h \
freetype.h fterrid.h ftnameid.h tttags.h ttload.h ttobjs.h ttengine.h \
ttmutex.h ttcache.h tttables.h ttcmap.h ttextend.h ttmemory.h \
ttfile.h ttdebug.h extend\ftxopen.h extend\ftxgdef.h extend\ftxgsub.h \
extend\ftxgpos.h extend\ftxopenf.h
extend\ftxkern.obj: extend\ftxkern.c extend\ftxkern.h freetype.h fterrid.h \
ftnameid.h ttextend.h ttconfig.h arch\win32\ft_conf.h tttypes.h \
ttobjs.h ttengine.h ttmutex.h ttcache.h tttables.h ttcmap.h ttdebug.h \
ttmemory.h ttfile.h ttload.h tttags.h
extend\ftxopen.obj: extend\ftxopen.c tttypes.h ttconfig.h arch\win32\ft_conf.h \
freetype.h fterrid.h ftnameid.h ttload.h ttobjs.h ttengine.h \
ttmutex.h ttcache.h tttables.h ttcmap.h ttextend.h ttmemory.h \
ttfile.h ttdebug.h extend\ftxopen.h extend\ftxgdef.h extend\ftxgsub.h \
extend\ftxgpos.h extend\ftxopenf.h
extend\ftxpost.obj: extend\ftxpost.c extend\ftxpost.h freetype.h fterrid.h \
ftnameid.h tttypes.h ttconfig.h arch\win32\ft_conf.h ttobjs.h \
ttengine.h ttmutex.h ttcache.h tttables.h ttcmap.h ttload.h ttfile.h \
ttdebug.h tttags.h ttmemory.h ttextend.h
extend\ftxsbit.obj: extend\ftxsbit.c extend\ftxsbit.h freetype.h fterrid.h \
ftnameid.h ttobjs.h ttconfig.h arch\win32\ft_conf.h ttengine.h \
tttypes.h ttmutex.h ttcache.h tttables.h ttcmap.h ttfile.h ttdebug.h \
ttload.h ttmemory.h tttags.h ttextend.h
extend\ftxwidth.obj: extend\ftxwidth.c extend\ftxwidth.h freetype.h fterrid.h \
ftnameid.h ttdebug.h ttconfig.h arch\win32\ft_conf.h tttypes.h \
ttobjs.h ttengine.h ttmutex.h ttcache.h tttables.h ttcmap.h ttfile.h \
tttags.h ttload.h
!ifndef __MAKE__
arch\win32\freetype.obj: arch\win32\freetype.c ttapi.c ttconfig.h \
arch\win32\ft_conf.h freetype.h fterrid.h ftnameid.h ttengine.h \
tttypes.h ttmutex.h ttcalc.h ttmemory.h ttcache.h ttfile.h ttdebug.h \
ttobjs.h tttables.h ttcmap.h ttload.h ttgload.h ttraster.h ttextend.h \
ttcache.c ttcalc.c ttcmap.c ttdebug.c ttgload.c tttags.h ttinterp.c \
ttinterp.h ttload.c ttobjs.c ttraster.c ttfile.c ttmemory.c ttmutex.c \
ttextend.c
!endif

42
lib/arch/win32/freetype.c Normal file
View File

@@ -0,0 +1,42 @@
/* This file is part of the FreeType project */
/* single object library component for Win32 */
#define TT_MAKE_OPTION_SINGLE_OBJECT
/* Note, you should define the EXPORT_DEF and EXPORT_FUNC macros */
/* here if you want to build a Win32 DLL. If undefined, the */
/* macros default to "extern"/"" (nothing), which is suitable */
/* for static libraries. See `ttconfig.h' for details. */
/* The macro EXPORT_DEF is placed before each high-level API */
/* function declaration, and EXPORT_FUNC before each definition */
/* (body). You can then use it to take any compiler-specific */
/* pragma for DLL-exported symbols */
/* first include common core components */
#include "ttapi.c"
#include "ttcache.c"
#include "ttcalc.c"
#include "ttcmap.c"
#include "ttdebug.c"
#include "ttgload.c"
#include "ttinterp.c"
#include "ttload.c"
#include "ttobjs.c"
#include "ttraster.c"
/* then system-specific (or ANSI) components */
#include "ttfile.c"
#include "ttmemory.c"
#include "ttmutex.c"
/* finally, add some extensions */
#ifdef TT_CONFIG_OPTION_EXTEND_ENGINE
#include "ttextend.c"
#endif
/* END */

104
lib/arch/win32/freetype.dsp Normal file
View File

@@ -0,0 +1,104 @@
# Microsoft Developer Studio Project File - Name="freetype" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 5.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Static Library" 0x0104
CFG=freetype - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "freetype.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "freetype.mak" CFG="freetype - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "freetype - Win32 Release" (based on "Win32 (x86) Static Library")
!MESSAGE "freetype - Win32 Debug" (based on "Win32 (x86) Static Library")
!MESSAGE
# Begin Project
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
!IF "$(CFG)" == "freetype - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
# ADD CPP /nologo /W3 /GX /O1 /I "." /I "..\.." /I "..\..\extend" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /FD /c
# SUBTRACT CPP /YX
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo
!ELSEIF "$(CFG)" == "freetype - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /Z7 /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
# ADD CPP /nologo /W3 /GX /Zi /O1 /I "." /I "..\.." /I "..\..\extend" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FD /c
# SUBTRACT CPP /YX
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo
!ENDIF
# Begin Target
# Name "freetype - Win32 Release"
# Name "freetype - Win32 Debug"
# Begin Source File
SOURCE=.\freetype.c
# End Source File
# Begin Source File
SOURCE=..\..\Extend\Ftxcmap.c
# End Source File
# Begin Source File
SOURCE=..\..\Extend\ftxerr18.c
# End Source File
# Begin Source File
SOURCE=..\..\Extend\Ftxgasp.c
# End Source File
# Begin Source File
SOURCE=..\..\Extend\Ftxkern.c
# End Source File
# Begin Source File
SOURCE=..\..\Extend\ftxpost.c
# End Source File
# End Target
# End Project

View File

@@ -0,0 +1,29 @@
Microsoft Developer Studio Workspace File, Format Version 5.00
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
###############################################################################
Project: "freetype"=.\freetype.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Global:
Package=<5>
{{{
}}}
Package=<3>
{{{
}}}
###############################################################################

BIN
lib/arch/win32/freetype.ide Normal file

Binary file not shown.

353
lib/arch/win32/freetype.mak Normal file
View File

@@ -0,0 +1,353 @@
# Microsoft Developer Studio Generated NMAKE File, Format Version 4.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Static Library" 0x0104
!IF "$(CFG)" == ""
CFG=freetype - Win32 Debug
!MESSAGE No configuration specified. Defaulting to freetype - Win32 Debug.
!ENDIF
!IF "$(CFG)" != "freetype - Win32 Release" && "$(CFG)" !=\
"freetype - Win32 Debug"
!MESSAGE Invalid configuration "$(CFG)" specified.
!MESSAGE You can specify a configuration when running NMAKE on this makefile
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "freetype.mak" CFG="freetype - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "freetype - Win32 Release" (based on "Win32 (x86) Static Library")
!MESSAGE "freetype - Win32 Debug" (based on "Win32 (x86) Static Library")
!MESSAGE
!ERROR An invalid configuration is specified.
!ENDIF
!IF "$(OS)" == "Windows_NT"
NULL=
!ELSE
NULL=nul
!ENDIF
################################################################################
# Begin Project
# PROP Target_Last_Scanned "freetype - Win32 Debug"
CPP=cl.exe
!IF "$(CFG)" == "freetype - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Target_Dir ""
OUTDIR=.\Release
INTDIR=.\Release
ALL : "$(OUTDIR)\freetype.lib"
CLEAN :
-@erase ".\Release\freetype.lib"
-@erase ".\Release\Ftxkern.obj"
-@erase ".\Release\ftxpost.obj"
-@erase ".\Release\ftxerr18.obj"
-@erase ".\Release\Ftxcmap.obj"
-@erase ".\Release\Freetype.obj"
-@erase ".\Release\Ftxgasp.obj"
"$(OUTDIR)" :
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c
# ADD CPP /nologo /W3 /GX /O2 /I "." /I "..\.." /I "..\..\extend" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c
CPP_PROJ=/nologo /ML /W3 /GX /O2 /I "." /I "..\.." /I "..\..\extend" /D "WIN32"\
/D "NDEBUG" /D "_WINDOWS" /Fp"$(INTDIR)/freetype.pch" /YX /Fo"$(INTDIR)/" /c
CPP_OBJS=.\Release/
CPP_SBRS=
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
BSC32_FLAGS=/nologo /o"$(OUTDIR)/freetype.bsc"
BSC32_SBRS=
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo
LIB32_FLAGS=/nologo /out:"$(OUTDIR)/freetype.lib"
LIB32_OBJS= \
"$(INTDIR)/Ftxkern.obj" \
"$(INTDIR)/ftxpost.obj" \
"$(INTDIR)/ftxerr18.obj" \
"$(INTDIR)/Ftxcmap.obj" \
"$(INTDIR)/Freetype.obj" \
"$(INTDIR)/Ftxgasp.obj"
"$(OUTDIR)\freetype.lib" : "$(OUTDIR)" $(DEF_FILE) $(LIB32_OBJS)
$(LIB32) @<<
$(LIB32_FLAGS) $(DEF_FLAGS) $(LIB32_OBJS)
<<
!ELSEIF "$(CFG)" == "freetype - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Target_Dir ""
OUTDIR=.\Debug
INTDIR=.\Debug
ALL : "$(OUTDIR)\freetype.lib"
CLEAN :
-@erase ".\Debug\freetype.lib"
-@erase ".\Debug\Freetype.obj"
-@erase ".\Debug\Ftxkern.obj"
-@erase ".\Debug\ftxpost.obj"
-@erase ".\Debug\Ftxcmap.obj"
-@erase ".\Debug\Ftxgasp.obj"
-@erase ".\Debug\ftxerr18.obj"
"$(OUTDIR)" :
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
# ADD BASE CPP /nologo /W3 /GX /Z7 /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /c
# ADD CPP /nologo /W3 /GX /Z7 /Od /I "." /I "..\.." /I "..\..\extend" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /c
CPP_PROJ=/nologo /MLd /W3 /GX /Z7 /Od /I "." /I "..\.." /I "..\..\extend" /D\
"WIN32" /D "_DEBUG" /D "_WINDOWS" /Fp"$(INTDIR)/freetype.pch" /YX\
/Fo"$(INTDIR)/" /c
CPP_OBJS=.\Debug/
CPP_SBRS=
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
BSC32_FLAGS=/nologo /o"$(OUTDIR)/freetype.bsc"
BSC32_SBRS=
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo
LIB32_FLAGS=/nologo /out:"$(OUTDIR)/freetype.lib"
LIB32_OBJS= \
"$(INTDIR)/Freetype.obj" \
"$(INTDIR)/Ftxkern.obj" \
"$(INTDIR)/ftxpost.obj" \
"$(INTDIR)/Ftxcmap.obj" \
"$(INTDIR)/Ftxgasp.obj" \
"$(INTDIR)/ftxerr18.obj"
"$(OUTDIR)\freetype.lib" : "$(OUTDIR)" $(DEF_FILE) $(LIB32_OBJS)
$(LIB32) @<<
$(LIB32_FLAGS) $(DEF_FLAGS) $(LIB32_OBJS)
<<
!ENDIF
.c{$(CPP_OBJS)}.obj:
$(CPP) $(CPP_PROJ) $<
.cpp{$(CPP_OBJS)}.obj:
$(CPP) $(CPP_PROJ) $<
.cxx{$(CPP_OBJS)}.obj:
$(CPP) $(CPP_PROJ) $<
.c{$(CPP_SBRS)}.sbr:
$(CPP) $(CPP_PROJ) $<
.cpp{$(CPP_SBRS)}.sbr:
$(CPP) $(CPP_PROJ) $<
.cxx{$(CPP_SBRS)}.sbr:
$(CPP) $(CPP_PROJ) $<
################################################################################
# Begin Target
# Name "freetype - Win32 Release"
# Name "freetype - Win32 Debug"
!IF "$(CFG)" == "freetype - Win32 Release"
!ELSEIF "$(CFG)" == "freetype - Win32 Debug"
!ENDIF
################################################################################
# Begin Source File
SOURCE=\Freetype\Lib\Extend\ftxpost.c
DEP_CPP_FTXPO=\
".\..\..\Extend\ftxpost.h"\
".\..\..\tttypes.h"\
".\..\..\ttobjs.h"\
".\..\..\tttables.h"\
".\..\..\ttload.h"\
".\..\..\ttfile.h"\
".\..\..\tttags.h"\
".\..\..\ttmemory.h"\
".\..\..\ttextend.h"\
".\..\..\freetype.h"\
"..\..\ttconfig.h"\
".\ft_conf.h"\
"..\..\ttengine.h"\
"..\..\ttmutex.h"\
"..\..\ttcache.h"\
"..\..\ttcmap.h"\
".\..\..\ttdebug.h"\
"$(INTDIR)\ftxpost.obj" : $(SOURCE) $(DEP_CPP_FTXPO) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
# End Source File
################################################################################
# Begin Source File
SOURCE=\Freetype\Lib\Extend\ftxerr18.c
DEP_CPP_FTXER=\
".\..\..\Extend\ftxerr18.h"\
".\..\..\Extend\ftxkern.h"\
".\..\..\Extend\ftxpost.h"\
".\..\..\freetype.h"\
"..\..\ttconfig.h"\
".\ft_conf.h"\
"$(INTDIR)\ftxerr18.obj" : $(SOURCE) $(DEP_CPP_FTXER) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
# End Source File
################################################################################
# Begin Source File
SOURCE=\Freetype\Lib\Extend\Ftxgasp.c
DEP_CPP_FTXGA=\
".\..\..\Extend\ftxgasp.h"\
".\..\..\tttypes.h"\
".\..\..\ttobjs.h"\
".\..\..\tttables.h"\
".\..\..\freetype.h"\
"..\..\ttconfig.h"\
".\ft_conf.h"\
"..\..\ttengine.h"\
"..\..\ttmutex.h"\
"..\..\ttcache.h"\
"..\..\ttcmap.h"\
"$(INTDIR)\Ftxgasp.obj" : $(SOURCE) $(DEP_CPP_FTXGA) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
# End Source File
################################################################################
# Begin Source File
SOURCE=\Freetype\Lib\Extend\Ftxkern.c
DEP_CPP_FTXKE=\
".\..\..\Extend\ftxkern.h"\
".\..\..\ttextend.h"\
".\..\..\tttypes.h"\
".\..\..\ttdebug.h"\
".\..\..\ttmemory.h"\
".\..\..\ttfile.h"\
".\..\..\ttobjs.h"\
".\..\..\ttload.h"\
".\..\..\tttags.h"\
".\..\..\freetype.h"\
"..\..\ttconfig.h"\
".\ft_conf.h"\
"..\..\ttengine.h"\
"..\..\ttmutex.h"\
"..\..\ttcache.h"\
".\..\..\tttables.h"\
"..\..\ttcmap.h"\
"$(INTDIR)\Ftxkern.obj" : $(SOURCE) $(DEP_CPP_FTXKE) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
# End Source File
################################################################################
# Begin Source File
SOURCE=\Freetype\Lib\Extend\Ftxcmap.c
DEP_CPP_FTXCM=\
".\..\..\Extend\ftxcmap.h"\
".\..\..\tttypes.h"\
".\..\..\ttobjs.h"\
".\..\..\tttables.h"\
".\..\..\freetype.h"\
"..\..\ttconfig.h"\
".\ft_conf.h"\
"..\..\ttengine.h"\
"..\..\ttmutex.h"\
"..\..\ttcache.h"\
"..\..\ttcmap.h"\
"$(INTDIR)\Ftxcmap.obj" : $(SOURCE) $(DEP_CPP_FTXCM) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
# End Source File
################################################################################
# Begin Source File
SOURCE=.\Freetype.c
DEP_CPP_FREET=\
".\..\..\ttapi.c"\
".\..\..\ttcache.c"\
".\..\..\ttcalc.c"\
".\..\..\ttcmap.c"\
".\..\..\ttgload.c"\
".\..\..\ttinterp.c"\
".\..\..\ttload.c"\
".\..\..\ttobjs.c"\
".\..\..\ttraster.c"\
".\..\..\ttfile.c"\
".\..\..\ttmemory.c"\
".\..\..\ttmutex.c"\
".\..\..\ttextend.c"\
".\..\..\freetype.h"\
"..\..\ttengine.h"\
"..\..\ttcalc.h"\
".\..\..\ttmemory.h"\
"..\..\ttcache.h"\
".\..\..\ttfile.h"\
".\..\..\ttobjs.h"\
".\..\..\ttload.h"\
"..\..\ttgload.h"\
"..\..\ttraster.h"\
".\..\..\ttextend.h"\
"..\..\ttconfig.h"\
".\ft_conf.h"\
"..\..\ttmutex.h"\
".\..\..\tttypes.h"\
".\..\..\ttdebug.h"\
".\..\..\tttables.h"\
"..\..\ttcmap.h"\
".\..\..\tttags.h"\
"..\..\ttinterp.h"\
{$(INCLUDE)}"\unistd.h"\
"$(INTDIR)\Freetype.obj" : $(SOURCE) $(DEP_CPP_FREET) "$(INTDIR)"
# End Source File
# End Target
# End Project
################################################################################

BIN
lib/arch/win32/freetype.mdp Normal file

Binary file not shown.

210
lib/arch/win32/ft_conf.h Normal file
View File

@@ -0,0 +1,210 @@
/* This file is part of the FreeType project */
/* ft_conf.h for Win32 */
/* we need the following because there are some typedefs in this file */
#ifndef FT_CONF_H
#define FT_CONF_H
#ifndef WIN32
#define WIN32
#endif
/* Define to empty if the 'const' keyword does not work. */
/* #undef const */
/* Define if you have a working `mmap' system call. */
#undef HAVE_MMAP
/* Define if you have the <stdlib.h> header file. */
#define HAVE_STDLIB_H
/* Define if you have the getpagesize function. */
#undef HAVE_GETPAGESIZE
/* Define if you have the memcpy function. */
#define HAVE_MEMCPY
/* Define if you have the memmove function. */
#define HAVE_MEMMOVE
/* Define if you have the valloc function. */
#undef HAVE_VALLOC
/* Define if you have the <fcntl.h> header file. */
#undef HAVE_FCNTL_H
/* Define if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
/* The number of bytes in a int. */
#define SIZEOF_INT 4
/* The number of bytes in a long. */
#define SIZEOF_LONG 4
/**********************************************************************/
/* */
/* The following configuration macros can be tweaked manually by */
/* a developer to turn on or off certain features or options in the */
/* TrueType engine. This may be useful to tune it for specific */
/* purposes.. */
/* */
/**********************************************************************/
/*************************************************************************/
/* Define this if the underlying operating system uses a different */
/* character width than 8bit for file names. You must then also supply */
/* a typedef declaration for defining 'TT_Text'. Default is off. */
/* #define HAVE_TT_TEXT */
/*************************************************************************/
/* Define this if you want to generate code to support engine extensions */
/* Default is on, but if you're satisfied by the basic services provided */
/* by the engine and need no extensions, undefine this configuration */
/* macro to save a few more bytes. */
#define TT_CONFIG_OPTION_EXTEND_ENGINE
/*************************************************************************/
/* Define this if you want to generate code to support gray-scaling, */
/* a.k.a. font-smoothing or anti-aliasing. Default is on, but you can */
/* disable it if you don't need it. */
#define TT_CONFIG_OPTION_GRAY_SCALING
/*************************************************************************/
/* Define this if you want to completely disable the use of the bytecode */
/* interpreter. Doing so will produce a much smaller library, but the */
/* quality of the rendered glyphs will enormously suffer from this. */
/* */
/* This switch was introduced due to the Apple patents issue which */
/* emerged recently on the FreeType lists. We still do not have Apple's */
/* opinion on the subject and will change this as soon as we have. */
#undef TT_CONFIG_OPTION_NO_INTERPRETER
/*************************************************************************/
/* Define this if you want to use a big 'switch' statement within the */
/* bytecode interpreter. Because some non-optimizing compilers are not */
/* able to produce jump tables from such statements, undefining this */
/* configuration macro will generate the appropriate C jump table in */
/* ttinterp.c. If you use an optimizing compiler, you should leave it */
/* defined for better performance and code compactness.. */
#define TT_CONFIG_OPTION_INTERPRETER_SWITCH
/*************************************************************************/
/* Define this if you want to build a 'static' version of the TrueType */
/* bytecode interpreter. This will produce much bigger code, which */
/* _may_ be faster on some architectures.. */
/* */
/* Do NOT DEFINE THIS is you build a thread-safe version of the engine */
/* */
#undef TT_CONFIG_OPTION_STATIC_INTERPRETER
/*************************************************************************/
/* Define this if you want to build a 'static' version of the scan-line */
/* converter (the component which in charge of converting outlines into */
/* bitmaps). This will produce a bigger object file for "ttraster.c", */
/* which _may_ be faster on some architectures.. */
/* */
/* Do NOT DEFINE THIS is you build a thread-safe version of the engine */
/* */
#undef TT_CONFIG_OPTION_STATIC_RASTER
/*************************************************************************/
/* Define TT_CONFIG_THREAD_SAFE if you want to build a thread-safe */
/* version of the library. */
#undef TT_CONFIG_OPTION_THREAD_SAFE
/**********************************************************************/
/* */
/* The following macros are used to define the debug level, as well */
/* as individual tracing levels for each component. There are */
/* currently three modes of operation : */
/* */
/* - trace mode (define DEBUG_LEVEL_TRACE) */
/* */
/* The engine prints all error messages, as well as tracing */
/* ones, filtered by each component's level */
/* */
/* - debug mode (define DEBUG_LEVEL_ERROR) */
/* */
/* Disable tracing, but keeps error output and assertion */
/* checks. */
/* */
/* - release mode (don't define anything) */
/* */
/* Don't include error-checking or tracing code in the */
/* engine's code. Ideal for releases. */
/* */
/* NOTE : */
/* */
/* Each component's tracing level is defined in its own source. */
/* */
/**********************************************************************/
/* Define if you want to use the tracing debug mode */
#undef DEBUG_LEVEL_TRACE
/* Define if you want to use the error debug mode - ignored if */
/* DEBUG_LEVEL_TRACE is defined */
#undef DEBUG_LEVEL_ERROR
/**************************************************************************/
/* Definition of various integer sizes. These types are used by ttcalc */
/* and ttinterp (for the 64-bit integers) only.. */
#if SIZEOF_INT == 4
typedef signed int TT_Int32;
typedef unsigned int TT_Word32;
#elif SIZEOF_LONG == 4
typedef signed long TT_Int32;
typedef unsigned long TT_Word32;
#else
#error "no 32bit type found"
#endif
#if SIZEOF_LONG == 8
/* LONG64 must be defined when a 64-bit type is available */
/* INT64 must then be defined to this type.. */
#define LONG64
#define INT64 long
#else
/* GCC provides the non-ANSI 'long long' 64-bit type. You can activate */
/* by defining the TT_USE_LONG_LONG macro in 'ft_conf.h'. Note that this */
/* will produce many -ansi warnings during library compilation. */
#ifdef TT_USE_LONG_LONG
#define LONG64
#define INT64 long long
#endif /* TT_USE_LONG_LONG */
#endif
#endif /* FT_CONF_H */
/* END */

24
lib/arch/win32/makedef Normal file
View File

@@ -0,0 +1,24 @@
# makedef
#
# This shell script creates a .DEF file necessary for building as DLL
# on the Windows 32-bit platform.
echo "\
; This definition file to be used to built the library as DLL
; has been generated automatically with the script \`makedef' on
; `date +%d-%b-%Y`.
LIBRARY ft13_32
DESCRIPTION 'FreeType 1.3 32-bit DLL <20> 1996-1999 Turner, Wilhelm, Lemberg'
EXETYPE WINDOWS
CODE PRELOAD MOVEABLE DISCARDABLE
DATA PRELOAD MOVEABLE MULTIPLE
EXPORTS
" > ttf.def
(cd ../..
sed -n -e "/^ *EXPORT_DEF/!d ; n ; s/(.*$//" \
-e "s/;$//" -e "s/ const / /" -e "s/ *[a-zA-Z][a-zA-Z_\*]* //" \
-e "s/ *//g" -e "s/^/ /" -e "p" *.h extend/*.h) >> ttf.def
# eof

29
lib/arch/win32/makedep Normal file
View File

@@ -0,0 +1,29 @@
# makedep
#
# This shell script creates a dependency file necessary for some compilers
# on the Win32 platform.
echo "\
# This dependency file to be used with various Win32 compilers
# has been generated automatically with the script \`makedep' on
# `date +%d-%b-%Y`.
" > depend.win
(cd ../..
gcc -MM -Iarch/win32 -I. *.c | \
sed -e "s/\.o:/.obj:/" -e "s:/:\\\\:g") >> depend.win
(cd ../..
gcc -MM -Iarch/win32 -I. -Iextend extend/*.c | \
sed -e "s/^\(.*\)\.o:/extend\\\\\1.obj:/" -e "s:/:\\\\:g") >> depend.win
echo "!ifndef __MAKE__" >> depend.win
(cd ../..
gcc -MM -Iarch/win32 -I. -Iextend arch/win32/*.c | \
sed -e "s/^\(.*\)\.o:/arch\\\\win32\\\\\1.obj:/" \
-e "s:/:\\\\:g") >> depend.win
echo "!endif" >> depend.win
# eof

127
lib/arch/win32/ttf.def Normal file
View File

@@ -0,0 +1,127 @@
; This definition file to be used to built the library as DLL
; has been generated automatically with the script `makedef' on
; 03-Sep-1999.
LIBRARY ft13_32
DESCRIPTION 'FreeType 1.3 32-bit DLL <EFBFBD> 1996-1999 Turner, Wilhelm, Lemberg'
EXETYPE WINDOWS
CODE PRELOAD MOVEABLE DISCARDABLE
DATA PRELOAD MOVEABLE MULTIPLE
EXPORTS
TT_FreeType_Version
TT_Init_FreeType
TT_Done_FreeType
TT_Set_Raster_Gray_Palette
TT_Open_Face
TT_Open_Collection
TT_Get_Face_Properties
TT_Set_Face_Pointer
TT_Get_Face_Pointer
TT_Flush_Face
TT_Get_Face_Metrics
TT_Close_Face
TT_Get_Font_Data
TT_New_Instance
TT_Set_Instance_Resolutions
TT_Set_Instance_CharSize
TT_Set_Instance_CharSizes
TT_Set_Instance_PixelSizes
TT_Set_Instance_Transform_Flags
TT_Get_Instance_Metrics
TT_Set_Instance_Pointer
TT_Get_Instance_Pointer
TT_Done_Instance
TT_New_Glyph
TT_Done_Glyph
TT_Load_Glyph
TT_Get_Glyph_Outline
TT_Get_Glyph_Metrics
TT_Get_Glyph_Big_Metrics
TT_Get_Glyph_Bitmap
TT_Get_Glyph_Pixmap
TT_New_Outline
TT_Done_Outline
TT_Copy_Outline
TT_Get_Outline_Bitmap
TT_Get_Outline_Pixmap
TT_Get_Outline_BBox
TT_Transform_Outline
TT_Translate_Outline
TT_Transform_Vector
TT_MulDiv
TT_MulFix
TT_Get_CharMap_Count
TT_Get_CharMap_ID
TT_Get_CharMap
TT_Char_Index
TT_Get_Name_Count
TT_Get_Name_ID
TT_Get_Name_String
TT_Register_Extension
TT_Extension_Get
TT_Use_Stream
TT_Done_Stream
TT_Flush_Stream
TT_Read_File
TT_Seek_File
TT_Skip_File
TT_Read_At_File
TT_File_Pos
TT_Stream_Size
TT_Null_FileFrame
TT_Access_Frame
TT_Check_And_Access_Frame
TT_Forget_Frame
TT_Get_Char
TT_Get_Short
TT_Get_Long
TT_LookUp_Table
TT_Alloc
TT_Realloc
TT_Free
TT_CharMap_First
TT_CharMap_Next
TT_CharMap_Last
TT_ErrToString18
TT_Get_Face_Gasp_Flags
TT_Init_GDEF_Extension
TT_Load_GDEF_Table
TT_GDEF_Get_Glyph_Property
TT_GDEF_Build_ClassDefinition
TT_Init_GPOS_Extension
TT_Load_GPOS_Table
TT_GPOS_Select_Script
TT_GPOS_Select_Language
TT_GPOS_Select_Feature
TT_GPOS_Query_Scripts
TT_GPOS_Query_Languages
TT_GPOS_Query_Features
TT_GPOS_Add_Feature
TT_GPOS_Clear_Features
TT_Init_GSUB_Extension
TT_Load_GSUB_Table
TT_GSUB_Select_Script
TT_GSUB_Select_Language
TT_GSUB_Select_Feature
TT_GSUB_Query_Scripts
TT_GSUB_Query_Languages
TT_GSUB_Query_Features
TT_GSUB_Add_Feature
TT_GSUB_Clear_Features
TT_GSUB_Register_Alternate_Function
TT_GSUB_Apply_String
TT_GSUB_Add_String
TT_Init_Kerning_Extension
TT_Get_Kerning_Directory
TT_Load_Kerning_Table
TT_Init_Post_Extension
TT_Load_PS_Names
TT_Get_PS_Name
TT_Init_SBit_Extension
TT_Get_Face_Bitmaps
TT_New_SBit_Image
TT_Done_SBit_Image
TT_Get_SBit_Strike
TT_Load_Glyph_Bitmap
TT_Get_Face_Widths

347
lib/extend/ftxcmap.c Normal file
View File

@@ -0,0 +1,347 @@
/*******************************************************************
*
* ftxcmap.h 1.0
*
* API extension for iterating over Cmaps
*
* Copyright 1996-1999 by Juliusz Chroboczek,
* 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 "ftxcmap.h"
#include "tttypes.h"
#include "ttobjs.h"
#include "tttables.h"
static Long charmap_first4 ( PCMap4, UShort* );
static Long charmap_next4 ( PCMap4, UShort, UShort* );
static Long charmap_last4 ( PCMap4, UShort* );
static UShort charmap_find_id4( PCMap4, UShort, TCMap4Segment*, UShort );
/*******************************************************************
*
* Function : TT_CharMap_First
*
* Description : Returns the first valid character code in a
* given character map. Also returns the corresponding
* glyph index.
*
* Input : charMap handle to the target character map
* id address where the glyph index will be
* be returned in case of success
*
* Output : First valid character code. -1 in case of failure.
*
* Notes :
*
******************************************************************/
EXPORT_FUNC
TT_Long TT_CharMap_First( TT_CharMap charMap,
TT_UShort* id )
{
PCMapTable cmap;
UShort i, c;
if ( !( cmap = HANDLE_CharMap( charMap ) ) )
return -1;
switch ( cmap->format )
{
case 0:
if ( id )
*id = cmap->c.cmap0.glyphIdArray[0];
return 0;
case 4:
return charmap_first4( &cmap->c.cmap4, id );
case 6:
if ( cmap->c.cmap6.entryCount < 1 )
return -1;
if ( id )
*id = cmap->c.cmap6.glyphIdArray[0];
return cmap->c.cmap6.firstCode;
default:
/* Now loop from 0 to 65535. We can't use a simple "for' on */
/* 16-bits systems, hence the "strange" loop here.. */
i = 0;
do
{
c = TT_Char_Index( charMap, i );
if ( c > 0 )
{
if ( id )
*id = c;
return i;
}
i++;
} while ( i != 0 ); /* because i is UShort! */
return -1;
}
}
static Long charmap_first4( PCMap4 cmap4,
UShort* id )
{
UShort firstCode;
if ( cmap4->segCountX2 / 2 < 1 )
return -1;
firstCode = cmap4->segments[0].startCount;
if ( id )
*id = charmap_find_id4( cmap4, firstCode, &(cmap4->segments[0]), 0 );
return firstCode;
}
/*******************************************************************
*
* Function : TT_CharMap_Next
*
* Description : Returns the next valid character code in a given
* charMap.
*
* Input : charMap handle to the target char. map
* index starting character code
* id address where the glyph index of the next
* character will be returned
*
* Output : Next valid character code after 'index'. -1 in case
* of failure.
*
* Notes :
*
******************************************************************/
EXPORT_FUNC
TT_Long TT_CharMap_Next( TT_CharMap charMap,
TT_UShort index,
TT_UShort* id )
{
PCMapTable cmap;
UShort i, c;
cmap = HANDLE_CharMap( charMap );
if ( !cmap )
return -1;
switch ( cmap->format )
{
case 0:
if ( index < 255 )
{
if ( id )
*id = cmap->c.cmap0.glyphIdArray[index + 1];
return index + 1;
}
else
return -1;
case 4:
return charmap_next4( &cmap->c.cmap4, index, id );
case 6:
{
UShort firstCode = cmap->c.cmap6.firstCode;
if ( index + 1 < firstCode + cmap->c.cmap6.entryCount )
{
if ( id )
*id = cmap->c.cmap6.glyphIdArray[index + 1 - firstCode];
return index + 1;
}
else
return -1;
}
default:
/* Now loop from 0 to 65535. We can't use a simple "for" on */
/* 16-bits systems, hence the "strange" loop here.. */
i = 0;
do
{
c = TT_Char_Index( charMap, i );
if ( c > 0 )
{
if ( id )
*id = c;
return i;
}
i++;
} while ( i != 0 ); /* because i is UShort! */
return -1;
}
}
static Long charmap_next4( PCMap4 cmap4,
UShort charCode,
UShort* id)
{
UShort segCount, nextCode;
UShort i;
TCMap4Segment seg4;
if ( charCode == 0xFFFF )
return -1; /* get it out of the way now */
segCount = cmap4->segCountX2 / 2;
for ( i = 0; i < segCount; i++ )
if ( charCode < cmap4->segments[i].endCount )
break;
/* Safety check - even though the last endCount should be 0xFFFF */
if ( i >= segCount )
return -1;
seg4 = cmap4->segments[i];
if ( charCode < seg4.startCount )
nextCode = seg4.startCount;
else
nextCode = charCode + 1;
if ( id )
*id = charmap_find_id4( cmap4, nextCode, &seg4, i );
return nextCode;
}
static UShort
charmap_find_id4( PCMap4 cmap4,
UShort charCode,
TCMap4Segment* seg4,
UShort i )
{
UShort index1;
if ( seg4->idRangeOffset == 0 )
return (charCode + seg4->idDelta) & 0xFFFF;
else
{
index1 = seg4->idRangeOffset / 2 + charCode-seg4->startCount -
( cmap4->segCountX2 / 2 - i );
if ( index1 >= cmap4->numGlyphId || cmap4->glyphIdArray[index1] == 0 )
return 0;
else
return (cmap4->glyphIdArray[index1] + seg4->idDelta) & 0xFFFF;
}
}
/*******************************************************************
*
* Function : TT_CharMap_Last
*
* Description : Returns the last valid character code in a
* given character map. Also returns the corresponding
* glyph index.
*
* Input : charMap handle to the target character map
* id address where the glyph index will be
* be returned in case of success
*
* Output : Last valid character code. -1 in case of failure.
*
* Notes :
*
******************************************************************/
EXPORT_FUNC
TT_Long TT_CharMap_Last( TT_CharMap charMap,
TT_UShort* id )
{
PCMapTable cmap;
UShort i, c;
if ( !( cmap = HANDLE_CharMap( charMap ) ) )
return -1;
switch ( cmap->format )
{
case 0:
if ( id )
*id = cmap->c.cmap0.glyphIdArray[255];
return 255;
case 4:
return charmap_last4( &cmap->c.cmap4, id );
case 6:
if ( cmap->c.cmap6.entryCount < 1 )
return -1;
if ( id )
*id = cmap->c.cmap6.glyphIdArray[cmap->c.cmap6.entryCount - 1];
return cmap->c.cmap6.firstCode + cmap->c.cmap6.entryCount - 1;
default:
i = 65535;
do
{
c = TT_Char_Index( charMap, i );
if ( c > 0 )
{
if ( id )
*id = c;
return i;
}
i--;
} while ( i != 0 );
return -1;
}
}
static Long charmap_last4( PCMap4 cmap4,
UShort* id )
{
UShort lastCode;
if ( cmap4->segCountX2 / 2 < 1 )
return -1;
lastCode = cmap4->segments[cmap4->segCountX2 / 2 - 1].endCount;
if ( id )
*id = charmap_find_id4( cmap4,
lastCode,
&(cmap4->segments[cmap4->segCountX2 / 2 - 1]),
0 );
return lastCode;
}
/* END */

60
lib/extend/ftxcmap.h Normal file
View File

@@ -0,0 +1,60 @@
/*******************************************************************
*
* ftxcmap.h 1.0
*
* API extension for iterating over Cmaps
*
* Copyright 1996-1999 by Juliusz Chroboczek,
* 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.
*
*
******************************************************************/
#ifndef FTXCMAP_H
#define FTXCMAP_H
#include "freetype.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Find the first entry of a Cmap. Its glyph index is returned */
/* in the "id" field, while the function returns the first valid */
/* character code in the Cmap. It returns -1 in case of failure. */
EXPORT_DEF
TT_Long TT_CharMap_First( TT_CharMap charMap,
TT_UShort* id );
/* Find the next entry of Cmap. Same return conventions. */
EXPORT_DEF
TT_Long TT_CharMap_Next( TT_CharMap charMap,
TT_UShort startId,
TT_UShort* id );
/* Find the last entry of a Cmap. Its glyph index is returned */
/* in the "id" field, while the function returns the last valid */
/* character code in the Cmap. It returns -1 in case of failure. */
EXPORT_DEF
TT_Long TT_CharMap_Last( TT_CharMap charMap,
TT_UShort* id );
#ifdef __cplusplus
}
#endif
#endif /* FTXCMAP_H */
/* END */

241
lib/extend/ftxerr18.c Normal file
View File

@@ -0,0 +1,241 @@
/****************************************************************************/
/* */
/* Erwin Dieterich, 15. 10. 1997 */
/* - 15. 08. 1999 */
/* */
/* TT_ErrToString: translate error codes to character strings */
/* */
/* This extension provides internationalized error strings from the */
/* various error messages. It uses the "gettext" package if available */
/* or returns English/American message strings if not. */
/* */
/* If you do not want to use it, or if you encounter some problems */
/* compiling this file, try to disable nls support when invoking */
/* ./configure (on Unix). */
/* */
/* */
/****************************************************************************/
#include "ttconfig.h"
#include "ftxerr18.h"
#include "ftxkern.h"
#include "ftxpost.h"
#include "ftxopen.h"
#ifdef HAVE_LOCALE_H
#include <locale.h>
#endif
#ifdef HAVE_LIBINTL_H
#include <libintl.h>
#undef _
#define _( String ) dgettext( "freetype", String )
#else
#define _( String ) ( String )
#endif
EXPORT_FUNC
TT_String* TT_ErrToString18( TT_Error error )
{
switch ( error )
{
/* ----- high-level API error codes ----- */
case TT_Err_Ok:
return _( "Successful function call, no error." );
case TT_Err_Invalid_Face_Handle:
return _( "Invalid face handle." );
case TT_Err_Invalid_Instance_Handle:
return _( "Invalid instance handle." );
case TT_Err_Invalid_Glyph_Handle:
return _( "Invalid glyph handle." );
case TT_Err_Invalid_CharMap_Handle:
return _( "Invalid charmap handle." );
case TT_Err_Invalid_Result_Address:
return _( "Invalid result address." );
case TT_Err_Invalid_Glyph_Index:
return _( "Invalid glyph index." );
case TT_Err_Invalid_Argument:
return _( "Invalid argument." );
case TT_Err_Could_Not_Open_File:
return _( "Could not open file." );
case TT_Err_File_Is_Not_Collection:
return _( "File is not a TrueType collection." );
case TT_Err_Table_Missing:
return _( "Mandatory table missing." );
case TT_Err_Invalid_Horiz_Metrics:
return _( "Invalid horizontal metrics (hmtx table broken)." );
case TT_Err_Invalid_CharMap_Format:
return _( "Invalid charmap format." );
case TT_Err_Invalid_PPem:
return _( "Invalid ppem value." );
case TT_Err_Invalid_Vert_Metrics:
return _( "Invalid vertical metrics (vmtx table broken)." );
case TT_Err_Invalid_File_Format:
return _( "Invalid file format." );
case TT_Err_Invalid_Engine:
return _( "Invalid engine." );
case TT_Err_Too_Many_Extensions:
return _( "Too many extensions." );
case TT_Err_Extensions_Unsupported:
return _( "Extensions unsupported." );
case TT_Err_Invalid_Extension_Id:
return _( "Invalid extension id." );
case TT_Err_No_Vertical_Data:
return _( "No vertical data in font." );
case TT_Err_Max_Profile_Missing:
return _( "Maximum Profile (maxp) table missing." );
case TT_Err_Header_Table_Missing:
return _( "Font Header (head) table missing." );
case TT_Err_Horiz_Header_Missing:
return _( "Horizontal Header (hhea) table missing." );
case TT_Err_Locations_Missing:
return _( "Index to Location (loca) table missing." );
case TT_Err_Name_Table_Missing:
return _( "Naming (name) table missing." );
case TT_Err_CMap_Table_Missing:
return _( "Character to Glyph Index Mapping (cmap) tables missing." );
case TT_Err_Hmtx_Table_Missing:
return _( "Horizontal Metrics (hmtx) table missing." );
case TT_Err_OS2_Table_Missing:
return _( "OS/2 table missing." );
case TT_Err_Post_Table_Missing:
return _( "PostScript (post) table missing." );
case TT_Err_Glyf_Table_Missing:
return _( "Glyph (glyf) table missing." );
/* ----- memory component error codes ----- */
case TT_Err_Out_Of_Memory:
return _( "Out of memory." );
/* ----- file component error codes ----- */
case TT_Err_Invalid_File_Offset:
return _( "Invalid file offset." );
case TT_Err_Invalid_File_Read:
return _( "Invalid file read." );
case TT_Err_Invalid_Frame_Access:
return _( "Invalid frame access." );
/* ----- glyph loader error codes ----- */
case TT_Err_Too_Many_Points:
return _( "Too many points." );
case TT_Err_Too_Many_Contours:
return _( "Too many contours." );
case TT_Err_Invalid_Composite:
return _( "Invalid composite glyph." );
case TT_Err_Too_Many_Ins:
return _( "Too many instructions." );
/* ----- byte-code interpreter error codes ----- */
case TT_Err_Invalid_Opcode:
return _( "Invalid opcode." );
case TT_Err_Too_Few_Arguments:
return _( "Too few arguments." );
case TT_Err_Stack_Overflow:
return _( "Stack overflow." );
case TT_Err_Code_Overflow:
return _( "Code overflow." );
case TT_Err_Bad_Argument:
return _( "Bad argument." );
case TT_Err_Divide_By_Zero:
return _( "Divide by zero." );
case TT_Err_Storage_Overflow:
return _( "Storage overflow." );
case TT_Err_Cvt_Overflow:
return _( "Control Value (cvt) table overflow." );
case TT_Err_Invalid_Reference:
return _( "Invalid reference." );
case TT_Err_Invalid_Distance:
return _( "Invalid distance." );
case TT_Err_Interpolate_Twilight:
return _( "Interpolate twilight points." );
case TT_Err_Debug_OpCode:
return _( "`DEBUG' opcode found." );
case TT_Err_ENDF_In_Exec_Stream:
return _( "`ENDF' in byte-code stream." );
case TT_Err_Out_Of_CodeRanges:
return _( "Out of code ranges." );
case TT_Err_Nested_DEFS:
return _( "Nested function definitions." );
case TT_Err_Invalid_CodeRange:
return _( "Invalid code range." );
case TT_Err_Invalid_Displacement:
return _( "Invalid displacement." );
case TT_Err_Execution_Too_Long:
return _( "Endless loop encountered while executing instructions." );
/* ----- internal failure error codes ----- */
case TT_Err_Nested_Frame_Access:
return _( "Nested frame access." );
case TT_Err_Invalid_Cache_List:
return _( "Invalid cache list." );
case TT_Err_Could_Not_Find_Context:
return _( "Could not find context." );
case TT_Err_Unlisted_Object:
return _( "Unlisted object." );
/* ----- scan-line converter error codes ----- */
case TT_Err_Raster_Pool_Overflow:
return _( "Raster pool overflow." );
case TT_Err_Raster_Negative_Height:
return _( "Raster: negative height encountered." );
case TT_Err_Raster_Invalid_Value:
return _( "Raster: invalid value." );
case TT_Err_Raster_Not_Initialized:
return _( "Raster not initialized." );
/* ----- engine extensions error codes ----- */
case TT_Err_Invalid_Kerning_Table_Format:
return _( "Invalid kerning (kern) table format." );
case TT_Err_Invalid_Kerning_Table:
return _( "Invalid kerning (kern) table." );
case TT_Err_Invalid_Post_Table_Format:
return _( "Invalid PostScript (post) table format." );
case TT_Err_Invalid_Post_Table:
return _( "Invalid PostScript (post) table." );
/* ----- TrueType Open extension error codes ----- */
case TTO_Err_Invalid_SubTable_Format:
return _( "Invalid TrueType Open subtable format." );
case TTO_Err_Invalid_SubTable:
return _( "Invalid TrueType Open subtable." );
case TTO_Err_Not_Covered:
return _( "Glyph(s) not covered by lookup." );
case TTO_Err_Too_Many_Nested_Contexts:
return _( "Too many nested context substitutions." );
case TTO_Err_Invalid_GSUB_SubTable_Format:
return _( "Invalid glyph substitution (GSUB) table format." );
case TTO_Err_Invalid_GSUB_SubTable:
return _( "Invalid glyph substitution (GSUB) table." );
case TTO_Err_Invalid_GPOS_SubTable_Format:
return _( "Invalid glyph positioning (GPOS) table format." );
case TTO_Err_Invalid_GPOS_SubTable:
return _( "Invalid glyph positioning (GPOS) table." );
default:
;
}
return _( "Invalid Error Number." );
}
/* END */

38
lib/extend/ftxerr18.h Normal file
View File

@@ -0,0 +1,38 @@
/****************************************************************************/
/* */
/* Erwin Dieterich, 15. 10. 1997 */
/* - 15. 08. 1999 */
/* */
/* TT_ErrToString: translate error codes to character strings */
/* */
/* This extension provides internationalized error strings from the */
/* various error messages. It uses the "gettext" package where available */
/* or returns english/american message strings if not. */
/* */
/* If you do not want to use it, or if you encounter some problems */
/* compiling this file, try to disable nls support by configuring */
/* FreeType with ./configure --disable-nls */
/* */
/* */
/****************************************************************************/
#ifndef FTXERR18_H
#define FTXERR18_H
#include "freetype.h"
#ifdef __cplusplus
extern "C" {
#endif
EXPORT_DEF
TT_String* TT_ErrToString18( TT_Error i );
#ifdef __cplusplus
}
#endif
#endif /* FTXERR18_H */
/* END */

69
lib/extend/ftxgasp.c Normal file
View File

@@ -0,0 +1,69 @@
/*******************************************************************
*
* ftxgasp.c 1.0
*
* Gasp table support API extension body
*
* Copyright 1996-1999 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.
*
*
* The gasp table is currently loaded by the core engine, but the
* standard API doesn't give access to it. This file is used to
* demonstrate the use of a simple API extension.
*
******************************************************************/
#include "ftxgasp.h"
#include "tttypes.h"
#include "ttobjs.h"
#include "tttables.h"
EXPORT_FUNC
TT_Error TT_Get_Face_Gasp_Flags( TT_Face face,
TT_UShort point_size,
TT_Bool* grid_fit,
TT_Bool* smooth_font )
{
PFace faze = HANDLE_Face( face );
UShort i, flag;
if ( !faze )
return TT_Err_Invalid_Face_Handle;
if ( faze->gasp.numRanges == 0 || !faze->gasp.gaspRanges )
return TT_Err_Table_Missing;
for ( i = 0; i < faze->gasp.numRanges; i++ )
{
if ( point_size <= faze->gasp.gaspRanges[i].maxPPEM )
{
flag = faze->gasp.gaspRanges[i].gaspFlag;
*grid_fit = ( (flag & GASP_GRIDFIT) != 0 );
*smooth_font = ( (flag & GASP_DOGRAY ) != 0 );
return TT_Err_Ok;
}
}
/* for very large fonts we enable font smoothing and discard */
/* grid fitting */
*grid_fit = 0;
*smooth_font = 1;
return TT_Err_Ok;
}
/* END */

53
lib/extend/ftxgasp.h Normal file
View File

@@ -0,0 +1,53 @@
/*******************************************************************
*
* ftxgasp.h 1.0
*
* Gasp table support API extension
*
* Copyright 1996-1999 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.
*
*
* The gasp table is currently loaded by the core engine, but the
* standard API doesn't give access to it. This file is used to
* demonstrate the use of a simple API extension.
*
******************************************************************/
#ifndef FTXGASP_H
#define FTXGASP_H
#include "freetype.h"
#ifdef __cplusplus
extern "C" {
#endif
/* This function returns for a given 'point_size' the values of the */
/* gasp flags 'grid_fit' and 'smooth_font'. The returned values */
/* are booleans (where 0 = NO, and 1 = YES). */
/* Note that this function will return TT_Err_Table_Missing if */
/* the font file doesn't contain any gasp table. */
EXPORT_DEF
TT_Error TT_Get_Face_Gasp_Flags( TT_Face face,
TT_UShort point_size,
TT_Bool* grid_fit,
TT_Bool* smooth_font );
#ifdef __cplusplus
}
#endif
#endif /* FTXGASP_H */
/* END */

1099
lib/extend/ftxgdef.c Normal file

File diff suppressed because it is too large Load Diff

216
lib/extend/ftxgdef.h Normal file
View File

@@ -0,0 +1,216 @@
/*******************************************************************
*
* ftxgdef.h
*
* TrueType Open GDEF table support
*
* Copyright 1996-1999 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.
*
******************************************************************/
#ifndef FTXOPEN_H
#error "Don't include this file! Use ftxopen.h instead."
#endif
#ifndef FTXGDEF_H
#define FTXGDEF_H
#ifdef __cplusplus
extern "C" {
#endif
#define TTO_Err_Invalid_GDEF_SubTable_Format 0x1030
#define TTO_Err_Invalid_GDEF_SubTable 0x1031
/* GDEF glyph classes */
#define UNCLASSIFIED_GLYPH 0
#define SIMPLE_GLYPH 1
#define LIGATURE_GLYPH 2
#define MARK_GLYPH 3
#define COMPONENT_GLYPH 4
/* GDEF glyph properties, corresponding to class values 1-4. Note that
TTO_COMPONENT has no corresponding flag in the LookupFlag field. */
#define TTO_BASE_GLYPH 0x0002
#define TTO_LIGATURE 0x0004
#define TTO_MARK 0x0008
#define TTO_COMPONENT 0x0010
/* Attachment related structures */
struct TTO_AttachPoint_
{
TT_UShort PointCount; /* size of the PointIndex array */
TT_UShort* PointIndex; /* array of contour points */
};
typedef struct TTO_AttachPoint_ TTO_AttachPoint;
struct TTO_AttachList_
{
TT_Bool loaded;
TTO_Coverage Coverage; /* Coverage table */
TT_UShort GlyphCount; /* number of glyphs with
attachments */
TTO_AttachPoint* AttachPoint; /* array of AttachPoint tables */
};
typedef struct TTO_AttachList_ TTO_AttachList;
/* Ligature Caret related structures */
struct TTO_CaretValueFormat1_
{
TT_Short Coordinate; /* x or y value (in design units) */
};
typedef struct TTO_CaretValueFormat1_ TTO_CaretValueFormat1;
struct TTO_CaretValueFormat2_
{
TT_UShort CaretValuePoint; /* contour point index on glyph */
};
typedef struct TTO_CaretValueFormat2_ TTO_CaretValueFormat2;
struct TTO_CaretValueFormat3_
{
TT_Short Coordinate; /* x or y value (in design units) */
TTO_Device Device; /* Device table for x or y value */
};
typedef struct TTO_CaretValueFormat3_ TTO_CaretValueFormat3;
struct TTO_CaretValueFormat4_
{
TT_UShort IdCaretValue; /* metric ID */
};
typedef struct TTO_CaretValueFormat4_ TTO_CaretValueFormat4;
struct TTO_CaretValue_
{
TT_UShort CaretValueFormat; /* 1, 2, 3, or 4 */
union
{
TTO_CaretValueFormat1 cvf1;
TTO_CaretValueFormat2 cvf2;
TTO_CaretValueFormat3 cvf3;
TTO_CaretValueFormat4 cvf4;
} cvf;
};
typedef struct TTO_CaretValue_ TTO_CaretValue;
struct TTO_LigGlyph_
{
TT_Bool loaded;
TT_UShort CaretCount; /* number of caret values */
TTO_CaretValue* CaretValue; /* array of caret values */
};
typedef struct TTO_LigGlyph_ TTO_LigGlyph;
struct TTO_LigCaretList_
{
TT_Bool loaded;
TTO_Coverage Coverage; /* Coverage table */
TT_UShort LigGlyphCount; /* number of ligature glyphs */
TTO_LigGlyph* LigGlyph; /* array of LigGlyph tables */
};
typedef struct TTO_LigCaretList_ TTO_LigCaretList;
/* The `NewGlyphClasses' field is not defined in the TTO specification.
We use it for fonts with a constructed `GlyphClassDef' structure
(i.e., which don't have a GDEF table) to collect glyph classes
assigned during the lookup process. The number of arrays in this
pointer array is GlyphClassDef->cd.cd2.ClassRangeCount+1; the nth
array then contains the glyph class values of the glyphs not covered
by the ClassRangeRecords structures with index n-1 and n. We store
glyph class values for four glyphs in a single array element.
`LastGlyph' is identical to the number of glyphs minus one in the
font; we need it only if `NewGlyphClasses' is not NULL (to have an
upper bound for the last array).
Note that we first store the file offset to the `MarkAttachClassDef'
field (which has been introduced in OpenType 1.2) -- since the
`Version' field value hasn't been increased to indicate that we have
one more field for some obscure reason, we must parse the GSUB table
to find out whether class values refer to this table. Only then we
can finally load the MarkAttachClassDef structure if necessary. */
struct TTO_GDEFHeader_
{
TT_Bool loaded;
TT_ULong offset;
TT_Fixed Version;
TTO_ClassDefinition GlyphClassDef;
TTO_AttachList AttachList;
TTO_LigCaretList LigCaretList;
TT_ULong MarkAttachClassDef_offset;
TTO_ClassDefinition MarkAttachClassDef; /* new in OT 1.2 */
TT_UShort LastGlyph;
TT_UShort** NewGlyphClasses;
};
typedef struct TTO_GDEFHeader_ TTO_GDEFHeader;
/* finally, the GDEF API */
EXPORT_DEF
TT_Error TT_Init_GDEF_Extension( TT_Engine engine );
EXPORT_DEF
TT_Error TT_Load_GDEF_Table( TT_Face face,
TTO_GDEFHeader* gdef );
EXPORT_DEF
TT_Error TT_GDEF_Get_Glyph_Property( TTO_GDEFHeader* gdef,
TT_UShort glyphID,
TT_UShort* property );
EXPORT_DEF
TT_Error TT_GDEF_Build_ClassDefinition( TTO_GDEFHeader* gdef,
TT_UShort num_glyphs,
TT_UShort glyph_count,
TT_UShort* glyph_array,
TT_UShort* class_array );
#ifdef __cplusplus
}
#endif
#endif /* FTXGDEF_H */
/* END */

4045
lib/extend/ftxgpos.c Normal file

File diff suppressed because it is too large Load Diff

767
lib/extend/ftxgpos.h Normal file
View File

@@ -0,0 +1,767 @@
/*******************************************************************
*
* ftxgpos.h
*
* TrueType Open GPOS table support
*
* Copyright 1996-1999 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.
*
******************************************************************/
#ifndef FTXOPEN_H
#error "Don't include this file! Use ftxopen.h instead."
#endif
#ifndef FTXGPOS_H
#define FTXGPOS_H
#ifdef __cplusplus
extern "C" {
#endif
#define TTO_Err_Invalid_GPOS_SubTable_Format 0x1020
#define TTO_Err_Invalid_GPOS_SubTable 0x1021
/* Lookup types for glyph positioning */
#define GPOS_LOOKUP_SINGLE 1
#define GPOS_LOOKUP_PAIR 2
#define GPOS_LOOKUP_CURSIVE 3
#define GPOS_LOOKUP_MARKBASE 4
#define GPOS_LOOKUP_MARKLIG 5
#define GPOS_LOOKUP_MARKMARK 6
#define GPOS_LOOKUP_CONTEXT 7
#define GPOS_LOOKUP_CHAIN 8
struct TTO_GPOSHeader_
{
TT_Bool loaded;
TT_ULong offset;
TT_Fixed Version;
TTO_ScriptList ScriptList;
TTO_FeatureList FeatureList;
TTO_LookupList LookupList;
TTO_GDEFHeader* gdef;
};
typedef struct TTO_GPOSHeader_ TTO_GPOSHeader;
/* shared tables */
struct TTO_ValueRecord_
{
TT_Short XPlacement; /* horizontal adjustment for
placement */
TT_Short YPlacement; /* vertical adjustment for
placement */
TT_Short XAdvance; /* horizontal adjustment for
advance */
TT_Short YAdvance; /* vertical adjustment for
advance */
TTO_Device XPlacementDevice; /* device table for horizontal
placement */
TTO_Device YPlacementDevice; /* device table for vertical
placement */
TTO_Device XAdvanceDevice; /* device table for horizontal
advance */
TTO_Device YAdvanceDevice; /* device table for vertical
advance */
TT_UShort XIdPlacement; /* horizontal placement metric ID */
TT_UShort YIdPlacement; /* vertical placement metric ID */
TT_UShort XIdAdvance; /* horizontal advance metric ID */
TT_UShort YIdAdvance; /* vertical advance metric ID */
};
typedef struct TTO_ValueRecord_ TTO_ValueRecord;
/* Mask values to scan the value format of the ValueRecord structure.
We always expand compressed ValueRecords of the font. */
#define HAVE_X_PLACEMENT 0x0001
#define HAVE_Y_PLACEMENT 0x0002
#define HAVE_X_ADVANCE 0x0004
#define HAVE_Y_ADVANCE 0x0008
#define HAVE_X_PLACEMENT_DEVICE 0x0010
#define HAVE_Y_PLACEMENT_DEVICE 0x0020
#define HAVE_X_ADVANCE_DEVICE 0x0040
#define HAVE_Y_ADVANCE_DEVICE 0x0080
#define HAVE_X_ID_PLACEMENT 0x0100
#define HAVE_Y_ID_PLACEMENT 0x0200
#define HAVE_X_ID_ADVANCE 0x0400
#define HAVE_Y_ID_ADVANCE 0x0800
struct TTO_AnchorFormat1_
{
TT_Short XCoordinate; /* horizontal value */
TT_Short YCoordinate; /* vertical value */
};
typedef struct TTO_AnchorFormat1_ TTO_AnchorFormat1;
struct TTO_AnchorFormat2_
{
TT_Short XCoordinate; /* horizontal value */
TT_Short YCoordinate; /* vertical value */
TT_UShort AnchorPoint; /* index to glyph contour point */
};
typedef struct TTO_AnchorFormat2_ TTO_AnchorFormat2;
struct TTO_AnchorFormat3_
{
TT_Short XCoordinate; /* horizontal value */
TT_Short YCoordinate; /* vertical value */
TTO_Device XDeviceTable; /* device table for X coordinate */
TTO_Device YDeviceTable; /* device table for Y coordinate */
};
typedef struct TTO_AnchorFormat3_ TTO_AnchorFormat3;
struct TTO_AnchorFormat4_
{
TT_UShort XIdAnchor; /* horizontal metric ID */
TT_UShort YIdAnchor; /* vertical metric ID */
};
typedef struct TTO_AnchorFormat4_ TTO_AnchorFormat4;
struct TTO_Anchor_
{
TT_UShort PosFormat; /* 1, 2, 3, or 4 -- 0 indicates
that there is no Anchor table */
union
{
TTO_AnchorFormat1 af1;
TTO_AnchorFormat2 af2;
TTO_AnchorFormat3 af3;
TTO_AnchorFormat4 af4;
} af;
};
typedef struct TTO_Anchor_ TTO_Anchor;
struct TTO_MarkRecord_
{
TT_UShort Class; /* mark class */
TTO_Anchor MarkAnchor; /* anchor table */
};
typedef struct TTO_MarkRecord_ TTO_MarkRecord;
struct TTO_MarkArray_
{
TT_UShort MarkCount; /* number of MarkRecord tables */
TTO_MarkRecord* MarkRecord; /* array of MarkRecord tables */
};
typedef struct TTO_MarkArray_ TTO_MarkArray;
/* LookupType 1 */
struct TTO_SinglePosFormat1_
{
TTO_ValueRecord Value; /* ValueRecord for all covered
glyphs */
};
typedef struct TTO_SinglePosFormat1_ TTO_SinglePosFormat1;
struct TTO_SinglePosFormat2_
{
TT_UShort ValueCount; /* number of ValueRecord tables */
TTO_ValueRecord* Value; /* array of ValueRecord tables */
};
typedef struct TTO_SinglePosFormat2_ TTO_SinglePosFormat2;
struct TTO_SinglePos_
{
TT_UShort PosFormat; /* 1 or 2 */
TTO_Coverage Coverage; /* Coverage table */
TT_UShort ValueFormat; /* format of ValueRecord table */
union
{
TTO_SinglePosFormat1 spf1;
TTO_SinglePosFormat2 spf2;
} spf;
};
typedef struct TTO_SinglePos_ TTO_SinglePos;
/* LookupType 2 */
struct TTO_PairValueRecord_
{
TT_UShort SecondGlyph; /* glyph ID for second glyph */
TTO_ValueRecord Value1; /* pos. data for first glyph */
TTO_ValueRecord Value2; /* pos. data for second glyph */
};
typedef struct TTO_PairValueRecord_ TTO_PairValueRecord;
struct TTO_PairSet_
{
TT_UShort PairValueCount;
/* number of PairValueRecord tables */
TTO_PairValueRecord* PairValueRecord;
/* array of PairValueRecord tables */
};
typedef struct TTO_PairSet_ TTO_PairSet;
struct TTO_PairPosFormat1_
{
TT_UShort PairSetCount; /* number of PairSet tables */
TTO_PairSet* PairSet; /* array of PairSet tables */
};
typedef struct TTO_PairPosFormat1_ TTO_PairPosFormat1;
struct TTO_Class2Record_
{
TTO_ValueRecord Value1; /* pos. data for first glyph */
TTO_ValueRecord Value2; /* pos. data for second glyph */
};
typedef struct TTO_Class2Record_ TTO_Class2Record;
struct TTO_Class1Record_
{
TTO_Class2Record* Class2Record; /* array of Class2Record tables */
};
typedef struct TTO_Class1Record_ TTO_Class1Record;
struct TTO_PairPosFormat2_
{
TTO_ClassDefinition ClassDef1; /* class def. for first glyph */
TTO_ClassDefinition ClassDef2; /* class def. for second glyph */
TT_UShort Class1Count; /* number of classes in ClassDef1
table */
TT_UShort Class2Count; /* number of classes in ClassDef2
table */
TTO_Class1Record* Class1Record; /* array of Class1Record tables */
};
typedef struct TTO_PairPosFormat2_ TTO_PairPosFormat2;
struct TTO_PairPos_
{
TT_UShort PosFormat; /* 1 or 2 */
TTO_Coverage Coverage; /* Coverage table */
TT_UShort ValueFormat1; /* format of ValueRecord table
for first glyph */
TT_UShort ValueFormat2; /* format of ValueRecord table
for second glyph */
union
{
TTO_PairPosFormat1 ppf1;
TTO_PairPosFormat2 ppf2;
} ppf;
};
typedef struct TTO_PairPos_ TTO_PairPos;
/* LookupType 3 */
struct TTO_EntryExitRecord_
{
TTO_Anchor EntryAnchor; /* entry Anchor table */
TTO_Anchor ExitAnchor; /* exit Anchor table */
};
typedef struct TTO_EntryExitRecord_ TTO_EntryExitRecord;
struct TTO_CursivePos_
{
TT_UShort PosFormat; /* always 1 */
TTO_Coverage Coverage; /* Coverage table */
TT_UShort EntryExitCount;
/* number of EntryExitRecord tables */
TTO_EntryExitRecord* EntryExitRecord;
/* array of EntryExitRecord tables */
};
typedef struct TTO_CursivePos_ TTO_CursivePos;
/* LookupType 4 */
struct TTO_BaseRecord_
{
TTO_Anchor* BaseAnchor; /* array of base glyph anchor
tables */
};
typedef struct TTO_BaseRecord_ TTO_BaseRecord;
struct TTO_BaseArray_
{
TT_UShort BaseCount; /* number of BaseRecord tables */
TTO_BaseRecord* BaseRecord; /* array of BaseRecord tables */
};
typedef struct TTO_BaseArray_ TTO_BaseArray;
struct TTO_MarkBasePos_
{
TT_UShort PosFormat; /* always 1 */
TTO_Coverage MarkCoverage; /* mark glyph coverage table */
TTO_Coverage BaseCoverage; /* base glyph coverage table */
TT_UShort ClassCount; /* number of mark classes */
TTO_MarkArray MarkArray; /* mark array table */
TTO_BaseArray BaseArray; /* base array table */
};
typedef struct TTO_MarkBasePos_ TTO_MarkBasePos;
/* LookupType 5 */
struct TTO_ComponentRecord_
{
TTO_Anchor* LigatureAnchor; /* array of ligature glyph anchor
tables */
};
typedef struct TTO_ComponentRecord_ TTO_ComponentRecord;
struct TTO_LigatureAttach_
{
TT_UShort ComponentCount;
/* number of ComponentRecord tables */
TTO_ComponentRecord* ComponentRecord;
/* array of ComponentRecord tables */
};
typedef struct TTO_LigatureAttach_ TTO_LigatureAttach;
struct TTO_LigatureArray_
{
TT_UShort LigatureCount; /* number of LigatureAttach tables */
TTO_LigatureAttach* LigatureAttach;
/* array of LigatureAttach tables */
};
typedef struct TTO_LigatureArray_ TTO_LigatureArray;
struct TTO_MarkLigPos_
{
TT_UShort PosFormat; /* always 1 */
TTO_Coverage MarkCoverage; /* mark glyph coverage table */
TTO_Coverage LigatureCoverage;
/* ligature glyph coverage table */
TT_UShort ClassCount; /* number of mark classes */
TTO_MarkArray MarkArray; /* mark array table */
TTO_LigatureArray LigatureArray; /* ligature array table */
};
typedef struct TTO_MarkLigPos_ TTO_MarkLigPos;
/* LookupType 6 */
struct TTO_Mark2Record_
{
TTO_Anchor* Mark2Anchor; /* array of mark glyph anchor
tables */
};
typedef struct TTO_Mark2Record_ TTO_Mark2Record;
struct TTO_Mark2Array_
{
TT_UShort Mark2Count; /* number of Mark2Record tables */
TTO_Mark2Record* Mark2Record; /* array of Mark2Record tables */
};
typedef struct TTO_Mark2Array_ TTO_Mark2Array;
struct TTO_MarkMarkPos_
{
TT_UShort PosFormat; /* always 1 */
TTO_Coverage Mark1Coverage; /* first mark glyph coverage table */
TTO_Coverage Mark2Coverage; /* second mark glyph coverave table */
TT_UShort ClassCount; /* number of combining mark classes */
TTO_MarkArray Mark1Array; /* MarkArray table for first mark */
TTO_Mark2Array Mark2Array; /* MarkArray table for second mark */
};
typedef struct TTO_MarkMarkPos_ TTO_MarkMarkPos;
/* needed by both lookup type 7 and 8 */
struct TTO_PosLookupRecord_
{
TT_UShort SequenceIndex; /* index into current
glyph sequence */
TT_UShort LookupListIndex; /* Lookup to apply to that pos. */
};
typedef struct TTO_PosLookupRecord_ TTO_PosLookupRecord;
/* LookupType 7 */
struct TTO_PosRule_
{
TT_UShort GlyphCount; /* total number of input glyphs */
TT_UShort PosCount; /* number of PosLookupRecord tables */
TT_UShort* Input; /* array of input glyph IDs */
TTO_PosLookupRecord* PosLookupRecord;
/* array of PosLookupRecord tables */
};
typedef struct TTO_PosRule_ TTO_PosRule;
struct TTO_PosRuleSet_
{
TT_UShort PosRuleCount; /* number of PosRule tables */
TTO_PosRule* PosRule; /* array of PosRule tables */
};
typedef struct TTO_PosRuleSet_ TTO_PosRuleSet;
struct TTO_ContextPosFormat1_
{
TTO_Coverage Coverage; /* Coverage table */
TT_UShort PosRuleSetCount; /* number of PosRuleSet tables */
TTO_PosRuleSet* PosRuleSet; /* array of PosRuleSet tables */
};
typedef struct TTO_ContextPosFormat1_ TTO_ContextPosFormat1;
struct TTO_PosClassRule_
{
TT_UShort GlyphCount; /* total number of context classes */
TT_UShort PosCount; /* number of PosLookupRecord tables */
TT_UShort* Class; /* array of classes */
TTO_PosLookupRecord* PosLookupRecord;
/* array of PosLookupRecord tables */
};
typedef struct TTO_PosClassRule_ TTO_PosClassRule;
struct TTO_PosClassSet_
{
TT_UShort PosClassRuleCount;
/* number of PosClassRule tables */
TTO_PosClassRule* PosClassRule; /* array of PosClassRule tables */
};
typedef struct TTO_PosClassSet_ TTO_PosClassSet;
/* The `MaxContextLength' field is not defined in the TTO specification
but simplifies the implementation of this format. It holds the
maximal context length used in the context rules. */
struct TTO_ContextPosFormat2_
{
TT_UShort MaxContextLength;
/* maximal context length */
TTO_Coverage Coverage; /* Coverage table */
TTO_ClassDefinition ClassDef; /* ClassDef table */
TT_UShort PosClassSetCount;
/* number of PosClassSet tables */
TTO_PosClassSet* PosClassSet; /* array of PosClassSet tables */
};
typedef struct TTO_ContextPosFormat2_ TTO_ContextPosFormat2;
struct TTO_ContextPosFormat3_
{
TT_UShort GlyphCount; /* number of input glyphs */
TT_UShort PosCount; /* number of PosLookupRecord tables */
TTO_Coverage* Coverage; /* array of Coverage tables */
TTO_PosLookupRecord* PosLookupRecord;
/* array of PosLookupRecord tables */
};
typedef struct TTO_ContextPosFormat3_ TTO_ContextPosFormat3;
struct TTO_ContextPos_
{
TT_UShort PosFormat; /* 1, 2, or 3 */
union
{
TTO_ContextPosFormat1 cpf1;
TTO_ContextPosFormat2 cpf2;
TTO_ContextPosFormat3 cpf3;
} cpf;
};
typedef struct TTO_ContextPos_ TTO_ContextPos;
/* LookupType 8 */
struct TTO_ChainPosRule_
{
TT_UShort BacktrackGlyphCount;
/* total number of backtrack glyphs */
TT_UShort* Backtrack; /* array of backtrack glyph IDs */
TT_UShort InputGlyphCount;
/* total number of input glyphs */
TT_UShort* Input; /* array of input glyph IDs */
TT_UShort LookaheadGlyphCount;
/* total number of lookahead glyphs */
TT_UShort* Lookahead; /* array of lookahead glyph IDs */
TT_UShort PosCount; /* number of PosLookupRecords */
TTO_PosLookupRecord* PosLookupRecord;
/* array of PosLookupRecords */
};
typedef struct TTO_ChainPosRule_ TTO_ChainPosRule;
struct TTO_ChainPosRuleSet_
{
TT_UShort ChainPosRuleCount;
/* number of ChainPosRule tables */
TTO_ChainPosRule* ChainPosRule; /* array of ChainPosRule tables */
};
typedef struct TTO_ChainPosRuleSet_ TTO_ChainPosRuleSet;
struct TTO_ChainContextPosFormat1_
{
TTO_Coverage Coverage; /* Coverage table */
TT_UShort ChainPosRuleSetCount;
/* number of ChainPosRuleSet tables */
TTO_ChainPosRuleSet* ChainPosRuleSet;
/* array of ChainPosRuleSet tables */
};
typedef struct TTO_ChainContextPosFormat1_ TTO_ChainContextPosFormat1;
struct TTO_ChainPosClassRule_
{
TT_UShort BacktrackGlyphCount;
/* total number of backtrack
classes */
TT_UShort* Backtrack; /* array of backtrack classes */
TT_UShort InputGlyphCount;
/* total number of context classes */
TT_UShort* Input; /* array of context classes */
TT_UShort LookaheadGlyphCount;
/* total number of lookahead
classes */
TT_UShort* Lookahead; /* array of lookahead classes */
TT_UShort PosCount; /* number of PosLookupRecords */
TTO_PosLookupRecord* PosLookupRecord;
/* array of substitution lookups */
};
typedef struct TTO_ChainPosClassRule_ TTO_ChainPosClassRule;
struct TTO_ChainPosClassSet_
{
TT_UShort ChainPosClassRuleCount;
/* number of ChainPosClassRule
tables */
TTO_ChainPosClassRule* ChainPosClassRule;
/* array of ChainPosClassRule
tables */
};
typedef struct TTO_ChainPosClassSet_ TTO_ChainPosClassSet;
/* The `MaxXXXLength' fields are not defined in the TTO specification
but simplifies the implementation of this format. It holds the
maximal context length used in the specific context rules. */
struct TTO_ChainContextPosFormat2_
{
TTO_Coverage Coverage; /* Coverage table */
TT_UShort MaxBacktrackLength;
/* maximal backtrack length */
TTO_ClassDefinition BacktrackClassDef;
/* BacktrackClassDef table */
TT_UShort MaxInputLength;
/* maximal input length */
TTO_ClassDefinition InputClassDef;
/* InputClassDef table */
TT_UShort MaxLookaheadLength;
/* maximal lookahead length */
TTO_ClassDefinition LookaheadClassDef;
/* LookaheadClassDef table */
TT_UShort ChainPosClassSetCount;
/* number of ChainPosClassSet
tables */
TTO_ChainPosClassSet* ChainPosClassSet;
/* array of ChainPosClassSet
tables */
};
typedef struct TTO_ChainContextPosFormat2_ TTO_ChainContextPosFormat2;
struct TTO_ChainContextPosFormat3_
{
TT_UShort BacktrackGlyphCount;
/* number of backtrack glyphs */
TTO_Coverage* BacktrackCoverage;
/* array of backtrack Coverage
tables */
TT_UShort InputGlyphCount;
/* number of input glyphs */
TTO_Coverage* InputCoverage;
/* array of input coverage
tables */
TT_UShort LookaheadGlyphCount;
/* number of lookahead glyphs */
TTO_Coverage* LookaheadCoverage;
/* array of lookahead coverage
tables */
TT_UShort PosCount; /* number of PosLookupRecords */
TTO_PosLookupRecord* PosLookupRecord;
/* array of substitution lookups */
};
typedef struct TTO_ChainContextPosFormat3_ TTO_ChainContextPosFormat3;
struct TTO_ChainContextPos_
{
TT_UShort PosFormat; /* 1, 2, or 3 */
union
{
TTO_ChainContextPosFormat1 ccpf1;
TTO_ChainContextPosFormat2 ccpf2;
TTO_ChainContextPosFormat3 ccpf3;
} ccpf;
};
typedef struct TTO_ChainContextPos_ TTO_ChainContextPos;
union TTO_GPOS_SubTable_
{
TTO_SinglePos single;
TTO_PairPos pair;
TTO_CursivePos cursive;
TTO_MarkBasePos markbase;
TTO_MarkLigPos marklig;
TTO_MarkMarkPos markmark;
TTO_ContextPos context;
TTO_ChainContextPos chain;
};
typedef union TTO_GPOS_SubTable_ TTO_GPOS_SubTable;
/* finally, the GPOS API */
EXPORT_DEF
TT_Error TT_Init_GPOS_Extension( TT_Engine engine );
EXPORT_DEF
TT_Error TT_Load_GPOS_Table( TT_Face face,
TTO_GPOSHeader* gpos,
TTO_GDEFHeader* gdef );
EXPORT_DEF
TT_Error TT_GPOS_Select_Script( TTO_GPOSHeader* gpos,
TT_ULong script_tag,
TT_UShort* script_index );
EXPORT_DEF
TT_Error TT_GPOS_Select_Language( TTO_GPOSHeader* gpos,
TT_ULong language_tag,
TT_UShort script_index,
TT_UShort* language_index,
TT_UShort* req_feature_index );
EXPORT_DEF
TT_Error TT_GPOS_Select_Feature( TTO_GPOSHeader* gpos,
TT_ULong feature_tag,
TT_UShort script_index,
TT_UShort language_index,
TT_UShort* feature_index );
EXPORT_DEF
TT_Error TT_GPOS_Query_Scripts( TTO_GPOSHeader* gpos,
TT_ULong** script_tag_list );
EXPORT_DEF
TT_Error TT_GPOS_Query_Languages( TTO_GPOSHeader* gpos,
TT_UShort script_index,
TT_ULong** language_tag_list );
EXPORT_DEF
TT_Error TT_GPOS_Query_Features( TTO_GPOSHeader* gpos,
TT_UShort script_index,
TT_UShort language_index,
TT_ULong** feature_tag_list );
EXPORT_DEF
TT_Error TT_GPOS_Add_Feature( TTO_GPOSHeader* gpos,
TT_UShort feature_index,
TT_UShort property );
EXPORT_DEF
TT_Error TT_GPOS_Clear_Features( TTO_GPOSHeader* gpos );
#ifdef __cplusplus
}
#endif
#endif /* FTXGPOS_H */
/* END */

4307
lib/extend/ftxgsub.c Normal file

File diff suppressed because it is too large Load Diff

581
lib/extend/ftxgsub.h Normal file
View File

@@ -0,0 +1,581 @@
/*******************************************************************
*
* ftxgsub.h
*
* TrueType Open GSUB table support
*
* Copyright 1996-1999 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.
*
******************************************************************/
#ifndef FTXOPEN_H
#error "Don't include this file! Use ftxopen.h instead."
#endif
#ifndef FTXGSUB_H
#define FTXGSUB_H
#ifdef __cplusplus
extern "C" {
#endif
#define TTO_Err_Invalid_GSUB_SubTable_Format 0x1010
#define TTO_Err_Invalid_GSUB_SubTable 0x1011
/* Lookup types for glyph substitution */
#define GSUB_LOOKUP_SINGLE 1
#define GSUB_LOOKUP_MULTIPLE 2
#define GSUB_LOOKUP_ALTERNATE 3
#define GSUB_LOOKUP_LIGATURE 4
#define GSUB_LOOKUP_CONTEXT 5
#define GSUB_LOOKUP_CHAIN 6
/* Use this if a feature applies to all glyphs */
#define ALL_GLYPHS 0xFFFF
/* A pointer to a function which selects the alternate glyph. `pos' is
the position of the glyph with index `glyphID', `num_alternates'
gives the number of alternates in the `alternates' array. `data'
points to the user-defined structure specified during a call to
TT_GSUB_Register_Alternate_Function(). The function must return an
index into the `alternates' array. */
typedef TT_UShort (*TTO_AltFunction)(TT_ULong pos,
TT_UShort glyphID,
TT_UShort num_alternates,
TT_UShort* alternates,
void* data );
struct TTO_GSUBHeader_
{
TT_Bool loaded;
TT_ULong offset;
TT_Fixed Version;
TTO_ScriptList ScriptList;
TTO_FeatureList FeatureList;
TTO_LookupList LookupList;
TTO_GDEFHeader* gdef;
/* the next two fields are used for an alternate substitution callback
function to select the proper alternate glyph. */
TTO_AltFunction alt;
void* data;
};
typedef struct TTO_GSUBHeader_ TTO_GSUBHeader;
/* LookupType 1 */
struct TTO_SingleSubstFormat1_
{
TT_Short DeltaGlyphID; /* constant added to get
substitution glyph index */
};
typedef struct TTO_SingleSubstFormat1_ TTO_SingleSubstFormat1;
struct TTO_SingleSubstFormat2_
{
TT_UShort GlyphCount; /* number of glyph IDs in
Substitute array */
TT_UShort* Substitute; /* array of substitute glyph IDs */
};
typedef struct TTO_SingleSubstFormat2_ TTO_SingleSubstFormat2;
struct TTO_SingleSubst_
{
TT_UShort SubstFormat; /* 1 or 2 */
TTO_Coverage Coverage; /* Coverage table */
union
{
TTO_SingleSubstFormat1 ssf1;
TTO_SingleSubstFormat2 ssf2;
} ssf;
};
typedef struct TTO_SingleSubst_ TTO_SingleSubst;
/* LookupType 2 */
struct TTO_Sequence_
{
TT_UShort GlyphCount; /* number of glyph IDs in the
Substitute array */
TT_UShort* Substitute; /* string of glyph IDs to
substitute */
};
typedef struct TTO_Sequence_ TTO_Sequence;
struct TTO_MultipleSubst_
{
TT_UShort SubstFormat; /* always 1 */
TTO_Coverage Coverage; /* Coverage table */
TT_UShort SequenceCount; /* number of Sequence tables */
TTO_Sequence* Sequence; /* array of Sequence tables */
};
typedef struct TTO_MultipleSubst_ TTO_MultipleSubst;
/* LookupType 3 */
struct TTO_AlternateSet_
{
TT_UShort GlyphCount; /* number of glyph IDs in the
Alternate array */
TT_UShort* Alternate; /* array of alternate glyph IDs */
};
typedef struct TTO_AlternateSet_ TTO_AlternateSet;
struct TTO_AlternateSubst_
{
TT_UShort SubstFormat; /* always 1 */
TTO_Coverage Coverage; /* Coverage table */
TT_UShort AlternateSetCount;
/* number of AlternateSet tables */
TTO_AlternateSet* AlternateSet; /* array of AlternateSet tables */
};
typedef struct TTO_AlternateSubst_ TTO_AlternateSubst;
/* LookupType 4 */
struct TTO_Ligature_
{
TT_UShort LigGlyph; /* glyphID of ligature
to substitute */
TT_UShort ComponentCount; /* number of components in ligature */
TT_UShort* Component; /* array of component glyph IDs */
};
typedef struct TTO_Ligature_ TTO_Ligature;
struct TTO_LigatureSet_
{
TT_UShort LigatureCount; /* number of Ligature tables */
TTO_Ligature* Ligature; /* array of Ligature tables */
};
typedef struct TTO_LigatureSet_ TTO_LigatureSet;
struct TTO_LigatureSubst_
{
TT_UShort SubstFormat; /* always 1 */
TTO_Coverage Coverage; /* Coverage table */
TT_UShort LigatureSetCount; /* number of LigatureSet tables */
TTO_LigatureSet* LigatureSet; /* array of LigatureSet tables */
};
typedef struct TTO_LigatureSubst_ TTO_LigatureSubst;
/* needed by both lookup type 5 and 6 */
struct TTO_SubstLookupRecord_
{
TT_UShort SequenceIndex; /* index into current
glyph sequence */
TT_UShort LookupListIndex; /* Lookup to apply to that pos. */
};
typedef struct TTO_SubstLookupRecord_ TTO_SubstLookupRecord;
/* LookupType 5 */
struct TTO_SubRule_
{
TT_UShort GlyphCount; /* total number of input glyphs */
TT_UShort SubstCount; /* number of SubstLookupRecord
tables */
TT_UShort* Input; /* array of input glyph IDs */
TTO_SubstLookupRecord* SubstLookupRecord;
/* array of SubstLookupRecord
tables */
};
typedef struct TTO_SubRule_ TTO_SubRule;
struct TTO_SubRuleSet_
{
TT_UShort SubRuleCount; /* number of SubRule tables */
TTO_SubRule* SubRule; /* array of SubRule tables */
};
typedef struct TTO_SubRuleSet_ TTO_SubRuleSet;
struct TTO_ContextSubstFormat1_
{
TTO_Coverage Coverage; /* Coverage table */
TT_UShort SubRuleSetCount; /* number of SubRuleSet tables */
TTO_SubRuleSet* SubRuleSet; /* array of SubRuleSet tables */
};
typedef struct TTO_ContextSubstFormat1_ TTO_ContextSubstFormat1;
struct TTO_SubClassRule_
{
TT_UShort GlyphCount; /* total number of context classes */
TT_UShort SubstCount; /* number of SubstLookupRecord
tables */
TT_UShort* Class; /* array of classes */
TTO_SubstLookupRecord* SubstLookupRecord;
/* array of SubstLookupRecord
tables */
};
typedef struct TTO_SubClassRule_ TTO_SubClassRule;
struct TTO_SubClassSet_
{
TT_UShort SubClassRuleCount;
/* number of SubClassRule tables */
TTO_SubClassRule* SubClassRule; /* array of SubClassRule tables */
};
typedef struct TTO_SubClassSet_ TTO_SubClassSet;
/* The `MaxContextLength' field is not defined in the TTO specification
but simplifies the implementation of this format. It holds the
maximal context length used in the context rules. */
struct TTO_ContextSubstFormat2_
{
TT_UShort MaxContextLength;
/* maximal context length */
TTO_Coverage Coverage; /* Coverage table */
TTO_ClassDefinition ClassDef; /* ClassDef table */
TT_UShort SubClassSetCount;
/* number of SubClassSet tables */
TTO_SubClassSet* SubClassSet; /* array of SubClassSet tables */
};
typedef struct TTO_ContextSubstFormat2_ TTO_ContextSubstFormat2;
struct TTO_ContextSubstFormat3_
{
TT_UShort GlyphCount; /* number of input glyphs */
TT_UShort SubstCount; /* number of SubstLookupRecords */
TTO_Coverage* Coverage; /* array of Coverage tables */
TTO_SubstLookupRecord* SubstLookupRecord;
/* array of substitution lookups */
};
typedef struct TTO_ContextSubstFormat3_ TTO_ContextSubstFormat3;
struct TTO_ContextSubst_
{
TT_UShort SubstFormat; /* 1, 2, or 3 */
union
{
TTO_ContextSubstFormat1 csf1;
TTO_ContextSubstFormat2 csf2;
TTO_ContextSubstFormat3 csf3;
} csf;
};
typedef struct TTO_ContextSubst_ TTO_ContextSubst;
/* LookupType 6 */
struct TTO_ChainSubRule_
{
TT_UShort BacktrackGlyphCount;
/* total number of backtrack glyphs */
TT_UShort* Backtrack; /* array of backtrack glyph IDs */
TT_UShort InputGlyphCount;
/* total number of input glyphs */
TT_UShort* Input; /* array of input glyph IDs */
TT_UShort LookaheadGlyphCount;
/* total number of lookahead glyphs */
TT_UShort* Lookahead; /* array of lookahead glyph IDs */
TT_UShort SubstCount; /* number of SubstLookupRecords */
TTO_SubstLookupRecord* SubstLookupRecord;
/* array of SubstLookupRecords */
};
typedef struct TTO_ChainSubRule_ TTO_ChainSubRule;
struct TTO_ChainSubRuleSet_
{
TT_UShort ChainSubRuleCount;
/* number of ChainSubRule tables */
TTO_ChainSubRule* ChainSubRule; /* array of ChainSubRule tables */
};
typedef struct TTO_ChainSubRuleSet_ TTO_ChainSubRuleSet;
struct TTO_ChainContextSubstFormat1_
{
TTO_Coverage Coverage; /* Coverage table */
TT_UShort ChainSubRuleSetCount;
/* number of ChainSubRuleSet tables */
TTO_ChainSubRuleSet* ChainSubRuleSet;
/* array of ChainSubRuleSet tables */
};
typedef struct TTO_ChainContextSubstFormat1_ TTO_ChainContextSubstFormat1;
struct TTO_ChainSubClassRule_
{
TT_UShort BacktrackGlyphCount;
/* total number of backtrack
classes */
TT_UShort* Backtrack; /* array of backtrack classes */
TT_UShort InputGlyphCount;
/* total number of context classes */
TT_UShort* Input; /* array of context classes */
TT_UShort LookaheadGlyphCount;
/* total number of lookahead
classes */
TT_UShort* Lookahead; /* array of lookahead classes */
TT_UShort SubstCount; /* number of SubstLookupRecords */
TTO_SubstLookupRecord* SubstLookupRecord;
/* array of substitution lookups */
};
typedef struct TTO_ChainSubClassRule_ TTO_ChainSubClassRule;
struct TTO_ChainSubClassSet_
{
TT_UShort ChainSubClassRuleCount;
/* number of ChainSubClassRule
tables */
TTO_ChainSubClassRule* ChainSubClassRule;
/* array of ChainSubClassRule
tables */
};
typedef struct TTO_ChainSubClassSet_ TTO_ChainSubClassSet;
/* The `MaxXXXLength' fields are not defined in the TTO specification
but simplifies the implementation of this format. It holds the
maximal context length used in the specific context rules. */
struct TTO_ChainContextSubstFormat2_
{
TTO_Coverage Coverage; /* Coverage table */
TT_UShort MaxBacktrackLength;
/* maximal backtrack length */
TTO_ClassDefinition BacktrackClassDef;
/* BacktrackClassDef table */
TT_UShort MaxInputLength;
/* maximal input length */
TTO_ClassDefinition InputClassDef;
/* InputClassDef table */
TT_UShort MaxLookaheadLength;
/* maximal lookahead length */
TTO_ClassDefinition LookaheadClassDef;
/* LookaheadClassDef table */
TT_UShort ChainSubClassSetCount;
/* number of ChainSubClassSet
tables */
TTO_ChainSubClassSet* ChainSubClassSet;
/* array of ChainSubClassSet
tables */
};
typedef struct TTO_ChainContextSubstFormat2_ TTO_ChainContextSubstFormat2;
struct TTO_ChainContextSubstFormat3_
{
TT_UShort BacktrackGlyphCount;
/* number of backtrack glyphs */
TTO_Coverage* BacktrackCoverage;
/* array of backtrack Coverage
tables */
TT_UShort InputGlyphCount;
/* number of input glyphs */
TTO_Coverage* InputCoverage;
/* array of input coverage
tables */
TT_UShort LookaheadGlyphCount;
/* number of lookahead glyphs */
TTO_Coverage* LookaheadCoverage;
/* array of lookahead coverage
tables */
TT_UShort SubstCount; /* number of SubstLookupRecords */
TTO_SubstLookupRecord* SubstLookupRecord;
/* array of substitution lookups */
};
typedef struct TTO_ChainContextSubstFormat3_ TTO_ChainContextSubstFormat3;
struct TTO_ChainContextSubst_
{
TT_UShort SubstFormat; /* 1, 2, or 3 */
union
{
TTO_ChainContextSubstFormat1 ccsf1;
TTO_ChainContextSubstFormat2 ccsf2;
TTO_ChainContextSubstFormat3 ccsf3;
} ccsf;
};
typedef struct TTO_ChainContextSubst_ TTO_ChainContextSubst;
union TTO_GSUB_SubTable_
{
TTO_SingleSubst single;
TTO_MultipleSubst multiple;
TTO_AlternateSubst alternate;
TTO_LigatureSubst ligature;
TTO_ContextSubst context;
TTO_ChainContextSubst chain;
};
typedef union TTO_GSUB_SubTable_ TTO_GSUB_SubTable;
/* A simple string object. It can both `send' and `receive' data.
In case of sending, `length' and `pos' will be used. In case of
receiving, `pos' points to the first free slot, and `allocated'
specifies the amount of allocated memory (and the `length' field
will be ignored). The routine TT_Add_String() will increase the
amount of memory if necessary. After end of receive, `length'
should be set to the value of `pos', and `pos' will be set to zero.
`properties' (which is treated as a bit field) gives the glyph's
properties: If a certain bit is set for a glyph, the feature which
has the same bit set in its property value is applied.
NEVER modify any elements of the structure! You should rather copy
its contents if necessary.
TT_Add_String() will also handle allocation; you should use
free() in case you want to destroy the arrays in the object. */
struct TTO_GSUB_String_
{
TT_ULong length;
TT_ULong pos;
TT_ULong allocated;
TT_UShort* string;
TT_UShort* properties;
};
typedef struct TTO_GSUB_String_ TTO_GSUB_String;
/* finally, the GSUB API */
EXPORT_DEF
TT_Error TT_Init_GSUB_Extension( TT_Engine engine );
EXPORT_DEF
TT_Error TT_Load_GSUB_Table( TT_Face face,
TTO_GSUBHeader* gsub,
TTO_GDEFHeader* gdef );
EXPORT_DEF
TT_Error TT_GSUB_Select_Script( TTO_GSUBHeader* gsub,
TT_ULong script_tag,
TT_UShort* script_index );
EXPORT_DEF
TT_Error TT_GSUB_Select_Language( TTO_GSUBHeader* gsub,
TT_ULong language_tag,
TT_UShort script_index,
TT_UShort* language_index,
TT_UShort* req_feature_index );
EXPORT_DEF
TT_Error TT_GSUB_Select_Feature( TTO_GSUBHeader* gsub,
TT_ULong feature_tag,
TT_UShort script_index,
TT_UShort language_index,
TT_UShort* feature_index );
EXPORT_DEF
TT_Error TT_GSUB_Query_Scripts( TTO_GSUBHeader* gsub,
TT_ULong** script_tag_list );
EXPORT_DEF
TT_Error TT_GSUB_Query_Languages( TTO_GSUBHeader* gsub,
TT_UShort script_index,
TT_ULong** language_tag_list );
EXPORT_DEF
TT_Error TT_GSUB_Query_Features( TTO_GSUBHeader* gsub,
TT_UShort script_index,
TT_UShort language_index,
TT_ULong** feature_tag_list );
EXPORT_DEF
TT_Error TT_GSUB_Add_Feature( TTO_GSUBHeader* gsub,
TT_UShort feature_index,
TT_UShort property );
EXPORT_DEF
TT_Error TT_GSUB_Clear_Features( TTO_GSUBHeader* gsub );
EXPORT_DEF
TT_Error TT_GSUB_Register_Alternate_Function( TTO_GSUBHeader* gsub,
TTO_AltFunction alt,
void* data );
EXPORT_DEF
TT_Error TT_GSUB_Apply_String( TTO_GSUBHeader* gsub,
TTO_GSUB_String* in,
TTO_GSUB_String* out );
EXPORT_DEF
TT_Error TT_GSUB_Add_String( TTO_GSUB_String* in,
TT_UShort num_in,
TTO_GSUB_String* out,
TT_UShort num_out,
TT_UShort* data );
#ifdef __cplusplus
}
#endif
#endif /* FTXGSUB_H */
/* END */

564
lib/extend/ftxkern.c Normal file
View File

@@ -0,0 +1,564 @@
/*******************************************************************
*
* ftxkern.c 1.0
*
* Kerning support extension.
*
* Copyright 1996-1999 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.
*
*
* The kerning support is currently part of the engine extensions.
*
******************************************************************/
#include "ftxkern.h"
#include "ttextend.h"
#include "tttypes.h"
#include "ttdebug.h"
#include "ttmemory.h"
#include "ttfile.h"
#include "ttobjs.h"
#include "ttload.h" /* For the macros */
#include "tttags.h"
/* Required by the tracing mode */
#undef TT_COMPONENT
#define TT_COMPONENT trace_any
#define KERNING_ID Build_Extension_ID( 'k', 'e', 'r', 'n' )
/*******************************************************************
*
* Function : SubTable_Load_0
*
* Description : Loads a format 0 kerning subtable data.
*
* Input : kern0 pointer to the kerning subtable
*
* Output : error code
*
* Notes : - Assumes that the stream is already `used'
*
* - the file cursor must be set by the caller
*
* - in case of error, the function _must_ destroy
* the data it allocates!
*
******************************************************************/
static TT_Error Subtable_Load_0( TT_Kern_0* kern0,
PFace input )
{
DEFINE_LOAD_LOCALS( input->stream );
UShort num_pairs, n;
if ( ACCESS_Frame( 8L ) )
return error;
num_pairs = GET_UShort();
kern0->nPairs = 0;
kern0->searchRange = GET_UShort();
kern0->entrySelector = GET_UShort();
kern0->rangeShift = GET_UShort();
/* we only set kern0->nPairs if the subtable has been loaded */
FORGET_Frame();
if ( ALLOC_ARRAY( kern0->pairs, num_pairs, TT_Kern_0_Pair ) )
return error;
if ( ACCESS_Frame( num_pairs * 6L ) )
goto Fail;
for ( n = 0; n < num_pairs; n++ )
{
kern0->pairs[n].left = GET_UShort();
kern0->pairs[n].right = GET_UShort();
kern0->pairs[n].value = GET_UShort();
if ( kern0->pairs[n].left >= input->numGlyphs ||
kern0->pairs[n].right >= input->numGlyphs )
{
FORGET_Frame();
error = TT_Err_Invalid_Kerning_Table;
goto Fail;
}
}
FORGET_Frame();
/* we're ok, set the pairs count */
kern0->nPairs = num_pairs;
return TT_Err_Ok;
Fail:
FREE( kern0->pairs );
return error;
}
/*******************************************************************
*
* Function : SubTable_Load_2
*
* Description : Loads a format 2 kerning subtable data.
*
* Input : kern2 pointer to the kerning subtable
* length subtable length. This is required as
* the subheader doesn't give any indication
* of the size of the `array' table.
*
* Output : error code
*
* Notes : - Assumes that the stream is already `used'
*
* - the file cursor must be set by the caller
*
* - in case of error, the function _must_ destroy
* the data it allocates!
*
******************************************************************/
static TT_Error Subtable_Load_2( TT_Kern_2* kern2,
PFace input )
{
DEFINE_LOAD_LOCALS( input->stream );
Long table_base;
UShort left_offset, right_offset, array_offset;
ULong array_size;
UShort left_max, right_max, n;
/* record the table offset */
table_base = FILE_Pos();
if ( ACCESS_Frame( 8L ) )
return error;
kern2->rowWidth = GET_UShort();
left_offset = GET_UShort();
right_offset = GET_UShort();
array_offset = GET_UShort();
FORGET_Frame();
/* first load left and right glyph classes */
if ( FILE_Seek( table_base + left_offset ) ||
ACCESS_Frame( 4L ) )
return error;
kern2->leftClass.firstGlyph = GET_UShort();
kern2->leftClass.nGlyphs = GET_UShort();
FORGET_Frame();
if ( ALLOC_ARRAY( kern2->leftClass.classes,
kern2->leftClass.nGlyphs,
UShort ) )
return error;
/* load left offsets */
if ( ACCESS_Frame( kern2->leftClass.nGlyphs * 2L ) )
goto Fail_Left;
for ( n = 0; n < kern2->leftClass.nGlyphs; n++ )
kern2->leftClass.classes[n] = GET_UShort();
FORGET_Frame();
/* right class */
if ( FILE_Seek( table_base + right_offset ) ||
ACCESS_Frame( 4L ) )
goto Fail_Left;
kern2->rightClass.firstGlyph = GET_UShort();
kern2->rightClass.nGlyphs = GET_UShort();
FORGET_Frame();
if ( ALLOC_ARRAY( kern2->rightClass.classes,
kern2->rightClass.nGlyphs,
UShort ) )
goto Fail_Left;
/* load right offsets */
if ( ACCESS_Frame( kern2->rightClass.nGlyphs * 2L ) )
goto Fail_Right;
for ( n = 0; n < kern2->rightClass.nGlyphs; n++ )
kern2->rightClass.classes[n] = GET_UShort();
FORGET_Frame();
/* Now load the kerning array. We don't have its size, we */
/* must compute it from what we know. */
/* We thus compute the maximum left and right offsets and */
/* add them to get the array size. */
left_max = right_max = 0;
for ( n = 0; n < kern2->leftClass.nGlyphs; n++ )
left_max = MAX( left_max, kern2->leftClass.classes[n] );
for ( n = 0; n < kern2->rightClass.nGlyphs; n++ )
right_max = MAX( right_max, kern2->leftClass.classes[n] );
array_size = left_max + right_max + 2;
if ( ALLOC( kern2->array, array_size ) )
goto Fail_Right;
if ( ACCESS_Frame( array_size ) )
goto Fail_Array;
for ( n = 0; n < array_size/2; n++ )
kern2->array[n] = GET_Short();
FORGET_Frame();
/* we're good now */
return TT_Err_Ok;
Fail_Array:
FREE( kern2->array );
Fail_Right:
FREE( kern2->rightClass.classes );
kern2->rightClass.nGlyphs = 0;
Fail_Left:
FREE( kern2->leftClass.classes );
kern2->leftClass.nGlyphs = 0;
return error;
}
/*******************************************************************
*
* Function : Kerning_Create
*
* Description : Creates the kerning directory if a face is
* loaded. The tables however are loaded on
* demand to save space.
*
* Input : face pointer to the parent face object
* kern pointer to the extension's kerning field
*
* Output : error code
*
* Notes : as in all constructors, the memory allocated isn't
* released in case of failure. Rather, the task is left
* to the destructor (which is called if an error
* occurs during the loading of a face).
*
******************************************************************/
static TT_Error Kerning_Create( void* ext,
PFace face )
{
DEFINE_LOAD_LOCALS( face->stream );
TT_Kerning* kern = (TT_Kerning*)ext;
UShort num_tables;
Long table;
TT_Kern_Subtable* sub;
/* by convention */
if ( !kern )
return TT_Err_Ok;
/* Now load the kerning directory. We're called from the face */
/* constructor. We thus need not use the stream. */
kern->version = 0;
kern->nTables = 0;
kern->tables = NULL;
table = TT_LookUp_Table( face, TTAG_kern );
if ( table < 0 )
return TT_Err_Ok; /* The table is optional */
if ( FILE_Seek( face->dirTables[table].Offset ) ||
ACCESS_Frame( 4L ) )
return error;
kern->version = GET_UShort();
num_tables = GET_UShort();
FORGET_Frame();
/* we don't set kern->nTables until we have allocated the array */
if ( ALLOC_ARRAY( kern->tables, num_tables, TT_Kern_Subtable ) )
return error;
kern->nTables = num_tables;
/* now load the directory entries, but do _not_ load the tables ! */
sub = kern->tables;
for ( table = 0; table < num_tables; table++ )
{
if ( ACCESS_Frame( 6L ) )
return error;
sub->loaded = FALSE; /* redundant, but good to see */
sub->version = GET_UShort();
sub->length = GET_UShort() - 6; /* substract header length */
sub->format = GET_Byte();
sub->coverage = GET_Byte();
FORGET_Frame();
sub->offset = FILE_Pos();
/* now skip to the next table */
if ( FILE_Skip( sub->length ) )
return error;
sub++;
}
/* that's fine, leave now */
return TT_Err_Ok;
}
/*******************************************************************
*
* Function : Kerning_Destroy
*
* Description : Destroys all kerning information.
*
* Input : kern pointer to the extension's kerning field
*
* Output : error code
*
* Notes : This function is a destructor; it must be able
* to destroy partially built tables.
*
******************************************************************/
static TT_Error Kerning_Destroy( void* ext,
PFace face )
{
TT_Kerning* kern = (TT_Kerning*)ext;
TT_Kern_Subtable* sub;
UShort n;
/* by convention */
if ( !kern )
return TT_Err_Ok;
if ( kern->nTables == 0 )
return TT_Err_Ok; /* no tables to release */
/* scan the table directory and release loaded entries */
sub = kern->tables;
for ( n = 0; n < kern->nTables; n++ )
{
if ( sub->loaded )
{
switch ( sub->format )
{
case 0:
FREE( sub->t.kern0.pairs );
sub->t.kern0.nPairs = 0;
sub->t.kern0.searchRange = 0;
sub->t.kern0.entrySelector = 0;
sub->t.kern0.rangeShift = 0;
break;
case 2:
FREE( sub->t.kern2.leftClass.classes );
sub->t.kern2.leftClass.firstGlyph = 0;
sub->t.kern2.leftClass.nGlyphs = 0;
FREE( sub->t.kern2.rightClass.classes );
sub->t.kern2.rightClass.firstGlyph = 0;
sub->t.kern2.rightClass.nGlyphs = 0;
FREE( sub->t.kern2.array );
sub->t.kern2.rowWidth = 0;
break;
default:
; /* invalid subtable format - do nothing */
}
sub->loaded = FALSE;
sub->version = 0;
sub->offset = 0;
sub->length = 0;
sub->coverage = 0;
sub->format = 0;
}
sub++;
}
FREE( kern->tables );
kern->nTables = 0;
return TT_Err_Ok;
}
/*******************************************************************
*
* Function : TT_Get_Kerning_Directory
*
* Description : Returns a given face's kerning directory.
*
* Input : face handle to the face object
* directory pointer to client's target directory
*
* Output : error code
*
* Notes : The kerning table directory is loaded with the face
* through the extension constructor. However, the kerning
* tables themselves are only loaded on demand, as they
* may represent a lot of data, unneeded by most uses of
* the engine.
*
******************************************************************/
EXPORT_FUNC
TT_Error TT_Get_Kerning_Directory( TT_Face face,
TT_Kerning* directory )
{
PFace faze = HANDLE_Face( face );
TT_Error error;
TT_Kerning* kerning;
if ( !faze )
return TT_Err_Invalid_Face_Handle;
/* copy directory header */
error = TT_Extension_Get( faze, KERNING_ID, (void**)&kerning );
if ( !error )
*directory = *kerning;
return error;
}
/*******************************************************************
*
* Function : TT_Load_Kerning_Table
*
* Description : Loads a kerning table intro memory.
*
* Input : face face handle
* kern_index index in the face's kerning directory
*
* Output : error code
*
* Notes :
*
******************************************************************/
EXPORT_FUNC
TT_Error TT_Load_Kerning_Table( TT_Face face,
TT_UShort kern_index )
{
TT_Error error;
TT_Stream stream;
TT_Kerning* kern;
TT_Kern_Subtable* sub;
PFace faze = HANDLE_Face( face );
if ( !faze )
return TT_Err_Invalid_Face_Handle;
error = TT_Extension_Get( faze, KERNING_ID, (void**)&kern );
if ( error )
return error;
if ( kern->nTables == 0 )
return TT_Err_Table_Missing;
if ( kern_index >= kern->nTables )
return TT_Err_Invalid_Argument;
sub = kern->tables + kern_index;
if ( sub->format != 0 && sub->format != 2 )
return TT_Err_Invalid_Kerning_Table_Format;
/* now access stream */
if ( USE_Stream( faze->stream, stream ) )
return error;
if ( FILE_Seek( sub->offset ) )
goto Fail;
if ( sub->format == 0 )
error = Subtable_Load_0( &sub->t.kern0, faze );
else if ( sub->format == 2 )
error = Subtable_Load_2( &sub->t.kern2, faze );
if ( !error )
sub->loaded = TRUE;
Fail:
/* release stream */
DONE_Stream( stream );
return error;
}
EXPORT_FUNC
TT_Error TT_Init_Kerning_Extension( TT_Engine engine )
{
PEngine_Instance _engine = HANDLE_Engine( engine );
TT_Error error;
if ( !_engine )
return TT_Err_Invalid_Engine;
error = TT_Register_Extension( _engine,
KERNING_ID,
sizeof ( TT_Kerning ),
Kerning_Create,
Kerning_Destroy );
return error;
}
/* END */

181
lib/extend/ftxkern.h Normal file
View File

@@ -0,0 +1,181 @@
/*******************************************************************
*
* ftxkern.h 1.0
*
* High-Level API Kerning extension
*
* Copyright 1996-1999 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.
*
*
* The kerning support is currently part of the engine extensions.
*
* This file should _not_ depend on engine internal types.
*
******************************************************************/
#ifndef FTXKERN_H
#define FTXKERN_H
#include "freetype.h"
#ifdef __cplusplus
extern "C" {
#endif
/* The kerning support in FreeType is minimal. This means that */
/* we do not try to interpret the kerning data in any way to */
/* `cook' it for a user application. This API lets you access */
/* directly the kerning tables found in the TrueType file; it's */
/* up to the client application to apply its own processing on */
/* these. */
/* The reason for this is that we generally do not encourage */
/* feature-bloat of the core engine. Moreover, not all */
/* libraries or font servers really need kerning data, or all */
/* formats of this data. */
/************** kerning error codes *****************************/
/* we choose the class 0x0A for our errors, this should not */
/* match with any error code class used in any other extension */
#define TT_Err_Invalid_Kerning_Table_Format 0x0A00
#define TT_Err_Invalid_Kerning_Table 0x0A01
/********** structures definitions ******************************/
/* Remember that all types and function are accessible by client */
/* applications in this section, and thus should have the `TT_' */
/* prefix. */
/* format 0 kerning pair */
struct TT_Kern_0_Pair_
{
TT_UShort left; /* index of left glyph in pair */
TT_UShort right; /* index of right glyph in pair */
TT_FWord value; /* kerning value */
};
typedef struct TT_Kern_0_Pair_ TT_Kern_0_Pair;
/* format 0 kerning subtable */
struct TT_Kern_0_
{
TT_UShort nPairs; /* number of kerning pairs */
TT_UShort searchRange; /* these values are defined by the TT spec */
TT_UShort entrySelector; /* for table searchs. */
TT_UShort rangeShift;
TT_Kern_0_Pair* pairs; /* a table of nPairs `pairs' */
};
typedef struct TT_Kern_0_ TT_Kern_0;
/* format 2 kerning glyph class */
struct TT_Kern_2_Class_
{
TT_UShort firstGlyph; /* first glyph in range */
TT_UShort nGlyphs; /* number of glyphs in range */
TT_UShort* classes; /* a table giving for each ranged glyph */
/* its class offset in the subtable pairs */
/* two-dimensional array */
};
typedef struct TT_Kern_2_Class_ TT_Kern_2_Class;
/* format 2 kerning subtable */
struct TT_Kern_2_
{
TT_UShort rowWidth; /* length of one row in bytes */
TT_Kern_2_Class leftClass; /* left class table */
TT_Kern_2_Class rightClass; /* right class table */
TT_FWord* array; /* 2-dimensional kerning values array */
};
typedef struct TT_Kern_2_ TT_Kern_2;
/* kerning subtable */
struct TT_Kern_Subtable_
{
TT_Bool loaded; /* boolean; indicates whether the table is */
/* loaded */
TT_UShort version; /* table version number */
TT_Long offset; /* file offset of table */
TT_UShort length; /* length of table, _excluding_ header */
TT_Byte coverage; /* lower 8 bit of the coverage table entry */
TT_Byte format; /* the subtable format, as found in the */
/* higher 8 bits of the coverage table entry */
union
{
TT_Kern_0 kern0;
TT_Kern_2 kern2;
} t;
};
typedef struct TT_Kern_Subtable_ TT_Kern_Subtable;
struct TT_Kerning_
{
TT_UShort version; /* kern table version number. starts at 0 */
TT_UShort nTables; /* number of tables */
TT_Kern_Subtable* tables; /* the kerning sub-tables */
};
typedef struct TT_Kerning_ TT_Kerning;
/***************** high-level API extension **************************/
/* Initialize Kerning extension, must be called after */
/* TT_Init_FreeType(). There is no need for a finalizer */
EXPORT_DEF
TT_Error TT_Init_Kerning_Extension( TT_Engine engine );
/* Note on the implemented mechanism: */
/* The kerning table directory is loaded with the face through the */
/* extension constructor. However, the tables will only be loaded */
/* on demand, as they may represent a lot of data, unnecessary to */
/* most applications. */
/* Queries a pointer to the kerning directory for the face object */
EXPORT_DEF
TT_Error TT_Get_Kerning_Directory( TT_Face face,
TT_Kerning* directory );
/* Load the kerning table number `kern_index' in the kerning */
/* directory. The table will stay in memory until the `face' */
/* face is destroyed. */
EXPORT_DEF
TT_Error TT_Load_Kerning_Table( TT_Face face,
TT_UShort kern_index );
#ifdef __cplusplus
}
#endif
#endif /* FTXKERN_H */
/* END */

1439
lib/extend/ftxopen.c Normal file

File diff suppressed because it is too large Load Diff

304
lib/extend/ftxopen.h Normal file
View File

@@ -0,0 +1,304 @@
/*******************************************************************
*
* ftxopen.h
*
* TrueType Open support.
*
* Copyright 1996-1999 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.
*
* This file should be included by the application. Nevertheless,
* the table specific APIs (and structures) are located in files like
* ftxgsub.h or ftxgpos.h; these header files are read by ftxopen.h .
*
******************************************************************/
#ifndef FTXOPEN_H
#define FTXOPEN_H
#include "freetype.h"
#ifdef __cplusplus
extern "C" {
#endif
#define TTO_MAX_NESTING_LEVEL 100
#define TTO_Err_Invalid_SubTable_Format 0x1000
#define TTO_Err_Invalid_SubTable 0x1001
#define TTO_Err_Not_Covered 0x1002
#define TTO_Err_Too_Many_Nested_Contexts 0x1003
/* Script list related structures */
struct TTO_LangSys_
{
TT_UShort LookupOrderOffset; /* always 0 for TT Open 1.0 */
TT_UShort ReqFeatureIndex; /* required FeatureIndex */
TT_UShort FeatureCount; /* number of Feature indices */
TT_UShort* FeatureIndex; /* array of Feature indices */
};
typedef struct TTO_LangSys_ TTO_LangSys;
struct TTO_LangSysRecord_
{
TT_ULong LangSysTag; /* LangSysTag identifier */
TTO_LangSys LangSys; /* LangSys table */
};
typedef struct TTO_LangSysRecord_ TTO_LangSysRecord;
struct TTO_Script_
{
TTO_LangSys DefaultLangSys; /* DefaultLangSys table */
TT_UShort LangSysCount; /* number of LangSysRecords */
TTO_LangSysRecord* LangSysRecord; /* array of LangSysRecords */
};
typedef struct TTO_Script_ TTO_Script;
struct TTO_ScriptRecord_
{
TT_ULong ScriptTag; /* ScriptTag identifier */
TTO_Script Script; /* Script table */
};
typedef struct TTO_ScriptRecord_ TTO_ScriptRecord;
struct TTO_ScriptList_
{
TT_UShort ScriptCount; /* number of ScriptRecords */
TTO_ScriptRecord* ScriptRecord; /* array of ScriptRecords */
};
typedef struct TTO_ScriptList_ TTO_ScriptList;
/* Feature list related structures */
struct TTO_Feature_
{
TT_UShort FeatureParams; /* always 0 for TT Open 1.0 */
TT_UShort LookupListCount; /* number of LookupList indices */
TT_UShort* LookupListIndex; /* array of LookupList indices */
};
typedef struct TTO_Feature_ TTO_Feature;
struct TTO_FeatureRecord_
{
TT_ULong FeatureTag; /* FeatureTag identifier */
TTO_Feature Feature; /* Feature table */
};
typedef struct TTO_FeatureRecord_ TTO_FeatureRecord;
struct TTO_FeatureList_
{
TT_UShort FeatureCount; /* number of FeatureRecords */
TTO_FeatureRecord* FeatureRecord; /* array of FeatureRecords */
};
typedef struct TTO_FeatureList_ TTO_FeatureList;
/* Lookup list related structures */
struct TTO_SubTable_; /* defined below after inclusion
of ftxgsub.h and ftxgpos.h */
typedef struct TTO_SubTable_ TTO_SubTable;
struct TTO_Lookup_
{
TT_UShort LookupType; /* Lookup type */
TT_UShort LookupFlag; /* Lookup qualifiers */
TT_UShort SubTableCount; /* number of SubTables */
TTO_SubTable* SubTable; /* array of SubTables */
};
typedef struct TTO_Lookup_ TTO_Lookup;
/* The `Properties' field is not defined in the TTO specification but
is needed for processing lookups. If properties[n] is > 0, the
function TT_GSUB_Apply() will process Lookup[n] for glyphs which
have the specific bit not set in the `properties' field of the
input string object. */
struct TTO_LookupList_
{
TT_UShort LookupCount; /* number of Lookups */
TTO_Lookup* Lookup; /* array of Lookup records */
TT_UShort* Properties; /* array of flags */
};
typedef struct TTO_LookupList_ TTO_LookupList;
/* Possible LookupFlag bit masks. `IGNORE_SPECIAL_MARKS' comes from the
OpenType 1.2 specification. */
#define IGNORE_BASE_GLYPHS 0x0002
#define IGNORE_LIGATURES 0x0004
#define IGNORE_MARKS 0x0008
#define IGNORE_SPECIAL_MARKS 0xFF00
struct TTO_CoverageFormat1_
{
TT_UShort GlyphCount; /* number of glyphs in GlyphArray */
TT_UShort* GlyphArray; /* array of glyph IDs */
};
typedef struct TTO_CoverageFormat1_ TTO_CoverageFormat1;
struct TTO_RangeRecord_
{
TT_UShort Start; /* first glyph ID in the range */
TT_UShort End; /* last glyph ID in the range */
TT_UShort StartCoverageIndex; /* coverage index of first
glyph ID in the range */
};
typedef struct TTO_RangeRecord_ TTO_RangeRecord;
struct TTO_CoverageFormat2_
{
TT_UShort RangeCount; /* number of RangeRecords */
TTO_RangeRecord* RangeRecord; /* array of RangeRecords */
};
typedef struct TTO_CoverageFormat2_ TTO_CoverageFormat2;
struct TTO_Coverage_
{
TT_UShort CoverageFormat; /* 1 or 2 */
union
{
TTO_CoverageFormat1 cf1;
TTO_CoverageFormat2 cf2;
} cf;
};
typedef struct TTO_Coverage_ TTO_Coverage;
struct TTO_ClassDefFormat1_
{
TT_UShort StartGlyph; /* first glyph ID of the
ClassValueArray */
TT_UShort GlyphCount; /* size of the ClassValueArray */
TT_UShort* ClassValueArray; /* array of class values */
};
typedef struct TTO_ClassDefFormat1_ TTO_ClassDefFormat1;
struct TTO_ClassRangeRecord_
{
TT_UShort Start; /* first glyph ID in the range */
TT_UShort End; /* last glyph ID in the range */
TT_UShort Class; /* applied to all glyphs in range */
};
typedef struct TTO_ClassRangeRecord_ TTO_ClassRangeRecord;
struct TTO_ClassDefFormat2_
{
TT_UShort ClassRangeCount;
/* number of ClassRangeRecords */
TTO_ClassRangeRecord* ClassRangeRecord;
/* array of ClassRangeRecords */
};
typedef struct TTO_ClassDefFormat2_ TTO_ClassDefFormat2;
/* The `Defined' field is not defined in the TTO specification but
apparently needed for processing fonts like trado.ttf: This font
refers to a class which contains not a single element. We map such
classes to class 0. */
struct TTO_ClassDefinition_
{
TT_Bool loaded;
TT_Bool* Defined; /* array of Booleans.
If Defined[n] is FALSE,
class n contains no glyphs. */
TT_UShort ClassFormat; /* 1 or 2 */
union
{
TTO_ClassDefFormat1 cd1;
TTO_ClassDefFormat2 cd2;
} cd;
};
typedef struct TTO_ClassDefinition_ TTO_ClassDefinition;
struct TTO_Device_
{
TT_UShort StartSize; /* smallest size to correct */
TT_UShort EndSize; /* largest size to correct */
TT_UShort DeltaFormat; /* DeltaValue array data format:
1, 2, or 3 */
TT_UShort* DeltaValue; /* array of compressed data */
};
typedef struct TTO_Device_ TTO_Device;
#include "ftxgdef.h"
#include "ftxgsub.h"
#include "ftxgpos.h"
struct TTO_SubTable_
{
union
{
TTO_GSUB_SubTable gsub;
TTO_GPOS_SubTable gpos;
} st;
};
enum TTO_Type_
{
GSUB,
GPOS
};
typedef enum TTO_Type_ TTO_Type;
#ifdef __cplusplus
}
#endif
#endif /* FTXOPEN_H */
/* END */

135
lib/extend/ftxopenf.h Normal file
View File

@@ -0,0 +1,135 @@
/*******************************************************************
*
* ftxopenf.h
*
* internal TrueType Open functions
*
* Copyright 1996-1999 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.
*
******************************************************************/
#ifndef FTXOPENF_H
#define FTXOPENF_H
#include "ftxopen.h"
#ifdef __cplusplus
extern "C" {
#endif
/* functions from ftxopen.c */
TT_Error Load_ScriptList( TTO_ScriptList* sl,
PFace input );
TT_Error Load_FeatureList( TTO_FeatureList* fl,
PFace input );
TT_Error Load_LookupList( TTO_LookupList* ll,
PFace input,
TTO_Type type );
TT_Error Load_Coverage( TTO_Coverage* c,
PFace input );
TT_Error Load_ClassDefinition( TTO_ClassDefinition* cd,
UShort limit,
PFace input );
TT_Error Load_Device( TTO_Device* d,
PFace input );
void Free_ScriptList( TTO_ScriptList* sl );
void Free_FeatureList( TTO_FeatureList* fl );
void Free_LookupList( TTO_LookupList* ll,
TTO_Type type );
void Free_Coverage( TTO_Coverage* c );
void Free_ClassDefinition( TTO_ClassDefinition* cd );
void Free_Device( TTO_Device* d );
/* functions from ftxgsub.c */
TT_Error Load_SingleSubst( TTO_SingleSubst* ss,
PFace input );
TT_Error Load_MultipleSubst( TTO_MultipleSubst* ms,
PFace input );
TT_Error Load_AlternateSubst( TTO_AlternateSubst* as,
PFace input );
TT_Error Load_LigatureSubst( TTO_LigatureSubst* ls,
PFace input );
TT_Error Load_ContextSubst( TTO_ContextSubst* cs,
PFace input );
TT_Error Load_ChainContextSubst( TTO_ChainContextSubst* ccs,
PFace input );
void Free_SingleSubst( TTO_SingleSubst* ss );
void Free_MultipleSubst( TTO_MultipleSubst* ms );
void Free_AlternateSubst( TTO_AlternateSubst* as );
void Free_LigatureSubst( TTO_LigatureSubst* ls );
void Free_ContextSubst( TTO_ContextSubst* cs );
void Free_ChainContextSubst( TTO_ChainContextSubst* ccs );
/* functions from ftxgpos.c */
TT_Error Load_SinglePos( TTO_SinglePos* sp,
PFace input );
TT_Error Load_PairPos( TTO_PairPos* pp,
PFace input );
TT_Error Load_CursivePos( TTO_CursivePos* cp,
PFace input );
TT_Error Load_MarkBasePos( TTO_MarkBasePos* mbp,
PFace input );
TT_Error Load_MarkLigPos( TTO_MarkLigPos* mlp,
PFace input );
TT_Error Load_MarkMarkPos( TTO_MarkMarkPos* mmp,
PFace input );
TT_Error Load_ContextPos( TTO_ContextPos* cp,
PFace input );
TT_Error Load_ChainContextPos( TTO_ChainContextPos* ccp,
PFace input );
void Free_SinglePos( TTO_SinglePos* sp );
void Free_PairPos( TTO_PairPos* pp );
void Free_CursivePos( TTO_CursivePos* cp );
void Free_MarkBasePos( TTO_MarkBasePos* mbp );
void Free_MarkLigPos( TTO_MarkLigPos* mlp );
void Free_MarkMarkPos( TTO_MarkMarkPos* mmp );
void Free_ContextPos( TTO_ContextPos* cp );
void Free_ChainContextPos( TTO_ChainContextPos* ccp );
/* query functions */
TT_Error Coverage_Index( TTO_Coverage* c,
UShort glyphID,
UShort* index );
TT_Error Get_Class( TTO_ClassDefinition* cd,
UShort glyphID,
UShort* class,
UShort* index );
TT_Error Get_Device( TTO_Device* d,
UShort size,
Short* value );
/* functions from ftxgdef.c */
TT_Error Add_Glyph_Property( TTO_GDEFHeader* gdef,
UShort glyphID,
UShort property );
#ifdef __cplusplus
}
#endif
#endif /* FTXOPENF_H */
/* END */

522
lib/extend/ftxpost.c Normal file
View File

@@ -0,0 +1,522 @@
/*******************************************************************
*
* ftxpost.c
*
* post table support API extension body
*
* Copyright 1996-1999 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.
*
*
* The post table is not completely loaded by the core engine. This
* file loads the missing PS glyph names and implements an API to
* access them.
*
******************************************************************/
#include "ftxpost.h"
#include "tttypes.h"
#include "ttobjs.h"
#include "tttables.h"
#include "ttload.h" /* for the macros */
#include "ttfile.h"
#include "tttags.h"
#include "ttmemory.h"
#include "ttextend.h"
#define POST_ID Build_Extension_ID( 'p', 'o', 's', 't' )
/* the 258 default Mac PS glyph names */
String* TT_Post_Default_Names[258] =
{
/* 0 */
".notdef", ".null", "CR", "space", "exclam",
"quotedbl", "numbersign", "dollar", "percent", "ampersand",
/* 10 */
"quotesingle", "parenleft", "parenright", "asterisk", "plus",
"comma", "hyphen", "period", "slash", "zero",
/* 20 */
"one", "two", "three", "four", "five",
"six", "seven", "eight", "nine", "colon",
/* 30 */
"semicolon", "less", "equal", "greater", "question",
"at", "A", "B", "C", "D",
/* 40 */
"E", "F", "G", "H", "I",
"J", "K", "L", "M", "N",
/* 50 */
"O", "P", "Q", "R", "S",
"T", "U", "V", "W", "X",
/* 60 */
"Y", "Z", "bracketleft", "backslash", "bracketright",
"asciicircum", "underscore", "grave", "a", "b",
/* 70 */
"c", "d", "e", "f", "g",
"h", "i", "j", "k", "l",
/* 80 */
"m", "n", "o", "p", "q",
"r", "s", "t", "u", "v",
/* 90 */
"w", "x", "y", "z", "braceleft",
"bar", "braceright", "asciitilde", "Adieresis", "Aring",
/* 100 */
"Ccedilla", "Eacute", "Ntilde", "Odieresis", "Udieresis",
"aacute", "agrave", "acircumflex", "adieresis", "atilde",
/* 110 */
"aring", "ccedilla", "eacute", "egrave", "ecircumflex",
"edieresis", "iacute", "igrave", "icircumflex", "idieresis",
/* 120 */
"ntilde", "oacute", "ograve", "ocircumflex", "odieresis",
"otilde", "uacute", "ugrave", "ucircumflex", "udieresis",
/* 130 */
"dagger", "degree", "cent", "sterling", "section",
"bullet", "paragraph", "germandbls", "registered", "copyright",
/* 140 */
"trademark", "acute", "dieresis", "notequal", "AE",
"Oslash", "infinity", "plusminus", "lessequal", "greaterequal",
/* 150 */
"yen", "mu", "partialdiff", "summation", "product",
"pi", "integral", "ordfeminine", "ordmasculine", "Omega",
/* 160 */
"ae", "oslash", "questiondown", "exclamdown", "logicalnot",
"radical", "florin", "approxequal", "Delta", "guillemotleft",
/* 170 */
"guillemotright", "ellipsis", "nbspace", "Agrave", "Atilde",
"Otilde", "OE", "oe", "endash", "emdash",
/* 180 */
"quotedblleft", "quotedblright", "quoteleft", "quoteright", "divide",
"lozenge", "ydieresis", "Ydieresis", "fraction", "currency",
/* 190 */
"guilsinglleft", "guilsinglright", "fi", "fl", "daggerdbl",
"periodcentered", "quotesinglbase", "quotedblbase", "perthousand", "Acircumflex",
/* 200 */
"Ecircumflex", "Aacute", "Edieresis", "Egrave", "Iacute",
"Icircumflex", "Idieresis", "Igrave", "Oacute", "Ocircumflex",
/* 210 */
"apple", "Ograve", "Uacute", "Ucircumflex", "Ugrave",
"dotlessi", "circumflex", "tilde", "macron", "breve",
/* 220 */
"dotaccent", "ring", "cedilla", "hungarumlaut", "ogonek",
"caron", "Lslash", "lslash", "Scaron", "scaron",
/* 230 */
"Zcaron", "zcaron", "brokenbar", "Eth", "eth",
"Yacute", "yacute", "Thorn", "thorn", "minus",
/* 240 */
"multiply", "onesuperior", "twosuperior", "threesuperior", "onehalf",
"onequarter", "threequarters", "franc", "Gbreve", "gbreve",
/* 250 */
"Idot", "Scedilla", "scedilla", "Cacute", "cacute",
"Ccaron", "ccaron", "dmacron",
};
static TT_Error Load_Format_20( TT_Post_20* post20,
PFace input )
{
DEFINE_LOAD_LOCALS( input->stream );
UShort nameindex, n, num;
Byte len;
if ( ACCESS_Frame( 2L ) )
return error;
num = GET_UShort();
FORGET_Frame();
/* UNDOCUMENTED! The number of glyphs in this table can be smaller */
/* than the value in the maxp table (cf. cyberbit.ttf). */
/* There already exist fonts which have more than 32768 glyph names */
/* in this table, so the test for this threshold has been dropped. */
if ( num > input->numGlyphs )
return TT_Err_Invalid_Post_Table;
post20->numGlyphs = num;
if ( ALLOC_ARRAY( post20->glyphNameIndex, num, TT_UShort ) )
return error;
if ( ACCESS_Frame( num * 2L ) )
goto Fail;
for ( n = 0; n < num; n++ )
{
post20->glyphNameIndex[n] = GET_UShort();
if ( post20->glyphNameIndex[n] > 258 + num )
{
FORGET_Frame();
error = TT_Err_Invalid_Post_Table;
goto Fail;
}
}
FORGET_Frame();
if ( ALLOC_ARRAY( post20->glyphNames, num, Char* ) )
goto Fail;
/* We must initialize the glyphNames array for proper */
/* deallocation. */
for ( n = 0; n < num; n++ )
post20->glyphNames[n] = NULL;
/* Now we can read the glyph names which are stored in */
/* Pascal string format. */
for ( n = 0; n < num; n++ )
{
nameindex = post20->glyphNameIndex[n];
if ( nameindex < 258 )
; /* default Mac glyph, do nothing */
else
{
if ( ACCESS_Frame( 1L ) )
goto Fail1;
len = GET_Byte();
FORGET_Frame();
if ( ALLOC_ARRAY( post20->glyphNames[nameindex - 258],
len + 1, Char ) ||
FILE_Read( post20->glyphNames[nameindex - 258], len ) )
goto Fail1;
/* we make a C string */
post20->glyphNames[nameindex - 258][len] = '\0';
}
}
return TT_Err_Ok;
Fail1:
for ( n = 0; n < num; n++ )
if ( post20->glyphNames[n] )
FREE( post20->glyphNames[n] );
FREE( post20->glyphNames );
Fail:
FREE( post20->glyphNameIndex );
return error;
}
static TT_Error Load_Format_25( TT_Post_25* post25,
PFace input )
{
DEFINE_LOAD_LOCALS( input->stream );
UShort n, num;
if ( ACCESS_Frame( 2L ) )
return error;
/* UNDOCUMENTED! This value appears only in the Apple TT specs. */
num = GET_UShort();
FORGET_Frame();
if ( num > input->numGlyphs || num > 258 )
return TT_Err_Invalid_Post_Table;
post25->numGlyphs = num;
if ( ALLOC_ARRAY( post25->offset, num, Char ) )
return error;
if ( ACCESS_Frame( num ) )
goto Fail;
for ( n = 0; n < num; n++ )
{
post25->offset[n] = GET_Char();
/* We add 128 to the tests to avoid problems with negative */
/* values for comparison. */
if ( n + ( post25->offset[n] + 128 ) > num + 128 ||
n + ( post25->offset[n] + 128 ) < 128 )
{
FORGET_Frame();
error = TT_Err_Invalid_Post_Table;
goto Fail;
}
}
FORGET_Frame();
return TT_Err_Ok;
Fail:
FREE( post25->offset );
return error;
}
static TT_Error Post_Create( void* ext,
PFace face )
{
TT_Post* post = (TT_Post*)ext;
Long table;
/* by convention */
if ( !post )
return TT_Err_Ok;
/* we store the start offset and the size of the subtable */
table = TT_LookUp_Table( face, TTAG_post );
post->offset = face->dirTables[table].Offset + 32L;
post->length = face->dirTables[table].Length - 32L;
post->loaded = FALSE;
return TT_Err_Ok;
}
static TT_Error Post_Destroy( void* ext,
PFace face )
{
TT_Post* post = (TT_Post*)ext;
UShort n;
/* by convention */
if ( !post )
return TT_Err_Ok;
if ( post->loaded )
{
switch ( face->postscript.FormatType )
{
case 0x00010000: /* nothing to do */
break;
case 0x00020000:
for ( n = 0; n < post->p.post20.numGlyphs; n++ )
if ( post->p.post20.glyphNames[n] )
FREE( post->p.post20.glyphNames[n] );
FREE( post->p.post20.glyphNames );
FREE( post->p.post20.glyphNameIndex );
break;
case 0x00028000:
FREE( post->p.post25.offset );
break;
case 0x00030000: /* nothing to do */
break;
#if 0
case 0x00040000:
break;
#endif
default:
; /* invalid format, do nothing */
}
}
return TT_Err_Ok;
}
EXPORT_FUNC
TT_Error TT_Init_Post_Extension( TT_Engine engine )
{
PEngine_Instance _engine = HANDLE_Engine( engine );
TT_Error error;
if ( !_engine )
return TT_Err_Invalid_Engine;
error = TT_Register_Extension( _engine,
POST_ID,
sizeof ( TT_Post ),
Post_Create,
Post_Destroy );
return error;
}
/*******************************************************************
*
* Function : TT_Load_PS_Names
*
* Description : Loads the PostScript Glyph Name subtable (if any).
*
* Output : error code
*
******************************************************************/
EXPORT_FUNC
TT_Error TT_Load_PS_Names( TT_Face face,
TT_Post* ppost )
{
PFace faze = HANDLE_Face( face );
TT_Error error;
TT_Stream stream;
TT_Post* post;
if ( !faze )
return TT_Err_Invalid_Face_Handle;
error = TT_Extension_Get( faze, POST_ID, (void**)&post );
if ( error )
return error;
if ( USE_Stream( faze->stream, stream ) )
return error;
switch ( faze->postscript.FormatType )
{
case 0x00010000:
error = TT_Err_Ok; /* nothing to do */
break;
case 0x00020000:
if ( FILE_Seek( post->offset ) )
goto Fail;
error = Load_Format_20( &post->p.post20, faze );
break;
case 0x00028000: /* 2.5 in 16.16 format */
if ( FILE_Seek( post->offset ) )
goto Fail;
error = Load_Format_25( &post->p.post25, faze );
break;
case 0x00030000:
error = TT_Err_Ok; /* nothing to do */
break;
#if 0
case 0x00040000:
break;
#endif
default:
error = TT_Err_Invalid_Post_Table_Format;
break;
}
if ( !error )
{
post->loaded = TRUE;
*ppost = *post;
}
Fail:
DONE_Stream( stream );
return error;
}
/*******************************************************************
*
* Function : TT_Get_PS_Name
*
* Description : Gets the PostScript Glyph Name of a glyph.
*
* Input : index glyph index
* PSname address of a string pointer.
* Will be NULL in case of error; otherwise it
* contains a pointer to the glyph name.
*
* You must not modify the returned string!
*
* Output : error code
*
******************************************************************/
EXPORT_FUNC
TT_Error TT_Get_PS_Name( TT_Face face,
TT_UShort index,
TT_String** PSname )
{
PFace faze = HANDLE_Face( face );
TT_Error error;
TT_Post* post;
UShort nameindex;
if ( !faze )
return TT_Err_Invalid_Face_Handle;
if ( index >= faze->numGlyphs )
return TT_Err_Invalid_Glyph_Index;
error = TT_Extension_Get( faze, POST_ID, (void**)&post );
if ( error )
return error;
*PSname = TT_Post_Default_Names[0]; /* default value */
switch ( faze->postscript.FormatType )
{
case 0x00010000:
if ( index < 258 ) /* paranoid checking */
*PSname = TT_Post_Default_Names[index];
break;
case 0x00020000:
if ( index < post->p.post20.numGlyphs )
nameindex = post->p.post20.glyphNameIndex[index];
else
break;
if ( nameindex < 258 )
*PSname = TT_Post_Default_Names[nameindex];
else
*PSname = (String*)post->p.post20.glyphNames[nameindex - 258];
break;
case 0x00028000:
if ( index < post->p.post25.numGlyphs ) /* paranoid checking */
*PSname = TT_Post_Default_Names[index + post->p.post25.offset[index]];
break;
case 0x00030000:
break; /* nothing to do */
#if 0
case 0x00040000:
break;
#endif
default:
; /* should never happen */
}
return TT_Err_Ok;
}
/* END */

107
lib/extend/ftxpost.h Normal file
View File

@@ -0,0 +1,107 @@
/*******************************************************************
*
* ftxpost.h
*
* post table support API extension
*
* Copyright 1996-1999 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.
*
*
* The post table is not completely loaded by the core engine. This
* file loads the missing PS glyph names and implements an API to
* access them.
*
******************************************************************/
#ifndef FTXPOST_H
#define FTXPOST_H
#include "freetype.h"
#ifdef __cplusplus
extern "C" {
#endif
#define TT_Err_Invalid_Post_Table_Format 0x0B00
#define TT_Err_Invalid_Post_Table 0x0B01
/* the 258 standard Mac glyph names, used for format 1.0 and 2.5 */
extern TT_String* TT_Post_Default_Names[];
/* format 2.0 table */
struct TT_Post_20_
{
TT_UShort numGlyphs;
TT_UShort* glyphNameIndex;
TT_Char** glyphNames;
};
typedef struct TT_Post_20_ TT_Post_20;
struct TT_Post_25_
{
TT_UShort numGlyphs;
TT_Char* offset;
};
typedef struct TT_Post_25_ TT_Post_25;
#if 0
/* format 4.0 table -- not implemented yet */
struct TT_Post_40_
{
};
typedef struct TT_Post_40_ TT_Post_40;
#endif
struct TT_Post_
{
TT_Long offset;
TT_Long length;
TT_Bool loaded;
union
{
TT_Post_20 post20;
TT_Post_25 post25;
#if 0
TT_Post_40 post40;
#endif
} p;
};
typedef struct TT_Post_ TT_Post;
EXPORT_DEF
TT_Error TT_Init_Post_Extension( TT_Engine engine );
EXPORT_DEF
TT_Error TT_Load_PS_Names( TT_Face face,
TT_Post* post );
EXPORT_DEF
TT_Error TT_Get_PS_Name( TT_Face face,
TT_UShort index,
TT_String** PSname );
#ifdef __cplusplus
}
#endif
#endif /* FTXPOST_H */
/* END */

1391
lib/extend/ftxsbit.c Normal file

File diff suppressed because it is too large Load Diff

490
lib/extend/ftxsbit.h Normal file
View File

@@ -0,0 +1,490 @@
/*******************************************************************
*
* ftxsbit.h
*
* embedded bitmap support API extension
*
* Copyright 1996-1999 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.
*
*
* This extension is used to load the embedded bitmaps present
* in certain TrueType files.
*
******************************************************************/
#ifndef FTXSBIT_H
#define FTXSBIT_H
#include "freetype.h"
#ifdef __cplusplus
extern "C" {
#endif
/*************************************************************/
/* */
/* <Struct> TT_SBit_Metrics */
/* */
/* <Description> */
/* A structure used to hold the big metrics of a given */
/* glyph bitmap in a TrueType or OpenType font. These */
/* are usually found in the `EBDT' table. */
/* */
/* <Fields> */
/* height :: glyph height in pixels */
/* width :: glyph width in pixels */
/* */
/* horiBearingX :: horizontal left bearing */
/* horiBearingY :: horizontal top bearing */
/* horiAdvance :: horizontal advance */
/* */
/* vertBearingX :: vertical left bearing */
/* vertBearingY :: vertical top bearing */
/* vertAdvance :: vertical advance */
/* */
typedef struct TT_SBit_Metrics_
{
TT_Byte height;
TT_Byte width;
TT_Char horiBearingX;
TT_Char horiBearingY;
TT_Byte horiAdvance;
TT_Char vertBearingX;
TT_Char vertBearingY;
TT_Byte vertAdvance;
} TT_SBit_Metrics;
/*************************************************************/
/* */
/* <Struct> TT_SBit_Small_Metrics */
/* */
/* <Description> */
/* A structure used to hold the small metrics of a given */
/* glyph bitmap in a TrueType or OpenType font. These */
/* are usually found in the `EBDT' table. */
/* */
/* <Fields> */
/* height :: glyph height in pixels */
/* width :: glyph width in pixels */
/* */
/* bearingX :: left-side bearing */
/* bearingY :: top-side bearing */
/* advance :: advance width or height */
/* */
typedef struct TT_SBit_Small_Metrics_
{
TT_Byte height;
TT_Byte width;
TT_Char bearingX;
TT_Char bearingY;
TT_Byte advance;
} TT_SBit_Small_Metrics;
/*************************************************************/
/* */
/* <Struct> TT_SBit_Line_Metrics */
/* */
/* <Description> */
/* A structure used to describe the text line metrics of */
/* a given bitmap strike, for either horizontal or */
/* vertical layout. */
/* */
/* <Fields> */
/* ascender :: ascender in pixels */
/* descender :: descender in pixels */
/* max_width :: maximum glyph width in pixels */
/* */
/* caret_slope_enumerator :: Rise of the caret slope, */
/* typically set to 1 for non-italic fonts. */
/* caret_slope_denominator :: Rise of the caret slope, */
/* typically set to 0 for non-italic fonts. */
/* caret_offset :: Offset in pixels */
/* to move the caret for proper positioning. */
/* */
/* min_origin_SB :: Minimum of horiBearingX */
/* (resp. vertBearingY) */
/* min_advance_SB :: Minimum of */
/* (hori. advance - ( horiBearingX + width )) */
/* (resp. vert. advance - ( vertBearingY + height )) */
/* max_before_BL :: Maximum of horiBearingY */
/* (resp. Maximum of vertBearingY) */
/* min_after_BL :: Minimum of ( horiBearingY - height ) */
/* (resp. vertBearingX - width ) */
/* */
typedef struct TT_SBit_Line_Metrics_
{
TT_Char ascender;
TT_Char descender;
TT_Byte max_width;
TT_Char caret_slope_numerator;
TT_Char caret_slope_denominator;
TT_Char caret_offset;
TT_Char min_origin_SB;
TT_Char min_advance_SB;
TT_Char max_before_BL;
TT_Char min_after_BL;
TT_Char pads[2];
} TT_SBit_Line_Metrics;
/*************************************************************/
/* */
/* <Struct> TT_SBit_Range */
/* */
/* <Description> */
/* A TrueType/OpenType subIndexTable as defined in the */
/* `EBLC' or `bloc' tables. */
/* */
/* <Fields> */
/* */
/* first_glyph :: first glyph index in range */
/* last_glyph :: last glyph index in range */
/* */
/* index_format :: format of index table. valid */
/* values are 1 to 5. */
/* */
/* image_format :: format of `EBDT' image data */
/* image_offset :: offset to image data in `EBDT' */
/* */
/* image_size :: for index formats 2 and 5. This is */
/* the size in bytes of each glyph bitmap */
/* glyph bitmap */
/* */
/* big_metrics :: for index formats 2 and 5. This is */
/* the big metrics for each glyph bitmap */
/* */
/* num_glyphs :: for index formats 4 and 5. This is */
/* the number of glyphs in the code */
/* array. */
/* */
/* glyph_offsets :: for index formats 1 and 3. */
/* glyph_codes :: for index formats 4 and 5. */
/* */
/* table_offset :: offset of index table in `EBLC' table */
/* -- only used during strike loading. */
/* */
typedef struct TT_SBit_Range
{
TT_UShort first_glyph;
TT_UShort last_glyph;
TT_UShort index_format;
TT_UShort image_format;
TT_ULong image_offset;
TT_ULong image_size;
TT_SBit_Metrics metrics;
TT_ULong num_glyphs;
TT_ULong* glyph_offsets;
TT_UShort* glyph_codes;
TT_ULong table_offset;
} TT_SBit_Range;
/*************************************************************/
/* */
/* <Struct> TT_SBit_Strike */
/* */
/* <Description> */
/* A structure used describe a given bitmap strike in the */
/* `EBLC' or `bloc' tables. */
/* */
/* <Fields> */
/* */
/* num_index_ranges :: number of index ranges */
/* index_ranges :: array of glyph index ranges */
/* */
/* color_ref :: unused. color reference? */
/* hori :: line metrics for horizontal layouts. */
/* vert :: line metrics for vertical layouts. */
/* */
/* start_glyph :: lowest glyph index for this strike. */
/* end_glyph :: higher glyph index for this strike. */
/* */
/* x_ppem :: horizontal pixels per EM */
/* y_ppem :: vertical pixels per EM */
/* bit_depth :: bit depth. valid values are 1, 2, 4 & 8 */
/* flags :: vertical or horizontal? */
/* */
typedef struct TT_SBit_Strike_
{
TT_Int num_ranges;
TT_SBit_Range* sbit_ranges;
TT_ULong ranges_offset;
TT_ULong color_ref;
TT_SBit_Line_Metrics hori;
TT_SBit_Line_Metrics vert;
TT_UShort start_glyph;
TT_UShort end_glyph;
TT_Byte x_ppem;
TT_Byte y_ppem;
TT_Byte bit_depth;
TT_Char flags;
} TT_SBit_Strike;
/*************************************************************/
/* */
/* <Struct> TT_SBit_Component */
/* */
/* <Description> */
/* A simple structure to describe a compound sbit element */
/* */
/* <Fields> */
/* glyph_code :: element's glyph index */
/* x_offset :: element's left bearing */
/* y_offset :: element's top bearing */
/* */
typedef struct TT_SBit_Component_
{
TT_UShort glyph_code;
TT_Char x_offset;
TT_Char y_offset;
} TT_SBit_Component;
/*************************************************************/
/* */
/* <Struct> TT_SBit_Scale */
/* */
/* <Description> */
/* A structure used describe a given bitmap scaling */
/* table, as defined for the `EBSC' table. */
/* */
/* <Fields> */
/* hori :: horizontal line metrics */
/* vert :: vertical line metrics */
/* */
/* x_ppem :: horizontal pixels per EM */
/* y_ppem :: vertical pixels per EM */
/* */
/* x_ppem_substitute :: substitution x_ppem */
/* y_ppem_substitute :: substitution y_ppem */
/* */
typedef struct TT_SBit_Scale_
{
TT_SBit_Line_Metrics hori;
TT_SBit_Line_Metrics vert;
TT_Byte x_ppem;
TT_Byte y_ppem;
TT_Byte x_ppem_substitute;
TT_Byte y_ppem_substitute;
} TT_SBit_Scale;
/*************************************************************/
/* */
/* <Struct> TT_SBit_Image */
/* */
/* <Description> */
/* A structure used to describe a given embedded bitmap */
/* image. */
/* */
/* <Fields> */
/* map :: bitmap descriptor */
/* bit_depth :: pixel bit depth */
/* metrics :: glyph metrics for the bitmap */
/* */
typedef struct TT_SBit_Image_
{
TT_Raster_Map map;
int bit_depth;
TT_Big_Glyph_Metrics metrics;
} TT_SBit_Image;
/*************************************************************/
/* */
/* <Struct> TT_EBLC */
/* */
/* <Description> */
/* A structure used to describe the `EBLC' table from */
/* a TrueType font. */
/* */
/* <Fields> */
/* version :: version number of the EBLC table */
/* */
/* num_strikes :: the number of strikes, i.e. bitmap */
/* sizes, present in this font */
/* */
/* strikes :: array of strikes */
/* */
typedef struct TT_EBLC_
{
TT_ULong version;
TT_ULong num_strikes;
TT_SBit_Strike* strikes;
} TT_EBLC;
/*************************************************************/
/* */
/* <Function> */
/* TT_Init_SBit_Extension */
/* */
/* <Description> */
/* Initializes the embedded bitmap extension for the */
/* FreeType engine. */
/* */
/* <Input> */
/* engine :: handle to current FreeType library instance */
/* */
/* <Return> */
/* Error code. 0 means success. */
/* */
EXPORT_DEF
TT_Error TT_Init_SBit_Extension( TT_Engine engine );
/*************************************************************/
/* */
/* <Function> */
/* TT_Get_Face_Bitmaps */
/* */
/* <Description> */
/* Loads the `EBLC' table from a font file, if any. */
/* */
/* <Input> */
/* face :: handle to the source TrueType font/face */
/* */
/* <Output> */
/* eblc_table :: a descriptor for the EBLC table */
/* */
/* <Return> */
/* Error code. 0 means success. */
/* */
/* <Note> */
/* This function returns TT_Err_Table_Missing if the */
/* font contains no embedded bitmaps. All fields in */
/* `eblc_table' will then be set to 0. */
/* */
EXPORT_DEF
TT_Error TT_Get_Face_Bitmaps( TT_Face face,
TT_EBLC* eblc_table );
/*************************************************************/
/* */
/* <Function> */
/* TT_New_SBit_Image */
/* */
/* <Description> */
/* Allocates a new embedded bitmap container. */
/* */
/* <Output> */
/* image :: sbit image */
/* */
/* <Return> */
/* Error code. 0 means success. */
/* */
EXPORT_DEF
TT_Error TT_New_SBit_Image( TT_SBit_Image** image );
/*************************************************************/
/* */
/* <Function> */
/* TT_Done_SBit_Image */
/* */
/* <Description> */
/* Releases an embedded bitmap container. */
/* */
/* <Input> */
/* image :: sbit image */
/* */
EXPORT_DEF
void TT_Done_SBit_Image( TT_SBit_Image* image );
/*************************************************************/
/* */
/* <Function> TT_Get_SBit_Strike */
/* */
/* <Description> */
/* Loads a suitable strike (bitmap sizetable) for the */
/* given instance. This strike includes */
/* sbitLineMetrics. */
/* */
/* <Input> */
/* face :: the source face */
/* instance :: the current size instance */
/* */
/* <Output> */
/* strike :: the bitmap strike descriptor */
/* */
/* <Return> */
/* Error code. 0 means success. */
/* */
EXPORT_DEF
TT_Error TT_Get_SBit_Strike( TT_Face face,
TT_Instance instance,
TT_SBit_Strike* strike );
/*************************************************************/
/* */
/* <Function> */
/* TT_Load_Glyph_Bitmap */
/* */
/* <Description> */
/* Loads a given glyph embedded bitmap. */
/* */
/* <Input> */
/* face :: handle to the source TrueType font/face */
/* instance :: current size/transform instance */
/* glyph_index :: index of source glyph */
/* bitmap :: target embedded bitmap descriptor */
/* */
/* <Return> */
/* Error code. 0 means success. */
/* */
/* <Note> */
/* This function returns an error if there is no */
/* embedded bitmap for the glyph at the given */
/* instance. */
/* */
EXPORT_DEF
TT_Error TT_Load_Glyph_Bitmap( TT_Face face,
TT_Instance instance,
TT_UShort glyph_index,
TT_SBit_Image* bitmap );
#ifdef __cplusplus
}
#endif
#endif /* FTXSBIT_H */
/* END */

185
lib/extend/ftxwidth.c Normal file
View File

@@ -0,0 +1,185 @@
/*******************************************************************
*
* ftxwidth.c 1.0
*
* Glyph Widths (and Heights) fast retrieval extension
*
* Copyright 1996-1999 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.
*
*
* This extension is used to parse the "glyf" table of a TrueType
* file in order to extract the bbox of a given range of glyphs.
*
* The bbox is then used to build font unit widths and height
* that are returned in two parallel arrays.
*
* This extension is needed by the FreeType/2 OS/2 Font Driver.
*
******************************************************************/
#include "ftxwidth.h"
#include "ttdebug.h"
#include "ttobjs.h"
#include "ttfile.h"
#include "tttags.h"
#include "ttload.h"
/* Required by the tracing mode */
#undef TT_COMPONENT
#define TT_COMPONENT trace_any
/******************************************************************/
/* */
/* Function: TT_Get_Face_Widths */
/* */
/* Description: Returns the widths and/or heights of a given */
/* range of glyphs for a face. */
/* */
/* Input: */
/* face :: face handle */
/* */
/* first_glyph :: first glyph in range */
/* */
/* last_glyph :: last glyph in range */
/* */
/* widths :: address of table receiving the widths */
/* expressed in font units (ushorts). Set */
/* this parameter to NULL if you're not */
/* interested by these values. */
/* */
/* heights :: address of table receiving the heights */
/* expressed in font units (ushorts). Set */
/* this parameter to NULL if you're not */
/* interested by these values. */
/* */
/* Returns: */
/* Error code */
/* */
/* */
/******************************************************************/
EXPORT_FUNC
TT_Error TT_Get_Face_Widths( TT_Face face,
TT_UShort first_glyph,
TT_UShort last_glyph,
TT_UShort* widths,
TT_UShort* heights )
{
DEFINE_ALL_LOCALS;
PFace faze = HANDLE_Face(face);
UShort n;
Long table;
ULong glyf_offset; /* offset of glyph table in file */
UShort zero_width = 0; /* width of glyph 0 */
UShort zero_height = 0; /* height of glyph 0 */
Bool zero_loaded = 0;
#ifndef TT_HUGE_PTR
PStorage locations;
#else
Storage TT_HUGE_PTR * locations;
#endif
TT_BBox bbox;
if ( !faze )
return TT_Err_Invalid_Face_Handle;
if ( last_glyph >= faze->numGlyphs ||
first_glyph > last_glyph )
return TT_Err_Invalid_Argument;
/* find "glyf" table */
table = TT_LookUp_Table( faze, TTAG_glyf );
if ( table < 0 )
{
PERROR(( "ERROR: there is no glyph table in this font file!\n" ));
return TT_Err_Glyf_Table_Missing;
}
glyf_offset = faze->dirTables[table].Offset;
/* now access stream */
if ( USE_Stream( faze->stream, stream ) )
return error;
locations = faze->glyphLocations + first_glyph;
/* loop to load each glyph in the range */
for ( n = first_glyph; n <= last_glyph; n++ )
{
if ( n + 1 < faze->numGlyphs &&
locations[0] == locations[1] )
{
/* Note : Glyph 0 is always used to indicate a missing glyph */
/* in a range. We must thus return its width and height */
/* where appropriate when we find an undefined glyph. */
if ( zero_loaded == 0 )
{
if ( FILE_Seek( glyf_offset + faze->glyphLocations[0] ) ||
ACCESS_Frame( 10L ) )
goto Fail;
(void)GET_Short(); /* skip number of contours */
bbox.xMin = GET_Short();
bbox.yMin = GET_Short();
bbox.xMax = GET_Short();
bbox.yMax = GET_Short();
FORGET_Frame();
zero_width = (UShort)(bbox.xMax - bbox.xMin);
zero_height = (UShort)(bbox.yMax - bbox.yMin);
zero_loaded = 1;
}
if ( widths )
*widths++ = zero_width;
if ( heights )
*heights++ = zero_height;
}
else
{
/* normal glyph, read header */
if ( FILE_Seek( glyf_offset + locations[0] ) ||
ACCESS_Frame( 10L ) )
goto Fail;
(void)GET_Short(); /* skip number of contours */
bbox.xMin = GET_Short();
bbox.yMin = GET_Short();
bbox.xMax = GET_Short();
bbox.yMax = GET_Short();
FORGET_Frame();
if ( widths )
*widths++ = (UShort)(bbox.xMax - bbox.xMin);
if ( heights )
*heights++ = (UShort)(bbox.yMax - bbox.yMin);
}
}
Fail:
DONE_Stream( stream );
return error;
}
/* END */

80
lib/extend/ftxwidth.h Normal file
View File

@@ -0,0 +1,80 @@
/*******************************************************************
*
* ftxwidth.h
*
* Glyph Widths (and Heights) fast retrieval extension.
*
* Copyright 1996-1999 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.
*
*
* This extension is used to parse the `glyf' table of a TrueType
* file in order to extract the bounding box of a given range of glyphs.
*
* The bounding box is then used to build font unit widths and heights
* that are returned in two parallel arrays.
*
* This extension is needed by the FreeType/2 OS/2 Font Driver.
*
******************************************************************/
#ifndef FTXWIDTH_H
#define FTXWIDTH_H
#include "freetype.h"
#ifdef __cplusplus
extern "C" {
#endif
/******************************************************************/
/* */
/* Function: TT_Get_Face_Widths */
/* */
/* Description: Returns the widths and/or heights of a given */
/* range of glyphs for a face. */
/* */
/* Input: */
/* face :: face handle */
/* */
/* first_glyph :: first glyph in range */
/* */
/* last_glyph :: last glyph in range */
/* */
/* widths :: address of table receiving the widths */
/* expressed in font units (ushorts). Set */
/* this parameter to NULL if you're not */
/* interested by these values. */
/* */
/* heights :: address of table receiving the heights */
/* expressed in font units (ushorts). Set */
/* this parameter to NULL if you're not */
/* interested by these values */
/* */
/* Returns: */
/* Error code */
/* */
/* */
/******************************************************************/
EXPORT_DEF
TT_Error TT_Get_Face_Widths( TT_Face face,
TT_UShort first_glyph,
TT_UShort last_glyph,
TT_UShort* widths,
TT_UShort* heights );
#ifdef __cplusplus
}
#endif
#endif /* FTXWIDTH_H */
/* END */

61
lib/extend/readme.1st Normal file
View File

@@ -0,0 +1,61 @@
This directory contains several extensions to the core engine.
An extension is a separately compilable unit which can be linked by
a client application to add new functionalities to the engine.
There are two kinds of extensions: an `API extension' provides
clients with new APIs to access internal engine structures or data,
while an `engine extension' implements new TrueType data or table
management.
This directory contains the following:
ftxcmap: An API extension to iterate over cmaps.
ftxgasp: A simple API extension which returns the TrueType `gasp'
table to client applications, when found in a font file.
Though this table is always loaded by the engine, there
is no function in the core API to access it. The reason
is simple: to demonstrate a simple API extension with
`ftxgasp'!
ftxkern: This engine extension is used to access kerning data,
when available in a font file. Note that it implements
on-the-fly loading and retrieving of kerning tables.
However, it doesn't interpret or process the data, and
client applications should use it according to the
TrueType specification.
ftxpost: An engine extension to load the PostScript glyph names
of the `post' table. See the `ftzoom' program for an
example how to use it.
ftxwidth: A simple extension used to load the widths and heights
of a given range of glyphs in a face. Results are
expressed in unscaled font units. This is required by
the latest version of the FreeType/2 DLL to speed up
font loading in the GRE (the OS/2 GRaphics Engine). It
can be used by other applications though...
ftxerr18: This extension simply converts a TrueType engine error
code into a corresponding string describing the error.
It is useful if you intend to write a package for end
users and want to give them not `Error code 135' but
`OS/2 table missing'. See docs/errstr.txt for a
description how to use it (really simple!). ftxerr18
supports localization of error strings (that is: error
strings are automatically translated into supported
languages) using gettext(). See docs/i18n.txt about
using gettext.
ftxsbit: Embedded bitmap support. This is an engine extension.
See e.g. the `ftstrtto' program for its usage.
ftxopen,
ftxgsub,
ftxgpos,
ftxgdef: This is experimental stuff for TrueType Open support!
Please ignore it or help debugging :-)
--- END ---

1147
lib/freetype.h Normal file

File diff suppressed because it is too large Load Diff

161
lib/fterrid.h Normal file
View File

@@ -0,0 +1,161 @@
/*******************************************************************
*
* fterrid.h
*
* TrueType Error ID definitions
*
* Copyright 1996-1999 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.
*
******************************************************************/
#ifndef FREETYPE_H
#error "Don't include this file! Use freetype.h instead."
#endif
#ifndef FTERRID_H
#define FTERRID_H
/************************ error codes declaration **************/
/* The error codes are grouped in 'classes' used to indicate the */
/* 'level' at which the error happened. */
/* The class is given by an error code's high byte. */
/* ------------- Success is always 0 -------- */
#define TT_Err_Ok 0
/* -------- High-level API error codes ------ */
#define TT_Err_Invalid_Face_Handle 0x001
#define TT_Err_Invalid_Instance_Handle 0x002
#define TT_Err_Invalid_Glyph_Handle 0x003
#define TT_Err_Invalid_CharMap_Handle 0x004
#define TT_Err_Invalid_Result_Address 0x005
#define TT_Err_Invalid_Glyph_Index 0x006
#define TT_Err_Invalid_Argument 0x007
#define TT_Err_Could_Not_Open_File 0x008
#define TT_Err_File_Is_Not_Collection 0x009
#define TT_Err_Table_Missing 0x00A
#define TT_Err_Invalid_Horiz_Metrics 0x00B
#define TT_Err_Invalid_CharMap_Format 0x00C
#define TT_Err_Invalid_PPem 0x00D
#define TT_Err_Invalid_Vert_Metrics 0x00E
#define TT_Err_Invalid_File_Format 0x010
#define TT_Err_Invalid_Engine 0x020
#define TT_Err_Too_Many_Extensions 0x021
#define TT_Err_Extensions_Unsupported 0x022
#define TT_Err_Invalid_Extension_Id 0x023
#define TT_Err_No_Vertical_Data 0x030
#define TT_Err_Max_Profile_Missing 0x080
#define TT_Err_Header_Table_Missing 0x081
#define TT_Err_Horiz_Header_Missing 0x082
#define TT_Err_Locations_Missing 0x083
#define TT_Err_Name_Table_Missing 0x084
#define TT_Err_CMap_Table_Missing 0x085
#define TT_Err_Hmtx_Table_Missing 0x086
#define TT_Err_OS2_Table_Missing 0x087
#define TT_Err_Post_Table_Missing 0x088
#define TT_Err_Glyf_Table_Missing 0x089
/* -------- Memory component error codes ---- */
/* this error indicates that an operation cannot */
/* be performed due to memory exhaustion. */
#define TT_Err_Out_Of_Memory 0x100
/* -------- File component error codes ------ */
/* these error codes indicate that the file could */
/* not be accessed properly. Usually, this means */
/* a broken font file! */
#define TT_Err_Invalid_File_Offset 0x200
#define TT_Err_Invalid_File_Read 0x201
#define TT_Err_Invalid_Frame_Access 0x202
/* -------- Glyph loader error codes -------- */
/* Produced only by the glyph loader, these error */
/* codes indicate a broken glyph in a font file. */
#define TT_Err_Too_Many_Points 0x300
#define TT_Err_Too_Many_Contours 0x301
#define TT_Err_Invalid_Composite 0x302
#define TT_Err_Too_Many_Ins 0x303
/* --- bytecode interpreter error codes ----- */
/* These error codes are produced by the TrueType */
/* bytecode interpreter. They usually indicate a */
/* broken font file, a broken glyph within a font */
/* file, or a bug in the interpreter! */
#define TT_Err_Invalid_Opcode 0x400
#define TT_Err_Too_Few_Arguments 0x401
#define TT_Err_Stack_Overflow 0x402
#define TT_Err_Code_Overflow 0x403
#define TT_Err_Bad_Argument 0x404
#define TT_Err_Divide_By_Zero 0x405
#define TT_Err_Storage_Overflow 0x406
#define TT_Err_Cvt_Overflow 0x407
#define TT_Err_Invalid_Reference 0x408
#define TT_Err_Invalid_Distance 0x409
#define TT_Err_Interpolate_Twilight 0x40A
#define TT_Err_Debug_OpCode 0x40B
#define TT_Err_ENDF_In_Exec_Stream 0x40C
#define TT_Err_Out_Of_CodeRanges 0x40D
#define TT_Err_Nested_DEFS 0x40E
#define TT_Err_Invalid_CodeRange 0x40F
#define TT_Err_Invalid_Displacement 0x410
#define TT_Err_Execution_Too_Long 0x411
/* ------ internal failure error codes ----- */
/* These error codes are produced when an incoherent */
/* library state has been detected. These reflect a */
/* severe bug in the engine! (Or a major overwrite */
/* of your application into the library's data.) */
#define TT_Err_Nested_Frame_Access 0x500
#define TT_Err_Invalid_Cache_List 0x501
#define TT_Err_Could_Not_Find_Context 0x502
#define TT_Err_Unlisted_Object 0x503
/* ---- scan-line converter error codes ----- */
/* These error codes are produced by the raster component. */
/* They indicate that an outline structure was incoherently */
/* setup, or that you're trying to render an horribly */
/* complex glyph! */
#define TT_Err_Raster_Pool_Overflow 0x600
#define TT_Err_Raster_Negative_Height 0x601
#define TT_Err_Raster_Invalid_Value 0x602
#define TT_Err_Raster_Not_Initialized 0x603
#endif /* FTERRID_H */
/* END */

628
lib/ftnameid.h Normal file
View File

@@ -0,0 +1,628 @@
/*******************************************************************
*
* ftnameid.h
*
* TrueType Name ID definitions
*
* Copyright 1996-1999 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.
*
******************************************************************/
#ifndef FREETYPE_H
#error "Don't include this file! Use freetype.h instead."
#endif
#ifndef FTNAMEID_H
#define FTNAMEID_H
/*
* possible values for the 'Platform' identifier code in the name
* records of the TTF "name" table
*/
#define TT_PLATFORM_APPLE_UNICODE 0
#define TT_PLATFORM_MACINTOSH 1
#define TT_PLATFORM_ISO 2
#define TT_PLATFORM_MICROSOFT 3
/*
* possible values of the platform specific encoding identifier field in
* the name records of the TTF "name" table when the 'Platform' identifier
* code is TT_PLATFORM_APPLE_UNICODE
*/
#define TT_APPLE_ID_DEFAULT 0
#define TT_APPLE_ID_UNICODE_1_1 1
#define TT_APPLE_ID_ISO_10646 2
#define TT_APPLE_ID_UNICODE_2_0 3
/*
* possible values of the platform specific encoding identifier field in
* the name records of the TTF "name" table when the 'Platform' identifier
* code is TT_PLATFORM_MACINTOSH
*/
#define TT_MAC_ID_ROMAN 0
#define TT_MAC_ID_JAPANESE 1
#define TT_MAC_ID_TRADITIONAL_CHINESE 2
#define TT_MAC_ID_KOREAN 3
#define TT_MAC_ID_ARABIC 4
#define TT_MAC_ID_HEBREW 5
#define TT_MAC_ID_GREEK 6
#define TT_MAC_ID_RUSSIAN 7
#define TT_MAC_ID_RSYMBOL 8
#define TT_MAC_ID_DEVANAGARI 9
#define TT_MAC_ID_GURMUKHI 10
#define TT_MAC_ID_GUJARATI 11
#define TT_MAC_ID_ORIYA 12
#define TT_MAC_ID_BENGALI 13
#define TT_MAC_ID_TAMIL 14
#define TT_MAC_ID_TELUGU 15
#define TT_MAC_ID_KANNADA 16
#define TT_MAC_ID_MALAYALAM 17
#define TT_MAC_ID_SINHALESE 18
#define TT_MAC_ID_BURMESE 19
#define TT_MAC_ID_KHMER 20
#define TT_MAC_ID_THAI 21
#define TT_MAC_ID_LAOTIAN 22
#define TT_MAC_ID_GEORGIAN 23
#define TT_MAC_ID_ARMENIAN 24
#define TT_MAC_ID_MALDIVIAN 25
#define TT_MAC_ID_SIMPLIFIED_CHINESE 25
#define TT_MAC_ID_TIBETAN 26
#define TT_MAC_ID_MONGOLIAN 27
#define TT_MAC_ID_GEEZ 28
#define TT_MAC_ID_SLAVIC 29
#define TT_MAC_ID_VIETNAMESE 30
#define TT_MAC_ID_SINDHI 31
#define TT_MAC_ID_UNINTERP 32
/*
* possible values of the platform specific encoding identifier field in
* the name records of the TTF "name" table when the 'Platform' identifier
* code is TT_PLATFORM_ISO
*/
#define TT_ISO_ID_7BIT_ASCII 0
#define TT_ISO_ID_10646 1
#define TT_ISO_ID_8859_1 2
/*
* possible values of the platform specific encoding identifier field in
* the name records of the TTF "name" table when the 'Platform' identifier
* code is TT_PLATFORM_MICROSOFT
*/
#define TT_MS_ID_SYMBOL_CS 0
#define TT_MS_ID_UNICODE_CS 1
#define TT_MS_ID_SJIS 2
#define TT_MS_ID_GB2312 3
#define TT_MS_ID_BIG_5 4
#define TT_MS_ID_WANSUNG 5
#define TT_MS_ID_JOHAB 6
/*
* possible values of the language identifier field in the name records of
* the TTF "name" table when the 'Platform' identifier code is
* TT_PLATFORM_MACINTOSH
*
* the canonical source for the Apple assigned Language ID's is at
* http://fonts.apple.com/TTRefMan/RM06/Chap6name.html
*/
#define TT_MAC_LANGID_ENGLISH 0
#define TT_MAC_LANGID_FRENCH 1
#define TT_MAC_LANGID_GERMAN 2
#define TT_MAC_LANGID_ITALIAN 3
#define TT_MAC_LANGID_DUTCH 4
#define TT_MAC_LANGID_SWEDISH 5
#define TT_MAC_LANGID_SPANISH 6
#define TT_MAC_LANGID_DANISH 7
#define TT_MAC_LANGID_PORTUGUESE 8
#define TT_MAC_LANGID_NORWEGIAN 9
#define TT_MAC_LANGID_HEBREW 10
#define TT_MAC_LANGID_JAPANESE 11
#define TT_MAC_LANGID_ARABIC 12
#define TT_MAC_LANGID_FINNISH 13
#define TT_MAC_LANGID_GREEK 14
#define TT_MAC_LANGID_ICELANDIC 15
#define TT_MAC_LANGID_MALTESE 16
#define TT_MAC_LANGID_TURKISH 17
#define TT_MAC_LANGID_CROATIAN 18
#define TT_MAC_LANGID_CHINESE_TRADITIONAL 19
#define TT_MAC_LANGID_URDU 20
#define TT_MAC_LANGID_HINDI 21
#define TT_MAC_LANGID_THAI 22
#define TT_MAC_LANGID_KOREAN 23
#define TT_MAC_LANGID_LITHUANIAN 24
#define TT_MAC_LANGID_POLISH 25
#define TT_MAC_LANGID_HUNGARIAN 26
#define TT_MAC_LANGID_ESTONIAN 27
#define TT_MAC_LANGID_LETTISH 28
#define TT_MAC_LANGID_SAAMISK 29
#define TT_MAC_LANGID_FAEROESE 30
#define TT_MAC_LANGID_FARSI 31
#define TT_MAC_LANGID_RUSSIAN 32
#define TT_MAC_LANGID_CHINESE_SIMPLIFIED 33
#define TT_MAC_LANGID_FLEMISH 34
#define TT_MAC_LANGID_IRISH 35
#define TT_MAC_LANGID_ALBANIAN 36
#define TT_MAC_LANGID_ROMANIAN 37
#define TT_MAC_LANGID_CZECH 38
#define TT_MAC_LANGID_SLOVAK 39
#define TT_MAC_LANGID_SLOVENIAN 40
#define TT_MAC_LANGID_YIDDISH 41
#define TT_MAC_LANGID_SERBIAN 42
#define TT_MAC_LANGID_MACEDONIAN 43
#define TT_MAC_LANGID_BULGARIAN 44
#define TT_MAC_LANGID_UKRAINIAN 45
#define TT_MAC_LANGID_BYELORUSSIAN 46
#define TT_MAC_LANGID_UZBEK 47
#define TT_MAC_LANGID_KAZAKH 48
#define TT_MAC_LANGID_AZERBAIJANI 49
#define TT_MAC_LANGID_AZERBAIJANI_ARABIC_SCRIPT 50
#define TT_MAC_LANGID_ARMENIAN 51
#define TT_MAC_LANGID_GEORGIAN 52
#define TT_MAC_LANGID_MOLDAVIAN 53
#define TT_MAC_LANGID_KIRGHIZ 54
#define TT_MAC_LANGID_TAJIKI 55
#define TT_MAC_LANGID_TURKMEN 56
#define TT_MAC_LANGID_MONGOLIAN 57
#define TT_MAC_LANGID_MONGOLIAN_CYRILLIC_SCRIPT 58
#define TT_MAC_LANGID_PASHTO 59
#define TT_MAC_LANGID_KURDISH 60
#define TT_MAC_LANGID_KASHMIRI 61
#define TT_MAC_LANGID_SINDHI 62
#define TT_MAC_LANGID_TIBETAN 63
#define TT_MAC_LANGID_NEPALI 64
#define TT_MAC_LANGID_SANSKRIT 65
#define TT_MAC_LANGID_MARATHI 66
#define TT_MAC_LANGID_BENGALI 67
#define TT_MAC_LANGID_ASSAMESE 68
#define TT_MAC_LANGID_GUJARATI 69
#define TT_MAC_LANGID_PUNJABI 70
#define TT_MAC_LANGID_ORIYA 71
#define TT_MAC_LANGID_MALAYALAM 72
#define TT_MAC_LANGID_KANNADA 73
#define TT_MAC_LANGID_TAMIL 74
#define TT_MAC_LANGID_TELUGU 75
#define TT_MAC_LANGID_SINHALESE 76
#define TT_MAC_LANGID_BURMESE 77
#define TT_MAC_LANGID_KHMER 78
#define TT_MAC_LANGID_LAO 79
#define TT_MAC_LANGID_VIETNAMESE 80
#define TT_MAC_LANGID_INDONESIAN 81
#define TT_MAC_LANGID_TAGALOG 82
#define TT_MAC_LANGID_MALAY_ROMAN_SCRIPT 83
#define TT_MAC_LANGID_MALAY_ARABIC_SCRIPT 84
#define TT_MAC_LANGID_AMHARIC 85
#define TT_MAC_LANGID_TIGRINYA 86
#define TT_MAC_LANGID_GALLA 87
#define TT_MAC_LANGID_SOMALI 88
#define TT_MAC_LANGID_SWAHILI 89
#define TT_MAC_LANGID_RUANDA 90
#define TT_MAC_LANGID_RUNDI 91
#define TT_MAC_LANGID_CHEWA 92
#define TT_MAC_LANGID_MALAGASY 93
#define TT_MAC_LANGID_ESPERANTO 94
#define TT_MAC_LANGID_WELSH 128
#define TT_MAC_LANGID_BASQUE 129
#define TT_MAC_LANGID_CATALAN 130
#define TT_MAC_LANGID_LATIN 131
#define TT_MAC_LANGID_QUECHUA 132
#define TT_MAC_LANGID_GUARANI 133
#define TT_MAC_LANGID_AYMARA 134
#define TT_MAC_LANGID_TATAR 135
#define TT_MAC_LANGID_UIGHUR 136
#define TT_MAC_LANGID_DZONGKHA 137
#define TT_MAC_LANGID_JAVANESE 138
#define TT_MAC_LANGID_SUNDANESE 139
#define TT_MAC_LANGID_SCOTTISH_GAELIC 140
#define TT_MAC_LANGID_IRISH_GAELIC 141
#define TT_MAC_LANGID_BRETON 142
#define TT_MAC_LANGID_INUKTITUT 143
/*
* possible values of the language identifier field in the name records of
* the TTF "name" table when the 'Platform' identifier code is
* TT_PLATFORM_MICROSOFT
*
* the canonical source for the MS assigned LCID's is at
* http://www.microsoft.com/typography/OTSPEC/lcid-cp.txt
*/
#define TT_MS_LANGID_ARABIC_SAUDI_ARABIA 0x0401
#define TT_MS_LANGID_ARABIC_IRAQ 0x0801
#define TT_MS_LANGID_ARABIC_EGYPT 0x0c01
#define TT_MS_LANGID_ARABIC_LIBYA 0x1001
#define TT_MS_LANGID_ARABIC_ALGERIA 0x1401
#define TT_MS_LANGID_ARABIC_MOROCCO 0x1801
#define TT_MS_LANGID_ARABIC_TUNISIA 0x1c01
#define TT_MS_LANGID_ARABIC_OMAN 0x2001
#define TT_MS_LANGID_ARABIC_YEMEN 0x2401
#define TT_MS_LANGID_ARABIC_SYRIA 0x2801
#define TT_MS_LANGID_ARABIC_JORDAN 0x2c01
#define TT_MS_LANGID_ARABIC_LEBANON 0x3001
#define TT_MS_LANGID_ARABIC_KUWAIT 0x3401
#define TT_MS_LANGID_ARABIC_UAE 0x3801
#define TT_MS_LANGID_ARABIC_BAHRAIN 0x3c01
#define TT_MS_LANGID_ARABIC_QATAR 0x4001
#define TT_MS_LANGID_BULGARIAN_BULGARIA 0x0402
#define TT_MS_LANGID_CATALAN_SPAIN 0x0403
#define TT_MS_LANGID_CHINESE_TAIWAN 0x0404
#define TT_MS_LANGID_CHINESE_PRC 0x0804
#define TT_MS_LANGID_CHINESE_HONG_KONG 0x0c04
#define TT_MS_LANGID_CHINESE_SINGAPORE 0x1004
#define TT_MS_LANGID_CHINESE_MACAU 0x1404
#define TT_MS_LANGID_CZECH_CZECH_REPUBLIC 0x0405
#define TT_MS_LANGID_DANISH_DENMARK 0x0406
#define TT_MS_LANGID_GERMAN_GERMANY 0x0407
#define TT_MS_LANGID_GERMAN_SWITZERLAND 0x0807
#define TT_MS_LANGID_GERMAN_AUSTRIA 0x0c07
#define TT_MS_LANGID_GERMAN_LUXEMBOURG 0x1007
#define TT_MS_LANGID_GERMAN_LIECHTENSTEI 0x1407
#define TT_MS_LANGID_GREEK_GREECE 0x0408
#define TT_MS_LANGID_ENGLISH_UNITED_STATES 0x0409
#define TT_MS_LANGID_ENGLISH_UNITED_KINGDOM 0x0809
#define TT_MS_LANGID_ENGLISH_AUSTRALIA 0x0c09
#define TT_MS_LANGID_ENGLISH_CANADA 0x1009
#define TT_MS_LANGID_ENGLISH_NEW_ZEALAND 0x1409
#define TT_MS_LANGID_ENGLISH_IRELAND 0x1809
#define TT_MS_LANGID_ENGLISH_SOUTH_AFRICA 0x1c09
#define TT_MS_LANGID_ENGLISH_JAMAICA 0x2009
#define TT_MS_LANGID_ENGLISH_CARIBBEAN 0x2409
#define TT_MS_LANGID_ENGLISH_BELIZE 0x2809
#define TT_MS_LANGID_ENGLISH_TRINIDAD 0x2c09
#define TT_MS_LANGID_ENGLISH_ZIMBABWE 0x3009
#define TT_MS_LANGID_ENGLISH_PHILIPPINES 0x3409
#define TT_MS_LANGID_SPANISH_SPAIN_TRADITIONAL_SORT 0x040a
#define TT_MS_LANGID_SPANISH_MEXICO 0x080a
#define TT_MS_LANGID_SPANISH_SPAIN_INTERNATIONAL_SORT 0x0c0a
#define TT_MS_LANGID_SPANISH_GUATEMALA 0x100a
#define TT_MS_LANGID_SPANISH_COSTA_RICA 0x140a
#define TT_MS_LANGID_SPANISH_PANAMA 0x180a
#define TT_MS_LANGID_SPANISH_DOMINICAN_REPUBLIC 0x1c0a
#define TT_MS_LANGID_SPANISH_VENEZUELA 0x200a
#define TT_MS_LANGID_SPANISH_COLOMBIA 0x240a
#define TT_MS_LANGID_SPANISH_PERU 0x280a
#define TT_MS_LANGID_SPANISH_ARGENTINA 0x2c0a
#define TT_MS_LANGID_SPANISH_ECUADOR 0x300a
#define TT_MS_LANGID_SPANISH_CHILE 0x340a
#define TT_MS_LANGID_SPANISH_URUGUAY 0x380a
#define TT_MS_LANGID_SPANISH_PARAGUAY 0x3c0a
#define TT_MS_LANGID_SPANISH_BOLIVIA 0x400a
#define TT_MS_LANGID_SPANISH_EL_SALVADOR 0x440a
#define TT_MS_LANGID_SPANISH_HONDURAS 0x480a
#define TT_MS_LANGID_SPANISH_NICARAGUA 0x4c0a
#define TT_MS_LANGID_SPANISH_PUERTO_RICO 0x500a
#define TT_MS_LANGID_FINNISH_FINLAND 0x040b
#define TT_MS_LANGID_FRENCH_FRANCE 0x040c
#define TT_MS_LANGID_FRENCH_BELGIUM 0x080c
#define TT_MS_LANGID_FRENCH_CANADA 0x0c0c
#define TT_MS_LANGID_FRENCH_SWITZERLAND 0x100c
#define TT_MS_LANGID_FRENCH_LUXEMBOURG 0x140c
#define TT_MS_LANGID_FRENCH_MONACO 0x180c
#define TT_MS_LANGID_HEBREW_ISRAEL 0x040d
#define TT_MS_LANGID_HUNGARIAN_HUNGARY 0x040e
#define TT_MS_LANGID_ICELANDIC_ICELAND 0x040f
#define TT_MS_LANGID_ITALIAN_ITALY 0x0410
#define TT_MS_LANGID_ITALIAN_SWITZERLAND 0x0810
#define TT_MS_LANGID_JAPANESE_JAPAN 0x0411
#define TT_MS_LANGID_KOREAN_EXTENDED_WANSUNG_KOREA 0x0412
#define TT_MS_LANGID_KOREAN_JOHAB_KOREA 0x0812
#define TT_MS_LANGID_DUTCH_NETHERLANDS 0x0413
#define TT_MS_LANGID_DUTCH_BELGIUM 0x0813
#define TT_MS_LANGID_NORWEGIAN_NORWAY_BOKMAL 0x0414
#define TT_MS_LANGID_NORWEGIAN_NORWAY_NYNORSK 0x0814
#define TT_MS_LANGID_POLISH_POLAND 0x0415
#define TT_MS_LANGID_PORTUGUESE_BRAZIL 0x0416
#define TT_MS_LANGID_PORTUGUESE_PORTUGAL 0x0816
#define TT_MS_LANGID_RHAETO_ROMANIC_SWITZERLAND 0x0417
#define TT_MS_LANGID_ROMANIAN_ROMANIA 0x0418
#define TT_MS_LANGID_MOLDAVIAN_MOLDAVIA 0x0818
#define TT_MS_LANGID_RUSSIAN_RUSSIA 0x0419
#define TT_MS_LANGID_RUSSIAN_MOLDAVIA 0x0819
#define TT_MS_LANGID_CROATIAN_CROATIA 0x041a
#define TT_MS_LANGID_SERBIAN_SERBIA_LATIN 0x081a
#define TT_MS_LANGID_SERBIAN_SERBIA_CYRILLIC 0x0c1a
#define TT_MS_LANGID_SLOVAK_SLOVAKIA 0x041b
#define TT_MS_LANGID_ALBANIAN_ALBANIA 0x041c
#define TT_MS_LANGID_SWEDISH_SWEDEN 0x041d
#define TT_MS_LANGID_SWEDISH_FINLAND 0x081d
#define TT_MS_LANGID_THAI_THAILAND 0x041e
#define TT_MS_LANGID_TURKISH_TURKEY 0x041f
#define TT_MS_LANGID_URDU_PAKISTAN 0x0420
#define TT_MS_LANGID_INDONESIAN_INDONESIA 0x0421
#define TT_MS_LANGID_UKRAINIAN_UKRAINE 0x0422
#define TT_MS_LANGID_BELARUSIAN_BELARUS 0x0423
#define TT_MS_LANGID_SLOVENE_SLOVENIA 0x0424
#define TT_MS_LANGID_ESTONIAN_ESTONIA 0x0425
#define TT_MS_LANGID_LATVIAN_LATVIA 0x0426
#define TT_MS_LANGID_LITHUANIAN_LITHUANIA 0x0427
#define TT_MS_LANGID_CLASSIC_LITHUANIAN_LITHUANIA 0x0827
#define TT_MS_LANGID_MAORI_NEW_ZEALAND 0x0428
#define TT_MS_LANGID_FARSI_IRAN 0x0429
#define TT_MS_LANGID_VIETNAMESE_VIET_NAM 0x042a
#define TT_MS_LANGID_ARMENIAN_ARMENIA 0x042b
#define TT_MS_LANGID_AZERI_AZERBAIJAN_LATIN 0x042c
#define TT_MS_LANGID_AZERI_AZERBAIJAN_CYRILLIC 0x082c
#define TT_MS_LANGID_BASQUE_SPAIN 0x042d
#define TT_MS_LANGID_SORBIAN_GERMANY 0x042e
#define TT_MS_LANGID_MACEDONIAN_MACEDONIA 0x042f
#define TT_MS_LANGID_SUTU_SOUTH_AFRICA 0x0430
#define TT_MS_LANGID_TSONGA_SOUTH_AFRICA 0x0431
#define TT_MS_LANGID_TSWANA_SOUTH_AFRICA 0x0432
#define TT_MS_LANGID_VENDA_SOUTH_AFRICA 0x0433
#define TT_MS_LANGID_XHOSA_SOUTH_AFRICA 0x0434
#define TT_MS_LANGID_ZULU_SOUTH_AFRICA 0x0435
#define TT_MS_LANGID_AFRIKAANS_SOUTH_AFRICA 0x0436
#define TT_MS_LANGID_GEORGIAN_GEORGIA 0x0437
#define TT_MS_LANGID_FAEROESE_FAEROE_ISLANDS 0x0438
#define TT_MS_LANGID_HINDI_INDIA 0x0439
#define TT_MS_LANGID_MALTESE_MALTA 0x043a
#define TT_MS_LANGID_SAAMI_LAPONIA 0x043b
#define TT_MS_LANGID_IRISH_GAELIC_IRELAND 0x043c
#define TT_MS_LANGID_SCOTTISH_GAELIC_UNITED_KINGDOM 0x083c
#define TT_MS_LANGID_MALAY_MALAYSIA 0x043e
#define TT_MS_LANGID_MALAY_BRUNEI_DARUSSALAM 0x083e
#define TT_MS_LANGID_KAZAK_KAZAKSTAN 0x043f
#define TT_MS_LANGID_SWAHILI_KENYA 0x0441
#define TT_MS_LANGID_UZBEK_UZBEKISTAN_LATIN 0x0443
#define TT_MS_LANGID_UZBEK_UZBEKISTAN_CYRILLIC 0x0843
#define TT_MS_LANGID_TATAR_TATARSTAN 0x0444
#define TT_MS_LANGID_BENGALI_INDIA 0x0445
#define TT_MS_LANGID_PUNJABI_INDIA 0x0446
#define TT_MS_LANGID_GUJARATI_INDIA 0x0447
#define TT_MS_LANGID_ORIYA_INDIA 0x0448
#define TT_MS_LANGID_TAMIL_INDIA 0x0449
#define TT_MS_LANGID_TELUGU_INDIA 0x044a
#define TT_MS_LANGID_KANNADA_INDIA 0x044b
#define TT_MS_LANGID_MALAYALAM_INDIA 0x044c
#define TT_MS_LANGID_ASSAMESE_INDIA 0x044d
#define TT_MS_LANGID_MARATHI_INDIA 0x044e
#define TT_MS_LANGID_SANSKRIT_INDIA 0x044f
#define TT_MS_LANGID_KONKANI_INDIA 0x0457
/*
* possible values of the 'Name' identifier field in the name records of
* the TTF "name" table. These values are platform independent.
*/
#define TT_NAME_ID_COPYRIGHT 0
#define TT_NAME_ID_FONT_FAMILY 1
#define TT_NAME_ID_FONT_SUBFAMILY 2
#define TT_NAME_ID_UNIQUE_ID 3
#define TT_NAME_ID_FULL_NAME 4
#define TT_NAME_ID_VERSION_STRING 5
#define TT_NAME_ID_PS_NAME 6
#define TT_NAME_ID_TRADEMARK 7
/* the following values are from the OpenType spec */
#define TT_NAME_ID_MANUFACTURER 8
#define TT_NAME_ID_DESIGNER 9
#define TT_NAME_ID_DESCRIPTION 10
#define TT_NAME_ID_VENDOR_URL 11
#define TT_NAME_ID_DESIGNER_URL 12
#define TT_NAME_ID_LICENSE 13
#define TT_NAME_ID_LICENSE_URL 14
/* number 15 is reserved */
#define TT_NAME_ID_PREFERRED_FAMILY 16
#define TT_NAME_ID_PREFERRED_SUBFAMILY 17
#define TT_NAME_ID_MAC_FULL_NAME 18
/*
* Bit Mask values for the Unicode Ranges from the TTF "OS2 " table.
*/
/* General Scripts Area */
/* Bit 0 C0 Controls and Basic Latin */
#define TT_UCR_BASIC_LATIN (1L << 0) /* U+0000-U+007F */
/* Bit 1 C1 Controls and Latin-1 Supplement */
#define TT_UCR_LATIN1_SUPPLEMENT (1L << 1) /* U+0080-U+00FF */
/* Bit 2 Latin Extended-A */
#define TT_UCR_LATIN_EXTENDED_A (1L << 2) /* U+0100-U+017F */
/* Bit 3 Latin Extended-B */
#define TT_UCR_LATIN_EXTENDED_B (1L << 3) /* U+0180-U+024F */
/* Bit 4 IPA Extensions */
#define TT_UCR_IPA_EXTENSIONS (1L << 4) /* U+0250-U+02AF */
/* Bit 5 Spacing Modifier Letters */
#define TT_UCR_SPACING_MODIFIER (1L << 5) /* U+02B0-U+02FF */
/* Bit 6 Combining Diacritical Marks */
#define TT_UCR_COMBINING_DIACRITICS (1L << 6) /* U+0300-U+036F */
/* Bit 7 Greek */
#define TT_UCR_GREEK (1L << 7) /* U+0370-U+03FF */
/* Bit 8 is reserved (was: Greek Symbols and Coptic) */
/* Bit 9 Cyrillic */
#define TT_UCR_CYRILLIC (1L << 9) /* U+0400-U+04FF */
/* Bit 10 Armenian */
#define TT_UCR_ARMENIAN (1L << 10) /* U+0530-U+058F */
/* Bit 11 Hebrew */
#define TT_UCR_HEBREW (1L << 11) /* U+0590-U+05FF */
/* Bit 12 is reserved (was: Hebrew Extended) */
/* Bit 13 Arabic */
#define TT_UCR_ARABIC (1L << 13) /* U+0600-U+06FF */
/* Bit 14 is reserved (was: Arabic Extended) */
/* Bit 15 Devanagari */
#define TT_UCR_DEVANAGARI (1L << 15) /* U+0900-U+097F */
/* Bit 16 Bengali */
#define TT_UCR_BENGALI (1L << 16) /* U+0980-U+09FF */
/* Bit 17 Gurmukhi */
#define TT_UCR_GURMUKHI (1L << 17) /* U+0A00-U+0A7F */
/* Bit 18 Gujarati */
#define TT_UCR_GUJARATI (1L << 18) /* U+0A80-U+0AFF */
/* Bit 19 Oriya */
#define TT_UCR_ORIYA (1L << 19) /* U+0B00-U+0B7F */
/* Bit 20 Tamil */
#define TT_UCR_TAMIL (1L << 20) /* U+0B80-U+0BFF */
/* Bit 21 Telugu */
#define TT_UCR_TELUGU (1L << 21) /* U+0C00-U+0C7F */
/* Bit 22 Kannada */
#define TT_UCR_KANNADA (1L << 22) /* U+0C80-U+0CFF */
/* Bit 23 Malayalam */
#define TT_UCR_MALAYALAM (1L << 23) /* U+0D00-U+0D7F */
/* Bit 24 Thai */
#define TT_UCR_THAI (1L << 24) /* U+0E00-U+0E7F */
/* Bit 25 Lao */
#define TT_UCR_LAO (1L << 25) /* U+0E80-U+0EFF */
/* Bit 26 Georgian */
#define TT_UCR_GEORGIAN (1L << 26) /* U+10A0-U+10FF */
/* Bit 27 is reserved (was Georgian Extended) */
/* Bit 28 Hangul Jamo */
#define TT_UCR_HANGUL_JAMO (1L << 28) /* U+1100-U+11FF */
/* Bit 29 Latin Extended Additional */
#define TT_UCR_LATIN_EXTENDED_ADDITIONAL (1L << 29) /* U+1E00-U+1EFF */
/* Bit 30 Greek Extended */
#define TT_UCR_GREEK_EXTENDED (1L << 30) /* U+1F00-U+1FFF */
/* Symbols Area */
/* Bit 31 General Punctuation */
#define TT_UCR_GENERAL_PUNCTUATION (1L << 31) /* U+2000-U+206F */
/* Bit 32 Superscripts And Subscripts */
#define TT_UCR_SUPERSCRIPTS_SUBSCRIPTS (1L << 0) /* U+2070-U+209F */
/* Bit 33 Currency Symbols */
#define TT_UCR_CURRENCY_SYMBOLS (1L << 1) /* U+20A0-U+20CF */
/* Bit 34 Combining Diacritical Marks For Symbols */
#define TT_UCR_COMBINING_DIACRITICS_SYMB (1L << 2) /* U+20D0-U+20FF */
/* Bit 35 Letterlike Symbols */
#define TT_UCR_LETTERLIKE_SYMBOLS (1L << 3) /* U+2100-U+214F */
/* Bit 36 Number Forms */
#define TT_UCR_NUMBER_FORMS (1L << 4) /* U+2150-U+218F */
/* Bit 37 Arrows */
#define TT_UCR_ARROWS (1L << 5) /* U+2190-U+21FF */
/* Bit 38 Mathematical Operators */
#define TT_UCR_MATHEMATICAL_OPERATORS (1L << 6) /* U+2200-U+22FF */
/* Bit 39 Miscellaneous Technical */
#define TT_UCR_MISCELLANEOUS_TECHNICAL (1L << 7) /* U+2300-U+23FF */
/* Bit 40 Control Pictures */
#define TT_UCR_CONTROL_PICTURES (1L << 8) /* U+2400-U+243F */
/* Bit 41 Optical Character Recognition */
#define TT_UCR_OCR (1L << 9) /* U+2440-U+245F */
/* Bit 42 Enclosed Alphanumerics */
#define TT_UCR_ENCLOSED_ALPHANUMERICS (1L << 10) /* U+2460-U+24FF */
/* Bit 43 Box Drawing */
#define TT_UCR_BOX_DRAWING (1L << 11) /* U+2500-U+257F */
/* Bit 44 Block Elements */
#define TT_UCR_BLOCK_ELEMENTS (1L << 12) /* U+2580-U+259F */
/* Bit 45 Geometric Shapes */
#define TT_UCR_GEOMETRIC_SHAPES (1L << 13) /* U+25A0-U+25FF */
/* Bit 46 Miscellaneous Symbols */
#define TT_UCR_MISCELLANEOUS_SYMBOLS (1L << 14) /* U+2600-U+26FF */
/* Bit 47 Dingbats */
#define TT_UCR_DINGBATS (1L << 15) /* U+2700-U+27BF */
/* CJK Phonetics and Symbols Area */
/* Bit 48 CJK Symbols And Punctuation */
#define TT_UCR_CJK_SYMBOLS (1L << 16) /* U+3000-U+303F */
/* Bit 49 Hiragana */
#define TT_UCR_HIRAGANA (1L << 17) /* U+3040-U+309F */
/* Bit 50 Katakana */
#define TT_UCR_KATAKANA (1L << 18) /* U+30A0-U+30FF */
/* Bit 51 Bopomofo */
#define TT_UCR_BOPOMOFO (1L << 19) /* U+3100-U+312F */
/* Bit 52 Hangul Compatibility Jamo */
#define TT_UCR_HANGUL_COMPATIBILITY_JAMO (1L << 20) /* U+3130-U+318F */
/* Bit 53 CJK Miscellaneous */
#define TT_UCR_CJK_MISC (1L << 21) /* U+3190-U+319F */
/* Bit 54 Enclosed CJK Letters And Months */
#define TT_UCR_ENCLOSED_CJK_LETTERS_MONTHS (1L << 22) /* U+3200-U+32FF */
/* Bit 55 CJK Compatibility */
#define TT_UCR_CJK_COMPATIBILITY (1L << 23) /* U+3300-U+33FF */
/* Hangul Syllables Area */
/* Bit 56 Hangul */
#define TT_UCR_HANGUL (1L << 24) /* U+AC00-U+D7A3 */
/* Surrogates Area */
/* Bit 57 Surrogates */
#define TT_UCR_SURROGATES (1L << 25) /* U+D800-U+DFFF */
/* Bit 58 is reserved for Unicode SubRanges */
/* CJK Ideographs Area */
/* Bit 59 CJK Unified Ideographs */
#define TT_UCR_CJK_UNIFIED_IDEOGRAPHS (1L << 27) /* U+4E00-U+9FFF */
/* Private Use Area */
/* Bit 60 Private Use */
#define TT_UCR_PRIVATE_USE (1L << 28) /* U+E000-U+F8FF */
/* Compatibility Area and Specials */
/* Bit 61 CJK Compatibility Ideographs */
#define TT_UCR_CJK_COMPATIBILITY_IDEOGRAPHS (1L << 29) /* U+F900-U+FAFF */
/* Bit 62 Alphabetic Presentation Forms */
#define TT_UCR_ALPHABETIC_PRESENTATION_FORMS (1L << 30) /* U+FB00-U+FB4F */
/* Bit 63 Arabic Presentation Forms-A */
#define TT_UCR_ARABIC_PRESENTATIONS_A (1L << 31) /* U+FB50-U+FSFF */
/* Bit 64 Combining Half Marks */
#define TT_UCR_COMBINING_HALF_MARKS (1L << 0) /* U+FE20-U+FE2F */
/* Bit 65 CJK Compatibility Forms */
#define TT_UCR_CJK_COMPATIBILITY_FORMS (1L << 1) /* U+FE30-U+FE4F */
/* Bit 66 Small Form Variants */
#define TT_UCR_SMALL_FORM_VARIANTS (1L << 2) /* U+FE50-U+FE6F */
/* Bit 67 Arabic Presentation Forms-B */
#define TT_UCR_ARABIC_PRESENTATIONS_B (1L << 3) /* U+FE70-U+FEFF */
/* Bit 68 Halfwidth And Fullwidth Forms */
#define TT_UCR_HALFWIDTH_FULLWIDTH_FORMS (1L << 4) /* U+FF00-U+FFEF */
/* Bit 69 Specials */
#define TT_UCR_SPECIALS (1L << 5) /* U+FEFF,
U+FFF0-U+FFFF */
/* Bit 70 Tibetan */
#define TT_UCR_TIBETAN (1L << 6) /* U+0F00-U+0FBF */
/* Some compilers have a very limited length of identifiers. */
#if defined( __TURBOC__ ) && __TURBOC__ < 0x0410 || defined( __PACIFIC__ )
#define HAVE_LIMIT_ON_IDENTS
#endif
#ifndef HAVE_LIMIT_ON_IDENTS
/*
* Here some alias #defines in order to be clearer.
*
* These are not always #defined to stay within the 31 character limit
* which some compilers have.
*
* Credits go to Dave Hoo <dhoo@flash.net> for pointing out that modern
* Borland compilers (read: from BC++ 3.1 on) can increase this limit.
* If you get a warning with such a compiler, use the -i40 switch.
*/
#define TT_UCR_ARABIC_PRESENTATION_FORMS_A \
TT_UCR_ARABIC_PRESENTATIONS_A
#define TT_UCR_ARABIC_PRESENTATION_FORMS_B \
TT_UCR_ARABIC_PRESENTATIONS_B
#define TT_UCR_COMBINING_DIACRITICAL_MARKS \
TT_UCR_COMBINING_DIACRITICS
#define TT_UCR_COMBINING_DIACRITICAL_MARKS_SYMB \
TT_UCR_COMBINING_DIACRITICS_SYMB
#endif /* ndef HAVE_LIMIT_ON_IDENTS */
#endif /* FTNAMEID_H */
/* END */

49
lib/header.h Normal file
View File

@@ -0,0 +1,49 @@
/*******************************************************************
*
* Function :
*
* Description :
*
* Input :
*
* Output :
*
* Notes :
*
******************************************************************/
/*******************************************************************
*
* Function :
*
* Description :
*
* Input : None
*
* Output : Error code.
*
******************************************************************/
/*******************************************************************
*
* Function :
*
* Description :
*
******************************************************************/
/*******************************************************************
*
* Component Name (e.g. TTRaster.C) + eventually a version number.
*
* Component Short Description (e.g. Rasterizer).
*
* Copyright 1996 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.
*
******************************************************************/

2219
lib/ttapi.c Normal file

File diff suppressed because it is too large Load Diff

463
lib/ttcache.c Normal file
View File

@@ -0,0 +1,463 @@
/*******************************************************************
*
* ttcache.c 1.1
*
* Generic object cache
*
* Copyright 1996-1999 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.
*
* Changes between 1.1 and 1.0:
*
* - introduced the refresher and finalizer in the cache class
* definition/implementation.
*
******************************************************************/
#include "ttengine.h"
#include "ttmemory.h"
#include "ttcache.h"
#include "ttobjs.h"
#include "ttdebug.h"
/* required by the tracing mode */
#undef TT_COMPONENT
#define TT_COMPONENT trace_cache
#define ZERO_List( list ) list = NULL
/* The macro FREE_Elements aliases the current engine instance's */
/* free list_elements recycle list. */
#define FREE_Elements ( engine->list_free_elements )
/* Redefinition of LOCK and UNLOCK macros for New_Element and Done_Element */
/* Note: The macros are redefined below for the cache functions */
#undef LOCK
#define LOCK() MUTEX_Lock ( engine->lock )
#undef UNLOCK
#define UNLOCK() MUTEX_Release( engine->lock )
/*******************************************************************
*
* Function : Element_New
*
* Description : Gets a new (either fresh or recycled) list
* element. The element is unlisted.
*
* Input : None
*
* Output : List element address. NULL if out of memory.
*
******************************************************************/
static
PList_Element Element_New( PEngine_Instance engine )
{
PList_Element element;
LOCK();
if ( FREE_Elements )
{
element = (PList_Element)FREE_Elements;
FREE_Elements = element->next;
}
else
{
if ( !MEM_Alloc( element, sizeof ( TList_Element ) ) )
{
element->next = NULL;
element->data = NULL;
}
}
/* Note: in case of failure, Alloc sets the pointer to NULL */
UNLOCK();
return element;
}
/*******************************************************************
*
* Function : Element_Done
*
* Description : Recycles an unlinked list element.
*
* Input : The list element to recycle. It _must_ be unlisted.
*
* Output : none.
*
* Note : This function doesn't check the element.
*
******************************************************************/
static
void Element_Done( PEngine_Instance engine,
PList_Element element )
{
LOCK();
/* Simply add the list element to the recycle list */
element->next = (PList_Element)FREE_Elements;
FREE_Elements = element;
UNLOCK();
}
/* Redefinition of LOCK and UNLOCK macros for the cache functions */
/* Note: The macros are defined above for the list element functions */
#undef LOCK
#define LOCK() MUTEX_Lock( *cache->lock )
#undef UNLOCK
#define UNLOCK() MUTEX_Release( *cache->lock )
/*******************************************************************
*
* Function : Cache_Create
*
* Description : Creates a new cache that will be used to list
* and recycle several objects of the same class.
*
* Input : clazz a pointer to the cache's class. This is
* a simple structure that describes the
* the cache's object types and recycling
* limits.
*
* cache address of cache to create
*
* lock address of the mutex to use for this
* cache. The mutex will be used to protect
* the cache's lists. Use NULL for unprotected
* cache.
*
* Output : Error code.
*
******************************************************************/
LOCAL_FUNC
TT_Error Cache_Create( PEngine_Instance engine,
PCache_Class clazz,
TCache* cache,
TMutex* lock )
{
cache->engine = engine;
cache->clazz = clazz;
cache->lock = lock;
cache->idle_count = 0;
ZERO_List( cache->active );
ZERO_List( cache->idle );
return TT_Err_Ok;
}
/*******************************************************************
*
* Function : Cache_Destroy
*
* Description : Destroys a cache and all its idle and active
* objects. This will call each object's destructor
* before freeing it.
*
* Input : cache address of cache to destroy
*
* Output : error code.
*
* Note: This function is not MT-Safe, as we assume that a client
* isn't stupid enough to use an object while destroying it.
*
******************************************************************/
LOCAL_FUNC
TT_Error Cache_Destroy( TCache* cache )
{
PDestructor destroy;
PList_Element current;
PList_Element next;
/* now destroy all active and idle listed objects */
/* get the destructor function */
destroy = cache->clazz->done;
/* destroy all elements in active list */
current = cache->active;
while ( current )
{
next = current->next;
destroy( current->data );
FREE( current->data );
Element_Done( cache->engine, current );
current = next;
}
ZERO_List(cache->active);
/* destroy all elements in idle list */
current = cache->idle;
while ( current )
{
next = current->next;
destroy( current->data );
FREE( current->data );
Element_Done( cache->engine, current );
current = next;
}
ZERO_List(cache->idle);
cache->clazz = NULL;
cache->idle_count = 0;
return TT_Err_Ok;
}
/*******************************************************************
*
* Function : Cache_New
*
* Description : Extracts a new object from a cache. This will
* try to recycle an idle object, if any is found.
* Otherwise, a new object will be allocated and
* built (by calling its constructor).
*
* Input : cache address of cache to use
* new_object address of target pointer to the 'new'
* object
* parent_object this pointer is passed to a new object
* constructor (unused if object is
* recycled)
*
* Output : Error code.
*
* Notes: This function is thread-safe, each cache list is protected
* through the cache's mutex, if there is one...
*
* *new_object will be set to NULL in case of failure.
*
******************************************************************/
LOCAL_FUNC
TT_Error Cache_New( TCache* cache,
void** new_object,
void* parent_object )
{
TT_Error error;
PList_Element current;
PConstructor build;
PRefresher reset;
void* object;
LOCK();
current = cache->idle;
if ( current )
{
cache->idle = current->next;
cache->idle_count--;
}
UNLOCK();
if ( current )
{
object = current->data;
reset = cache->clazz->reset;
if ( reset )
{
error = reset( object, parent_object );
if ( error )
{
LOCK();
current->next = cache->idle;
cache->idle = current;
cache->idle_count++;
UNLOCK();
goto Exit;
}
}
}
else
{
/* if no object was found in the cache, create a new one */
build = cache->clazz->init;
if ( MEM_Alloc( object, cache->clazz->object_size ) )
goto Memory_Fail;
current = Element_New( cache->engine );
if ( !current )
goto Memory_Fail;
current->data = object;
error = build( object, parent_object );
if ( error )
{
Element_Done( cache->engine, current );
goto Fail;
}
}
LOCK();
current->next = cache->active;
cache->active = current;
UNLOCK();
*new_object = current->data;
return TT_Err_Ok;
Exit:
*new_object = NULL;
return error;
Memory_Fail:
error = TT_Err_Out_Of_Memory;
Fail:
FREE( object );
goto Exit;
}
/*******************************************************************
*
* Function : Cache_Done
*
* Description : Releases an object to the cache. This will either
* recycle or destroy the object, based on the cache's
* class and state.
*
* Input : cache the cache to use
* data the object to recycle/discard
*
* Output : error code.
*
* Notes : The object's destructor is called only when
* the objectwill be effectively destroyed by this
* function. This will not happen during recycling.
*
******************************************************************/
LOCAL_FUNC
TT_Error Cache_Done( TCache* cache, void* data )
{
TT_Error error;
PList_Element element;
PList_Element prev;
PFinalizer finalize;
Long limit;
Bool destroy;
/* Look for object in active list */
LOCK();
element = cache->active;
prev = NULL;
while ( element )
{
if ( element->data == data )
{
if ( prev )
prev->next = element->next;
else
cache->active = element->next;
goto Suite;
}
prev = element;
element = element->next;
}
UNLOCK();
return TT_Err_Unlisted_Object;
Suite:
limit = cache->clazz->idle_limit;
destroy = (cache->idle_count >= limit);
UNLOCK();
if ( destroy )
{
/* destroy the object when the cache is full */
cache->clazz->done( element->data );
FREE( element->data );
Element_Done( cache->engine, element );
}
else
{
/* Finalize the object before adding it to the */
/* idle list. Return the error if any is found. */
finalize = cache->clazz->finalize;
if ( finalize )
{
error = finalize( element->data );
if ( error )
goto Exit;
/* Note: a failure at finalize time is a severe bug in */
/* the engine, which is why we allow ourselves to */
/* lose the object in this case. A finalizer should */
/* have its own error codes to spot this kind of */
/* problems easily. */
}
LOCK();
element->next = cache->idle;
cache->idle = element;
cache->idle_count++;
UNLOCK();
}
error = TT_Err_Ok;
Exit:
return error;
}
LOCAL_FUNC
TT_Error TTCache_Init( PEngine_Instance engine )
{
/* Create list elements mutex */
FREE_Elements = NULL;
return TT_Err_Ok;
}
LOCAL_FUNC
TT_Error TTCache_Done( PEngine_Instance engine )
{
/* We don't protect this function, as this is the end of the engine's */
/* execution.. */
PList_Element element, next;
/* frees the recycled list elements */
element = FREE_Elements;
while ( element )
{
next = element->next;
FREE( element );
element = next;
}
return TT_Err_Ok;
}
/* END */

216
lib/ttcache.h Normal file
View File

@@ -0,0 +1,216 @@
/*******************************************************************
*
* ttcache.h 1.1
*
* Generic object cache
*
* Copyright 1996-1999 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.
*
*
* This component defines and implements object caches.
*
* An object class is a structure layout that encapsulate one
* given type of data used by the FreeType engine. Each object
* class is completely described by:
*
* - a 'root' or 'leading' structure containing the first
* important fields of the class. The root structure is
* always of fixed size.
*
* It is implemented as a simple C structure, and may
* contain several pointers to sub-tables that can be
* sized and allocated dynamically.
*
* Examples: TFace, TInstance, TGlyph & TExecution_Context
* (defined in 'ttobjs.h')
*
* - we make a difference between 'child' pointers and 'peer'
* pointers. A 'child' pointer points to a sub-table that is
* owned by the object, while a 'peer' pointer points to any
* other kind of data the object isn't responsible for.
*
* An object class is thus usually a 'tree' of 'child' tables.
*
* - each object class needs a constructor and a destructor.
*
* A constructor is a function which receives the address of
* freshly allocated and zeroed object root structure and
* 'builds' all the valid child data that must be associated
* to the object before it becomes 'valid'.
*
* A destructor does the inverse job: given the address of
* a valid object, it must discard all its child data and
* zero its main fields (essentially the pointers and array
* sizes found in the root fields).
*
*
* Important notes:
*
* When the constructor fails to allocate an object, it must
* return immediately with an error code, and not try to release
* what it has previously allocated before the error. The cache
* manager detects the error and calls the destructor on the
* partial object, before returning the error to the caller (along
* with a NULL pointer for the "new" object).
*
* The destructor must thus be able to deal with "partial objects",
* i.e., objects where only part of the child tables are allocated,
* and only release these ones. As the TT_Free() function accepts
* a NULL parameter (and returns successfuly in this case), no check
* is really necessary when using the macro 'FREE()'.
*
* Currently, there is no check in the cache manager to see if a
* destructor fails (double error state!).
*
* This scheme is more compact and more maintanable than the one
* where de-allocation code is duplicated in the constructor
* _and_ the destructor.
*
*
*
* Changes between 1.1 and 1.0:
*
* - introduced the refreshed and finalizer class definition/implementation
* - inserted an engine instance pointer in the cache structure
*
******************************************************************/
#ifndef TTCACHE_H
#define TTCACHE_H
#include "tttypes.h"
#include "ttconfig.h"
#include "ttmutex.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef TT_Error TConstructor( void* object,
void* parent );
typedef TT_Error TDestructor ( void* object );
typedef TConstructor TRefresher;
typedef TDestructor TFinalizer;
typedef TConstructor* PConstructor;
typedef TDestructor* PDestructor;
typedef TRefresher* PRefresher;
typedef TFinalizer* PFinalizer;
/* A Cache class record holds the data necessary to define */
/* a cache kind. */
struct TCache_Class_
{
ULong object_size;
Long idle_limit;
PConstructor init;
PDestructor done;
PRefresher reset;
PFinalizer finalize;
};
typedef struct TCache_Class_ TCache_Class;
typedef TCache_Class* PCache_Class;
/* Simple list node record. A list element is said to be 'unlinked' */
/* when it doesn't belong to any list. */
struct TList_Element_;
typedef struct TList_Element_ TList_Element;
typedef TList_Element* PList_Element;
struct TList_Element_
{
PList_Element next;
void* data;
};
/* Simple singly-linked list record - LIFO style, no tail field */
typedef PList_Element TSingle_List;
struct TCache_
{
PEngine_Instance engine;
PCache_Class clazz; /* 'class' is a reserved word in C++ */
TMutex* lock;
TSingle_List active;
TSingle_List idle;
Long idle_count;
};
typedef struct TCache_ TCache;
typedef TCache* PCache;
/* Returns a new list element, either fresh or recycled. */
/* Note: the returned element is unlinked. */
/* An object cache holds two lists tracking the active and */
/* idle objects that are currently created and used by the */
/* engine. It can also be 'protected' by a mutex. */
/* Initializes a new cache, of class 'clazz', pointed by 'cache', */
/* protected by the 'lock' mutex. Set 'lock' to NULL if the cache */
/* doesn't need protection */
LOCAL_DEF
TT_Error Cache_Create( PEngine_Instance engine,
PCache_Class clazz,
TCache* cache,
TMutex* lock );
/* Destroys a cache and all its listed objects */
LOCAL_DEF
TT_Error Cache_Destroy( TCache* cache );
/* Extracts a new object from the cache */
LOCAL_DEF
TT_Error Cache_New( TCache* cache,
void** new_object,
void* parent_object );
/* Returns an object to the cache, or discards it depending */
/* on the cache class' 'idle_limit' field */
LOCAL_DEF
TT_Error Cache_Done( TCache* cache, void* data );
#define CACHE_New( _cache, _newobj, _parent ) \
Cache_New( (TCache*)_cache, (void**)&_newobj, (void*)_parent )
#define CACHE_Done( _cache, _obj ) \
Cache_Done( (TCache*)_cache, (void*)_obj )
LOCAL_DEF
TT_Error TTCache_Init( PEngine_Instance engine );
LOCAL_DEF
TT_Error TTCache_Done( PEngine_Instance engine );
#ifdef __cplusplus
}
#endif
#endif /* TTCACHE_H */
/* END */

403
lib/ttcalc.c Normal file
View File

@@ -0,0 +1,403 @@
/*******************************************************************
*
* ttcalc.c
*
* Arithmetic Computations (body).
*
* Copyright 1996-1999 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 "ttcalc.h"
#include "ttdebug.h"
#include "tttables.h"
/* required by the tracing mode */
#undef TT_COMPONENT
#define TT_COMPONENT trace_calc
/* Support for 1-complement arithmetic has been totally dropped in this */
/* release. You can still write your own code if you need it... */
static const Long Roots[63] =
{
1, 1, 2, 3, 4, 5, 8, 11,
16, 22, 32, 45, 64, 90, 128, 181,
256, 362, 512, 724, 1024, 1448, 2048, 2896,
4096, 5892, 8192, 11585, 16384, 23170, 32768, 46340,
65536, 92681, 131072, 185363, 262144, 370727,
524288, 741455, 1048576, 1482910, 2097152, 2965820,
4194304, 5931641, 8388608, 11863283, 16777216, 23726566,
33554432, 47453132, 67108864, 94906265,
134217728, 189812531, 268435456, 379625062,
536870912, 759250125, 1073741824, 1518500250,
2147483647
};
#ifdef LONG64
EXPORT_FUNC
TT_Long TT_MulDiv( TT_Long a, TT_Long b, TT_Long c )
{
Long s;
s = a; a = ABS( a );
s ^= b; b = ABS( b );
s ^= c; c = ABS( c );
a = ((TT_Int64)a * b + c/2) / c;
return ( s < 0 ) ? -a : a;
}
EXPORT_FUNC
TT_Long TT_MulFix( TT_Long a, TT_Long b )
{
Long s;
s = a; a = ABS( a );
s ^= b; b = ABS( b );
a = ((TT_Int64)a * b + 0x8000) / 0x10000;
return ( s < 0 ) ? -a : a;
}
LOCAL_FUNC
Int Order64( TT_Int64 z )
{
Int j = 0;
while ( z )
{
z = (unsigned INT64)z >> 1;
j++;
}
return j - 1;
}
LOCAL_FUNC
TT_Int32 Sqrt64( TT_Int64 l )
{
TT_Int64 r, s;
if ( l <= 0 ) return 0;
if ( l == 1 ) return 1;
r = Roots[Order64( l )];
do
{
s = r;
r = ( r + l/r ) >> 1;
}
while ( r > s || r*r > l );
return r;
}
#else /* LONG64 */
/* The TT_MulDiv function has been optimized thanks to ideas from */
/* Graham Asher. The trick is to optimize computation when everything */
/* fits within 32-bits (a rather common case). */
/* */
/* we compute 'a*b+c/2', then divide it by 'c'. (positive values) */
/* */
/* 46340 is FLOOR(SQRT(2^31-1)). */
/* */
/* if ( a <= 46340 && b <= 46340 ) then ( a*b <= 0x7FFEA810 ) */
/* */
/* 0x7FFFFFFF - 0x7FFEA810 = 0x157F0 */
/* */
/* if ( c < 0x157F0*2 ) then ( a*b+c/2 <= 0x7FFFFFFF ) */
/* */
/* and 2*0x157F0 = 176096 */
/* */
EXPORT_FUNC
TT_Long TT_MulDiv( TT_Long a, TT_Long b, TT_Long c )
{
long s;
if ( a == 0 || b == c )
return a;
s = a; a = ABS( a );
s ^= b; b = ABS( b );
s ^= c; c = ABS( c );
if ( a <= 46340 && b <= 46340 && c <= 176095 )
{
a = ( a*b + c/2 )/c;
}
else
{
TT_Int64 temp, temp2;
MulTo64( a, b, &temp );
temp2.hi = (TT_Int32)(c >> 31);
temp2.lo = (TT_Word32)(c / 2);
Add64( &temp, &temp2, &temp );
a = Div64by32( &temp, c );
}
return ( s < 0 ) ? -a : a;
}
/* The optimization for TT_MulFix is different. We could simply be */
/* happy by applying the same principles than with TT_MulDiv, because */
/* */
/* c = 0x10000 < 176096 */
/* */
/* however, in most cases, we have a 'b' with a value around 0x10000 */
/* which is greater than 46340. */
/* */
/* According to Graham's testing, most cases have 'a' < 100, so a good */
/* idea is to use bounds like 1024 and 2097151 (= floor(2^31-1)/1024 ) */
/* for 'a' and 'b' respectively.. */
/* */
EXPORT_FUNC
TT_Long TT_MulFix( TT_Long a, TT_Long b )
{
long s;
if ( a == 0 || b == 0x10000 )
return a;
s = a; a = ABS( a );
s ^= b; b = ABS( b );
if ( a <= 1024 && b <= 2097151 )
{
a = ( a*b + 0x8000 ) >> 16;
}
else
{
TT_Int64 temp, temp2;
MulTo64( a, b, &temp );
temp2.hi = 0;
temp2.lo = 0x8000;
Add64( &temp, &temp2, &temp );
a = Div64by32( &temp, 0x10000 );
}
return ( s < 0 ) ? -a : a;
}
LOCAL_FUNC
void Neg64( TT_Int64* x )
{
/* Remember that -(0x80000000) == 0x80000000 with 2-complement! */
/* We take care of that here. */
x->hi ^= 0xFFFFFFFFUL;
x->lo ^= 0xFFFFFFFFUL;
x->lo++;
if ( !x->lo )
{
x->hi++;
if ( x->hi == 0x80000000UL ) /* Check -MaxInt32 - 1 */
{
x->lo--;
x->hi--; /* We return 0x7FFFFFFF! */
}
}
}
LOCAL_FUNC
void Add64( TT_Int64* x, TT_Int64* y, TT_Int64* z )
{
register TT_Word32 lo, hi;
lo = x->lo + y->lo;
hi = x->hi + y->hi + ( lo < x->lo );
z->lo = lo;
z->hi = hi;
}
LOCAL_FUNC
void Sub64( TT_Int64* x, TT_Int64* y, TT_Int64* z )
{
register TT_Word32 lo, hi;
lo = x->lo - y->lo;
hi = x->hi - y->hi - ( (TT_Int32)lo < 0 );
z->lo = lo;
z->hi = hi;
}
LOCAL_FUNC
void MulTo64( TT_Int32 x, TT_Int32 y, TT_Int64* z )
{
TT_Int32 s;
TT_Word32 lo1, hi1, lo2, hi2, lo, hi, i1, i2;
s = x; x = ABS( x );
s ^= y; y = ABS( y );
lo1 = x & 0x0000FFFF; hi1 = x >> 16;
lo2 = y & 0x0000FFFF; hi2 = y >> 16;
lo = lo1*lo2;
i1 = lo1*hi2;
i2 = lo2*hi1;
hi = hi1*hi2;
/* Check carry overflow of i1 + i2 */
if ( i2 )
{
if ( i1 >= (TT_Word32)-(TT_Int32)i2 ) hi += 1L << 16;
i1 += i2;
}
i2 = i1 >> 16;
i1 = i1 << 16;
/* Check carry overflow of i1 + lo */
if ( i1 )
{
if ( lo >= (TT_Word32)-(TT_Int32)i1 ) hi++;
lo += i1;
}
hi += i2;
z->lo = lo;
z->hi = hi;
if ( s < 0 ) Neg64( z );
}
LOCAL_FUNC
TT_Int32 Div64by32( TT_Int64* x, TT_Int32 y )
{
TT_Int32 s;
TT_Word32 q, r, i, lo;
s = x->hi; if ( s < 0 ) Neg64( x );
s ^= y; y = ABS( y );
/* Shortcut */
if ( x->hi == 0 )
{
q = x->lo / y;
return ( s < 0 ) ? -(TT_Int32)q : (TT_Int32)q;
}
r = x->hi;
lo = x->lo;
if ( r >= (TT_Word32)y ) /* we know y is to be treated as unsigned here */
return ( s < 0 ) ? 0x80000001UL : 0x7FFFFFFFUL;
/* Return Max/Min Int32 if divide overflow */
/* This includes division by zero! */
q = 0;
for ( i = 0; i < 32; i++ )
{
r <<= 1;
q <<= 1;
r |= lo >> 31;
if ( r >= (TT_Word32)y )
{
r -= y;
q |= 1;
}
lo <<= 1;
}
return ( s < 0 ) ? -(TT_Int32)q : (TT_Int32)q;
}
LOCAL_FUNC
Int Order64( TT_Int64* z )
{
TT_Word32 i;
Int j;
if ( z->hi )
{
i = z->hi;
j = 32;
}
else
{
i = z->lo;
j = 0;
}
while ( i > 0 )
{
i >>= 1;
j++;
}
return j-1;
}
LOCAL_FUNC
TT_Int32 Sqrt64( TT_Int64* l )
{
TT_Int64 l2;
TT_Int32 r, s;
if ( (TT_Int32)l->hi < 0 ||
(l->hi == 0 && l->lo == 0) ) return 0;
s = Order64( l );
if ( s == 0 ) return 1;
r = Roots[s];
do
{
s = r;
r = ( r + Div64by32(l,r) ) >> 1;
MulTo64( r, r, &l2 );
Sub64 ( l, &l2, &l2 );
}
while ( r > s || (TT_Int32)l2.hi < 0 );
return r;
}
#endif /* LONG64 */
/* END */

97
lib/ttcalc.h Normal file
View File

@@ -0,0 +1,97 @@
/*******************************************************************
*
* ttcalc.h
*
* Arithmetic Computations (specification).
*
* Copyright 1996-1999 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.
*
******************************************************************/
#ifndef TTCALC_H
#define TTCALC_H
#include "ttconfig.h"
#include "freetype.h"
#ifdef __cplusplus
extern "C" {
#endif
#ifdef LONG64
typedef INT64 TT_Int64;
#define ADD_64( x, y, z ) z = x + y
#define SUB_64( x, y, z ) z = x - y
#define MUL_64( x, y, z ) z = (TT_Int64)(x) * (y)
#define DIV_64( x, y ) ( (x) / (y) )
#define SQRT_64( x ) Sqrt64( x )
#define SQRT_32( x ) Sqrt32( x )
LOCAL_DEF TT_Int32 Sqrt64( TT_Int64 l );
#else /* LONG64 */
struct TT_Int64_
{
TT_Word32 lo;
TT_Word32 hi;
};
typedef struct TT_Int64_ TT_Int64;
#define ADD_64( x, y, z ) Add64( &x, &y, &z )
#define SUB_64( x, y, z ) Sub64( &x, &y, &z )
#define MUL_64( x, y, z ) MulTo64( x, y, &z )
#define DIV_64( x, y ) Div64by32( &x, y )
#define SQRT_64( x ) Sqrt64( &x )
#define SQRT_32( x ) Sqrt32( x )
LOCAL_DEF void Add64( TT_Int64* x, TT_Int64* y, TT_Int64* z );
LOCAL_DEF void Sub64( TT_Int64* x, TT_Int64* y, TT_Int64* z );
LOCAL_DEF void MulTo64( TT_Int32 x, TT_Int32 y, TT_Int64* z );
LOCAL_DEF TT_Int32 Div64by32( TT_Int64* x, TT_Int32 y );
LOCAL_DEF int Order64( TT_Int64* z );
LOCAL_DEF TT_Int32 Sqrt64( TT_Int64* l );
#endif /* LONG64 */
/* The two following functions are now part of the API! */
/* TT_Long TT_MulDiv( TT_Long a, TT_Long b, TT_Long c ); */
/* TT_Long TT_MulFix( TT_Long a, TT_Long b ); */
#define INT_TO_F26DOT6( x ) ( (Long)(x) << 6 )
#define INT_TO_F2DOT14( x ) ( (Long)(x) << 14 )
#define INT_TO_FIXED( x ) ( (Long)(x) << 16 )
#define F2DOT14_TO_FIXED( x ) ( (Long)(x) << 2 )
#define FLOAT_TO_FIXED( x ) ( (Long)(x * 65536.0) )
#define ROUND_F26DOT6( x ) ( x >= 0 ? ( ((x) + 32) & -64) \
: ( -((32 - (x)) & -64) ) )
#ifdef __cplusplus
}
#endif
#endif /* TTCALC_H */
/* END */

Some files were not shown because too many files have changed in this diff Show More