updated the build system to avoid file duplication :

- All "common" ANSI files were moved to "freetype2/config"
- The modules list is in "config" now (instead of
  config/<system>")
- All system-specific configuration Makefiles have been
  renamed. E.g.  "config/win32/Makefile.gcc" is now
  "config/win32/w32-gcc.mk"
- Updated "config/freetype.mk" and "config/modules.mk"
This commit is contained in:
David Turner 2000-02-29 16:56:18 +00:00
parent 587bc78f86
commit 7bda46d094
50 changed files with 1670 additions and 7269 deletions

View File

@ -1,199 +0,0 @@
#*******************************************************************
#*
#* FreeType 2 Configuration rules for a `normal' ANSI compiler
#*
#* 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 purpose of this sub-Makefile is to define various build and
#* platform specific variables before including the sub-Makefile
#* containing the FreeType library rules, found in
#*
#* $(TOP)/config/freetype.mk
#*
#* The following variables must be defined before including this
#* file :
#*
#* TOP Pathname to the top of the FreeType sources
#* hierarchy
#*
#* This file should define the following variables before including
#* the FreeType library rules file :
#*
#* BUILD Pathname to the platform-specific files used
#* for the build. Usually `$(TOP)/config/<system>'
#*
#* SEP Directory separator used during compilation.
#* (usually "/" or "\"). Note that on Win32, both gcc
#* and Visual C++ use "/" as a directory separator !!
#*
#* HOSTSEP Directory separator for $(COPY) and $(DELETE)
#*
#* DELETE The forced remove/delete command to erase one or more
#* files
#*
#* INCLUDE The location of all public header files. e.g.
#* `$(TOP)/include'include' *
#*
#* SRC The directory containing all sources. e.g.
#* '$(TOP)/src'
#*
#* OBJ_DIR The location where compiled object files will be
#* placed, e.g. '$(TOP)/obj'
#*
#* LIB_DIR The location where the resulting library file will be
#* placed, e.g. '$(TOP)/obj'
#*
#* LIBRARY The filename of the resulting library file, without
#* its extension.. e.g. 'libfreetype' or 'freetype'
#*
#* O The object file suffix. Can be '.o', '.obj,' '.lo,'
#* ';coff,' etc.
#*
#* A The library file suffix. Can be '.a' '.so,' '.lib'
#* '.dll,' etc.
#*
#* I The path inclusion flag. Some compilers use a
#* different flag than '-I' to specify an additional
#* include path. Examples are '/i=' or '-J ', etc.
#*
#* D The macro definition flag. I haven't met compilers
#* which don't use the '-D' switch to define a macro, but
#* who knows...
#*
#* T The compilation flag used to identify the target. Some
#* compilers use a different flag than '-o ' to specify
#* the name of the target object file.
#*
#* CFLAGS The set of flags used to compile object files.
#* (usually contains the flag '-c').
#*
#*
#*
#*******************************************************************
ifndef TOP
TOP := .
endif
DELETE := rm -f
SEP := /
HOSTSEP := $(SEP)
BUILD := $(TOP)/config/ansi
PLATFORM := ansi
# the directory where all object files are placed
#
# Note that this is not $(TOP)/obj !!
# This lets you build the library in your own directory
# with something like :
#
# set TOP=....../path/to/freetype2/top/dir...
# mkdir obj
# make -f %TOP%/Makefile setup [options]
# make -f %TOP%/Makefile
#
#
OBJ_DIR := obj
# the directory where all library files are placed
#
# by default, this is the same as OBJ_DIR, however, this can be
# changed to suit particular needs..
#
LIB_DIR := $(OBJ_DIR)
# the object file extension, this can be .o, .tco, .obj, etc..
# depending on the platform
#
O := o
# the library file extension, this can be .a, .lib, etc..
# depending on the platform
#
A := a
# The name of the final library file.
# Note that the DOS-specific Makefile uses a shorter (8.3) name
#
LIBRARY := libfreetype
# path inclusion flag.
#
# Some compilers use a different flag than '-I' to specify an
# additional include path. Examples are "/i=" or "-J", etc...
#
I := -I
# C flag used to define a macro before the compilation of a given
# source object. Usually is '-D' like in "-DDEBUG"
#
D := -D
# Target flag - beware, there is a space after the 'o' !!
#
#
T := -o
# The link flag used to specify a given library file on link.
# Note that this is only used to compile the demo programs, not
# the library itself.
#
L := -l
# C flags
#
# These should concern :
#
# - debug output
# - optimization
# - warnings
# - ansi compliance..
#
ifndef CFLAGS
CFLAGS := -c
endif
# ANSIFLAGS : put there the flags used to make your compiler ANSI-compliant
# nothing (if it already is by default like LCC).
#
ANSIFLAGS :=
# Now include the main sub-makefile. It contains all the rules used
# to build the library with the previous variables defined
#
include $(TOP)/config/freetype.mk
clean_freetype: clean_freetype_std
distclean_freetype: clean_freetype_library_std
# Librarian to use to build the static library
#
FT_LIBRARIAN := $(AR) -r
# This final rule is used to link all object files into a single
# library. It is part of the system-specific sub-Makefile because not
# all librarians accept a simple syntax like :
#
# librarian library_file {list of object files}
#
$(FT_LIBRARY): $(OBJECTS_LIST)
-$(DELETE) $@
$(FT_LIBRARIAN) $@ $(OBJECTS_LIST)

134
config/ansi/ansi.mk Normal file
View File

@ -0,0 +1,134 @@
#*******************************************************************
#*
#* FreeType 2 Configuration rules for a `normal' ANSI compiler
#*
#* Copyright 1996-2000 by
#* David Turner, Robert Wilhelm, and Werner Lemberg.
#*
#* This file is part of the FreeType project, and may only be used
#* modified and distributed under the terms of the FreeType project
#* license, LICENSE.TXT. By continuing to use, modify, or distribute
#* this file you indicate that you have read the license and
#* understand and accept it fully.
#*
#* Please read the file "freetype/docs/config.txt" to understand
#* what this file does..
#*
#*******************************************************************
ifndef TOP
TOP := .
endif
DELETE := rm -f
SEP := /
HOSTSEP := $(SEP)
BUILD := $(TOP)/config/ansi
PLATFORM := ansi
# the directory where all object files are placed
#
# Note that this is not $(TOP)/obj !!
# This lets you build the library in your own directory
# with something like :
#
# set TOP=....../path/to/freetype2/top/dir...
# mkdir obj
# make -f %TOP%/Makefile setup [options]
# make -f %TOP%/Makefile
#
#
OBJ_DIR := obj
# the directory where all library files are placed
#
# by default, this is the same as OBJ_DIR, however, this can be
# changed to suit particular needs..
#
LIB_DIR := $(OBJ_DIR)
# the object file extension, this can be .o, .tco, .obj, etc..
# depending on the platform
#
O := o
# the library file extension, this can be .a, .lib, etc..
# depending on the platform
#
A := a
# The name of the final library file.
# Note that the DOS-specific Makefile uses a shorter (8.3) name
#
LIBRARY := libfreetype
# path inclusion flag.
#
# Some compilers use a different flag than '-I' to specify an
# additional include path. Examples are "/i=" or "-J", etc...
#
I := -I
# C flag used to define a macro before the compilation of a given
# source object. Usually is '-D' like in "-DDEBUG"
#
D := -D
# Target flag - beware, there is a space after the 'o' !!
#
#
T := -o
# The link flag used to specify a given library file on link.
# Note that this is only used to compile the demo programs, not
# the library itself.
#
L := -l
# C flags
#
# These should concern : debug output, optimization & warnings
#
# Use the ANSIFLAGS variable to define the compiler flags used
# to enfore ANSI compliance..
#
ifndef CFLAGS
CFLAGS := -c
endif
# ANSIFLAGS : put there the flags used to make your compiler ANSI-compliant
# nothing (if it already is by default like LCC).
#
ANSIFLAGS :=
# Now include the main sub-makefile. It contains all the rules used
# to build the library with the previous variables defined
#
include $(TOP)/config/freetype.mk
clean_freetype: clean_freetype_std
distclean_freetype: clean_freetype_library_std
# Librarian to use to build the static library
#
FT_LIBRARIAN := $(AR) -r
# This final rule is used to link all object files into a single
# library. It is part of the system-specific sub-Makefile because not
# all librarians accept a simple syntax like :
#
# librarian library_file {list of object files}
#
$(FT_LIBRARY): $(OBJECTS_LIST)
-$(DELETE) $@
$(FT_LIBRARIAN) $@ $(OBJECTS_LIST)

View File

@ -1,4 +0,0 @@
FT_DRIVER(sfnt_driver_interface)
FT_DRIVER(tt_driver_interface)
FT_DRIVER(t1_driver_interface)
FT_DRIVER(psnames_driver_interface)

View File

@ -1,204 +0,0 @@
#ifndef FTOPTION_H
#define FTOPTION_H
/*************************************************************************/
/* */
/* USER-SELECTABLE CONFIGURATION MACROS */
/* */
/* These macros can be toggled by developers to enable or disable */
/* certain aspects of FreeType. This file contains macros that apply to */
/* all of FreeType. Driver-specific configurations are placed in each */
/* driver directory (e.g. `freetype/drivers/ttlib/ttconfig.h'). */
/* */
/*************************************************************************/
/*************************************************************************/
/* */
/* Alternate Glyph Image Format support */
/* */
/* By default, the glyph images returned by the FreeType glyph loader */
/* can either be a pixmap or a vectorial outline defined through */
/* bezier control points. When defining the following configuration */
/* macro, some font drivers will be able to register alternate */
/* glyph image formats. */
/* */
/* Unset this macro if you're sure that you'll never use a font driver */
/* with an alternate glyph format, this will reduce the size of the */
/* base layer code. */
/* */
#define FT_CONFIG_OPTION_ALTERNATE_GLYPH_FORMATS
/*************************************************************************/
/* */
/* Glyph Postscript Names handling */
/* */
/* By default, FreeType 2 is built with the "psnames" module compiled */
/* in. This module is in charge of converting a glyph name string into */
/* a Unicode value, or return a Macintosh standard glyph name for the */
/* use with the TrueType "post" table. */
/* */
/* Undefine this macro if you do not want the "psnames" compiled in */
/* your build of FreeType. This has the following effects : */
/* */
/* - the TrueType driver will provide its own set of glyph names, */
/* if you build it to support postscript names in the TrueType */
/* "post" table. */
/* */
/* - the Type 1 driver will not be able to synthetize a */
/* Unicode charmap out of the glyphs found in the fonts. */
/* */
/* You would normally undefine this configuration macro when */
/* building a version of FreeType that doesn't contain a Type 1 */
/* or CFF driver. */
/* */
#define FT_CONFIG_OPTION_POSTSCRIPT_NAMES
/*************************************************************************/
/* */
/* Postscript Names to Unicode Values support */
/* */
/* By default, FreeType 2 is built with the "psnames" module compiled */
/* in. Among other things, the module is used to convert a glyph */
/* name into a unicode value. This is especially useful in order to */
/* synthetize on the fly a Unicode charmap from the CFF/Type 1 driver */
/* through a big table named the "Adobe Glyph List". */
/* */
/* Undefine this macro if you do not want the Adobe Glyph List */
/* compiled in your "psnames" module. The Type 1 driver will not */
/* be able to synthetize a Unicode charmap out of the glyphs found */
/* in the fonts.. */
/* */
#define FT_CONFIG_OPTION_ADOBE_GLYPH_LIST
/*************************************************************************/
/* */
/* GCC provides the non-ANSI `long long' 64-bit type. You can activate */
/* it by defining the FTCALC_USE_LONG_LONG macro here. Note however */
/* that we did not experience any improvement in speed with gcc, and */
/* that the final code seems bigger when linked. */
/* */
#undef FTCALC_USE_LONG_LONG
/*************************************************************************/
/* */
/* When compiling FreeType as a DLL, some systems/compilers need a */
/* special keyword in front of each function definition instead of */
/* `extern'. */
/* */
/* The macros EXPORT_DEF and EXPORT_FUNC are thus used to define */
/* exported library function interfaces and exported library functions */
/* implementations respectively. */
/* */
/* If not defined here, they automatically default to `extern' and void */
/* later in this header file. */
/* */
#undef EXPORT_DEF
#undef EXPORT_FUNC
/*************************************************************************/
/* */
/* Debug level */
/* */
/* FreeType can be compiled in debug or trace mode. In debug mode, */
/* errors are reported through the `ftdebug' component. In trace */
/* mode, additional messages are sent to the standard output during */
/* execution. */
/* */
/* Define FT_DEBUG_LEVEL_ERROR to build the library in debug mode. */
/* Define FT_DEBUG_LEVEL_TRACE to build it in trace mode. */
/* */
/* Don't define any of these macros to compile in `release' mode. */
/* */
#undef FT_DEBUG_LEVEL_ERROR
#undef FT_DEBUG_LEVEL_TRACE
/*************************************************************************/
/* */
/* Anti-aliasing support */
/* */
/* Undefine this macro only if you want to disable the anti-aliasing */
/* support in FreeType. This will save you about 5 Kb of code. It */
/* may be important for some embedded systems. */
/* */
#define FT_CONFIG_OPTION_ANTI_ALIAS
/*************************************************************************/
/* */
/* Endianess performance improvement */
/* */
/* FreeType is completely endian-independent, and can thus be compiled */
/* directly on _any_ machine. However, some components of the library */
/* provide improved routines for the cases where endianess is known. */
/* */
/* It usually results in speed-ups and reduced code size. Note that */
/* you should not define both of these macros. */
/* */
/* */
/* NOTE: For now, only the scan-line converter (base/ftraster.c) uses */
/* these macros to speed-up some anti-alias rendering routines. */
/* */
#undef FT_CONFIG_OPTION_LITTLE_ENDIAN
#undef FT_CONFIG_OPTION_BIG_ENDIAN
/*************************************************************************/
/* */
/* Define this configuration macro whenever you want to build a version */
/* of FreeType that does not include a default `system' component. */
/* */
/* Note that this will prevent the compilation of `ftinit', hence the */
/* function FT_Init_FreeType */
/* */
#undef FT_CONFIG_OPTION_NO_DEFAULT_SYSTEM
/*************************************************************************/
/* */
/* The size in bytes of the render pool used by the scan-line */
/* converter to do all of its work. */
/* */
/* This must be greater than 4 Kb */
/* */
#define FT_RENDER_POOL_SIZE 32768
/*************************************************************************/
/* */
/* FT_MAX_DRIVERS */
/* */
/* The maximum number of font drivers that can be registered in a */
/* single FreeType library object. 8 seems to be a good choice due */
/* to the relative low actual number of drivers ;-) */
/* */
#define FT_MAX_DRIVERS 8
/*************************************************************************/
/* */
/* FT_MAX_EXTENSIONS */
/* */
/* The maximum number of extensions that can be registered in a */
/* single font driver. 8 seems to be a good choice for now.. */
/* */
#define FT_MAX_EXTENSIONS 8
/*************************************************************************/
/* */
/* FT_MAX_GLYPH_FORMATS */
/* */
/* The maximum number of glyph image formats that might be registered */
/* in a given library instance. 8 seems to be a good choice due to */
/* the relatively low number of current formats ;-) */
/* */
#define FT_MAX_GLYPH_FORMATS 8
#endif /* FTOPTION_H */

View File

@ -1,971 +0,0 @@
/***************************************************************************/
/* */
/* ftsys.c */
/* */
/* ANSI-specific system operations (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. */
/* */
/***************************************************************************/
/*************************************************************************/
/* */
/* This implementation of the `ftsys' component uses the standard ANSI C */
/* library. */
/* */
/* IMPORTANT NOTE: */
/* */
/* Porters, read carefully the comments in ftsys.h before trying to */
/* port this file to your system. It contains many essential */
/* remarks, and will ease your work greatly. */
/* */
/*************************************************************************/
#include "ftsys.h"
#include "ftstream.h"
#include "ftdebug.h"
#ifdef FT_CONFIG_OPTION_DEBUG_MEMORY
#include "memdebug.c"
#endif
/*************************************************************************/
/* The macro FT_COMPONENT is used in trace mode. It is an implicit */
/* parameter of the PTRACE() and PERROR() macros, used to print/log */
/* messages during execution. */
/* */
#undef FT_COMPONENT
#define FT_COMPONENT trace_io
#undef CUR_SYSTEM /* just in case */
/*************************************************************************/
/* */
/* To ease porting, we use the macro SYS_STREAM to name the */
/* system-specific stream type. For example, it is a `FILE*' with the */
/* ANSI libc, it will be a file descriptor, i.e. an integer, when using */
/* the Unix system API, etc. */
/* */
#define SYS_STREAM FILE*
/*************************************************************************/
/* */
/* This implementation of ftsys uses the ANSI C library. Memory */
/* management is performed through malloc/free, i/o access through */
/* fopen/fread/fseek, and no synchronisation primitive is implemented */
/* (they contain dummy code) */
/* */
/*************************************************************************/
#include <stdio.h>
#include <stdlib.h>
/*************************************************************************/
/* */
/* I/O ACCESS AND MANAGEMENT */
/* */
/* We only define the `ANSI' resource class in this class. It is */
/* disk-based and provides a MRU cache in order to only keep the file */
/* descriptors of the 10 most recently used resource files. */
/* */
/* It simply contains two lists. One contains the `cached' resources */
/* with a valid FILE* pointer, the second contains all other `flushed' */
/* resource objects. */
/* */
/*************************************************************************/
/*************************************************************************/
/* */
/* <Struct> */
/* FT_AnsiFileRec */
/* */
/* <Description> */
/* The FT_AnsiFile class derives from FT_ResourceRec. */
/* */
/* <Fields> */
/* root :: The root resource class fields. */
/* */
/* pathname :: This is a copy of the ANSI file pathname used to open */
/* streams for the resource. A different implementation */
/* is free to use Unicode chars, or file i-node numbers, */
/* etc. */
/* */
/* file_size :: The size in bytes of the resource. This field should */
/* be set to -1 until the resource is first opened. */
/* */
typedef struct FT_AnsiFileRec_
{
FT_ResourceRec root;
char* pathname; /* the font file's pathname */
FT_Long file_size; /* file size in bytes */
} FT_AnsiFileRec, *FT_AnsiFile;
/*************************************************************************/
/* */
/* We use the macro STREAM_Name() as a convenience to return a given */
/* ANSI resource's pathname. Its `stream' argument is a FT_Resource */
/* which is typecasted to the FT_AnsiFile class. */
/* */
#define STREAM_Name( stream ) ((FT_AnsiFile)stream->resource)->pathname
/*************************************************************************/
/* */
/* We use the macro STREAM_File() as a convenience to extract the */
/* system-specific stream handle from a given FreeType stream object. */
/* */
#define STREAM_File( stream ) ((FILE*)stream->stream_id.pointer)
/*************************************************************************/
/* */
/* <Function> */
/* AnsiFile_Open */
/* */
/* <Description> */
/* This function is used to open a system-stream for a given */
/* resource. */
/* */
/* Note that it must update the target FreeType stream object with */
/* the system-stream handle and the resource's size. */
/* */
/* Also, the `stream->base' field must be set to NULL for disk-based */
/* resources, and to the address in memory of the resource's first */
/* byte for memory-based ones. */
/* */
/* <Input> */
/* resource :: The source resource. */
/* stream :: The target stream object. */
/* */
/* <Return> */
/* FreeType error code. 0 means success. */
/* */
/* <Note> */
/* This function simply calls fopen() in the resource's file */
/* pathname. */
/* */
/* The stream object IS NOT CREATED by this function, but by its */
/* caller. */
/* */
static
FT_Error AnsiFile_Open( FT_AnsiFile resource,
FT_Stream stream )
{
FILE* file;
/* open the file */
file = fopen( resource->pathname, "rb" );
if ( !file )
{
PERROR(( "AnsiFile_Open: Could not open file `%s'\n",
resource->pathname ));
return FT_Err_Cannot_Open_Stream;
}
/* compute file size if necessary */
if ( resource->file_size < 0 )
{
fseek( file, 0, SEEK_END );
resource->file_size = ftell( file );
fseek( file, 0, SEEK_SET );
}
stream->resource = (FT_Resource)resource;
stream->stream_id.pointer = file;
stream->size = resource->file_size;
/* it's a disk-based resource, we don't need to use the `base' and */
/* `cursor' fields of the stream objects */
stream->base = NULL;
stream->cursor = NULL;
PTRACE1(( "AnsiFile_Open: Opened `%s' (%d bytes) successfully\n",
resource->pathname, resource->file_size ));
return FT_Err_Ok;
}
/*************************************************************************/
/* */
/* <Function> */
/* AnsiFile_Close */
/* */
/* <Description> */
/* Closes a given stream. */
/* */
/* <Input> */
/* stream :: The target stream object. */
/* */
/* <Return> */
/* FreeType error code. 0 means success. */
/* */
/* <Note> */
/* This function simply calls fclose() on the stream's ANSI FILE */
/* object. */
/* */
static
FT_Error AnsiFile_Close( FT_Stream stream )
{
PTRACE1(( "AnsiFile_Close: Closing file `%s'\n", STREAM_Name( stream ) ));
fclose( STREAM_File( stream ) );
stream->resource = NULL;
stream->stream_id.pointer = NULL;
stream->size = 0;
return FT_Err_Ok;
}
/*************************************************************************/
/* */
/* <Function> */
/* AnsiFile_Seek */
/* */
/* <Description> */
/* Seeks a stream to a given position. */
/* */
/* <Input> */
/* stream :: The target stream object. */
/* position :: The offset in bytes from the start of the */
/* resource/stream. */
/* */
/* <Return> */
/* FreeType error code. 0 means success. */
/* */
/* <Note> */
/* This function simply calls fseek() on the stream. */
/* */
/* The `seek' method is never called by the stream manager in case */
/* of a memory-based resource (i.e., when `stream->base' isn't NULL). */
/* */
static
FT_Error AnsiFile_Seek( FT_Stream stream,
FT_Long position )
{
if ( fseek( STREAM_File( stream ), position, SEEK_SET ) )
{
PERROR(( "AnsiFile_Seek: FAILED! Pos. %ld of `%s'\n",
position, STREAM_Name( stream ) ));
return FT_Err_Invalid_Stream_Seek;
}
PTRACE2(( "AnsiFile_Seek: Pos. %ld of `%s'\n",
position, STREAM_Name( stream ) ));
return FT_Err_Ok;
}
/*************************************************************************/
/* */
/* <Function> */
/* AnsiFile_Skip */
/* */
/* <Description> */
/* Skips a given number of bytes in an ANSI stream. Useful to skip */
/* pad bytes, for example. */
/* */
/* <Input> */
/* stream :: The target stream object. */
/* count :: The number of bytes to skip in the stream. */
/* */
/* <Return> */
/* FreeType error code. 0 means success. */
/* */
/* <Note> */
/* This function simply calls fseek() on the stream. */
/* */
/* The `skip' method is never called by the stream manager in case */
/* of a memory-based resource (i.e., when `stream->base' isn't NULL). */
/* */
static
FT_Error AnsiFile_Skip( FT_Stream stream,
FT_Long count )
{
if ( fseek( STREAM_File( stream ), count, SEEK_CUR ) )
{
PERROR(( "AnsiFile_Skip: FAILED! %ld bytes in `%s'\n",
count, STREAM_Name( stream ) ));
return FT_Err_Invalid_Stream_Seek;
}
PTRACE2(( "AnsiFile_Skip: %ld bytes in `%s'\n",
count, STREAM_Name( stream ) ));
return FT_Err_Ok;
}
/*************************************************************************/
/* */
/* <Function> */
/* AnsiFile_Pos */
/* */
/* <Description> */
/* Returns the current offset within an ANSI stream's resource. */
/* */
/* <Input> */
/* stream :: The target stream object. */
/* */
/* <Output> */
/* position :: The current offset. -1 in case of error. */
/* */
/* <Return> */
/* FreeType error code. 0 means success. */
/* */
/* <Note> */
/* This function simply calls ftell() on the stream. */
/* */
/* The `pos' method is never called by the stream manager in case */
/* of a memory-based resource (i.e., when `stream->base' isn't NULL). */
/* */
static
FT_Error AnsiFile_Pos( FT_Stream stream,
FT_Long* position )
{
*position = ftell( STREAM_File( stream ) );
if ( *position == -1 )
{
PTRACE2(( "AnsiFile_Pos: FAILED! In `%s'\n", STREAM_Name( stream ) ));
return FT_Err_Invalid_Stream_Seek;
}
PTRACE2(( "AnsiFile_Pos: For `%s'\n", STREAM_Name( stream ) ));
return FT_Err_Ok;
}
/*************************************************************************/
/* */
/* <Function> */
/* AnsiFile_Read */
/* */
/* <Description> */
/* Reads a given number of bytes from an ANSI stream into memory. */
/* */
/* <Input> */
/* stream :: The target stream object. */
/* buffer :: The target read buffer where data is copied. */
/* size :: The number of bytes to read from the stream. */
/* */
/* <Output> */
/* read_bytes :: The number of bytes effectively read from the */
/* stream. Used in case of error */
/* (i.e. FT_Err_Invalid_Stream_Read) by some parts of */
/* the library. */
/* <Return> */
/* FreeType error code. 0 means success. */
/* */
/* <Note> */
/* This function simply calls fread() on the stream. */
/* */
/* It MUST return the error FT_Err_Invalid_Stream_Read in case of */
/* an over-read (i.e., reading more bytes from the stream that what */
/* is left), as the stream component checks for this specific value. */
/* */
/* The `read' method is never called by the stream manager in case */
/* of a memory-based resource (i.e., when `stream->base' isn't NULL). */
/* */
static
FT_Error AnsiFile_Read( FT_Stream stream,
FT_Char* buffer,
FT_Long size,
FT_Long* read_bytes )
{
*read_bytes = fread( buffer, 1, size, STREAM_File( stream ) );
if ( *read_bytes != size )
{
/* Note : we can have an over-read here when called by the */
/* function FT_Access_Compressed_Frame. This means */
/* that the following message should be a trace, */
/* rather than an error for disk-based resources.. */
/* */
/* the function must set the value of 'read_bytes' */
/* even if it returns an error code.. */
PTRACE2(( "AnsiFile_Read: FAILED! Read %ld bytes from '%s'\n",
size, STREAM_Name( stream ) ));
return FT_Err_Invalid_Stream_Read;
}
PTRACE2(( "AnsiFile_Read: Read %ld bytes to buffer 0x%08lx from `%s'\n",
size, (long)buffer, STREAM_Name( stream ) ));
return FT_Err_Ok;
}
/*************************************************************************/
/* */
/* The following table is the `virtual method table' for the `ANSI */
/* resource class', which methods are defined above. Its address is set */
/* in the `interface' field of all resource objects created by the */
/* function FT_Create_AnsiFile() (see below). */
/* */
static
FTRes_InterfaceRec FT_AnsiFile_Interface =
{
(FTRes_Open_Func) AnsiFile_Open,
(FTRes_Close_Func)AnsiFile_Close,
(FTRes_Seek_Func) AnsiFile_Seek,
(FTRes_Skip_Func) AnsiFile_Skip,
(FTRes_Pos_Func) AnsiFile_Pos,
(FTRes_Read_Func) AnsiFile_Read,
};
/*************************************************************************/
/* */
/* <Function> */
/* FT_Create_Resource */
/* */
/* <Description> */
/* Creates a new resource object. This function is called by the */
/* FT_New_Resource() function of the base layer. */
/* */
/* <Input> */
/* library :: The input library object. */
/* pathname :: The file's pathname as an ASCII string. */
/* */
/* <Output> */
/* aresource :: A handle to new resource object. */
/* */
/* <Return> */
/* Error code. 0 means success. */
/* */
/* <Note> */
/* This functions does not open a stream. It simply copies the */
/* pathname within a fresh new resource object. */
/* */
EXPORT_FUNC
FT_Error FT_Create_Resource( FT_Library library,
const char* pathname,
FT_Resource* aresource )
{
FT_Int len;
FT_AnsiFile resource;
FT_Error error;
FT_System system;
if ( !library )
return FT_Err_Invalid_Library_Handle;
system = library->system;
if ( !pathname )
goto Fail_Null;
len = strlen( pathname );
if ( len == 0 )
goto Fail_Null;
resource = NULL;
if ( ALLOC( resource, sizeof ( *resource ) ) ||
ALLOC( resource->pathname, len + 1 ) )
goto Fail_Memory;
resource->root.library = library;
resource->root.interface = &FT_AnsiFile_Interface;
resource->root.flags = FT_RESOURCE_TYPE_DISK_BASED;
resource->file_size = -1;
strcpy( resource->pathname, pathname );
PTRACE1(( "Create_AnsiFile: Ansi resource created for `%s'\n",
pathname ));
*aresource = (FT_Resource)resource;
return FT_Err_Ok;
Fail_Null:
PERROR(( "Create_AnsiFile: Null pathname!\n" ));
return FT_Err_Invalid_Argument;
Fail_Memory:
if ( resource )
FREE( resource->pathname );
FREE( resource );
PERROR(( "Create_AnsiFile: Not enough memory to create resource!\n" ));
return error;
}
/*************************************************************************/
/* */
/* <Function> */
/* FT_Destroy_Resource */
/* */
/* <Description> */
/* Discards a given resource object explicitly. */
/* */
/* <Input> */
/* resource :: The ANSI resource object. */
/* */
/* <Note> */
/* This function does not check whether runs or streams are opened */
/* for the resource (for now, we assume developer intelligence. */
/* We'll most probably lower our standard later to ease debugging :-) */
/* */
EXPORT_FUNC
FT_Error FT_Destroy_Resource( FT_Resource resource )
{
FT_System system = resource->library->system;
FT_AnsiFile ansi = (FT_AnsiFile)resource;
if ( !ansi || ansi->root.interface != &FT_AnsiFile_Interface )
{
PERROR((
"Destroy_AnsiFile: Trying to destroy an invalid resource!\n" ));
return FT_Err_Invalid_Resource_Handle;
}
PTRACE1(( "Destroy_AnsiFile: Destroying resource for `%s'\n",
ansi->pathname ));
FREE( ansi->pathname );
FREE( ansi );
return FT_Err_Ok;
}
/*************************************************************************/
/* */
/* MEMORY MANAGEMENT */
/* */
/* */
/* This part copies the old FreeType 1.0 and 1.1 memory management */
/* scheme that was defined in the file `ttmemory.h'. One can see that */
/* */
/* - a set of macros is defined for the memory operations used by the */
/* engine (MEM_Copy(), MEM_Move(), MEM_Set()). This comes from the */
/* fact that many compilers are able to inline these operations */
/* directly within the compiled code, rather than generating a call */
/* to the C library. However, this obliges us to include the */
/* `<string.h>' header file. */
/* */
/* If you provide your own memory operations, you can get rid of the */
/* `#include <string.h>' below. */
/* */
/* */
/* - the FT_Alloc() function has several essential properties that MUST */
/* be retained by each port: */
/* */
/* - It returns an error code, NOT the allocated block's base */
/* address. */
/* */
/* - It takes the address of a target pointer, where the block's base */
/* address will be set. If the size is zero, its value will be */
/* NULL, and the function returns successfully. */
/* */
/* - In case of error, the pointer's value is set to NULL and an */
/* error code is returned. */
/* */
/* - The new allocated block MUST be zero-filled. This is a strong */
/* convention the rest of the engine relies on. */
/* */
/* */
/* - the FT_Free() function has also its essentials: */
/* */
/* - It takes the address of a pointer which value is the block's */
/* base address. This is UNLIKE a standard `free()' which takes */
/* the block's base directly. */
/* */
/* - It accepts successfully the address of a pointer which value is */
/* NULL, in which case it simply returns. */
/* */
/* - The pointer is always set to NULL by the function. */
/* */
/* */
/* - The MEM_Alloc(), ALLOC(), and ALLOC_ARRAY() macros are used by the */
/* library and should NOT be modified by porters! */
/* */
/*************************************************************************/
/*************************************************************************/
/* */
/* The macro FT_COMPONENT is used in trace mode. It is an implicit */
/* parameter of the PTRACE() and PERROR() macros, used to print/log */
/* messages during execution. */
/* */
#undef FT_COMPONENT
#define FT_COMPONENT trace_memory
/*************************************************************************/
/* */
/* <Function> */
/* FT_Alloc */
/* */
/* <Description> */
/* Allocates a new block of memory. The returned area is always */
/* zero-filled, this is a strong convention in many FreeType parts. */
/* */
/* <Input> */
/* system :: A handle to a given `system object' where allocation */
/* occurs. */
/* */
/* size :: The size in bytes of the block to allocate. */
/* */
/* <Output> */
/* P :: A pointer to the fresh new block. It should be set to */
/* NULL if `size' is 0, or in case of error. */
/* */
/* <Return> */
/* FreeType error code. 0 means success. */
/* */
BASE_FUNC
FT_Error FT_Alloc( FT_System system,
FT_Long size,
void** P )
{
if ( !P )
{
PERROR(( "FT_Alloc: Invalid pointer address!\n" ));
return FT_Err_Invalid_Argument;
}
if ( size > 0 )
{
*P = malloc( size );
if ( !*P )
{
PERROR(( "FT_Alloc: Out of memory (%ld bytes requested)!\n",
size ));
return FT_Err_Out_Of_Memory;
}
#ifdef FT_CONFIG_OPTION_DEBUG_MEMORY
DM_Record( (char*)*P, size );
#endif
system->total_alloc += size;
/* ALWAYS ZERO-FILL THE BLOCK! */
MEM_Set( *P, 0, size );
}
else
*P = NULL;
PTRACE2(( "FT_Alloc: Size = %ld, pointer = 0x%08lx, block = 0x%08lx\n",
size, (long)P, (long)*P ));
return FT_Err_Ok;
}
/*************************************************************************/
/* */
/* <Function> */
/* FT_Realloc */
/* */
/* <Description> */
/* Reallocates a block of memory pointed to by `*P' to `Size' bytes */
/* from the heap, possibly changing `*P'. */
/* */
/* <Input> */
/* system :: A handle to a given `system object' where allocation */
/* occurs. */
/* */
/* size :: The size in bytes of the block to allocate. */
/* */
/* <InOut> */
/* P :: A pointer to the fresh new block. It should be set to */
/* NULL if `size' is 0, or in case of error. */
/* */
/* <Return> */
/* FreeType error code. 0 means success. */
/* */
BASE_FUNC
FT_Error FT_Realloc( FT_System system,
FT_Long size,
void* *P )
{
void* Q;
if ( !P )
{
PERROR(( "FT_Realloc: Invalid pointer address!\n" ));
return FT_Err_Invalid_Argument;
}
/* if the original pointer is NULL, call FT_Alloc() */
if ( !*P )
return FT_Alloc( system, size, P );
/* if the new block if zero-sized, clear the current one */
if ( size <= 0 )
return FT_Free( system, P );
#ifdef FT_CONFIG_OPTION_DEBUG_MEMORY
DM_Forget( (char*)*P );
#endif
Q = (void*)realloc( *P, size );
if ( !Q )
{
PERROR(( "FT_Realloc: Reallocation failed!\n" ));
return FT_Err_Out_Of_Memory;
}
#ifdef FT_CONFIG_OPTION_DEBUG_MEMORY
DM_Record( (char*)Q, size );
#endif
*P = Q;
return FT_Err_Ok;
}
/*************************************************************************/
/* */
/* <Function> */
/* FT_Free */
/* */
/* <Description> */
/* Releases a given block of memory allocated through FT_Alloc(). */
/* */
/* <Input> */
/* system :: A handle to a given `system object' where allocation */
/* occured. */
/* */
/* P :: This is the _address_ of a _pointer_ which points to the */
/* allocated block. It is always set to NULL on exit. */
/* */
/* <Return> */
/* FreeType error code. 0 means success. */
/* */
/* <Note> */
/* If P or *P are NULL, this function should return successfully. */
/* This is a strong convention within all of FreeType and its */
/* drivers. */
/* */
BASE_FUNC
FT_Error FT_Free( FT_System system,
void* *P )
{
UNUSED( system );
PTRACE2(( "FT_Free: Freeing pointer 0x%08lx (block 0x%08lx)\n",
(long)P, (P ? (long)*P : -1) ));
if ( !P || !*P )
return FT_Err_Ok;
free( *P );
#ifdef FT_CONFIG_OPTION_DEBUG_MEMORY
DM_Forget( (char*)*P );
#endif
*P = NULL;
return FT_Err_Ok;
}
/*************************************************************************/
/* */
/* SYNCHRONIZATION MANAGEMENT */
/* */
/* */
/* This section deals with mutexes. The library can be compiled to */
/* two distinct thread support levels (namely single threaded and */
/* re-entrant modes). */
/* */
/* It protects its variables through the MUTEX_Lock() and */
/* MUTEX_Release() macros which are void in single threaded mode. */
/* */
/* It defines a typeless mutex reference type, `FT_Mutex', that you're */
/* free to redefine for your system's needs. */
/* */
/* The default implementation of ftsys.c contains only dummy functions */
/* which always return successfully. You NEED to specialize them in */
/* order to port ftsys.c to any multi-threaded environment. */
/* */
/*************************************************************************/
/*************************************************************************/
/* */
/* The macro FT_COMPONENT is used in trace mode. It is an implicit */
/* parameter of the PTRACE() and PERROR() macros, used to print/log */
/* messages during execution. */
/* */
#undef FT_COMPONENT
#define FT_COMPONENT trace_sync
#ifdef FT_CONFIG_THREADS
BASE_FUNC
FT_Error FT_Mutex_Create( FT_System system,
TMutex* mutex )
{
UNUSED( system );
mutex = (void*)-1;
system->num_mutexes++;
/* Insert your own mutex creation code here */
return FT_Err_Ok;
}
BASE_FUNC
void FT_Mutex_Delete( FT_System system,
TMutex* mutex )
{
UNUSED( system );
mutex = (void*)0;
system->num_mutexes--;
/* Insert your own mutex destruction code here */
}
BASE_FUNC
void FT_Mutex_Lock( FT_System system,
TMutex* mutex )
{
/* NOTE: It is legal to call this function with a NULL argument */
/* in which case an immediate return is appropriate. */
UNUSED( system );
if ( !mutex )
return;
/* Insert your own mutex locking code here */
}
BASE_FUNC
void FT_Mutex_Release( FT_System system,
TMutex* mutex )
{
/* NOTE: It is legal to call this function with a NULL argument */
/* in which case an immediate return is appropriate */
UNUSED( system );
if ( !mutex )
return;
/* Insert your own mutex release code here */
}
#endif /* FT_CONFIG_THREADS */
/*************************************************************************/
/* */
/* <Function> */
/* FT_New_System */
/* */
/* <Description> */
/* This function is used to create and initialize new system objects. */
/* These are mainly used to let client applications and font servers */
/* specify their own memory allocators and synchronization */
/* procedures. */
/* */
/* <Output> */
/* system :: A handle to a given `system object'. */
/* */
/* <Return> */
/* FreeType error code. 0 means success. */
/* */
EXPORT_FUNC
FT_Error FT_New_System( FT_System* system )
{
*system = (FT_System)malloc( sizeof ( **system ) );
if ( !*system )
return FT_Err_Out_Of_Memory;
/* the ANSI function `free()' is unable to return the number */
/* of released bytes. Hence, the `current_alloc' field of the */
/* system object cannot be used. */
(*system)->system_flags = FT_SYSTEM_FLAG_TOTAL_ALLOC |
FT_SYSTEM_FLAG_MUTEXES;
(*system)->total_alloc = 0;
(*system)->num_mutexes = 0;
#ifdef FT_CONFIG_OPTION_DEBUG_MEMORY
DM_Init_Mem();
#endif
/* initialize i/o management (nothing) */
/* initialize synchronisation (nothing) */
/* initialize streams (nothing) */
return FT_Err_Ok;
}
/*************************************************************************/
/* */
/* <Function> */
/* FT_Done_System */
/* */
/* <Description> */
/* Destroys a given FreeType system object. */
/* */
/* <Input> */
/* system :: A handle to a given `system object'. */
/* */
/* <Return> */
/* FreeType error code. 0 means success. */
/* */
EXPORT_FUNC
FT_Error FT_Done_System( FT_System system )
{
/* finalize synchronization (nothing) */
/* finalize i/o management (nothing) */
/* finalize memory management */
#ifdef FT_CONFIG_OPTION_DEBUG_MEMORY
DM_Done_Mem();
#endif
free( system );
return FT_Err_Ok;
}
/* END */

View File

@ -1,214 +0,0 @@
/**************************************************************************
*
* ftsystem.h 1.0
*
* ANSI-specific FreeType low-level system interface
*
* This file contains the definition of interface used by FreeType
* to access low-level, i.e. memory management, i/o access as well
* as thread synchronisation.
*
*
* Copyright 1996-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 <ftsystem.h>
#include <fterrors.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/*********************************************************************/
/* */
/* MEMORY MANAGEMENT INTERFACE */
/* */
/************************************************************************
*
* <FuncType>
* FT_Alloc_Func
*
* <Description>
* The memory allocator function type
*
* <Input>
* system :: pointer to the system object
* size :: requested size in bytes
*
* <Output>
* block :: address of newly allocated block
*
* <Return>
* Error code. 0 means success.
*
* <Note>
* If your allocation routine ALWAYS zeroes the new block, you
* should set the flag FT_SYSTEM_FLAG_ALLOC_ZEROES in your system
* object 'flags' field.
*
* If you have set the flag FT_SYSTEM_FLAG_REPORT_CURRENT_ALLOC in
* your system's "system_flags" field, this function should update
* the "current_alloc" field of the system object.
*
************************************************************************/
static
void* ft_alloc( FT_Memory memory,
long size )
{
(void)memory;
return malloc(size);
}
/************************************************************************
*
* <FuncType>
* FT_Realloc_Func
*
* <Description>
* The memory reallocator function type
*
* <Input>
* system :: pointer to the system object
* new_size :: new requested size in bytes
*
* <InOut>
* block :: address of block in memory
*
* <Return>
* Error code. 0 means success.
*
* <Note>
* This function is _never_ called when the system flag
* FT_SYSTEM_FLAG_NO_REALLOC is set. Instead, the engine will emulate
* realloc through "alloc" and "free".
*
* Note that this is possible due to the fact that FreeType's
* "FT_Realloc" always requests the _current_ size of the reallocated
* block as a parameter, thus avoiding memory leaks.
*
* If you have set the flag FT_SYSTEM_FLAG_REPORT_CURRENT_ALLOC in
* your system's "system_flags" field, this function should update
* the "current_alloc" field of the system object.
*
************************************************************************/
static
void* ft_realloc( FT_Memory memory,
long cur_size,
long new_size,
void* block )
{
(void)memory;
(void)cur_size;
return realloc( block, new_size );
}
/************************************************************************
*
* <FuncType>
* FT_Free_Func
*
* <Description>
* The memory release function type
*
* <Input>
* system :: pointer to the system object
* block :: address of block in memory
*
* <Note>
* If you have set the flag FT_SYSTEM_FLAG_REPORT_CURRENT_ALLOC in
* your system's "system_flags" field, this function should update
* the "current_alloc" field of the system object.
*
************************************************************************/
static
void ft_free( FT_Memory memory,
void* block )
{
(void)memory;
free( block );
}
/*********************************************************************/
/* */
/* RESOURCE MANAGEMENT INTERFACE */
/* */
#define STREAM_FILE(stream) ((FILE*)stream->descriptor.pointer)
static
void ft_close_stream( FT_Stream stream )
{
fclose( STREAM_FILE(stream) );
}
static
unsigned long ft_io_stream( FT_Stream stream,
unsigned long offset,
char* buffer,
unsigned long count )
{
FILE* file;
file = STREAM_FILE(stream);
fseek( file, offset, SEEK_SET );
return (unsigned long)fread( buffer, 1, count, file );
}
extern
int FT_New_Stream( const char* filepathname,
FT_Stream stream )
{
FILE* file;
file = fopen( filepathname, "rb" );
if (!file)
return FT_Err_Cannot_Open_Resource;
fseek( file, 0, SEEK_END );
stream->size = ftell(file);
fseek( file, 0, SEEK_SET );
stream->descriptor.pointer = file;
stream->pos = 0;
stream->read = ft_io_stream;
stream->close = ft_close_stream;
return 0;
}
extern
FT_Memory FT_New_Memory( void )
{
FT_Memory memory;
memory = (FT_Memory)malloc( sizeof(*memory) );
if (memory)
{
memory->user = 0;
memory->alloc = ft_alloc;
memory->realloc = ft_realloc;
memory->free = ft_free;
}
return memory;
}

View File

@ -1,182 +0,0 @@
/***************************************************************************/
/* */
/* ftconfig.h */
/* */
/* ANSI-specific configuration file (specification only). */
/* */
/* 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 header file contains a number of macro definitions that are used */
/* by the rest of the engine. Porters are free to copy this file and */
/* adapt it to suit their own system. */
/* */
/* IMPORTANT NOTE: */
/* */
/* Porters, read carefully the comments in `ftsys.h' before trying to */
/* port this file to your system. It contains many essential */
/* remarks, and will ease your work greatly. */
/* */
/*************************************************************************/
#ifndef FTCONFIG_H
#define FTCONFIG_H
/* Include the header file containing all developer build options */
#include <ftoption.h>
/*************************************************************************/
/* */
/* PLATFORM-SPECIFIC CONFIGURATION MACROS */
/* */
/* These macros can be toggled to suit a specific system. The current */
/* ones are defaults used to compile FreeType in an ANSI C environment */
/* (16bit compilers are also supported). Copy this file to your own */
/* `freetype/arch/<system>' directory, and edit it to port the engine. */
/* */
/*************************************************************************/
/* Define to empty if the keyword does not work. */
/* #undef const */
/* Define if you have the ANSI C header files. */
#define STDC_HEADERS 1
/* We use <limits.h> values to know the sizes of the types. */
#include <limits.h>
/* The number of bytes in an `int' type. */
#if UINT_MAX == 0xFFFFFFFF
#define SIZEOF_INT 4
#elif UINT_MAX == 0xFFFF
#define SIZEOF_INT 2
#elif UINT_MAX > 0xFFFFFFFF && UINT_MAX == 0xFFFFFFFFFFFFFFFF
#define SIZEOF_INT 8
#else
#error "Unsupported number of bytes in `int' type!"
#endif
/* The number of bytes in a `long' type. */
#if ULONG_MAX == 0xFFFFFFFF
#define SIZEOF_LONG 4
#elif ULONG_MAX > 0xFFFFFFFF && ULONG_MAX == 0xFFFFFFFFFFFFFFFF
#define SIZEOF_LONG 8
#else
#error "Unsupported number of bytes in `long' type!"
#endif
/* Define if you have the memcpy function. */
#define HAVE_MEMCPY 1
/* Define if you have the <fcntl.h> header file. */
#define HAVE_FCNTL_H 0
/* Define if you have the <unistd.h> header file. */
#define HAVE_UNISTD_H 0
/* Preferred alignment of data */
#define FT_ALIGNMENT 8
/*************************************************************************/
/* */
/* AUTOMATIC CONFIGURATION MACROS */
/* */
/* These macros are computed from the ones defined above. Don't touch */
/* their definition, unless you know precisely what you're doing. No */
/* porter should need to mess with them. */
/* */
/*************************************************************************/
/*************************************************************************/
/* */
/* IntN types */
/* */
/* Used to guarantee the size of some specific integers. */
/* */
typedef signed short FT_Int16;
typedef unsigned short FT_Word16;
#if SIZEOF_INT == 4
typedef signed int FT_Int32;
typedef unsigned int FT_Word32;
#elif SIZEOF_LONG == 4
typedef signed long FT_Int32;
typedef unsigned long FT_Word32;
#else
#error "no 32bit type found - please check your configuration files"
#endif
#if SIZEOF_LONG == 8
/* LONG64 must be defined when a 64-bit type is available */
#define LONG64
#define INT64 long
#else
/*************************************************************************/
/* */
/* GCC provides the non-ANSI 'long long' 64-bit type. You can activate */
/* it by defining the FTCALC_USE_LONG_LONG macro in `ftconfig.h'. Note */
/* that this will produce many -ansi warnings during library */
/* compilation. */
/* */
#ifdef FTCALC_USE_LONG_LONG
#define LONG64
#define INT64 long long
#endif /* FTCALC_USE_LONG_LONG */
#endif
#ifdef FT_MAKE_OPTION_SINGLE_OBJECT
#define LOCAL_DEF static
#define LOCAL_FUNC static
#else
#define LOCAL_DEF extern
#define LOCAL_FUNC /* nothing */
#endif
#ifdef FT_MAKE_OPTION_SINGLE_LIBRARY_OBJECT
#define BASE_DEF LOCAL_DEF
#define BASE_FUNC LOCAL_FUNC
#else
#define BASE_DEF extern
#define BASE_FUNC /* nothing */
#endif
#ifndef EXPORT_DEF
#define EXPORT_DEF extern
#endif
#ifndef EXPORT_FUNC
#define EXPORT_FUNC /* nothing */
#endif
#endif /* FTCONFIG_H */
/* END */

View File

@ -1,214 +0,0 @@
/**************************************************************************
*
* ftsystem.h 1.0
*
* ANSI-specific FreeType low-level system interface
*
* This file contains the definition of interface used by FreeType
* to access low-level, i.e. memory management, i/o access as well
* as thread synchronisation.
*
*
* Copyright 1996-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 <ftsystem.h>
#include <fterrors.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/*********************************************************************/
/* */
/* MEMORY MANAGEMENT INTERFACE */
/* */
/************************************************************************
*
* <FuncType>
* FT_Alloc_Func
*
* <Description>
* The memory allocator function type
*
* <Input>
* system :: pointer to the system object
* size :: requested size in bytes
*
* <Output>
* block :: address of newly allocated block
*
* <Return>
* Error code. 0 means success.
*
* <Note>
* If your allocation routine ALWAYS zeroes the new block, you
* should set the flag FT_SYSTEM_FLAG_ALLOC_ZEROES in your system
* object 'flags' field.
*
* If you have set the flag FT_SYSTEM_FLAG_REPORT_CURRENT_ALLOC in
* your system's "system_flags" field, this function should update
* the "current_alloc" field of the system object.
*
************************************************************************/
static
void* ft_alloc( FT_Memory memory,
long size )
{
(void)memory;
return malloc(size);
}
/************************************************************************
*
* <FuncType>
* FT_Realloc_Func
*
* <Description>
* The memory reallocator function type
*
* <Input>
* system :: pointer to the system object
* new_size :: new requested size in bytes
*
* <InOut>
* block :: address of block in memory
*
* <Return>
* Error code. 0 means success.
*
* <Note>
* This function is _never_ called when the system flag
* FT_SYSTEM_FLAG_NO_REALLOC is set. Instead, the engine will emulate
* realloc through "alloc" and "free".
*
* Note that this is possible due to the fact that FreeType's
* "FT_Realloc" always requests the _current_ size of the reallocated
* block as a parameter, thus avoiding memory leaks.
*
* If you have set the flag FT_SYSTEM_FLAG_REPORT_CURRENT_ALLOC in
* your system's "system_flags" field, this function should update
* the "current_alloc" field of the system object.
*
************************************************************************/
static
void* ft_realloc( FT_Memory memory,
long cur_size,
long new_size,
void* block )
{
(void)memory;
(void)cur_size;
return realloc( block, new_size );
}
/************************************************************************
*
* <FuncType>
* FT_Free_Func
*
* <Description>
* The memory release function type
*
* <Input>
* system :: pointer to the system object
* block :: address of block in memory
*
* <Note>
* If you have set the flag FT_SYSTEM_FLAG_REPORT_CURRENT_ALLOC in
* your system's "system_flags" field, this function should update
* the "current_alloc" field of the system object.
*
************************************************************************/
static
void ft_free( FT_Memory memory,
void* block )
{
(void)memory;
free( block );
}
/*********************************************************************/
/* */
/* RESOURCE MANAGEMENT INTERFACE */
/* */
#define STREAM_FILE(stream) ((FILE*)stream->descriptor.pointer)
static
void ft_close_stream( FT_Stream stream )
{
fclose( STREAM_FILE(stream) );
}
static
unsigned long ft_io_stream( FT_Stream stream,
unsigned long offset,
char* buffer,
unsigned long count )
{
FILE* file;
file = STREAM_FILE(stream);
fseek( file, offset, SEEK_SET );
return (unsigned long)fread( buffer, 1, count, file );
}
extern
int FT_New_Stream( const char* filepathname,
FT_Stream stream )
{
FILE* file;
file = fopen( filepathname, "rb" );
if (!file)
return FT_Err_Cannot_Open_Resource;
fseek( file, 0, SEEK_END );
stream->size = ftell(file);
fseek( file, 0, SEEK_SET );
stream->descriptor.pointer = file;
stream->pos = 0;
stream->read = ft_io_stream;
stream->close = ft_close_stream;
return 0;
}
extern
FT_Memory FT_New_Memory( void )
{
FT_Memory memory;
memory = (FT_Memory)malloc( sizeof(*memory) );
if (memory)
{
memory->user = 0;
memory->alloc = ft_alloc;
memory->realloc = ft_realloc;
memory->free = ft_free;
}
return memory;
}

View File

@ -1,194 +0,0 @@
#*******************************************************************
#*
#* FreeType 2 Configuration rules for Unix + gcc
#*
#* 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 purpose of this sub-Makefile is to define various build and
#* platform specific variables before including the sub-Makefile
#* containing the FreeType library rules, found in
#*
#* $(TOP)/config/freetype.mk
#*
#* The following variables must be defined before including this
#* file :
#*
#* TOP Pathname to the top of the FreeType sources
#* hierarchy
#*
#* This file should define the following variables before including
#* the FreeType library rules file :
#*
#* BUILD Pathname to the platform-specific files used
#* for the build. Usually `$(TOP)/config/<system>'
#*
#* SEP Directory separator used during compilation.
#* (usually "/" or "\"). Note that on Win32, both gcc
#* and Visual C++ use "/" as a directory separator !!
#*
#* HOSTSEP Directory separator for $(COPY) and $(DELETE)
#*
#* DELETE The forced remove/delete command to erase one or more
#* files
#*
#* INCLUDE The location of all public header files. e.g.
#* `$(TOP)/include'include' *
#*
#* SRC The directory containing all sources. e.g.
#* '$(TOP)/src'
#*
#* OBJ_DIR The location where compiled object files will be
#* placed, e.g. '$(TOP)/obj'
#*
#* LIB_DIR The location where the resulting library file will be
#* placed, e.g. '$(TOP)/obj'
#*
#* LIBRARY The filename of the resulting library file, without
#* its extension.. e.g. 'libfreetype' or 'freetype'
#*
#* O The object file suffix. Can be '.o', '.obj,' '.lo,'
#* ';coff,' etc.
#*
#* A The library file suffix. Can be '.a' '.so,' '.lib'
#* '.dll,' etc.
#*
#* I The path inclusion flag. Some compilers use a
#* different flag than '-I' to specify an additional
#* include path. Examples are '/i=' or '-J ', etc.
#*
#* D The macro definition flag. I haven't met compilers
#* which don't use the '-D' switch to define a macro, but
#* who knows...
#*
#* T The compilation flag used to identify the target. Some
#* compilers use a different flag than '-o ' to specify
#* the name of the target object file.
#*
#* CFLAGS The set of flags used to compile object files.
#* (usually contains the flag '-c').
#*
#*
#*
#*******************************************************************
ifndef TOP
TOP := .
endif
DELETE := rm -f
SEP := /
HOSTSEP := $(strip \ )
BUILD := $(TOP)/config/dos
PLATFORM := dos
# the directory where all object files are placed
#
# Note that this is not $(TOP)/obj !!
# This lets you build the library in your own directory
# with something like :
#
# set TOP=....../path/to/freetype2/top/dir...
# mkdir obj
# make -f %TOP%/Makefile setup [options]
# make -f %TOP%/Makefile
#
#
OBJ_DIR := obj
# the directory where all library files are placed
#
# by default, this is the same as OBJ_DIR, however, this can be
# changed to suit particular needs..
#
LIB_DIR := $(OBJ_DIR)
# the object file extension, this can be .o, .tco, .obj, etc..
# depending on the platform
#
O := o
# the library file extension, this can be .a, .lib, etc..
# depending on the platform
#
A := a
# The name of the final library file.
# Note that the DOS-specific Makefile uses a shorter (8.3) name
#
LIBRARY := libfreetype
# path inclusion flag.
#
# Some compilers use a different flag than '-I' to specify an
# additional include path. Examples are "/i=" or "-J", etc...
#
I := -I
# The link flag used to specify a given library file on link.
# Note that this is only used to compile the demo programs, not
# the library itself.
#
L := -l
# C flag used to define a macro before the compilation of a given
# source object. Usually is '-D' like in "-DDEBUG"
#
D := -D
# Target flag - beware, there is a space after the 'o' !!
#
#
T := -o
# C flags
#
# These should concern :
#
# - debug output
# - optimization
# - warnings
# - ansi compliance..
#
ifndef CFLAGS
CFLAGS := -c -g -O6 -Wall
endif
# ANSIFLAGS : put there the flags used to make your compiler ANSI-compliant
# nothing (if it already is by default like LCC).
#
ANSIFLAGS := -ansi -pedantic
ifdef BUILD_FREETYPE
include $(TOP)/config/freetype.mk
clean_freetype: clean_freetype_dos
distclean_freetype: distclean_freetype_dos
# This final rule is used to link all object files into a single
# library. It is part of the system-specific sub-Makefile because not
# all librarians accept a simple syntax like :
#
# librarian library_file {list of object files}
#
$(FT_LIBRARY): $(OBJECTS_LIST)
-$(DELETE) $@
$(AR) -r $@ $(OBJECTS_LIST)
endif

View File

@ -19,7 +19,7 @@ ifdef COMSPEC
is_dos := $(findstring Dos,$(shell ver))
# We try to recognize a Dos session under OS/2. The "ver" command
# returns 'Operating System/2 ...' there so 'is_dos' should be empty
# returns 'Operating System/2 ...' there, so 'is_dos' should be empty
# there.
#
# To recognize a Dos session under OS/2, we check COMSPEC for the
@ -40,7 +40,7 @@ COPY := copy
# Use gcc, i.e. DJGPP by default. Aren't we biased ;-)
#
#
CONFIG_FILE := Makefile.gcc
CONFIG_FILE := dos-gcc.mk
SEP := /
ifndef CC
CC := gcc
@ -48,28 +48,28 @@ endif
ifneq ($(findstring turboc,$(MAKECMDGOALS)),) # Turbo C
CONFIG_FILE := Makefile.tcc
CONFIG_FILE := dos-tcc.mk
SEP := $(BACKSLASH)
CC := tcc
.PHONY: turboc
endif
ifneq ($(findstring watcom,$(MAKECMDGOALS)),) # Watcom C/C++
CONFIG_FILE := Makefile.wat
CONFIG_FILE := dos-wat.mk
SEP := $(BACKSLASH)
CC := wcc386
.PHONY: watcom
endif
ifneq ($(findstring borlandc16,$(MAKECMDGOALS)),) # Borland C/C++ 16 bits
CONFIG_FILE := Makefile.bcc
CONFIG_FILE := dos-bcc.mk
SEP := $(BACKSLASH)
CC := bcc
.PHONY: borlandc16
endif
ifneq ($(findstring borlandc,$(MAKECMDGOALS)),) # Borland C/C++ 32 bits
CONFIG_FILE := Makefile.bcc
CONFIG_FILE := dos-bcc.mk
SEP := $(BACKSLASH)
CC := bcc32
.PHONY: borlandc

131
config/dos/dos-gcc.mk Normal file
View File

@ -0,0 +1,131 @@
#*******************************************************************
#*
#* FreeType 2 Configuration rules for Dos + GCC
#*
#* Copyright 1996-2000 by
#* David Turner, Robert Wilhelm, and Werner Lemberg.
#*
#* This file is part of the FreeType project, and may only be used
#* modified and distributed under the terms of the FreeType project
#* license, LICENSE.TXT. By continuing to use, modify, or distribute
#* this file you indicate that you have read the license and
#* understand and accept it fully.
#*
#* Please read the file "freetype/docs/config.txt" to understand
#* what this file does..
#*
#*******************************************************************
ifndef TOP
TOP := .
endif
DELETE := rm -f
SEP := /
HOSTSEP := $(strip \ )
BUILD := $(TOP)/config/dos
PLATFORM := dos
# the directory where all object files are placed
#
# Note that this is not $(TOP)/obj !!
# This lets you build the library in your own directory
# with something like :
#
# set TOP=....../path/to/freetype2/top/dir...
# mkdir obj
# make -f %TOP%/Makefile setup [options]
# make -f %TOP%/Makefile
#
#
OBJ_DIR := obj
# the directory where all library files are placed
#
# by default, this is the same as OBJ_DIR, however, this can be
# changed to suit particular needs..
#
LIB_DIR := $(OBJ_DIR)
# the object file extension, this can be .o, .tco, .obj, etc..
# depending on the platform
#
O := o
# the library file extension, this can be .a, .lib, etc..
# depending on the platform
#
A := a
# The name of the final library file.
# Note that the DOS-specific Makefile uses a shorter (8.3) name
#
LIBRARY := libfreetype
# path inclusion flag.
#
# Some compilers use a different flag than '-I' to specify an
# additional include path. Examples are "/i=" or "-J", etc...
#
I := -I
# The link flag used to specify a given library file on link.
# Note that this is only used to compile the demo programs, not
# the library itself.
#
L := -l
# C flag used to define a macro before the compilation of a given
# source object. Usually is '-D' like in "-DDEBUG"
#
D := -D
# Target flag - beware, there is a space after the 'o' !!
#
#
T := -o
# C flags
#
# These should concern :
#
# - debug output
# - optimization
# - warnings
# - ansi compliance..
#
ifndef CFLAGS
CFLAGS := -c -g -O6 -Wall
endif
# ANSIFLAGS : put there the flags used to make your compiler ANSI-compliant
# nothing (if it already is by default like LCC).
#
ANSIFLAGS := -ansi -pedantic
ifdef BUILD_FREETYPE
include $(TOP)/config/freetype.mk
clean_freetype: clean_freetype_dos
distclean_freetype: distclean_freetype_dos
# This final rule is used to link all object files into a single
# library. It is part of the system-specific sub-Makefile because not
# all librarians accept a simple syntax like :
#
# librarian library_file {list of object files}
#
$(FT_LIBRARY): $(OBJECTS_LIST)
-$(DELETE) $@
$(AR) -r $@ $(OBJECTS_LIST)
endif

View File

@ -23,8 +23,8 @@
#
include $(TOP)/config/modules.mk
# The targets `objects', `library' and `multiple' are defined
# at the end of this Makefile when all rules have been included..
# The targets `objects', `library' are defined at the end of
# this Makefile when all rules have been included..
#
.PHONY: build_freetype objects library
@ -59,10 +59,11 @@ BASE_ := $(BASE_DIR)$(SEP)
OBJ_ := $(OBJ_DIR)$(SEP)
LIB_ := $(LIB_DIR)$(SEP)
PUBLIC_ := $(TOP)$(SEP)include$(SEP)
CONFIG_ := $(TOP)$(SEP)config$(SEP)
# The name of the final library file.
#
FT_LIBRARY := $(LIB_DIR)$(SEP)$(LIBRARY).$A
FT_LIBRARY := $(LIB_)$(LIBRARY).$A
# include paths
@ -70,10 +71,10 @@ FT_LIBRARY := $(LIB_DIR)$(SEP)$(LIBRARY).$A
# IMPORTANT NOTE: The architecture-dependent directory must ALWAYS be placed
# in front of the include list. Porters are then able to put
# their own version of some of the FreeType components in
# the 'freetype/arch/<system>' directory, as these files
# the 'freetype/config/<system>' directory, as these files
# will override the default sources.
#
INCLUDES := $(BUILD) $(TOP)$(SEP)include $(INCLUDES)
INCLUDES := $(BUILD) $(TOP)$(SEP)config $(TOP)$(SEP)include $(INCLUDES)
INCLUDE_FLAGS = $(INCLUDES:%=$I%)
@ -95,13 +96,19 @@ DRIVERS_LIST :=
OBJECTS_LIST :=
# System-specific component - this must be defined in this Makefile
# for easy updates
# for easy updates. The default Ansi ftsystem.c is located in
# 'freetype/config/ftsystem.c'. However, some system-specific
# configuration might define FTSYS_SRC to fetch it in other places,
# like 'freetype/config/<system>/ftsystem.c'
#
# BASE_H is defined in src/base/rules.mk and contains the list of all
# base layer header files.
#
FTSYS_SRC = $(BUILD)$(SEP)ftsystem.c
FTSYS_OBJ = $(OBJ_DIR)$(SEP)ftsystem.$O
ifndef FTSYS_SRC
FTSYS_SRC = $(BASE_)ftsystem.c
endif
FTSYS_OBJ = $(OBJ_)ftsystem.$O
OBJECTS_LIST += $(FTSYS_OBJ)
@ -111,7 +118,8 @@ $(FTSYS_OBJ): $(FTSYS_SRC) $(BASE_H)
# ftdebug component
#
#
# FTDebug contains code used to print traces and errors. It is
# normally empty for a release build (see ftoption.h)
#
FTDEBUG_SRC = $(BASE_)ftdebug.c
@ -144,14 +152,15 @@ include $(wildcard $(SRC)/*/rules.mk)
# The set of initial drivers is determined by the driver Makefiles
# includes above. Each driver Makefile updates the FTINIT_xxxx lists
# which contain additional include paths and macros used to compile the
# single 'ftapi.c' source.
# single 'ftinit.c' source.
#
FTINIT_SRC := $(BASE_DIR)$(SEP)ftinit.c
FTINIT_SRC := $(BASE_)ftinit.c
FTINIT_OBJ := $(OBJ_)ftinit.$O
$(FTINIT_OBJ): $(FTINIT_SRC) $(BASE_H) $(FTINIT_DRIVER_H) $(FT_MODULE_LIST)
$(FT_COMPILE) $(FTINIT_DRIVER_PATHS:%=$I%) \
$(FTINIT_DRIVER_MACROS:%=$D%) $T$@ $<
OBJECTS_LIST += $(FTINIT_OBJ)
$(FTINIT_OBJ): $(FTINIT_SRC) $(BASE_H) $(FT_MODULE_LIST)
$(FT_COMPILE) $T$@ $<
# All FreeType library objects
@ -159,11 +168,19 @@ $(FTINIT_OBJ): $(FTINIT_SRC) $(BASE_H) $(FTINIT_DRIVER_H) $(FT_MODULE_LIST)
# By default, we include the base layer extensions. These could be
# ommitted on builds which do not want them.
#
OBJ_M = $(BASE_OBJ_M) $(BASE_EXT_OBJ) $(DRV_OBJS_M) \
$(FTINIT_OBJ)
OBJ_M = $(BASE_OBJ_M) $(BASE_EXT_OBJ) $(DRV_OBJS_M)
OBJ_S = $(BASE_OBJ_S) $(BASE_EXT_OBJ) $(DRV_OBJS_S) \
$(FTINIT_OBJ)
OBJ_S = $(BASE_OBJ_S) $(BASE_EXT_OBJ) $(DRV_OBJS_S)
# the target 'multi' on the Make command line indicates that we want
# to compile each source file independently..
#
# Otherwise, each module/driver is compiled in a single object file
# through source file inclusion (see 'src/base/ftbase.c' or
# 'src/truetype/truetype.c' for examples)
#
BASE_OBJECTS := $(OBJECTS_LIST)
ifneq ($(findstring multi,$(MAKECMDGOALS)),)
OBJECTS_LIST += $(OBJ_M)
@ -183,7 +200,7 @@ library: $(FT_LIBRARY)
# on all systems though..
#
clean_freetype_std:
-$(DELETE) $(OBJ_S) $(OBJ_M)
-$(DELETE) $(BASE_OBJECTS) $(OBJS_M) $(OBJS_S)
distclean_freetype_std: clean_freetype_std
-$(DELETE) $(FT_LIBRARY)
@ -199,6 +216,8 @@ clean_freetype_dos:
distclean_freetype_dos: clean_freetype_dos
-del $(subst $(SEP),$(HOSTSEP),$(FT_LIBRARY)) 2> nul
# remove configuration file (used for distclean)
#
remove_config_mk:
-$(DELETE) $(subst $(SEP),$(HOSTSEP),$(CONFIG_MK))

View File

@ -4,7 +4,7 @@
/* */
/* ANSI-specific configuration file (specification only). */
/* */
/* Copyright 1996-1999 by */
/* Copyright 1996-2000 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used */
@ -19,18 +19,21 @@
/*************************************************************************/
/* */
/* This header file contains a number of macro definitions that are used */
/* by the rest of the engine. Porters are free to copy this file and */
/* adapt it to suit their own system. */
/* by the rest of the engine. Most of the macros here are automatically */
/* determined at compile time, and you should not need to change it to */
/* port FreeType, except to compile the library with a non ANSI compiler */
/* */
/* IMPORTANT NOTE: */
/* Note however that if some specific modifications are needed, we */
/* advise you to place a modified copy in your build directory. */
/* */
/* Porters, read carefully the comments in `ftsys.h' before trying to */
/* port this file to your system. It contains many essential */
/* remarks, and will ease your work greatly. */
/* The build directory is usually "freetype/config/<system>", and */
/* contains system-specific files that are always included first when */
/* building the library.. */
/* */
/* This ANSI version should stay in "freetype/config" */
/* */
/*************************************************************************/
#ifndef FTCONFIG_H
#define FTCONFIG_H
@ -138,10 +141,11 @@
/*************************************************************************/
/* */
/* GCC provides the non-ANSI 'long long' 64-bit type. You can activate */
/* it by defining the FTCALC_USE_LONG_LONG macro in `ftconfig.h'. Note */
/* that this will produce many -ansi warnings during library */
/* compilation. */
/* many compilers provide the non-ANSI 'long long' 64-bit type. You can */
/* activate it by defining the FTCALC_USE_LONG_LONG macro in `ftoption.h'*/
/* Note that this will produce many -ansi warnings during library */
/* compilation, and that in many cases, the generated code will not be */
/* smaller or faster !! */
/* */
#ifdef FTCALC_USE_LONG_LONG

View File

@ -1,4 +1,5 @@
FT_DRIVER(psnames_driver_interface)
FT_DRIVER(sfnt_driver_interface)
FT_DRIVER(tt_driver_interface)
FT_DRIVER(t1_driver_interface)
FT_DRIVER(psnames_driver_interface)
FT_DRIVER(t1z_driver_interface)

View File

@ -1,3 +1,20 @@
/***************************************************************************/
/* */
/* ftoption.h */
/* */
/* User-selectable configuration macros. */
/* */
/* Copyright 1996-2000 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used */
/* modified and distributed under the terms of the FreeType project */
/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
/* this file you indicate that you have read the license and */
/* understand and accept it fully. */
/* */
/***************************************************************************/
#ifndef FTOPTION_H
#define FTOPTION_H
@ -6,9 +23,16 @@
/* USER-SELECTABLE CONFIGURATION MACROS */
/* */
/* These macros can be toggled by developers to enable or disable */
/* certain aspects of FreeType. This file contains macros that apply to */
/* all of FreeType. Driver-specific configurations are placed in each */
/* driver directory (e.g. `freetype/drivers/ttlib/ttconfig.h'). */
/* certain aspects of FreeType. This is a default file, where all major */
/* options are enabled. */
/* */
/* Note that if some modifications are required for your build, we */
/* advise you to put a modified copy of this file in your build */
/* directory, rather than modifying it in-place. */
/* */
/* The build directory is normally "freetype/config/<system>" and */
/* contains build or system-specific files that are included in */
/* priority when building the library. */
/* */
/*************************************************************************/
@ -27,8 +51,13 @@
/* with an alternate glyph format, this will reduce the size of the */
/* base layer code. */
/* */
/* Note that a few Type 1 fonts, as well as Windows "Vector" fonts */
/* use a vector "plotter" format that isn't supported when this */
/* macro is undefined.. */
/* */
#define FT_CONFIG_OPTION_ALTERNATE_GLYPH_FORMATS
/*************************************************************************/
/* */
/* Glyph Postscript Names handling */
@ -54,6 +83,7 @@
/* */
#define FT_CONFIG_OPTION_POSTSCRIPT_NAMES
/*************************************************************************/
/* */
/* Postscript Names to Unicode Values support */
@ -71,12 +101,14 @@
/* */
#define FT_CONFIG_OPTION_ADOBE_GLYPH_LIST
/*************************************************************************/
/* */
/* GCC provides the non-ANSI `long long' 64-bit type. You can activate */
/* it by defining the FTCALC_USE_LONG_LONG macro here. Note however */
/* that we did not experience any improvement in speed with gcc, and */
/* that the final code seems bigger when linked. */
/* many compilers provide the non-ANSI 'long long' 64-bit type. You can */
/* activate it by defining the FTCALC_USE_LONG_LONG macro in `ftoption.h'*/
/* Note that this will produce many -ansi warnings during library */
/* compilation, and that in many cases, the generated code will not be */
/* smaller or faster !! */
/* */
#undef FTCALC_USE_LONG_LONG
@ -146,17 +178,6 @@
#undef FT_CONFIG_OPTION_BIG_ENDIAN
/*************************************************************************/
/* */
/* Define this configuration macro whenever you want to build a version */
/* of FreeType that does not include a default `system' component. */
/* */
/* Note that this will prevent the compilation of `ftinit', hence the */
/* function FT_Init_FreeType */
/* */
#undef FT_CONFIG_OPTION_NO_DEFAULT_SYSTEM
/*************************************************************************/
/* */
/* The size in bytes of the render pool used by the scan-line */
@ -164,7 +185,7 @@
/* */
/* This must be greater than 4 Kb */
/* */
#define FT_RENDER_POOL_SIZE 32768
#define FT_RENDER_POOL_SIZE 8192
/*************************************************************************/
@ -175,6 +196,9 @@
/* single FreeType library object. 8 seems to be a good choice due */
/* to the relative low actual number of drivers ;-) */
/* */
/* If you don't intend to register new drivers at runtime, you */
/* certainly do not need to change this value.. */
/* */
#define FT_MAX_DRIVERS 8
@ -185,6 +209,9 @@
/* The maximum number of extensions that can be registered in a */
/* single font driver. 8 seems to be a good choice for now.. */
/* */
/* If you don't know what this means, you certainly do not need to */
/* change this value.. */
/* */
#define FT_MAX_EXTENSIONS 8
@ -196,9 +223,7 @@
/* in a given library instance. 8 seems to be a good choice due to */
/* the relatively low number of current formats ;-) */
/* */
#define FT_MAX_GLYPH_FORMATS 8
#endif /* FTOPTION_H */

View File

@ -17,7 +17,7 @@
#* OTHER MAKEFILES. *
#* *
#* This file is in charge of handling the generation of the modules list *
#* file, normally located in `config/<platform>/modules'. *
#* file, normally located in `config/ftmodule.h' *
#* *
#****************************************************************************
@ -26,7 +26,9 @@
# MODULE_LIST, as it name suggests, indicate where the modules list
# reside. For now, it is in $(BUILD)/ftmodule.h
#
FT_MODULE_LIST := $(BUILD)$(SEP)ftmodule.h
ifndef FT_MODULE_LIST
FT_MODULE_LIST := $(TOP)$(SEP)config$(SEP)ftmodule.h
endif
# To build the modules list, we invoke the `make_module_list' target
#
@ -56,7 +58,7 @@ endif
OPEN_DRIVER := $(OPEN_MODULE)FT_DRIVER(
CLOSE_DRIVER := )$(CLOSE_MODULE)
ECHO_DRIVER := @echo "* driver:
ECHO_DRIVER := @echo "* driver:
ECHO_DRIVER_DESC := (
ECHO_DRIVER_DONE := )"

View File

@ -1,217 +0,0 @@
#*******************************************************************
#*
#* FreeType 2 Configuration rules for Unix + gcc
#*
#* 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 purpose of this sub-Makefile is to define various build and
#* platform specific variables before including the sub-Makefile
#* containing the FreeType library rules, found in
#*
#* $(TOP)/config/freetype.mk
#*
#* The following variables must be defined before including this
#* file :
#*
#* TOP Pathname to the top of the FreeType sources
#* hierarchy
#*
#* This file should define the following variables before including
#* the FreeType library rules file :
#*
#* BUILD Pathname to the platform-specific files used
#* for the build. Usually `$(TOP)/config/<system>'
#*
#* SEP Directory separator used during compilation.
#* (usually "/" or "\"). Note that on Win32, both gcc
#* and Visual C++ use "/" as a directory separator !!
#*
#* HOSTSEP Directory separator for $(COPY) and $(DELETE)
#*
#* DELETE The forced remove/delete command to erase one or more
#* files
#*
#* INCLUDE The location of all public header files. e.g.
#* `$(TOP)/include'include' *
#*
#* SRC The directory containing all sources. e.g.
#* '$(TOP)/src'
#*
#* OBJ_DIR The location where compiled object files will be
#* placed, e.g. '$(TOP)/obj'
#*
#* LIB_DIR The location where the resulting library file will be
#* placed, e.g. '$(TOP)/obj'
#*
#* LIBRARY The filename of the resulting library file, without
#* its extension.. e.g. 'libfreetype' or 'freetype'
#*
#* O The object file suffix. Can be '.o', '.obj,' '.lo,'
#* ';coff,' etc.
#*
#* A The library file suffix. Can be '.a' '.so,' '.lib'
#* '.dll,' etc.
#*
#* I The path inclusion flag. Some compilers use a
#* different flag than '-I' to specify an additional
#* include path. Examples are '/i=' or '-J ', etc.
#*
#* D The macro definition flag. I haven't met compilers
#* which don't use the '-D' switch to define a macro, but
#* who knows...
#*
#* T The compilation flag used to identify the target. Some
#* compilers use a different flag than '-o ' to specify
#* the name of the target object file.
#*
#* CFLAGS The set of flags used to compile object files.
#* (usually contains the flag '-c').
#*
#*
#*
#*******************************************************************
ifndef TOP
TOP := .
endif
DELETE := del
SEP := /
HOSTSEP := $(strip \ )
BUILD := $(TOP)/config/os2
PLATFORM := os2
CC := gcc
# the directory where all object files are placed
#
# Note that this is not $(TOP)/obj !!
# This lets you build the library in your own directory
# with something like :
#
# set TOP=....../path/to/freetype2/top/dir...
# mkdir obj
# make -f %TOP%/Makefile setup [options]
# make -f %TOP%/Makefile
#
#
OBJ_DIR := obj
# the directory where all library files are placed
#
# by default, this is the same as OBJ_DIR, however, this can be
# changed to suit particular needs..
#
LIB_DIR := $(OBJ_DIR)
# the object file extension, this can be .o, .tco, .obj, etc..
# depending on the platform
#
O := o
# the library file extension, this can be .a, .lib, etc..
# depending on the platform
#
A := a
# The name of the final library file.
# Note that the DOS-specific Makefile uses a shorter (8.3) name
#
LIBRARY := libfreetype
# path inclusion flag.
#
# Some compilers use a different flag than '-I' to specify an
# additional include path. Examples are "/i=" or "-J", etc...
#
I := -I
# The link flag used to specify a given library file on link.
# Note that this is only used to compile the demo programs, not
# the library itself.
#
L := -l
# C flag used to define a macro before the compilation of a given
# source object. Usually is '-D' like in "-DDEBUG"
#
D := -D
# Target flag - beware, there is a space after the 'o' !!
#
#
T := -o
# C flags
#
# These should concern :
#
# - debug output
# - optimization
# - warnings
# - ansi compliance..
#
ifndef CFLAGS
CFLAGS := -c -g -O6 -Wall
endif
# ANSIFLAGS : put there the flags used to make your compiler ANSI-compliant
# nothing (if it already is by default like LCC).
#
ANSIFLAGS := -ansi -pedantic
ifdef BUILD_FREETYPE
include $(TOP)/config/freetype.mk
clean_freetype: clean_freetype_dos
distclean_freetype: distclean_freetype_dos
# Librarian to use to build the static library
#
FT_LIBRARIAN := $(AR) -r
# This final rule is used to link all object files into a single
# library. It is part of the system-specific sub-Makefile because not
# all librarians accept a simple syntax like :
#
# librarian library_file {list of object files}
#
$(FT_LIBRARY): $(OBJECTS_LIST)
-$(DELETE) $@
$(FT_LIBRARIAN) $@ $(OBJECTS_LIST)
# Cleaning rules
#
DIR_OBJ := $(subst $(SEP),\,$(OBJ_DIR))
clean_freetype_objects:
-del $(DIR_OBJ)\*.$O
clean_freetype_lib:
-del $(subst $(SEP),\,$(FT_LIBRARY))
clean: clean_freetype_objects
endif

View File

@ -15,30 +15,37 @@ PLATFORM := os2
COPY := copy
DELETE := del
CONFIG_FILE := Makefile.emx # gcc-emx by default
CONFIG_FILE := os2-gcc.mk # gcc-emx by default
SEP := /
ifneq ($(findstring visualage,$(MAKECMDGOALS)),) # Visual Age C++
CONFIG_FILE := Makefile.icc
CONFIG_FILE := os2-icc.mk
SEP := $(BACKSLASH)
CC := icc
.PHONY: visualage
endif
ifneq ($(findstring watcom,$(MAKECMDGOALS)),) # Watcom C/C++
CONFIG_FILE := Makefile.wat
CONFIG_FILE := os2-wat.mk
SEP := $(BACKSLASH)
CC := wcc386
.PHONY: watcom
endif
ifneq ($(findstring borlandc,$(MAKECMDGOALS)),) # Borland C++ 32 bits
CONFIG_FILE := Makefile.bcc
CONFIG_FILE := os2-bcc.mk
SEP := $(BACKSLASH)
CC := bcc32
.PHONY: borlandc
endif
ifneq ($(findstring devel,$(MAKECMDGOALS)),)
CONFIG_FILE := os2-dev.mk
CC := gcc
SEP := /
devel: setup
endif
CONFIG_RULES := $(TOP)\config\os2\$(CONFIG_FILE)
setup: dos_setup

View File

@ -1,182 +0,0 @@
/***************************************************************************/
/* */
/* ftconfig.h */
/* */
/* ANSI-specific configuration file (specification only). */
/* */
/* 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 header file contains a number of macro definitions that are used */
/* by the rest of the engine. Porters are free to copy this file and */
/* adapt it to suit their own system. */
/* */
/* IMPORTANT NOTE: */
/* */
/* Porters, read carefully the comments in `ftsys.h' before trying to */
/* port this file to your system. It contains many essential */
/* remarks, and will ease your work greatly. */
/* */
/*************************************************************************/
#ifndef FTCONFIG_H
#define FTCONFIG_H
/* Include the header file containing all developer build options */
#include <ftoption.h>
/*************************************************************************/
/* */
/* PLATFORM-SPECIFIC CONFIGURATION MACROS */
/* */
/* These macros can be toggled to suit a specific system. The current */
/* ones are defaults used to compile FreeType in an ANSI C environment */
/* (16bit compilers are also supported). Copy this file to your own */
/* `freetype/arch/<system>' directory, and edit it to port the engine. */
/* */
/*************************************************************************/
/* Define to empty if the keyword does not work. */
/* #undef const */
/* Define if you have the ANSI C header files. */
#define STDC_HEADERS 1
/* We use <limits.h> values to know the sizes of the types. */
#include <limits.h>
/* The number of bytes in an `int' type. */
#if UINT_MAX == 0xFFFFFFFF
#define SIZEOF_INT 4
#elif UINT_MAX == 0xFFFF
#define SIZEOF_INT 2
#elif UINT_MAX > 0xFFFFFFFF && UINT_MAX == 0xFFFFFFFFFFFFFFFF
#define SIZEOF_INT 8
#else
#error "Unsupported number of bytes in `int' type!"
#endif
/* The number of bytes in a `long' type. */
#if ULONG_MAX == 0xFFFFFFFF
#define SIZEOF_LONG 4
#elif ULONG_MAX > 0xFFFFFFFF && ULONG_MAX == 0xFFFFFFFFFFFFFFFF
#define SIZEOF_LONG 8
#else
#error "Unsupported number of bytes in `long' type!"
#endif
/* Define if you have the memcpy function. */
#define HAVE_MEMCPY 1
/* Define if you have the <fcntl.h> header file. */
#define HAVE_FCNTL_H 0
/* Define if you have the <unistd.h> header file. */
#define HAVE_UNISTD_H 0
/* Preferred alignment of data */
#define FT_ALIGNMENT 8
/*************************************************************************/
/* */
/* AUTOMATIC CONFIGURATION MACROS */
/* */
/* These macros are computed from the ones defined above. Don't touch */
/* their definition, unless you know precisely what you're doing. No */
/* porter should need to mess with them. */
/* */
/*************************************************************************/
/*************************************************************************/
/* */
/* IntN types */
/* */
/* Used to guarantee the size of some specific integers. */
/* */
typedef signed short FT_Int16;
typedef unsigned short FT_Word16;
#if SIZEOF_INT == 4
typedef signed int FT_Int32;
typedef unsigned int FT_Word32;
#elif SIZEOF_LONG == 4
typedef signed long FT_Int32;
typedef unsigned long FT_Word32;
#else
#error "no 32bit type found - please check your configuration files"
#endif
#if SIZEOF_LONG == 8
/* LONG64 must be defined when a 64-bit type is available */
#define LONG64
#define INT64 long
#else
/*************************************************************************/
/* */
/* GCC provides the non-ANSI 'long long' 64-bit type. You can activate */
/* it by defining the FTCALC_USE_LONG_LONG macro in `ftconfig.h'. Note */
/* that this will produce many -ansi warnings during library */
/* compilation. */
/* */
#ifdef FTCALC_USE_LONG_LONG
#define LONG64
#define INT64 long long
#endif /* FTCALC_USE_LONG_LONG */
#endif
#ifdef FT_MAKE_OPTION_SINGLE_OBJECT
#define LOCAL_DEF static
#define LOCAL_FUNC static
#else
#define LOCAL_DEF extern
#define LOCAL_FUNC /* nothing */
#endif
#ifdef FT_MAKE_OPTION_SINGLE_LIBRARY_OBJECT
#define BASE_DEF LOCAL_DEF
#define BASE_FUNC LOCAL_FUNC
#else
#define BASE_DEF extern
#define BASE_FUNC /* nothing */
#endif
#ifndef EXPORT_DEF
#define EXPORT_DEF extern
#endif
#ifndef EXPORT_FUNC
#define EXPORT_FUNC /* nothing */
#endif
#endif /* FTCONFIG_H */
/* END */

View File

@ -1,4 +0,0 @@
FT_DRIVER(psnames_driver_interface)
FT_DRIVER(sfnt_driver_interface)
FT_DRIVER(tt_driver_interface)
FT_DRIVER(t1_driver_interface)

View File

@ -1,204 +0,0 @@
#ifndef FTOPTION_H
#define FTOPTION_H
/*************************************************************************/
/* */
/* USER-SELECTABLE CONFIGURATION MACROS */
/* */
/* These macros can be toggled by developers to enable or disable */
/* certain aspects of FreeType. This file contains macros that apply to */
/* all of FreeType. Driver-specific configurations are placed in each */
/* driver directory (e.g. `freetype/drivers/ttlib/ttconfig.h'). */
/* */
/*************************************************************************/
/*************************************************************************/
/* */
/* Alternate Glyph Image Format support */
/* */
/* By default, the glyph images returned by the FreeType glyph loader */
/* can either be a pixmap or a vectorial outline defined through */
/* bezier control points. When defining the following configuration */
/* macro, some font drivers will be able to register alternate */
/* glyph image formats. */
/* */
/* Unset this macro if you're sure that you'll never use a font driver */
/* with an alternate glyph format, this will reduce the size of the */
/* base layer code. */
/* */
#define FT_CONFIG_OPTION_ALTERNATE_GLYPH_FORMATS
/*************************************************************************/
/* */
/* Glyph Postscript Names handling */
/* */
/* By default, FreeType 2 is built with the "psnames" module compiled */
/* in. This module is in charge of converting a glyph name string into */
/* a Unicode value, or return a Macintosh standard glyph name for the */
/* use with the TrueType "post" table. */
/* */
/* Undefine this macro if you do not want the "psnames" compiled in */
/* your build of FreeType. This has the following effects : */
/* */
/* - the TrueType driver will provide its own set of glyph names, */
/* if you build it to support postscript names in the TrueType */
/* "post" table. */
/* */
/* - the Type 1 driver will not be able to synthetize a */
/* Unicode charmap out of the glyphs found in the fonts. */
/* */
/* You would normally undefine this configuration macro when */
/* building a version of FreeType that doesn't contain a Type 1 */
/* or CFF driver. */
/* */
#define FT_CONFIG_OPTION_POSTSCRIPT_NAMES
/*************************************************************************/
/* */
/* Postscript Names to Unicode Values support */
/* */
/* By default, FreeType 2 is built with the "psnames" module compiled */
/* in. Among other things, the module is used to convert a glyph */
/* name into a unicode value. This is especially useful in order to */
/* synthetize on the fly a Unicode charmap from the CFF/Type 1 driver */
/* through a big table named the "Adobe Glyph List". */
/* */
/* Undefine this macro if you do not want the Adobe Glyph List */
/* compiled in your "psnames" module. The Type 1 driver will not */
/* be able to synthetize a Unicode charmap out of the glyphs found */
/* in the fonts.. */
/* */
#define FT_CONFIG_OPTION_ADOBE_GLYPH_LIST
/*************************************************************************/
/* */
/* GCC provides the non-ANSI `long long' 64-bit type. You can activate */
/* it by defining the FTCALC_USE_LONG_LONG macro here. Note however */
/* that we did not experience any improvement in speed with gcc, and */
/* that the final code seems bigger when linked. */
/* */
#undef FTCALC_USE_LONG_LONG
/*************************************************************************/
/* */
/* When compiling FreeType as a DLL, some systems/compilers need a */
/* special keyword in front of each function definition instead of */
/* `extern'. */
/* */
/* The macros EXPORT_DEF and EXPORT_FUNC are thus used to define */
/* exported library function interfaces and exported library functions */
/* implementations respectively. */
/* */
/* If not defined here, they automatically default to `extern' and void */
/* later in this header file. */
/* */
#undef EXPORT_DEF
#undef EXPORT_FUNC
/*************************************************************************/
/* */
/* Debug level */
/* */
/* FreeType can be compiled in debug or trace mode. In debug mode, */
/* errors are reported through the `ftdebug' component. In trace */
/* mode, additional messages are sent to the standard output during */
/* execution. */
/* */
/* Define FT_DEBUG_LEVEL_ERROR to build the library in debug mode. */
/* Define FT_DEBUG_LEVEL_TRACE to build it in trace mode. */
/* */
/* Don't define any of these macros to compile in `release' mode. */
/* */
#undef FT_DEBUG_LEVEL_ERROR
#undef FT_DEBUG_LEVEL_TRACE
/*************************************************************************/
/* */
/* Anti-aliasing support */
/* */
/* Undefine this macro only if you want to disable the anti-aliasing */
/* support in FreeType. This will save you about 5 Kb of code. It */
/* may be important for some embedded systems. */
/* */
#define FT_CONFIG_OPTION_ANTI_ALIAS
/*************************************************************************/
/* */
/* Endianess performance improvement */
/* */
/* FreeType is completely endian-independent, and can thus be compiled */
/* directly on _any_ machine. However, some components of the library */
/* provide improved routines for the cases where endianess is known. */
/* */
/* It usually results in speed-ups and reduced code size. Note that */
/* you should not define both of these macros. */
/* */
/* */
/* NOTE: For now, only the scan-line converter (base/ftraster.c) uses */
/* these macros to speed-up some anti-alias rendering routines. */
/* */
#undef FT_CONFIG_OPTION_LITTLE_ENDIAN
#undef FT_CONFIG_OPTION_BIG_ENDIAN
/*************************************************************************/
/* */
/* Define this configuration macro whenever you want to build a version */
/* of FreeType that does not include a default `system' component. */
/* */
/* Note that this will prevent the compilation of `ftinit', hence the */
/* function FT_Init_FreeType */
/* */
#undef FT_CONFIG_OPTION_NO_DEFAULT_SYSTEM
/*************************************************************************/
/* */
/* The size in bytes of the render pool used by the scan-line */
/* converter to do all of its work. */
/* */
/* This must be greater than 4 Kb */
/* */
#define FT_RENDER_POOL_SIZE 32768
/*************************************************************************/
/* */
/* FT_MAX_DRIVERS */
/* */
/* The maximum number of font drivers that can be registered in a */
/* single FreeType library object. 8 seems to be a good choice due */
/* to the relative low actual number of drivers ;-) */
/* */
#define FT_MAX_DRIVERS 8
/*************************************************************************/
/* */
/* FT_MAX_EXTENSIONS */
/* */
/* The maximum number of extensions that can be registered in a */
/* single font driver. 8 seems to be a good choice for now.. */
/* */
#define FT_MAX_EXTENSIONS 8
/*************************************************************************/
/* */
/* FT_MAX_GLYPH_FORMATS */
/* */
/* The maximum number of glyph image formats that might be registered */
/* in a given library instance. 8 seems to be a good choice due to */
/* the relatively low number of current formats ;-) */
/* */
#define FT_MAX_GLYPH_FORMATS 8
#endif /* FTOPTION_H */

View File

@ -1,940 +0,0 @@
/***************************************************************************/
/* */
/* ftsys.c */
/* */
/* OS/2-specific system operations (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. */
/* */
/***************************************************************************/
/*************************************************************************/
/* */
/* This implementation of the `ftsys' component uses malloc()/free() for */
/* memory management, and the OS/2 DosXXXXX() API functionss for file */
/* access. */
/* */
/* IMPORTANT NOTE: */
/* */
/* Porters, read carefully the comments in ftsys.h before trying to */
/* port this file to your system. It contains many essential */
/* remarks, and will ease your work greatly. */
/* */
/*************************************************************************/
#include "ftsys.h"
#include "ftstream.h"
#include "ftdebug.h"
#include <os2.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
/*************************************************************************/
/* The macro FT_COMPONENT is used in trace mode. It is an implicit */
/* parameter of the PTRACE() and PERROR() macros, used to print/log */
/* messages during execution. */
/* */
#undef FT_COMPONENT
#define FT_COMPONENT trace_io
#undef CUR_SYSTEM /* just in case */
/*************************************************************************/
/* */
/* To ease porting, we use the macro SYS_STREAM to name the */
/* system-specific stream type. For example, it is a `FILE*' with the */
/* ANSI libc, it will be a file descriptor, i.e. an integer, when using */
/* the Unix system API, etc. */
/* */
#define SYS_STREAM HFILE
/*************************************************************************/
/* */
/* I/O ACCESS AND MANAGEMENT */
/* */
/* We only define the `ANSI' resource class in this class. It is */
/* disk-based and provides a MRU cache in order to only keep the file */
/* descriptors of the 10 most recently used resource files. */
/* */
/* It simply contains two lists. One contains the `cached' resources */
/* with a valid FILE* pointer, the second contains all other `flushed' */
/* resource objects. */
/* */
/*************************************************************************/
/*************************************************************************/
/* */
/* <Struct> */
/* FT_Os2FileRec */
/* */
/* <Description> */
/* The FT_Os2File class derives from FT_ResourceRec. */
/* */
/* <Fields> */
/* root :: The root resource class fields. */
/* */
/* pathname :: This is a copy of the ANSI file pathname used to open */
/* streams for the resource. A different implementation */
/* is free to use Unicode chars, or file i-node numbers, */
/* etc. */
/* */
/* file_size :: The size in bytes of the resource. This field should */
/* be set to -1 until the resource is first opened. */
/* */
typedef struct FT_Os2FileRec_
{
FT_ResourceRec root;
char* pathname; /* the font file's pathname */
FT_Long file_size; /* file size in bytes */
} FT_Os2FileRec, *FT_Os2File;
/*************************************************************************/
/* */
/* We use the macro STREAM_Name() as a convenience to return a given */
/* ANSI resource's pathname. Its `stream' argument is a FT_Resource */
/* which is typecasted to the FT_Os2File class. */
/* */
#define STREAM_Name( stream ) ((FT_Os2File)stream->resource)->pathname
/*************************************************************************/
/* */
/* We use the macro STREAM_File() as a convenience to extract the */
/* system-specific stream handle from a given FreeType stream object. */
/* */
#define STREAM_File(stream) ((HFILE)stream->stream_id.pointer)
/*************************************************************************/
/* */
/* <Function> */
/* Os2File_Open */
/* */
/* <Description> */
/* This function is used to open a system-stream for a given */
/* resource. */
/* */
/* Note that it must update the target FreeType stream object with */
/* the system-stream handle and the resource's size. */
/* */
/* Also, the `stream->base' field must be set to NULL for disk-based */
/* resources, and to the address in memory of the resource's first */
/* byte for memory-based ones. */
/* */
/* <Input> */
/* resource :: The source resource. */
/* stream :: The target stream object. */
/* */
/* <Return> */
/* FreeType error code. 0 means success. */
/* */
/* <Note> */
/* The stream object IS NOT CREATED by this function, but by its */
/* caller. */
/* */
static
FT_Error Os2File_Open( FT_Os2File resource,
FT_Stream stream )
{
HFILE file;
ULONG ulAction;
/* open the file */
#ifdef __EMX__
if ( DosOpen( (FT_Byte*)resource->pathname,
&file,
&ulAction, 0, 0, OPEN_ACTION_OPEN_IF_EXISTS,
OPEN_SHARE_DENYNONE | OPEN_ACCESS_READONLY,
NULL ) )
#else
if ( DosOpen( resource->pathname,
&file,
&ulAction, 0, 0, OPEN_ACTION_OPEN_IF_EXISTS,
OPEN_SHARE_DENYNONE | OPEN_ACCESS_READONLY,
NULL ) )
#endif /* __EMX__ */
{
PERROR(( "Os2File_Open: Could not open file `%s'\n",
resource->pathname ));
return FT_Err_Cannot_Open_Stream;
}
/* compute file size if necessary */
if ( resource->file_size < 0 )
{
DosSetFilePtr( file, 0, FILE_END, (ULONG*)&resource->file_size );
DosSetFilePtr( file, 0, FILE_BEGIN, &ulAction );
}
stream->resource = (FT_Resource)resource;
stream->stream_id.pointer = (void*)file;
stream->size = resource->file_size;
/* it's a disk-based resource, we don't need to use the "base" and */
/* "cursor" fields of the stream objects */
stream->base = NULL;
stream->cursor = NULL;
PTRACE1(( "Os2File_Open: Opened `%s' (%d bytes) successfully\n",
resource->pathname, resource->file_size ));
return FT_Err_Ok;
}
/*************************************************************************/
/* */
/* <Function> */
/* Os2File_Close */
/* */
/* <Description> */
/* Closes a given stream. */
/* */
/* <Input> */
/* stream :: The target stream object. */
/* */
/* <Return> */
/* FreeType error code. 0 means success. */
/* */
static
FT_Error Os2File_Close( FT_Stream stream )
{
PTRACE1(( "OS2File_Close: Closing file `%s'\n", STREAM_Name( stream ) ));
DosClose( STREAM_File( stream ) );
stream->resource = NULL;
stream->stream_id.pointer = NULL;
stream->size = 0;
return FT_Err_Ok;
}
/*************************************************************************/
/* */
/* <Function> */
/* Os2File_Seek */
/* */
/* <Description> */
/* Seeks a stream to a given position. */
/* */
/* <Input> */
/* stream :: The target stream object. */
/* position :: The offset in bytes from the start of the */
/* resource/stream. */
/* */
/* <Return> */
/* FreeType error code. 0 means success. */
/* */
/* <Note> */
/* The `seek' method is never called by the stream manager in case */
/* of a memory-based resource (i.e., when `stream->base' isn't NULL). */
/* */
static
FT_Error Os2File_Seek( FT_Stream stream,
FT_Long position )
{
ULONG ibActual;
if ( DosSetFilePtr( STREAM_File( stream ), position,
FILE_BEGIN, &ibActual ) )
{
PERROR(( "Os2File_Seek: FAILED! Pos. %ld of `%s'\n",
position, STREAM_Name( stream ) ));
return FT_Err_Invalid_Stream_Seek;
}
PTRACE2(( "Os2File_Seek: Pos. %ld of `%s'\n",
position, STREAM_Name( stream ) ));
return FT_Err_Ok;
}
/*************************************************************************/
/* */
/* <Function> */
/* Os2File_Skip */
/* */
/* <Description> */
/* Skips a given number of bytes in an OS/2 stream. Useful to skip */
/* pad bytes, for example. */
/* */
/* <Input> */
/* stream :: The target stream object. */
/* count :: The number of bytes to skip in the stream. */
/* */
/* <Return> */
/* FreeType error code. 0 means success. */
/* */
/* <Note> */
/* The `skip' method is never called by the stream manager in case */
/* of a memory-based resource (i.e., when `stream->base' isn't NULL). */
/* */
static
FT_Error Os2File_Skip( FT_Stream stream,
FT_Long count )
{
ULONG ibActual;
DosSetFilePtr( STREAM_File( stream ), 0, FILE_CURRENT, &ibActual );
return Os2File_Seek( stream, ibActual + count );
}
/*************************************************************************/
/* */
/* <Function> */
/* Os2File_Pos */
/* */
/* <Description> */
/* Returns the current offset within an OS/2 stream's resource. */
/* */
/* <Input> */
/* stream :: The target stream object. */
/* */
/* <Output> */
/* position :: The current offset. -1 in case of error. */
/* */
/* <Return> */
/* FreeType error code. 0 means success. */
/* */
/* <Note> */
/* The `pos' method is never called by the stream manager in case */
/* of a memory-based resource (i.e., when `stream->base' isn't NULL). */
/* */
static
FT_Error Os2File_Pos( FT_Stream stream,
FT_Long* position )
{
ULONG ibActual;
if ( DosSetFilePtr( STREAM_File( stream ), 0, FILE_CURRENT, &ibActual ) )
{
PTRACE2(( "Os2File_Pos: FAILED! in `%s'\n", STREAM_Name( stream ) ));
return FT_Err_Invalid_Stream_Seek;
}
*position = ibActual;
PTRACE2(( "Os2File_Pos: For `%s'\n", STREAM_Name( stream ) ));
return FT_Err_Ok;
}
/*************************************************************************/
/* */
/* <Function> */
/* Os2File_Read */
/* */
/* <Description> */
/* Reads a given number of bytes from an OS/2 stream into memory. */
/* */
/* <Input> */
/* stream :: The target stream object. */
/* buffer :: The target read buffer where data is copied. */
/* size :: The number of bytes to read from the stream. */
/* */
/* <Output> */
/* read_bytes :: The number of bytes effectively read from the */
/* stream. Used in case of error */
/* (i.e. FT_Err_Invalid_Stream_Read) by some parts of */
/* the library. */
/* <Return> */
/* FreeType error code. 0 means success. */
/* */
/* <Note> */
/* It MUST return the error FT_Err_Invalid_Stream_Read in case of */
/* an over-read (i.e., reading more bytes from the stream that what */
/* is left), as the stream component checks for this specific value. */
/* */
/* The `read' method is never called by the stream manager in case */
/* of a memory-based resource (i.e., when `stream->base' isn't NULL). */
/* */
static
FT_Error Os2File_Read( FT_Stream stream,
char* buffer,
FT_Long size,
FT_Long* read_bytes )
{
ULONG cbActual;
DosRead( STREAM_File( stream ), buffer, size, &cbActual );
*read_bytes = cbActual;
if ( cbActual != (ULONG)size )
{
/* Note : we can have an over-read here when called by the */
/* function FT_Access_Compressed_Frame. This means */
/* that the following message should be a trace, */
/* rather than an error for disk-based resources.. */
/* */
/* the function must set the value of 'read_bytes' */
/* even if it returns an error code.. */
PTRACE2(( "Os2File_Read: FAILED! Read %ld bytes from '%s'\n",
size, STREAM_Name( stream ) ));
return FT_Err_Invalid_Stream_Read;
}
PTRACE2(( "Os2File_Read: Read %ld bytes to buffer 0x%08lx from `%s'\n",
size, (long)buffer, STREAM_Name( stream ) ));
return FT_Err_Ok;
}
/*************************************************************************/
/* */
/* The following table is the `virtual method table' for the `OS/2 */
/* resource class', which methods are defined above. Its address is set */
/* in the `interface' field of all resource objects created by the */
/* function FT_Create_Os2File() (see below). */
/* */
static
FTRes_InterfaceRec FT_Os2File_Interface =
{
(FTRes_Open_Func) Os2File_Open,
(FTRes_Close_Func) Os2File_Close,
(FTRes_Seek_Func) Os2File_Seek,
(FTRes_Skip_Func) Os2File_Skip,
(FTRes_Pos_Func) Os2File_Pos,
(FTRes_Read_Func) Os2File_Read,
};
/*************************************************************************/
/* */
/* <Function> */
/* FT_Create_Resource */
/* */
/* <Description> */
/* Creates a new resource object. This function is called by the */
/* FT_New_Resource() function of the base layer. */
/* */
/* <Input> */
/* library :: The input library object. */
/* pathname :: The file's pathname as an ASCII string. */
/* */
/* <Output> */
/* aresource :: A handle to new resource object. */
/* */
/* <Return> */
/* Error code. 0 means success. */
/* */
/* <Note> */
/* This functions does not open a stream. It simply copies the */
/* pathname within a fresh new resource object. */
/* */
EXPORT_FUNC
FT_Error FT_Create_Resource( FT_Library library,
const char* pathname,
FT_Resource* aresource )
{
FT_Int len;
FT_Os2File resource;
FT_Error error;
FT_System system;
if ( !library )
return FT_Err_Invalid_Library_Handle;
system = library->system;
if ( !pathname )
goto Fail_Null;
len = strlen( pathname );
if ( len == 0 )
goto Fail_Null;
resource = NULL;
if ( ALLOC( resource, sizeof ( *resource ) ) ||
ALLOC( resource->pathname, len + 1 ) )
goto Fail_Memory;
resource->root.library = library;
resource->root.interface = &FT_Os2File_Interface;
resource->root.flags = FT_RESOURCE_TYPE_DISK_BASED;
resource->file_size = -1;
strcpy( resource->pathname, pathname );
PTRACE1(( "Create_Os2File: OS/2 resource created for '%s'\n",
pathname ));
*aresource = (FT_Resource)resource;
return FT_Err_Ok;
Fail_Null:
PERROR(( "Create_Os2File: Null pathname!\n" ));
return FT_Err_Invalid_Argument;
Fail_Memory:
if ( resource )
FREE( resource->pathname );
FREE( resource );
PERROR(( "Create_Os2File: Not enough memory to create resource!\n" ));
return error;
}
/*************************************************************************/
/* */
/* <Function> */
/* FT_Destroy_Resource */
/* */
/* <Description> */
/* Discards a given resource object explicitly. */
/* */
/* <Input> */
/* resource :: The OS/2 resource object. */
/* */
/* <Note> */
/* This function does not check whether runs or streams are opened */
/* for the resource (for now, we assume developer intelligence. */
/* We'll most probably lower our standard later to ease debugging :-) */
/* */
EXPORT_FUNC
FT_Error FT_Destroy_Resource( FT_Resource resource )
{
FT_System system = resource->library->system;
FT_Os2File ansi = (FT_Os2File)resource;
if ( !ansi || ansi->root.interface != &FT_Os2File_Interface )
{
PERROR((
"Destroy_Os2File: Trying to destroy an invalid resource!\n" ));
return FT_Err_Invalid_Resource_Handle;
}
PTRACE1(( "Destroy_Os2File: Destroying resource for `%s'\n",
ansi->pathname ));
FREE( ansi->pathname );
FREE( ansi );
return FT_Err_Ok;
}
/*************************************************************************/
/* */
/* MEMORY MANAGEMENT */
/* */
/* */
/* This part copies the old FreeType 1.0 and 1.1 memory management */
/* scheme that was defined in the file `ttmemory.h'. One can see that */
/* */
/* - a set of macros is defined for the memory operations used by the */
/* engine (MEM_Copy(), MEM_Move(), MEM_Set()). This comes from the */
/* fact that many compilers are able to inline these operations */
/* directly within the compiled code, rather than generating a call */
/* to the C library. However, this obliges us to include the */
/* `<string.h>' header file. */
/* */
/* If you provide your own memory operations, you can get rid of the */
/* `#include <string.h>' below. */
/* */
/* */
/* - the FT_Alloc() function has several essential properties that MUST */
/* be retained by each port: */
/* */
/* - It returns an error code, NOT the allocated block's base */
/* address. */
/* */
/* - It takes the address of a target pointer, where the block's base */
/* address will be set. If the size is zero, its value will be */
/* NULL, and the function returns successfully. */
/* */
/* - In case of error, the pointer's value is set to NULL and an */
/* error code is returned. */
/* */
/* - The new allocated block MUST be zero-filled. This is a strong */
/* convention the rest of the engine relies on. */
/* */
/* */
/* - the FT_Free() function has also its essentials: */
/* */
/* - It takes the address of a pointer which value is the block's */
/* base address. This is UNLIKE a standard `free()' which takes */
/* the block's base directly. */
/* */
/* - It accepts successfully the address of a pointer which value is */
/* NULL, in which case it simply returns. */
/* */
/* - The pointer is always set to NULL by the function. */
/* */
/* */
/* - The MEM_Alloc(), ALLOC(), and ALLOC_ARRAY() macros are used by the */
/* library and should NOT be modified by porters! */
/* */
/*************************************************************************/
/*************************************************************************/
/* */
/* The macro FT_COMPONENT is used in trace mode. It is an implicit */
/* parameter of the PTRACE() and PERROR() macros, used to print/log */
/* messages during execution. */
/* */
#undef FT_COMPONENT
#define FT_COMPONENT trace_memory
/*************************************************************************/
/* */
/* <Function> */
/* FT_Alloc */
/* */
/* <Description> */
/* Allocates a new block of memory. The returned area is always */
/* zero-filled, this is a strong convention in many FreeType parts. */
/* */
/* <Input> */
/* system :: A handle to a given `system object' where allocation */
/* occurs. */
/* */
/* size :: The size in bytes of the block to allocate. */
/* */
/* <Output> */
/* P :: A pointer to the fresh new block. It should be set to */
/* NULL if `size' is 0, or in case of error. */
/* */
/* <Return> */
/* FreeType error code. 0 means success. */
/* */
BASE_FUNC
FT_Error FT_Alloc( FT_System system,
FT_Long size,
void** P )
{
if ( !P )
{
PERROR(( "FT_Alloc: Invalid pointer address!\n" ));
return FT_Err_Invalid_Argument;
}
if ( size > 0 )
{
*P = malloc( size );
if ( !*P )
{
PERROR(( "FT_Alloc: Out of memory (%ld bytes requested)!\n",
size ));
return FT_Err_Out_Of_Memory;
}
system->total_alloc += size;
/* ALWAYS ZERO-FILL THE BLOCK! */
MEM_Set( *P, 0, size );
}
else
*P = NULL;
PTRACE2(( "FT_Alloc: Size = %ld, pointer = 0x%08lx, block = 0x%08lx\n",
size, (long)P, (long)*P ));
return FT_Err_Ok;
}
/*************************************************************************/
/* */
/* <Function> */
/* FT_Realloc */
/* */
/* <Description> */
/* Reallocates a block of memory pointed to by `*P' to `Size' bytes */
/* from the heap, possibly changing `*P'. */
/* */
/* <Input> */
/* system :: A handle to a given `system object' where allocation */
/* occurs. */
/* */
/* size :: The size in bytes of the block to allocate. */
/* */
/* <InOut> */
/* P :: A pointer to the fresh new block. It should be set to */
/* NULL if `size' is 0, or in case of error. */
/* */
/* <Return> */
/* FreeType error code. 0 means success. */
/* */
BASE_FUNC
FT_Error FT_Realloc( FT_System system,
FT_Long size,
void** P )
{
void* Q;
if ( !P )
{
PERROR(( "FT_Realloc: Invalid pointer address!\n" ));
return FT_Err_Invalid_Argument;
}
/* if the original pointer is NULL, call FT_Alloc() */
if ( !*P )
return FT_Alloc( system, size, P );
/* if the new block if zero-sized, clear the current one */
if ( size <= 0 )
return FT_Free( system, P );
Q = (void*)realloc( *P, size );
if ( !Q )
{
PERROR(( "FT_Realloc: Reallocation failed!\n" ));
return FT_Err_Out_Of_Memory;
}
*P = Q;
return FT_Err_Ok;
}
/*************************************************************************/
/* */
/* <Function> */
/* FT_Free */
/* */
/* <Description> */
/* Releases a given block of memory allocated through FT_Alloc(). */
/* */
/* <Input> */
/* system :: A handle to a given `system object' where allocation */
/* occured. */
/* */
/* P :: This is the _address_ of a _pointer_ which points to the */
/* allocated block. It is always set to NULL on exit. */
/* */
/* <Return> */
/* FreeType error code. 0 means success. */
/* */
/* <Note> */
/* If P or *P are NULL, this function should return successfully. */
/* This is a strong convention within all of FreeType and its */
/* drivers. */
/* */
BASE_FUNC
FT_Error FT_Free( FT_System system,
void* *P )
{
UNUSED( system );
PTRACE2(( "FT_Free: Freeing pointer 0x%08lx (block 0x%08lx)\n",
(long)P, (P ? (long)*P : -1) ));
if ( !P || !*P )
return FT_Err_Ok;
free( *P );
*P = NULL;
return FT_Err_Ok;
}
/*************************************************************************/
/* */
/* SYNCHRONIZATION MANAGEMENT */
/* */
/* */
/* This section deals with mutexes. The library can be compiled to */
/* two distinct thread support levels (namely single threaded and */
/* re-entrant modes). */
/* */
/* It protects its variables through the MUTEX_Lock() and */
/* MUTEX_Release() macros which are void in single threaded mode. */
/* */
/* It defines a typeless mutex reference type, `FT_Mutex', that you're */
/* free to redefine for your system's needs. */
/* */
/* The default implementation of ftsys.c contains only dummy functions */
/* which always return successfully. You NEED to specialize them in */
/* order to port ftsys.c to any multi-threaded environment. */
/* */
/*************************************************************************/
/*************************************************************************/
/* */
/* The macro FT_COMPONENT is used in trace mode. It is an implicit */
/* parameter of the PTRACE() and PERROR() macros, used to print/log */
/* messages during execution. */
/* */
#undef FT_COMPONENT
#define FT_COMPONENT trace_sync
#ifdef FT_CONFIG_THREADS
BASE_FUNC
FT_Error FT_Mutex_Create( FT_System system,
TMutex* mutex )
{
UNUSED( system );
mutex = (void*)-1;
system->num_mutexes++;
/* Insert your own mutex creation code here */
return FT_Err_Ok;
}
BASE_FUNC
void FT_Mutex_Delete( FT_System system,
TMutex* mutex )
{
UNUSED( system );
mutex = (void*)0;
system->num_mutexes--;
/* Insert your own mutex destruction code here */
}
BASE_FUNC
void FT_Mutex_Lock( FT_System system,
TMutex* mutex )
{
/* NOTE: It is legal to call this function with a NULL argument */
/* in which case an immediate return is appropriate. */
UNUSED( system );
if ( !mutex )
return;
/* Insert your own mutex locking code here */
}
BASE_FUNC
void FT_Mutex_Release( FT_System system,
TMutex* mutex )
{
/* NOTE: It is legal to call this function with a NULL argument */
/* in which case an immediate return is appropriate */
UNUSED( system );
if ( !mutex )
return;
/* Insert your own mutex release code here */
}
#endif /* FT_CONFIG_THREADS */
/*************************************************************************/
/* */
/* <Function> */
/* FT_New_System */
/* */
/* <Description> */
/* This function is used to create and initialize new system objects. */
/* These are mainly used to let client applications and font servers */
/* specify their own memory allocators and synchronization */
/* procedures. */
/* */
/* <Output> */
/* system :: A handle to a given `system object'. */
/* */
/* <Return> */
/* FreeType error code. 0 means success. */
/* */
EXPORT_FUNC
FT_Error FT_New_System( FT_System* system )
{
*system = (FT_System)malloc( sizeof ( **system ) );
if ( !*system )
return FT_Err_Out_Of_Memory;
/* initialize memory management */
(*system)->system_flags = FT_SYSTEM_FLAG_TOTAL_ALLOC |
FT_SYSTEM_FLAG_MUTEXES;
(*system)->total_alloc = 0;
(*system)->num_mutexes = 0;
/* initialize i/o management (nothing) */
/* initialize synchronisation (nothing) */
/* initialize streams (nothing) */
return FT_Err_Ok;
}
/*************************************************************************/
/* */
/* <Function> */
/* FT_Done_System */
/* */
/* <Description> */
/* Destroys a given FreeType system object. */
/* */
/* <Input> */
/* system :: A handle to a given `system object'. */
/* */
/* <Return> */
/* FreeType error code. 0 means success. */
/* */
EXPORT_FUNC
FT_Error FT_Done_System( FT_System system )
{
/* finalize synchronization (nothing) */
/* finalize i/o management (nothing) */
/* finalize memory management */
free( system );
return FT_Err_Ok;
}
/* END */

View File

@ -1,214 +0,0 @@
/**************************************************************************
*
* ftsystem.h 1.0
*
* ANSI-specific FreeType low-level system interface
*
* This file contains the definition of interface used by FreeType
* to access low-level, i.e. memory management, i/o access as well
* as thread synchronisation.
*
*
* Copyright 1996-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 <ftsystem.h>
#include <fterrors.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/*********************************************************************/
/* */
/* MEMORY MANAGEMENT INTERFACE */
/* */
/************************************************************************
*
* <FuncType>
* FT_Alloc_Func
*
* <Description>
* The memory allocator function type
*
* <Input>
* system :: pointer to the system object
* size :: requested size in bytes
*
* <Output>
* block :: address of newly allocated block
*
* <Return>
* Error code. 0 means success.
*
* <Note>
* If your allocation routine ALWAYS zeroes the new block, you
* should set the flag FT_SYSTEM_FLAG_ALLOC_ZEROES in your system
* object 'flags' field.
*
* If you have set the flag FT_SYSTEM_FLAG_REPORT_CURRENT_ALLOC in
* your system's "system_flags" field, this function should update
* the "current_alloc" field of the system object.
*
************************************************************************/
static
void* ft_alloc( FT_Memory memory,
long size )
{
(void)memory;
return malloc(size);
}
/************************************************************************
*
* <FuncType>
* FT_Realloc_Func
*
* <Description>
* The memory reallocator function type
*
* <Input>
* system :: pointer to the system object
* new_size :: new requested size in bytes
*
* <InOut>
* block :: address of block in memory
*
* <Return>
* Error code. 0 means success.
*
* <Note>
* This function is _never_ called when the system flag
* FT_SYSTEM_FLAG_NO_REALLOC is set. Instead, the engine will emulate
* realloc through "alloc" and "free".
*
* Note that this is possible due to the fact that FreeType's
* "FT_Realloc" always requests the _current_ size of the reallocated
* block as a parameter, thus avoiding memory leaks.
*
* If you have set the flag FT_SYSTEM_FLAG_REPORT_CURRENT_ALLOC in
* your system's "system_flags" field, this function should update
* the "current_alloc" field of the system object.
*
************************************************************************/
static
void* ft_realloc( FT_Memory memory,
long cur_size,
long new_size,
void* block )
{
(void)memory;
(void)cur_size;
return realloc( block, new_size );
}
/************************************************************************
*
* <FuncType>
* FT_Free_Func
*
* <Description>
* The memory release function type
*
* <Input>
* system :: pointer to the system object
* block :: address of block in memory
*
* <Note>
* If you have set the flag FT_SYSTEM_FLAG_REPORT_CURRENT_ALLOC in
* your system's "system_flags" field, this function should update
* the "current_alloc" field of the system object.
*
************************************************************************/
static
void ft_free( FT_Memory memory,
void* block )
{
(void)memory;
free( block );
}
/*********************************************************************/
/* */
/* RESOURCE MANAGEMENT INTERFACE */
/* */
#define STREAM_FILE(stream) ((FILE*)stream->descriptor.pointer)
static
void ft_close_stream( FT_Stream stream )
{
fclose( STREAM_FILE(stream) );
}
static
unsigned long ft_io_stream( FT_Stream stream,
unsigned long offset,
char* buffer,
unsigned long count )
{
FILE* file;
file = STREAM_FILE(stream);
fseek( file, offset, SEEK_SET );
return (unsigned long)fread( buffer, 1, count, file );
}
extern
int FT_New_Stream( const char* filepathname,
FT_Stream stream )
{
FILE* file;
file = fopen( filepathname, "rb" );
if (!file)
return FT_Err_Cannot_Open_Resource;
fseek( file, 0, SEEK_END );
stream->size = ftell(file);
fseek( file, 0, SEEK_SET );
stream->descriptor.pointer = file;
stream->pos = 0;
stream->read = ft_io_stream;
stream->close = ft_close_stream;
return 0;
}
extern
FT_Memory FT_New_Memory( void )
{
FT_Memory memory;
memory = (FT_Memory)malloc( sizeof(*memory) );
if (memory)
{
memory->user = 0;
memory->alloc = ft_alloc;
memory->realloc = ft_realloc;
memory->free = ft_free;
}
return memory;
}

View File

@ -1,213 +0,0 @@
#*******************************************************************
#*
#* FreeType 2 Configuration rules for Unix + gcc
#*
#* 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 purpose of this sub-Makefile is to define various build and
#* platform specific variables before including the sub-Makefile
#* containing the FreeType library rules, found in
#*
#* $(TOP)/config/freetype.mk
#*
#* The following variables must be defined before including this
#* file :
#*
#* TOP Pathname to the top of the FreeType sources
#* hierarchy
#*
#* This file should define the following variables before including
#* the FreeType library rules file :
#*
#* BUILD Pathname to the platform-specific files used
#* for the build. Usually `$(TOP)/config/<system>'
#*
#* SEP Directory separator used during compilation.
#* (usually "/" or "\"). Note that on Win32, both gcc
#* and Visual C++ use "/" as a directory separator !!
#*
#* HOSTSEP Directory separator for $(COPY) and $(DELETE)
#*
#* DELETE The forced remove/delete command to erase one or more
#* files
#*
#* INCLUDE The location of all public header files. e.g.
#* `$(TOP)/include'include' *
#*
#* SRC The directory containing all sources. e.g.
#* '$(TOP)/src'
#*
#* OBJ_DIR The location where compiled object files will be
#* placed, e.g. '$(TOP)/obj'
#*
#* LIB_DIR The location where the resulting library file will be
#* placed, e.g. '$(TOP)/obj'
#*
#* LIBRARY The filename of the resulting library file, without
#* its extension.. e.g. 'libfreetype' or 'freetype'
#*
#* O The object file suffix. Can be '.o', '.obj,' '.lo,'
#* ';coff,' etc.
#*
#* A The library file suffix. Can be '.a' '.so,' '.lib'
#* '.dll,' etc.
#*
#* I The path inclusion flag. Some compilers use a
#* different flag than '-I' to specify an additional
#* include path. Examples are '/i=' or '-J ', etc.
#*
#* D The macro definition flag. I haven't met compilers
#* which don't use the '-D' switch to define a macro, but
#* who knows...
#*
#* T The compilation flag used to identify the target. Some
#* compilers use a different flag than '-o ' to specify
#* the name of the target object file.
#*
#* CFLAGS The set of flags used to compile object files.
#* (usually contains the flag '-c').
#*
#*
#*
#*******************************************************************
DELETE := del
SEP := /
HOSTSEP := $(strip \ )
BUILD := $(TOP)/config/os2
PLATFORM := os2
CC := gcc
# the directory where all object files are placed
#
# Note that this is not $(TOP)/obj !!
# This lets you build the library in your own directory
# with something like :
#
# set TOP=....../path/to/freetype2/top/dir...
# mkdir obj
# make -f %TOP%/Makefile setup [options]
# make -f %TOP%/Makefile
#
#
OBJ_DIR := obj
# the directory where all library files are placed
#
# by default, this is the same as OBJ_DIR, however, this can be
# changed to suit particular needs..
#
LIB_DIR := $(OBJ_DIR)
# the object file extension, this can be .o, .tco, .obj, etc..
# depending on the platform
#
O := o
# the library file extension, this can be .a, .lib, etc..
# depending on the platform
#
A := a
# The name of the final library file.
# Note that the DOS-specific Makefile uses a shorter (8.3) name
#
LIBRARY := libfreetype
# path inclusion flag.
#
# Some compilers use a different flag than '-I' to specify an
# additional include path. Examples are "/i=" or "-J", etc...
#
I := -I
# The link flag used to specify a given library file on link.
# Note that this is only used to compile the demo programs, not
# the library itself.
#
L := -L
# C flag used to define a macro before the compilation of a given
# source object. Usually is '-D' like in "-DDEBUG"
#
D := -D
# Target flag - beware, there is a space after the 'o' !!
#
#
T := -o
# C flags
#
# These should concern :
#
# - debug output
# - optimization
# - warnings
# - ansi compliance..
#
ifndef CFLAGS
CFLAGS := -c -g -O0 -Wall
endif
# ANSIFLAGS : put there the flags used to make your compiler ANSI-compliant
# nothing (if it already is by default like LCC).
#
ANSIFLAGS := -ansi -pedantic
ifdef BUILD_FREETYPE
include $(TOP)/config/freetype.mk
clean_freetype: clean_freetype_dos
distclean_freetype: distclean_freetype_dos
# Librarian to use to build the static library
#
FT_LIBRARIAN := $(AR) -r
# This final rule is used to link all object files into a single
# library. It is part of the system-specific sub-Makefile because not
# all librarians accept a simple syntax like :
#
# librarian library_file {list of object files}
#
$(FT_LIBRARY): $(OBJECTS_LIST)
-$(DELETE) $@
$(FT_LIBRARIAN) $@ $(OBJECTS_LIST)
# Cleaning rules
#
DIR_OBJ := $(subst $(SEP),\,$(OBJ_DIR))
clean_freetype_objects:
-del $(DIR8OBJ)\*.$O
clean_freetype_lib:
-del $(FT_LIBRARY)
clean: clean_freetype_objects
endif

View File

@ -1,196 +0,0 @@
#*******************************************************************
#*
#* FreeType 2 Configuration rules for Unix + gcc
#*
#* 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 purpose of this sub-Makefile is to define various build and
#* platform specific variables before including the sub-Makefile
#* containing the FreeType library rules, found in
#*
#* $(TOP)/config/freetype.mk
#*
#* The following variables must be defined before including this
#* file :
#*
#* TOP Pathname to the top of the FreeType sources
#* hierarchy
#*
#* This file should define the following variables before including
#* the FreeType library rules file :
#*
#* BUILD Pathname to the platform-specific files used
#* for the build. Usually `$(TOP)/config/<system>'
#*
#* SEP Directory separator used during compilation.
#* (usually "/" or "\"). Note that on Win32, both gcc
#* and Visual C++ use "/" as a directory separator !!
#*
#* HOSTSEP Directory separator for $(COPY) and $(DELETE)
#*
#* DELETE The forced remove/delete command to erase one or more
#* files
#*
#* INCLUDE The location of all public header files. e.g.
#* `$(TOP)/include'include' *
#*
#* SRC The directory containing all sources. e.g.
#* '$(TOP)/src'
#*
#* OBJ_DIR The location where compiled object files will be
#* placed, e.g. '$(TOP)/obj'
#*
#* LIB_DIR The location where the resulting library file will be
#* placed, e.g. '$(TOP)/obj'
#*
#* LIBRARY The filename of the resulting library file, without
#* its extension.. e.g. 'libfreetype' or 'freetype'
#*
#* O The object file suffix. Can be '.o', '.obj,' '.lo,'
#* ';coff,' etc.
#*
#* A The library file suffix. Can be '.a' '.so,' '.lib'
#* '.dll,' etc.
#*
#* I The path inclusion flag. Some compilers use a
#* different flag than '-I' to specify an additional
#* include path. Examples are '/i=' or '-J ', etc.
#*
#* D The macro definition flag. I haven't met compilers
#* which don't use the '-D' switch to define a macro, but
#* who knows...
#*
#* T The compilation flag used to identify the target. Some
#* compilers use a different flag than '-o ' to specify
#* the name of the target object file.
#*
#* CFLAGS The set of flags used to compile object files.
#* (usually contains the flag '-c').
#*
#*
#*
#*******************************************************************
DELETE := del
SEP := /
HOSTSEP := $(strip \ )
BUILD := $(TOP)/config/os2
PLATFORM := os2
CC := gcc
# the directory where all object files are placed
#
# Note that this is not $(TOP)/obj !!
# This lets you build the library in your own directory
# with something like :
#
# set TOP=....../path/to/freetype2/top/dir...
# mkdir obj
# make -f %TOP%/Makefile setup [options]
# make -f %TOP%/Makefile
#
#
OBJ_DIR := obj
# the directory where all library files are placed
#
# by default, this is the same as OBJ_DIR, however, this can be
# changed to suit particular needs..
#
LIB_DIR := $(OBJ_DIR)
# the object file extension, this can be .o, .tco, .obj, etc..
# depending on the platform
#
O := o
# the library file extension, this can be .a, .lib, etc..
# depending on the platform
#
A := a
# The name of the final library file.
# Note that the DOS-specific Makefile uses a shorter (8.3) name
#
LIBRARY := libfreetype
# path inclusion flag.
#
# Some compilers use a different flag than '-I' to specify an
# additional include path. Examples are "/i=" or "-J", etc...
#
I := -I
# The link flag used to specify a given library file on link.
# Note that this is only used to compile the demo programs, not
# the library itself.
#
L := -L
# C flag used to define a macro before the compilation of a given
# source object. Usually is '-D' like in "-DDEBUG"
#
D := -D
# Target flag - beware, there is a space after the 'o' !!
#
#
T := -o
# C flags
#
# These should concern :
#
# - debug output
# - optimization
# - warnings
# - ansi compliance..
#
ifndef CFLAGS
CFLAGS := -c -g -O0 -Wall
endif
# ANSIFLAGS : put there the flags used to make your compiler ANSI-compliant
# nothing (if it already is by default like LCC).
#
ANSIFLAGS := -ansi -pedantic
ifdef BUILD_FREETYPE
include $(TOP)/config/freetype.mk
clean_freetype: clean_freetype_dos
distclean_freetype: distclean_freetype_dos
# Librarian to use to build the static library
#
FT_LIBRARIAN := $(AR) -r
# This final rule is used to link all object files into a single
# library. It is part of the system-specific sub-Makefile because not
# all librarians accept a simple syntax like :
#
# librarian library_file {list of object files}
#
$(FT_LIBRARY): $(OBJECTS_LIST)
-$(DELETE) $@
$(FT_LIBRARIAN) $@ $(OBJECTS_LIST)
endif

156
config/os2/os2-dev.mk Normal file
View File

@ -0,0 +1,156 @@
#*******************************************************************
#*
#* FreeType 2 Configuration rules for OS/2 + gcc
#* THIS VERSION TURNS OFF OPTIMIZATIONS FOR DEBUGGING !!
#*
#* Copyright 1996-2000 by
#* David Turner, Robert Wilhelm, and Werner Lemberg.
#*
#* This file is part of the FreeType project, and may only be used
#* modified and distributed under the terms of the FreeType project
#* license, LICENSE.TXT. By continuing to use, modify, or distribute
#* this file you indicate that you have read the license and
#* understand and accept it fully.
#*
#* Please read the file "freetype/docs/config.txt" to understand
#* what this file does..
#*
#*******************************************************************
ifndef TOP
TOP := .
endif
DELETE := del
SEP := /
HOSTSEP := $(strip \ )
BUILD := $(TOP)/config/os2
PLATFORM := os2
CC := gcc
# the directory where all object files are placed
#
# Note that this is not $(TOP)/obj !!
# This lets you build the library in your own directory
# with something like :
#
# set TOP=....../path/to/freetype2/top/dir...
# mkdir obj
# make -f %TOP%/Makefile setup [options]
# make -f %TOP%/Makefile
#
#
OBJ_DIR := obj
# the directory where all library files are placed
#
# by default, this is the same as OBJ_DIR, however, this can be
# changed to suit particular needs..
#
LIB_DIR := $(OBJ_DIR)
# the object file extension, this can be .o, .tco, .obj, etc..
# depending on the platform
#
O := o
# the library file extension, this can be .a, .lib, etc..
# depending on the platform
#
A := a
# The name of the final library file.
# Note that the DOS-specific Makefile uses a shorter (8.3) name
#
LIBRARY := libfreetype
# path inclusion flag.
#
# Some compilers use a different flag than '-I' to specify an
# additional include path. Examples are "/i=" or "-J", etc...
#
I := -I
# The link flag used to specify a given library file on link.
# Note that this is only used to compile the demo programs, not
# the library itself.
#
L := -l
# C flag used to define a macro before the compilation of a given
# source object. Usually is '-D' like in "-DDEBUG"
#
D := -D
# Target flag - beware, there is a space after the 'o' !!
#
#
T := -o
# C flags
#
# These should concern :
#
# - debug output
# - optimization
# - warnings
# - ansi compliance..
#
ifndef CFLAGS
CFLAGS := -c -g -O0 -Wall
endif
# ANSIFLAGS : put there the flags used to make your compiler ANSI-compliant
# nothing (if it already is by default like LCC).
#
ANSIFLAGS := -ansi -pedantic
ifdef BUILD_FREETYPE
include $(TOP)/config/freetype.mk
clean_freetype: clean_freetype_dos
distclean_freetype: distclean_freetype_dos
# Librarian to use to build the static library
#
FT_LIBRARIAN := $(AR) -r
# This final rule is used to link all object files into a single
# library. It is part of the system-specific sub-Makefile because not
# all librarians accept a simple syntax like :
#
# librarian library_file {list of object files}
#
$(FT_LIBRARY): $(OBJECTS_LIST)
-$(DELETE) $@
$(FT_LIBRARIAN) $@ $(OBJECTS_LIST)
# Cleaning rules
#
DIR_OBJ := $(subst $(SEP),\,$(OBJ_DIR))
clean_freetype_objects:
-del $(DIR_OBJ)\*.$O
clean_freetype_lib:
-del $(subst $(SEP),\,$(FT_LIBRARY))
clean: clean_freetype_objects
endif

155
config/os2/os2-gcc.mk Normal file
View File

@ -0,0 +1,155 @@
#*******************************************************************
#*
#* FreeType 2 Configuration rules for OS/2 + gcc
#*
#* Copyright 1996-2000 by
#* David Turner, Robert Wilhelm, and Werner Lemberg.
#*
#* This file is part of the FreeType project, and may only be used
#* modified and distributed under the terms of the FreeType project
#* license, LICENSE.TXT. By continuing to use, modify, or distribute
#* this file you indicate that you have read the license and
#* understand and accept it fully.
#*
#* Please read the file "freetype/docs/config.txt" to understand
#* what this file does..
#*
#*******************************************************************
ifndef TOP
TOP := .
endif
DELETE := del
SEP := /
HOSTSEP := $(strip \ )
BUILD := $(TOP)/config/os2
PLATFORM := os2
CC := gcc
# the directory where all object files are placed
#
# Note that this is not $(TOP)/obj !!
# This lets you build the library in your own directory
# with something like :
#
# set TOP=....../path/to/freetype2/top/dir...
# mkdir obj
# make -f %TOP%/Makefile setup [options]
# make -f %TOP%/Makefile
#
#
OBJ_DIR := obj
# the directory where all library files are placed
#
# by default, this is the same as OBJ_DIR, however, this can be
# changed to suit particular needs..
#
LIB_DIR := $(OBJ_DIR)
# the object file extension, this can be .o, .tco, .obj, etc..
# depending on the platform
#
O := o
# the library file extension, this can be .a, .lib, etc..
# depending on the platform
#
A := a
# The name of the final library file.
# Note that the DOS-specific Makefile uses a shorter (8.3) name
#
LIBRARY := libfreetype
# path inclusion flag.
#
# Some compilers use a different flag than '-I' to specify an
# additional include path. Examples are "/i=" or "-J", etc...
#
I := -I
# The link flag used to specify a given library file on link.
# Note that this is only used to compile the demo programs, not
# the library itself.
#
L := -l
# C flag used to define a macro before the compilation of a given
# source object. Usually is '-D' like in "-DDEBUG"
#
D := -D
# Target flag - beware, there is a space after the 'o' !!
#
#
T := -o
# C flags
#
# These should concern :
#
# - debug output
# - optimization
# - warnings
# - ansi compliance..
#
ifndef CFLAGS
CFLAGS := -c -g -O6 -Wall
endif
# ANSIFLAGS : put there the flags used to make your compiler ANSI-compliant
# nothing (if it already is by default like LCC).
#
ANSIFLAGS := -ansi -pedantic
ifdef BUILD_FREETYPE
include $(TOP)/config/freetype.mk
clean_freetype: clean_freetype_dos
distclean_freetype: distclean_freetype_dos
# Librarian to use to build the static library
#
FT_LIBRARIAN := $(AR) -r
# This final rule is used to link all object files into a single
# library. It is part of the system-specific sub-Makefile because not
# all librarians accept a simple syntax like :
#
# librarian library_file {list of object files}
#
$(FT_LIBRARY): $(OBJECTS_LIST)
-$(DELETE) $@
$(FT_LIBRARIAN) $@ $(OBJECTS_LIST)
# Cleaning rules
#
DIR_OBJ := $(subst $(SEP),\,$(OBJ_DIR))
clean_freetype_objects:
-del $(DIR_OBJ)\*.$O
clean_freetype_lib:
-del $(subst $(SEP),\,$(FT_LIBRARY))
clean: clean_freetype_objects
endif

View File

@ -1,193 +0,0 @@
#*******************************************************************
#*
#* FreeType 2 Configuration rules for Unix + gcc
#*
#* 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 purpose of this sub-Makefile is to define various build and
#* platform specific variables before including the sub-Makefile
#* containing the FreeType library rules, found in
#*
#* $(TOP)/config/freetype.mk
#*
#* The following variables must be defined before including this
#* file :
#*
#* TOP Pathname to the top of the FreeType sources
#* hierarchy
#*
#* This file should define the following variables before including
#* the FreeType library rules file :
#*
#* BUILD Pathname to the platform-specific files used
#* for the build. Usually `$(TOP)/config/<system>'
#*
#* SEP Directory separator used during compilation.
#* (usually "/" or "\"). Note that on Win32, both gcc
#* and Visual C++ use "/" as a directory separator !!
#*
#* HOSTSEP Directory separator for $(COPY) and $(DELETE)
#*
#* DELETE The forced remove/delete command to erase one or more
#* files
#*
#* INCLUDE The location of all public header files. e.g.
#* `$(TOP)/include'include' *
#*
#* SRC The directory containing all sources. e.g.
#* '$(TOP)/src'
#*
#* OBJ_DIR The location where compiled object files will be
#* placed, e.g. '$(TOP)/obj'
#*
#* LIB_DIR The location where the resulting library file will be
#* placed, e.g. '$(TOP)/obj'
#*
#* LIBRARY The filename of the resulting library file, without
#* its extension.. e.g. 'libfreetype' or 'freetype'
#*
#* O The object file suffix. Can be '.o', '.obj,' '.lo,'
#* ';coff,' etc.
#*
#* A The library file suffix. Can be '.a' '.so,' '.lib'
#* '.dll,' etc.
#*
#* I The path inclusion flag. Some compilers use a
#* different flag than '-I' to specify an additional
#* include path. Examples are '/i=' or '-J ', etc.
#*
#* D The macro definition flag. I haven't met compilers
#* which don't use the '-D' switch to define a macro, but
#* who knows...
#*
#* T The compilation flag used to identify the target. Some
#* compilers use a different flag than '-o ' to specify
#* the name of the target object file.
#*
#* CFLAGS The set of flags used to compile object files.
#* (usually contains the flag '-c').
#*
#*
#*
#*******************************************************************
ifndef TOP
TOP := .
endif
DELETE := rm -f
SEP := /
HOSTSEP := $(SEP)
BUILD := $(TOP)/config/unix
PLATFORM := unix
# the directory where all object files are placed
#
# Note that this is not $(TOP)/obj !!
# This lets you build the library in your own directory
# with something like :
#
# set TOP=....../path/to/freetype2/top/dir...
# mkdir obj
# make -f %TOP%/Makefile setup [options]
# make -f %TOP%/Makefile
#
#
OBJ_DIR := obj
# the directory where all library files are placed
#
# by default, this is the same as OBJ_DIR, however, this can be
# changed to suit particular needs..
#
LIB_DIR := $(OBJ_DIR)
# the object file extension, this can be .o, .tco, .obj, etc..
# depending on the platform
#
O := o
# the library file extension, this can be .a, .lib, etc..
# depending on the platform
#
A := a
# The name of the final library file.
# Note that the DOS-specific Makefile uses a shorter (8.3) name
#
LIBRARY := libfreetype
# path inclusion flag.
#
# Some compilers use a different flag than '-I' to specify an
# additional include path. Examples are "/i=" or "-J", etc...
#
I := -I
# The link flag used to specify a given library file on link.
# Note that this is only used to compile the demo programs, not
# the library itself.
#
L := -l
# C flag used to define a macro before the compilation of a given
# source object. Usually is '-D' like in "-DDEBUG"
#
D := -D
# Target flag - beware, there is a space after the 'o' !!
#
#
T := -o
# C flags
#
# These should concern :
#
# - debug output
# - optimization
# - warnings
# - ansi compliance..
#
ifndef CFLAGS
CFLAGS := -c -g -O6 -Wall
endif
# ANSIFLAGS : put there the flags used to make your compiler ANSI-compliant
# nothing (if it already is by default like LCC).
#
ANSIFLAGS := -ansi -pedantic
ifdef BUILD_FREETYPE
include $(TOP)/config/freetype.mk
clean_freetype: clean_freetype_std
distclean_freetype: distclean_freetype_std
# This final rule is used to link all object files into a single
# library. It is part of the system-specific sub-Makefile because not
# all librarians accept a simple syntax like :
#
# librarian library_file {list of object files}
#
$(FT_LIBRARY): $(OBJECTS_LIST)
-$(DELETE) $@
$(AR) -r $@ $(OBJECTS_LIST)
endif

View File

@ -1,193 +0,0 @@
#*******************************************************************
#*
#* FreeType 2 Configuration rules for Unix + gcc
#*
#* 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 purpose of this sub-Makefile is to define various build and
#* platform specific variables before including the sub-Makefile
#* containing the FreeType library rules, found in
#*
#* $(TOP)/config/freetype.mk
#*
#* The following variables must be defined before including this
#* file :
#*
#* TOP Pathname to the top of the FreeType sources
#* hierarchy
#*
#* This file should define the following variables before including
#* the FreeType library rules file :
#*
#* BUILD Pathname to the platform-specific files used
#* for the build. Usually `$(TOP)/config/<system>'
#*
#* SEP Directory separator used during compilation.
#* (usually "/" or "\"). Note that on Win32, both gcc
#* and Visual C++ use "/" as a directory separator !!
#*
#* HOSTSEP Directory separator for $(COPY) and $(DELETE)
#*
#* DELETE The forced remove/delete command to erase one or more
#* files
#*
#* INCLUDE The location of all public header files. e.g.
#* `$(TOP)/include'include' *
#*
#* SRC The directory containing all sources. e.g.
#* '$(TOP)/src'
#*
#* OBJ_DIR The location where compiled object files will be
#* placed, e.g. '$(TOP)/obj'
#*
#* LIB_DIR The location where the resulting library file will be
#* placed, e.g. '$(TOP)/obj'
#*
#* LIBRARY The filename of the resulting library file, without
#* its extension.. e.g. 'libfreetype' or 'freetype'
#*
#* O The object file suffix. Can be '.o', '.obj,' '.lo,'
#* ';coff,' etc.
#*
#* A The library file suffix. Can be '.a' '.so,' '.lib'
#* '.dll,' etc.
#*
#* I The path inclusion flag. Some compilers use a
#* different flag than '-I' to specify an additional
#* include path. Examples are '/i=' or '-J ', etc.
#*
#* D The macro definition flag. I haven't met compilers
#* which don't use the '-D' switch to define a macro, but
#* who knows...
#*
#* T The compilation flag used to identify the target. Some
#* compilers use a different flag than '-o ' to specify
#* the name of the target object file.
#*
#* CFLAGS The set of flags used to compile object files.
#* (usually contains the flag '-c').
#*
#*
#*
#*******************************************************************
ifndef TOP
TOP := .
endif
DELETE := rm -f
SEP := /
HOSTSEP := $(SEP)
BUILD := $(TOP)/config/unix
PLATFORM := unix
# the directory where all object files are placed
#
# Note that this is not $(TOP)/obj !!
# This lets you build the library in your own directory
# with something like :
#
# set TOP=....../path/to/freetype2/top/dir...
# mkdir obj
# make -f %TOP%/Makefile setup [options]
# make -f %TOP%/Makefile
#
#
OBJ_DIR := obj
# the directory where all library files are placed
#
# by default, this is the same as OBJ_DIR, however, this can be
# changed to suit particular needs..
#
LIB_DIR := $(OBJ_DIR)
# the object file extension, this can be .o, .tco, .obj, etc..
# depending on the platform
#
O := o
# the library file extension, this can be .a, .lib, etc..
# depending on the platform
#
A := a
# The name of the final library file.
# Note that the DOS-specific Makefile uses a shorter (8.3) name
#
LIBRARY := libfreetype
# path inclusion flag.
#
# Some compilers use a different flag than '-I' to specify an
# additional include path. Examples are "/i=" or "-J", etc...
#
I := -I
# The link flag used to specify a given library file on link.
# Note that this is only used to compile the demo programs, not
# the library itself.
#
L := -l
# C flag used to define a macro before the compilation of a given
# source object. Usually is '-D' like in "-DDEBUG"
#
D := -D
# Target flag - beware, there is a space after the 'o' !!
#
#
T := -o
# C flags
#
# These should concern :
#
# - debug output
# - optimization
# - warnings
# - ansi compliance..
#
ifndef CFLAGS
CFLAGS := -c -g -O0 -Wall
endif
# ANSIFLAGS : put there the flags used to make your compiler ANSI-compliant
# nothing (if it already is by default like LCC).
#
ANSIFLAGS := -ansi -pedantic
ifdef BUILD_FREETYPE
include $(TOP)/config/freetype.mk
clean_freetype: clean_freetype_std
distclean_freetype: distclean_freetype_std
# This final rule is used to link all object files into a single
# library. It is part of the system-specific sub-Makefile because not
# all librarians accept a simple syntax like :
#
# librarian library_file {list of object files}
#
$(FT_LIBRARY): $(OBJECTS_LIST)
-$(DELETE) $@
$(AR) -r $@ $(OBJECTS_LIST)
endif

View File

@ -20,10 +20,29 @@ DELETE := rm -f
# if `devel' is the requested target, use the development Makefile
#
ifneq ($(findstring devel,$(MAKECMDGOALS)),)
CONFIG_RULES := $(BUILD)$(SEP)Makefile.devel
devel: ;
CONFIG_RULES := $(BUILD)$(SEP)unix-dev.mk
devel: setup;
endif
# test wether we're using gcc ? If it is, we selected the
# 'unix-gcc.mk' configuration file. Otherwise, the standard
# 'unix.mk' which simply calls "cc -c" with no extra arguments
#
# Feel free to add support for other platform specific compilers
# in this directory (e.g. solaris.mk + changes here to detect the
# platform)
#
ifeq ($(CC),gcc)
is_gcc := 1
else
CONFIG_RULES := $(BUILD)$(SEP)Makefile
ifneq ($(findstring gcc,$(shell $(CC) --version)),)
is_gcc := 1
endif
ifdef is_gcc
CONFIG_RULES := $(BUILD)$(SEP)unix-gcc.mk
else
CONFIG_RULES := $(BUILD)$(SEP)unix.mk
endif
setup: std_setup

View File

@ -1,172 +0,0 @@
/*******************************************************************
*
* ftconfig.h
*
* Unix-specific configuration file
*
* 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 header file contains a number of macro definitions that are
* used by the rest of the engine. Porters are free to copy this file
* and adapt it to suit their own system..
*
* IMPORTANT NOTE :
*
* Porters, read carefully the comments in ftsys.h before trying
* to port this file to your system. It contains many essential
* remarks, and will ease your work greatly..
*
******************************************************************/
#ifndef FTCONFIG_H
#define FTCONFIG_H
/*************************************************************************/
/* */
/* PLATFORM-SPECIFIC CONFIGURATION MACROS */
/* */
/* These macros can be toggled to suit a specific system. The current */
/* ones are defaults used to compile FreeType in a 32-bits ANSI C */
/* environment. Copy this file to your own "freetype/arch/<system>" */
/* directory, and edit it to port the engine.. */
/* */
/*************************************************************************/
/* Define to empty if the keyword does not work. */
/* #undef const */
/* Define if you have a working `mmap' system call. */
#define HAVE_MMAP
/* Define if you have the ANSI C header files. */
#define STDC_HEADERS 1
/* Define if your processor stores words with the most significant
byte first (like Motorola and SPARC, unlike Intel and VAX). */
/* #undef WORDS_BIGENDIAN */
/* 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 <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 */
/* Preferred alignment of data */
#define FT_ALIGNMENT 8
/* See the definition of the macro FT_CONFIG_OPTION_LITTLE_ENDIAN */
/* and FT_CONFIG_OPTION_BIG_ENDIAN below, they may need to be set */
/* according to the platform too.. */
#include <ftoption.h>
/*************************************************************************/
/* */
/* AUTOMATIC CONFIGURATION MACROS */
/* */
/* These macros are computed from the ones defined above. Don't touch */
/* their definition, unless you know precisely what you're doing. No */
/* porter should need to mess with them. */
/* */
/*************************************************************************/
/* IntN types: */
/* */
/* Used to guarantee the size of some specific integers. */
/* */
typedef signed short FT_Int16;
typedef unsigned short FT_Word16;
#if SIZEOF_INT == 4
typedef signed int FT_Int32;
typedef unsigned int FT_Word32;
#elif SIZEOF_LONG == 4
typedef signed long FT_Int32;
typedef unsigned long FT_Word32;
#else
#error "no 32bit type found - please check your configuration files"
#endif
#if SIZEOF_LONG == 8
/* LONG64 must be defined when a 64-bit type is available */
#define LONG64
#define INT64 long
#else
/* GCC provides the non-ANSI 'long long' 64-bit type. You can activate it */
/* by defining the FTCALC_USE_LONG_LONG macro in 'ftconfig.h'. Note that */
/* this will produce many -ansi warnings during library compilation. */
#ifdef FTCALC_USE_LONG_LONG
#define LONG64
#define INT64 long long
#endif /* FTCALC_USE_LONG_LONG */
#endif
#ifdef FT_MAKE_OPTION_SINGLE_OBJECT
#define LOCAL_DEF static
#define LOCAL_FUNC static
#else
#define LOCAL_DEF extern
#define LOCAL_FUNC /* nothing */
#endif
#ifdef FT_MAKE_OPTION_SINGLE_LIBRARY_OBJECT
#define BASE_DEF LOCAL_DEF
#define BASE_FUNC LOCAL_FUNC
#else
#define BASE_DEF extern
#define BASE_FUNC /* nothing */
#endif
#ifndef EXPORT_DEF
#define EXPORT_DEF extern
#endif
#ifndef EXPORT_FUNC
#define EXPORT_FUNC /* nothing */
#endif
#endif /* FTCONFIG_H */

View File

@ -1,4 +0,0 @@
FT_DRIVER(sfnt_driver_interface)
FT_DRIVER(tt_driver_interface)
FT_DRIVER(t1_driver_interface)
FT_DRIVER(psnames_driver_interface)

View File

@ -1,204 +0,0 @@
#ifndef FTOPTION_H
#define FTOPTION_H
/*************************************************************************/
/* */
/* USER-SELECTABLE CONFIGURATION MACROS */
/* */
/* These macros can be toggled by developers to enable or disable */
/* certain aspects of FreeType. This file contains macros that apply to */
/* all of FreeType. Driver-specific configurations are placed in each */
/* driver directory (e.g. `freetype/drivers/ttlib/ttconfig.h'). */
/* */
/*************************************************************************/
/*************************************************************************/
/* */
/* Alternate Glyph Image Format support */
/* */
/* By default, the glyph images returned by the FreeType glyph loader */
/* can either be a pixmap or a vectorial outline defined through */
/* bezier control points. When defining the following configuration */
/* macro, some font drivers will be able to register alternate */
/* glyph image formats. */
/* */
/* Unset this macro if you're sure that you'll never use a font driver */
/* with an alternate glyph format, this will reduce the size of the */
/* base layer code. */
/* */
#define FT_CONFIG_OPTION_ALTERNATE_GLYPH_FORMATS
/*************************************************************************/
/* */
/* Glyph Postscript Names handling */
/* */
/* By default, FreeType 2 is built with the "psnames" module compiled */
/* in. This module is in charge of converting a glyph name string into */
/* a Unicode value, or return a Macintosh standard glyph name for the */
/* use with the TrueType "post" table. */
/* */
/* Undefine this macro if you do not want the "psnames" compiled in */
/* your build of FreeType. This has the following effects : */
/* */
/* - the TrueType driver will provide its own set of glyph names, */
/* if you build it to support postscript names in the TrueType */
/* "post" table. */
/* */
/* - the Type 1 driver will not be able to synthetize a */
/* Unicode charmap out of the glyphs found in the fonts. */
/* */
/* You would normally undefine this configuration macro when */
/* building a version of FreeType that doesn't contain a Type 1 */
/* or CFF driver. */
/* */
#define FT_CONFIG_OPTION_POSTSCRIPT_NAMES
/*************************************************************************/
/* */
/* Postscript Names to Unicode Values support */
/* */
/* By default, FreeType 2 is built with the "psnames" module compiled */
/* in. Among other things, the module is used to convert a glyph */
/* name into a unicode value. This is especially useful in order to */
/* synthetize on the fly a Unicode charmap from the CFF/Type 1 driver */
/* through a big table named the "Adobe Glyph List". */
/* */
/* Undefine this macro if you do not want the Adobe Glyph List */
/* compiled in your "psnames" module. The Type 1 driver will not */
/* be able to synthetize a Unicode charmap out of the glyphs found */
/* in the fonts.. */
/* */
#define FT_CONFIG_OPTION_ADOBE_GLYPH_LIST
/*************************************************************************/
/* */
/* GCC provides the non-ANSI `long long' 64-bit type. You can activate */
/* it by defining the FTCALC_USE_LONG_LONG macro here. Note however */
/* that we did not experience any improvement in speed with gcc, and */
/* that the final code seems bigger when linked. */
/* */
#undef FTCALC_USE_LONG_LONG
/*************************************************************************/
/* */
/* When compiling FreeType as a DLL, some systems/compilers need a */
/* special keyword in front of each function definition instead of */
/* `extern'. */
/* */
/* The macros EXPORT_DEF and EXPORT_FUNC are thus used to define */
/* exported library function interfaces and exported library functions */
/* implementations respectively. */
/* */
/* If not defined here, they automatically default to `extern' and void */
/* later in this header file. */
/* */
#undef EXPORT_DEF
#undef EXPORT_FUNC
/*************************************************************************/
/* */
/* Debug level */
/* */
/* FreeType can be compiled in debug or trace mode. In debug mode, */
/* errors are reported through the `ftdebug' component. In trace */
/* mode, additional messages are sent to the standard output during */
/* execution. */
/* */
/* Define FT_DEBUG_LEVEL_ERROR to build the library in debug mode. */
/* Define FT_DEBUG_LEVEL_TRACE to build it in trace mode. */
/* */
/* Don't define any of these macros to compile in `release' mode. */
/* */
#undef FT_DEBUG_LEVEL_ERROR
#undef FT_DEBUG_LEVEL_TRACE
/*************************************************************************/
/* */
/* Anti-aliasing support */
/* */
/* Undefine this macro only if you want to disable the anti-aliasing */
/* support in FreeType. This will save you about 5 Kb of code. It */
/* may be important for some embedded systems. */
/* */
#define FT_CONFIG_OPTION_ANTI_ALIAS
/*************************************************************************/
/* */
/* Endianess performance improvement */
/* */
/* FreeType is completely endian-independent, and can thus be compiled */
/* directly on _any_ machine. However, some components of the library */
/* provide improved routines for the cases where endianess is known. */
/* */
/* It usually results in speed-ups and reduced code size. Note that */
/* you should not define both of these macros. */
/* */
/* */
/* NOTE: For now, only the scan-line converter (base/ftraster.c) uses */
/* these macros to speed-up some anti-alias rendering routines. */
/* */
#undef FT_CONFIG_OPTION_LITTLE_ENDIAN
#undef FT_CONFIG_OPTION_BIG_ENDIAN
/*************************************************************************/
/* */
/* Define this configuration macro whenever you want to build a version */
/* of FreeType that does not include a default `system' component. */
/* */
/* Note that this will prevent the compilation of `ftinit', hence the */
/* function FT_Init_FreeType */
/* */
#undef FT_CONFIG_OPTION_NO_DEFAULT_SYSTEM
/*************************************************************************/
/* */
/* The size in bytes of the render pool used by the scan-line */
/* converter to do all of its work. */
/* */
/* This must be greater than 4 Kb */
/* */
#define FT_RENDER_POOL_SIZE 32768
/*************************************************************************/
/* */
/* FT_MAX_DRIVERS */
/* */
/* The maximum number of font drivers that can be registered in a */
/* single FreeType library object. 8 seems to be a good choice due */
/* to the relative low actual number of drivers ;-) */
/* */
#define FT_MAX_DRIVERS 8
/*************************************************************************/
/* */
/* FT_MAX_EXTENSIONS */
/* */
/* The maximum number of extensions that can be registered in a */
/* single font driver. 8 seems to be a good choice for now.. */
/* */
#define FT_MAX_EXTENSIONS 8
/*************************************************************************/
/* */
/* FT_MAX_GLYPH_FORMATS */
/* */
/* The maximum number of glyph image formats that might be registered */
/* in a given library instance. 8 seems to be a good choice due to */
/* the relatively low number of current formats ;-) */
/* */
#define FT_MAX_GLYPH_FORMATS 8
#endif /* FTOPTION_H */

View File

@ -1,871 +0,0 @@
/*******************************************************************
*
* ftsys.c
*
* Unix-specific system operations.
*
* 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 implementation of the 'ftsys' component uses memory-mapped
* files, as well as the ANSI malloc/free functions..
*
* IMPORTANT NOTE :
*
* Porters, read carefully the comments in ftsys.h before trying
* to port this file to your system. It contains many essential
* remarks, and will ease your work greatly..
*
******************************************************************/
#include "ftsys.h"
#include "ftobjs.h"
#include "ftstream.h"
#include "ftdebug.h"
/* Memory-mapping includes and definitions.. */
/* */
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <sys/mman.h>
#ifndef MAP_FILE
#define MAP_FILE 0x00
#endif
/*
* The prototype for munmap() is not provided on SunOS. This needs to
* have a check added later to see if the GNU C library is being used.
* If so, then this prototype is not needed.
*/
#if defined(__sun__) && !defined(SVR4) && !defined(__SVR4)
extern int munmap( caddr_t addr, int len );
#endif
#include <sys/stat.h>
#ifdef HAVE_FCNTL_H
#include <fcntl.h>
#endif
/* The macro FT_COMPONENT is used in trace mode. It is an implicit */
/* parameter of the PTRACE and PERROR macros, used to print/log */
/* messages during execution.. */
/* */
#undef FT_COMPONENT
#define FT_COMPONENT trace_io
/* To ease porting, we use the macro SYS_STREAM to name the system-specific */
/* stream type. For example, it is a "FILE*" with the ANSI libc, it will be */
/* a file descriptor, i.e. an integer, when using the Unix system api, etc. */
/* we identify each memory-mapped file through its address in memory */
/* hence the following macro definition.. */
#define SYS_STREAM void*
/**************************************************************************/
/* */
/* I/O ACCESS AND MANAGEMENT */
/* */
/* We only define the "ANSI" resource class in this class. It is */
/* disk-based, and provides a MRU cache, in order to only keep the file */
/* descriptors of the 10 most recently used resource files. */
/* */
/* it simply contains two lists. One contains the "cached" resources */
/* with a valid FILE* pointer, the second contains all other "flushed" */
/* resource objects. */
/* */
/* The FT_MMapFile class derives from FT_ResourceRec - description : */
/* */
/* <Struct> FT_AnsiFileRec */
/* */
/* <Fields> */
/* */
/* root :: */
/* the root resource class fields. */
/* */
/* pathname :: */
/* the file's pathname. Needed because we open and close font */
/* resources dynamically in order to limit the number of */
/* concurrently active mappings (this saves kernel resources). */
/* */
/* file_size :: */
/* the size in bytes of the resource. This field should be set to */
/* -1 until the resource is first opened.. */
/* */
#include <stdio.h>
typedef struct FT_MMapFileRec_
{
FT_ResourceRec root;
const char* pathname;
FT_Long file_size; /* file size in bytes */
} FT_MMapFileRec, *FT_MMapFile;
/* We use the macro STREAM_Name as a convenience to return a given */
/* ANSI resource's pathname. Its "stream" argument is a FT_Resource */
/* which is typecasted to the FT_AnsiFile class */
#define STREAM_Name(stream) ((FT_MMapFile)stream->resource)->pathname
/* We use the macro STREAM_File as a convenience to extract the */
/* system-specific stream handle from a given FreeType stream object */
#define STREAM_File(stream) ((void*)stream->stream_id.pointer)
/***************************************************************************/
/* */
/* <Function> MMapFile_Open */
/* */
/* <Description> */
/* This function is used to open a system-stream for a given resource. */
/* */
/* Note that it must update the target FreeType stream object with the */
/* system-stream handle and the resource's size. */
/* */
/* Also, the 'stream->base' field must be set to NULL for disk-based */
/* resource, and to the address in memory of the resource's first byte */
/* for a memory-based one. */
/* */
/* <Input> */
/* resource :: the source resource */
/* stream :: the target stream object */
/* */
/* <Return> */
/* Error code */
/* */
/* <Note> */
/* This function simply opens and maps the resource's file pathname */
/* */
/* The stream object IS NOT CREATED by this function, but by its caller. */
/* */
/***************************************************************************/
static
FT_Error MMapFile_Open( FT_MMapFile resource,
FT_Stream stream )
{
int file;
struct stat stat_buf;
/* open the file */
file = open( resource->pathname, O_RDONLY );
if (file < 0)
{
PERROR(( "UnixSys.MMapFile_Open : could not open '%s'\n",
resource->pathname ));
return FT_Err_Cannot_Open_Stream;
}
if (fstat( file, &stat_buf ) < 0)
{
PERROR(( "UnixSys.MMapFile_Open : could not 'fstat' file '%s'\n",
resource->pathname ));
goto Fail_Map;
}
if ( resource->file_size < 0 )
resource->file_size = stat_buf.st_size;
stream->resource = (FT_Resource)resource;
stream->system = resource->root.driver->system;
stream->size = resource->file_size;
stream->stream_id.pointer = mmap( NULL,
resource->file_size,
PROT_READ,
MAP_FILE | MAP_PRIVATE,
file,
0 );
if ( (long)stream->stream_id.pointer == -1 )
{
PERROR(( "UnixSys.MMapFile_Open : Could not map file '%s'\n",
resource->pathname ));
goto Fail_Map;
}
close(file);
stream->base = (FT_Byte*)stream->stream_id.pointer;
stream->cursor = stream->base;
PTRACE1(( "UnixSys.MMapFile_Open: opened '%s' (%d bytes) succesfully\n",
resource->pathname, resource->file_size ));
return FT_Err_Ok;
Fail_Map:
close(file);
stream->resource = NULL;
stream->size = 0;
stream->stream_id.pointer = NULL;
stream->base = NULL;
stream->cursor = NULL;
return FT_Err_Cannot_Open_Stream;
}
/***************************************************************************/
/* */
/* <Function> MMapFile_Close */
/* */
/* <Description> Closes a given stream */
/* */
/* <Input> */
/* stream :: the target stream object */
/* */
/* <Return> */
/* Error code */
/* */
/* <Note> */
/* This function simply unmaps the resource.. */
/* */
/***************************************************************************/
static
FT_Error MMapFile_Close( FT_Stream stream )
{
PTRACE1(( "Closing file '%s'\n", STREAM_Name(stream) ));
munmap ( (void*)stream->stream_id.pointer, stream->size );
stream->resource = NULL;
stream->stream_id.pointer = NULL;
stream->size = 0;
stream->base = NULL;
stream->cursor = NULL;
return FT_Err_Ok;
}
/***************************************************************************/
/* */
/* <Function> MMapFile_Seek */
/* */
/* <Description> Seek a stream to a given position */
/* */
/* <Input> */
/* stream :: the target stream object */
/* position :: offset in bytes from start of resource/stream */
/* */
/* <Return> */
/* Error code */
/* */
/* <Note> */
/* This function should never be called for memory-based resources.. */
/* */
/***************************************************************************/
static
FT_Error MMapFile_Seek( FT_Stream stream,
FT_Long position )
{
(void)stream;
(void)position;
return FT_Err_Invalid_Stream_Operation;
}
/***************************************************************************/
/* */
/* <Function> MMapFile_Skip */
/* */
/* <Description> Skip a given number of bytes in an MMap stream. */
/* Useful to skip pad bytes, for example. */
/* */
/* <Input> */
/* stream :: the target stream object */
/* count :: number of bytes to skip in the stream */
/* */
/* <Return> */
/* Error code */
/* */
/* <Note> */
/* This function should never be called for memory-based resources.. */
/* */
/***************************************************************************/
static
FT_Error MMapFile_Skip( FT_Stream stream,
FT_Long count )
{
(void)stream;
(void)count;
return FT_Err_Invalid_Stream_Operation;
}
/***************************************************************************/
/* */
/* <Function> MMapFile_Pos */
/* */
/* <Description> Returns the current offset within an MMap stream's */
/* resource. */
/* */
/* <Input> */
/* stream :: the target stream object */
/* */
/* <Output> */
/* position :: current offset. -1 in case of error */
/* */
/* <Return> */
/* Error code. */
/* */
/* <Note> */
/* This function should never be called for memory-based resources.. */
/* */
/***************************************************************************/
static
FT_Error MMapFile_Pos( FT_Stream stream,
FT_Long* position )
{
(void)stream;
(void)position;
return FT_Err_Invalid_Stream_Operation;
}
/***************************************************************************/
/* */
/* <Function> MMapFile_Read */
/* */
/* <Description> Read a given number of bytes from an MMap stream into */
/* memory. */
/* */
/* <Input> */
/* stream :: the target stream object */
/* buffer :: the target read buffer where data is copied */
/* size :: number of bytes to read from the stream */
/* */
/* <Output> */
/* read_bytes :: the number of bytes effectively read from the stream */
/* used in case of error (i.e. FT_Err_Invalid_Stream_Read) */
/* by some parts of the library.. */
/* <Return> */
/* Error code */
/* */
/* <Note> */
/* This function should never be called for memory-based resources.. */
/* */
/***************************************************************************/
static
FT_Error MMapFile_Read( FT_Stream stream,
FT_Byte* buffer,
FT_Long size,
FT_Long* read_bytes )
{
(void)stream;
(void)buffer;
(void)size;
(void)read_bytes;
return FT_Err_Invalid_Stream_Operation;
}
/* The following table is the "virtual method table" for the 'MMap */
/* resource class', which methods are defined above. Its address is */
/* set in the 'interface' field of all resource objects created by */
/* the function FT_Create_MMapFile (see below) */
static
FTRes_InterfaceRec FT_MMapFile_Interface =
{
(FTRes_Open_Func) MMapFile_Open,
(FTRes_Close_Func) MMapFile_Close,
(FTRes_Seek_Func) MMapFile_Seek,
(FTRes_Skip_Func) MMapFile_Skip,
(FTRes_Pos_Func) MMapFile_Pos,
(FTRes_Read_Func) MMapFile_Read,
};
/************************************************************************/
/* */
/* <Function> FT_Create_Resource */
/* */
/* <Description> */
/* Create a new resource object for a given library. Note that this */
/* function takes an ASCII 'pathname' as an argument. */
/* */
/* <Input> */
/* library :: handle to target library object */
/* pathanme :: ASCII pathname of the font file */
/* */
/* <Output> */
/* resource :: handle to new resource object */
/* */
/* <Return> */
/* Error code. 0 means success */
/* */
/* <Note> */
/* When porting the library to exotic environments, where an */
/* ASCII pathname isn't used to name files, developers should */
/* invoke directly their own resource creation function which */
/* must be placed in their port of the "ftsys" component. */
/* */
/* See the porting guide for more information.. */
/* */
EXPORT_FUNC
FT_Error FT_Create_Resource( FT_Library library,
const char* pathname,
FT_Resource* aresource )
{
FT_Int len;
FT_System system;
FT_MMapFile resource;
FT_Error error;
*aresource = NULL;
if (!library)
{
PERROR(( "Unix.New_Resource : null library handle\n" ));
return FT_Err_Invalid_Library_Handle;
}
system = library->system;
if ( !pathname )
goto Fail_Null;
len = strlen(pathname);
if (len == 0)
goto Fail_Null;
resource = NULL;
if ( ALLOC( resource, sizeof(*resource) ) ||
ALLOC( resource->pathname, len+1 ) )
goto Fail_Memory;
resource->root.library = library;
resource->root.interface = &FT_MMapFile_Interface;
resource->root.flags = FT_RESOURCE_TYPE_MEMORY_BASED;
resource->file_size = -1;
strcpy( (char*)resource->pathname, pathname );
PTRACE1(( "Create_MMapFile : MMap resource created for '%s'\n",
pathname ));
*aresource = (FT_Resource)resource;
return FT_Err_Ok;
Fail_Null:
PERROR(( "Create_MMapFile : null pathname !!\n" ));
return FT_Err_Invalid_Argument;
Fail_Memory:
if (resource)
FREE( resource->pathname );
FREE( resource );
PERROR(( "Create_MMapFile : error when creating resource !\n" ));
return error;
}
/***************************************************************************/
/* */
/* <Function> FT_Destroy_Resource */
/* */
/* <Description> Destroys an MMap resource object. */
/* This function is never called directly by the font */
/* drivers. Only by the higher-level part of FreeType */
/* (called the HLib), or client applications */
/* */
/* <Input> */
/* resource :: the MMap resource object */
/* */
/* <Note> */
/* This functions does not check that runs or streams are opened for */
/* the resource (for now, we assume developer intelligence. We'll most */
/* probably lower our standard later to ease debugging ;-) */
/* */
/***************************************************************************/
EXPORT_FUNC
FT_Error FT_Destroy_Resource( FT_Resource resource )
{
FT_System system = resource->library->system;
FT_MMapFile res = (FT_MMapFile)resource;
if ( !res || res->root.interface != &FT_MMapFile_Interface )
{
PERROR((
"Destroy_MMapFile : Trying to destroy an invalid resource !!\n" ));
return FT_Err_Invalid_Resource_Handle;
}
PTRACE1(( "Destroy_MMapFile : destroying resource for '%s'\n",
res->pathname ));
FREE( res->pathname );
FREE( res );
return FT_Err_Ok;
}
/**************************************************************************/
/* */
/* MEMORY MANAGEMENT */
/* */
/* */
/* This part copies the old FreeType 1.0 and 1.1 memory management */
/* scheme that was defined in the file "ttmemory.h". One can see that */
/* */
/* - a set of macros is defined for the memory operations used */
/* by the engine ( MEM_Copy, MEM_Move, MEM_Set ). This comes from */
/* the fact that many compilers are able to inline these ops directly */
/* within the compiled code, rather than generating a call to the */
/* C library. However, this obliges us to include the <string.h> */
/* header file. */
/* */
/* If you provide your own memory operations routine, you can get */
/* rid of the #include <string.h> below. */
/* */
/* */
/* - the FT_Alloc function has several essential properties that */
/* MUST be retained by each port : */
/* */
/* - it returns an error code, NOT the allocated block's base */
/* address */
/* */
/* - it takes the address of a target pointer, where the block's */
/* base address will be set. if the size is zero, its value */
/* will be NULL and the function returns successfully */
/* */
/* - in case of error, the pointer's value is set to NULL and */
/* an error code is returned.. */
/* */
/* - the new allocated block MUST be zero-filled. This is a strong */
/* convetion the rest of the engine relies on */
/* */
/* */
/* */
/* - the FT_Free function has also its essentials : */
/* */
/* - it takes the address of a pointer which value is the block's */
/* base address. This is UNLIKE a standard "free" which takes the */
/* the block's base directly. */
/* */
/* - it accepts succesfully the address of a pointer which value */
/* is NULL, in which case it simply returns. */
/* */
/* - the pointer is always set to NULL by the function */
/* */
/* */
/* - the MEM_Alloc, ALLOC and ALLOC_ARRAY macros are used by the */
/* library, and should NOT be modified by porters !! */
/* */
/* The macro FT_COMPONENT is used in trace mode. It is an implicit */
/* parameter of the PTRACE and PERROR macros, used to print/log */
/* messages during execution.. */
/* */
#undef FT_COMPONENT
#define FT_COMPONENT trace_memory
#include <stdlib.h>
/**************************************************************************/
/* */
/* <Function> FT_Alloc */
/* */
/* <Description> */
/* Allocates a new bloc of memory. The returned area is always */
/* zero-filled, this is a strong convention in many FreeType parts */
/* */
/* <Input> */
/* system :: handle to a given 'system object' where allocation */
/* occurs.. */
/* */
/* size :: size in bytes of the block to allocate */
/* */
/* <Output> */
/* P :: pointer to the fresh new block. It should be set */
/* to NULL if 'size' is 0, of in case of error.. */
/* */
/* <Return> */
/* FreeType error code. 0 means success. */
/* */
/**************************************************************************/
BASE_FUNC
FT_Error FT_Alloc( FT_System system,
long size,
void* *P )
{
if (!P)
{
PERROR(( "FT_Alloc : invalid pointer address !!\n" ));
return FT_Err_Invalid_Argument;
}
if ( size > 0 )
{
*P = malloc( size );
if ( !*P )
{
PERROR(( "FT_Alloc : out of memory (%ld bytes requested) !!\n",
size ));
return FT_Err_Out_Of_Memory;
}
system->total_alloc += size;
/* ALWAYS ZERO-FILL THE BLOCK !!!!! */
MEM_Set( *P, 0, size );
}
else
*P = NULL;
PTRACE2(( "FT_Alloc : size = %ld, pointer = 0x%08lx, block = 0x%08lx\n",
size, (long)P, (long)*P ));
return FT_Err_Ok;
}
/**************************************************************************/
/* */
/* <Function> FT_Realloc */
/* */
/* <Description> */
/* Reallocates a block of memory pointed to by '*P' to 'Size' */
/* bytes from the hea^, possibly changing '*P'. */
/* */
/* <Input> */
/* system :: handle to a given 'system object' where allocation */
/* occurs.. */
/* */
/* size :: size in bytes of the block to allocate */
/* */
/* <InOut> */
/* P :: pointer to the fresh new block. It should be set */
/* to NULL if 'size' is 0, of in case of error.. */
/* */
/* <Return> */
/* FreeType error code. 0 means success. */
/* */
BASE_FUNC
int FT_Realloc( FT_System system,
long size,
void* *P )
{
void* Q;
if (!P)
{
PERROR(( "FT_Realloc : invalid pointer address !!\n" ));
return FT_Err_Invalid_Argument;
}
/* if the original pointer is NULL, call FT_Alloc */
if (!*P)
return FT_Alloc( system, size, P );
/* if the new block if zero-sized, clear the current one */
if (size <= 0)
return FT_Free( system, P );
Q = (void*)realloc( *P, size );
if (!Q)
{
PERROR(( "FT_Realloc : reallocation failed\n" ));
return FT_Err_Out_Of_Memory;
}
*P = Q;
return FT_Err_Ok;
}
/**************************************************************************/
/* */
/* <Function> FT_Free */
/* */
/* <Description> */
/* Releases a given block of memory allocated through FT_Alloc */
/* */
/* <Input> */
/* system :: handle to a given 'system object' where allocation */
/* occured.. */
/* */
/* P :: This is the _address_ of a _pointer_ which points to */
/* the allocated block. It is always set to NULL on exit */
/* */
/* <Return> */
/* FreeType error code. 0 means success. */
/* */
/* <Note> */
/* If P or *P are NULL, this function should return successfuly. This */
/* is a strong convention within all of FreeType and its drivers.. */
/* */
BASE_FUNC
FT_Error FT_Free( FT_System system,
void* *P )
{
(void)system; /* unused parameter. Gets rid of warnings */
PTRACE2(( "FT_Free : freeing pointer 0x%08lx (block 0x%08lx)\n",
(long)P, (P ? (long)*P : -1) ));
if ( !P || !*P )
return FT_Err_Ok;
free( *P );
*P = NULL;
return FT_Err_Ok;
}
/**************************************************************************/
/* */
/* SYNCHRONIZATION MANAGEMENT */
/* */
/* */
/* This section deals with mutexes. The library can be compiled to */
/* three distinct thread-support levels ( namely single-threaded, */
/* thread-safe and re-entrant modes ). */
/* */
/* It protects its variables through the MUTEX_Lock and MUTEX_Release */
/* macros which are void in single-threaded mode. */
/* */
/* */
/* It defines a type-less mutex reference type, "TMutex", that you're */
/* free to redefine for your system's needs.. */
/* */
/* The default implementation of ftsys.c contains only dummy functions */
/* which always return succesfully. you NEED to specialize them in */
/* order to port ftsys.c in any multi-threaded environment... */
/* */
/* The macro FT_COMPONENT is used in trace mode. It is an implicit */
/* parameter of the PTRACE and PERROR macros, used to print/log */
/* messages during execution.. */
/* */
#undef FT_COMPONENT
#define FT_COMPONENT trace_sync
#ifdef FT_CONFIG_THREADS
BASE_FUNC
FT_Error FT_Mutex_Create ( FT_System system,
TMutex* mutex )
{
(void)system; /* unused parameter. Gets rid of warnings */
mutex = (void*)-1;
system->num_mutexes++;
return FT_Err_Ok;
/* Replace this line with your own mutex creation code */
}
BASE_FUNC
void FT_Mutex_Delete ( FT_System system,
TMutex* mutex )
{
(void)system; /* unused parameter. Gets rid of warnings */
mutex = (void*)0;
system->num_mutexes--;
/* Replace this line with your own mutex destruction code */
}
BASE_FUNC
void FT_Mutex_Lock ( FT_System system,
TMutex* mutex )
{
/* NOTE: It is legal to call this function with a NULL argument */
/* in which case an immediate return is appropriate. */
(void)system; /* unused parameter. Gets rid of warnings */
if ( !mutex )
return;
; /* Insert your own mutex locking code here */
}
void FT_Mutex_Release( FT_System system,
TMutex* mutex )
{
/* NOTE: It is legal to call this function with a NULL argument */
/* in which case an immediate return is appropriate */
(void)system; /* unused parameter. Gets rid of warnings */
if ( !mutex )
return;
; /* Insert your own mutex release code here */
}
#endif /* FT_CONFIG_THREADS */
EXPORT_FUNC
FT_Error FT_New_System( FT_System* system )
{
*system = (FT_System)malloc( sizeof(FT_SystemRec) );
if ( !*system )
return FT_Err_Out_Of_Memory;
/* the ANSI function 'free' is unable to return the number */
/* of released bytes. Hence, the 'current_alloc' field of the */
/* system object cannot be used */
(*system)->system_flags = FT_SYSTEM_FLAG_TOTAL_ALLOC |
FT_SYSTEM_FLAG_MUTEXES;
(*system)->total_alloc = 0;
(*system)->num_mutexes = 0;
/* initialise i/o management (nothing) */
/* initialise synchronisation (nothing) */
/* initialise streams */
return FT_Err_Ok;
}
EXPORT_FUNC
FT_Error FT_Done_System( FT_System system )
{
/* finalise syncrhonisation (nothing) */
/* finalise i/o management (nothing) */
/* finalise memory management */
free( system );
return FT_Err_Ok;
}

131
config/unix/unix-dev.mk Normal file
View File

@ -0,0 +1,131 @@
#*******************************************************************
#*
#* FreeType 2 Configuration rules for a standard Unix + GCC
#* NOTE: THIS VERSION TURNS OFF ALL OPTIMIZATIONS FOR DEBUGGING !!
#*
#* Copyright 1996-2000 by
#* David Turner, Robert Wilhelm, and Werner Lemberg.
#*
#* This file is part of the FreeType project, and may only be used
#* modified and distributed under the terms of the FreeType project
#* license, LICENSE.TXT. By continuing to use, modify, or distribute
#* this file you indicate that you have read the license and
#* understand and accept it fully.
#*
#* Please read the file "freetype/docs/config.txt" to understand
#* what this file does..
#*
#*******************************************************************
ifndef TOP
TOP := .
endif
DELETE := rm -f
SEP := /
HOSTSEP := $(SEP)
BUILD := $(TOP)/config/unix
PLATFORM := unix
# the directory where all object files are placed
#
# Note that this is not $(TOP)/obj !!
# This lets you build the library in your own directory
# with something like :
#
# set TOP=....../path/to/freetype2/top/dir...
# mkdir obj
# make -f %TOP%/Makefile setup [options]
# make -f %TOP%/Makefile
#
#
OBJ_DIR := obj
# the directory where all library files are placed
#
# by default, this is the same as OBJ_DIR, however, this can be
# changed to suit particular needs..
#
LIB_DIR := $(OBJ_DIR)
# the object file extension, this can be .o, .tco, .obj, etc..
# depending on the platform
#
O := o
# the library file extension, this can be .a, .lib, etc..
# depending on the platform
#
A := a
# The name of the final library file.
# Note that the DOS-specific Makefile uses a shorter (8.3) name
#
LIBRARY := libfreetype
# path inclusion flag.
#
# Some compilers use a different flag than '-I' to specify an
# additional include path. Examples are "/i=" or "-J", etc...
#
I := -I
# The link flag used to specify a given library file on link.
# Note that this is only used to compile the demo programs, not
# the library itself.
#
L := -l
# C flag used to define a macro before the compilation of a given
# source object. Usually is '-D' like in "-DDEBUG"
#
D := -D
# Target flag - beware, there is a space after the 'o' !!
#
#
T := -o
# C flags
#
# These should concern :
#
# - debug output
# - optimization
# - warnings
# - ansi compliance..
#
ifndef CFLAGS
CFLAGS := -c -g -O0 -Wall
endif
# ANSIFLAGS : put there the flags used to make your compiler ANSI-compliant
# nothing (if it already is by default like LCC).
#
ANSIFLAGS := -ansi -pedantic
ifdef BUILD_FREETYPE
include $(TOP)/config/freetype.mk
clean_freetype: clean_freetype_std
distclean_freetype: distclean_freetype_std
# This final rule is used to link all object files into a single
# library. It is part of the system-specific sub-Makefile because not
# all librarians accept a simple syntax like :
#
# librarian library_file {list of object files}
#
$(FT_LIBRARY): $(OBJECTS_LIST)
-$(DELETE) $@
$(AR) -r $@ $(OBJECTS_LIST)
endif

130
config/unix/unix-gcc.mk Normal file
View File

@ -0,0 +1,130 @@
#*******************************************************************
#*
#* FreeType 2 Configuration rules for a standard Unix compiler
#*
#* Copyright 1996-2000 by
#* David Turner, Robert Wilhelm, and Werner Lemberg.
#*
#* This file is part of the FreeType project, and may only be used
#* modified and distributed under the terms of the FreeType project
#* license, LICENSE.TXT. By continuing to use, modify, or distribute
#* this file you indicate that you have read the license and
#* understand and accept it fully.
#*
#* Please read the file "freetype/docs/config.txt" to understand
#* what this file does..
#*
#*******************************************************************
ifndef TOP
TOP := .
endif
DELETE := rm -f
SEP := /
HOSTSEP := $(SEP)
BUILD := $(TOP)/config/unix
PLATFORM := unix
# the directory where all object files are placed
#
# Note that this is not $(TOP)/obj !!
# This lets you build the library in your own directory
# with something like :
#
# set TOP=....../path/to/freetype2/top/dir...
# mkdir obj
# make -f %TOP%/Makefile setup [options]
# make -f %TOP%/Makefile
#
#
OBJ_DIR := obj
# the directory where all library files are placed
#
# by default, this is the same as OBJ_DIR, however, this can be
# changed to suit particular needs..
#
LIB_DIR := $(OBJ_DIR)
# the object file extension, this can be .o, .tco, .obj, etc..
# depending on the platform
#
O := o
# the library file extension, this can be .a, .lib, etc..
# depending on the platform
#
A := a
# The name of the final library file.
# Note that the DOS-specific Makefile uses a shorter (8.3) name
#
LIBRARY := libfreetype
# path inclusion flag.
#
# Some compilers use a different flag than '-I' to specify an
# additional include path. Examples are "/i=" or "-J", etc...
#
I := -I
# The link flag used to specify a given library file on link.
# Note that this is only used to compile the demo programs, not
# the library itself.
#
L := -l
# C flag used to define a macro before the compilation of a given
# source object. Usually is '-D' like in "-DDEBUG"
#
D := -D
# Target flag - beware, there is a space after the 'o' !!
#
#
T := -o
# C flags
#
# These should concern :
#
# - debug output
# - optimization
# - warnings
# - ansi compliance..
#
ifndef CFLAGS
CFLAGS := -c -g -O6 -Wall
endif
# ANSIFLAGS : put there the flags used to make your compiler ANSI-compliant
# nothing (if it already is by default like LCC).
#
ANSIFLAGS := -ansi -pedantic
ifdef BUILD_FREETYPE
include $(TOP)/config/freetype.mk
clean_freetype: clean_freetype_std
distclean_freetype: distclean_freetype_std
# This final rule is used to link all object files into a single
# library. It is part of the system-specific sub-Makefile because not
# all librarians accept a simple syntax like :
#
# librarian library_file {list of object files}
#
$(FT_LIBRARY): $(OBJECTS_LIST)
-$(DELETE) $@
$(AR) -r $@ $(OBJECTS_LIST)
endif

130
config/unix/unix.mk Normal file
View File

@ -0,0 +1,130 @@
#*******************************************************************
#*
#* FreeType 2 Configuration rules for a standard Unix compiler
#*
#* Copyright 1996-2000 by
#* David Turner, Robert Wilhelm, and Werner Lemberg.
#*
#* This file is part of the FreeType project, and may only be used
#* modified and distributed under the terms of the FreeType project
#* license, LICENSE.TXT. By continuing to use, modify, or distribute
#* this file you indicate that you have read the license and
#* understand and accept it fully.
#*
#* Please read the file "freetype/docs/config.txt" to understand
#* what this file does..
#*
#*******************************************************************
ifndef TOP
TOP := .
endif
DELETE := rm -f
SEP := /
HOSTSEP := $(SEP)
BUILD := $(TOP)/config/unix
PLATFORM := unix
# the directory where all object files are placed
#
# Note that this is not $(TOP)/obj !!
# This lets you build the library in your own directory
# with something like :
#
# set TOP=....../path/to/freetype2/top/dir...
# mkdir obj
# make -f %TOP%/Makefile setup [options]
# make -f %TOP%/Makefile
#
#
OBJ_DIR := obj
# the directory where all library files are placed
#
# by default, this is the same as OBJ_DIR, however, this can be
# changed to suit particular needs..
#
LIB_DIR := $(OBJ_DIR)
# the object file extension, this can be .o, .tco, .obj, etc..
# depending on the platform
#
O := o
# the library file extension, this can be .a, .lib, etc..
# depending on the platform
#
A := a
# The name of the final library file.
# Note that the DOS-specific Makefile uses a shorter (8.3) name
#
LIBRARY := libfreetype
# path inclusion flag.
#
# Some compilers use a different flag than '-I' to specify an
# additional include path. Examples are "/i=" or "-J", etc...
#
I := -I
# The link flag used to specify a given library file on link.
# Note that this is only used to compile the demo programs, not
# the library itself.
#
L := -l
# C flag used to define a macro before the compilation of a given
# source object. Usually is '-D' like in "-DDEBUG"
#
D := -D
# Target flag - beware, there is a space after the 'o' !!
#
#
T := -o
# C flags
#
# These should concern :
#
# - debug output
# - optimization
# - warnings
# - ansi compliance..
#
ifndef CFLAGS
CFLAGS := -c
endif
# ANSIFLAGS : put there the flags used to make your compiler ANSI-compliant
# nothing (if it already is by default like LCC).
#
ANSIFLAGS :=
ifdef BUILD_FREETYPE
include $(TOP)/config/freetype.mk
clean_freetype: clean_freetype_std
distclean_freetype: distclean_freetype_std
# This final rule is used to link all object files into a single
# library. It is part of the system-specific sub-Makefile because not
# all librarians accept a simple syntax like :
#
# librarian library_file {list of object files}
#
$(FT_LIBRARY): $(OBJECTS_LIST)
-$(DELETE) $@
$(AR) -r $@ $(OBJECTS_LIST)
endif

View File

@ -1,200 +0,0 @@
#*******************************************************************
#*
#* FreeType 2 Configuration rules for Unix + gcc
#*
#* 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 purpose of this sub-Makefile is to define various build and
#* platform specific variables before including the sub-Makefile
#* containing the FreeType library rules, found in
#*
#* $(TOP)/config/freetype.mk
#*
#* The following variables must be defined before including this
#* file :
#*
#* TOP Pathname to the top of the FreeType sources
#* hierarchy
#*
#* This file should define the following variables before including
#* the FreeType library rules file :
#*
#* BUILD Pathname to the platform-specific files used
#* for the build. Usually `$(TOP)/config/<system>'
#*
#* SEP Directory separator used during compilation.
#* (usually "/" or "\"). Note that on Win32, both gcc
#* and Visual C++ use "/" as a directory separator !!
#*
#* HOSTSEP Directory separator for $(COPY) and $(DELETE)
#*
#* DELETE The forced remove/delete command to erase one or more
#* files
#*
#* INCLUDE The location of all public header files. e.g.
#* `$(TOP)/include'include' *
#*
#* SRC The directory containing all sources. e.g.
#* '$(TOP)/src'
#*
#* OBJ_DIR The location where compiled object files will be
#* placed, e.g. '$(TOP)/obj'
#*
#* LIB_DIR The location where the resulting library file will be
#* placed, e.g. '$(TOP)/obj'
#*
#* LIBRARY The filename of the resulting library file, without
#* its extension.. e.g. 'libfreetype' or 'freetype'
#*
#* O The object file suffix. Can be '.o', '.obj,' '.lo,'
#* ';coff,' etc.
#*
#* A The library file suffix. Can be '.a' '.so,' '.lib'
#* '.dll,' etc.
#*
#* I The path inclusion flag. Some compilers use a
#* different flag than '-I' to specify an additional
#* include path. Examples are '/i=' or '-J ', etc.
#*
#* D The macro definition flag. I haven't met compilers
#* which don't use the '-D' switch to define a macro, but
#* who knows...
#*
#* T The compilation flag used to identify the target. Some
#* compilers use a different flag than '-o ' to specify
#* the name of the target object file.
#*
#* CFLAGS The set of flags used to compile object files.
#* (usually contains the flag '-c').
#*
#*
#*
#*******************************************************************
ifndef TOP
TOP := .
endif
DELETE := del
SEP := /
HOSTSEP := $(strip \ )
BUILD := $(TOP)/config/win32
PLATFORM := win32
CC := gcc
# the directory where all object files are placed
#
# Note that this is not $(TOP)/obj !!
# This lets you build the library in your own directory
# with something like :
#
# set TOP=....../path/to/freetype2/top/dir...
# mkdir obj
# make -f %TOP%/Makefile setup [options]
# make -f %TOP%/Makefile
#
#
OBJ_DIR := obj
# the directory where all library files are placed
#
# by default, this is the same as OBJ_DIR, however, this can be
# changed to suit particular needs..
#
LIB_DIR := $(OBJ_DIR)
# the object file extension, this can be .o, .tco, .obj, etc..
# depending on the platform
#
O := o
# the library file extension, this can be .a, .lib, etc..
# depending on the platform
#
A := a
# The name of the final library file.
# Note that the DOS-specific Makefile uses a shorter (8.3) name
#
LIBRARY := libfreetype
# path inclusion flag.
#
# Some compilers use a different flag than '-I' to specify an
# additional include path. Examples are "/i=" or "-J", etc...
#
I := -I
# The link flag used to specify a given library file on link.
# Note that this is only used to compile the demo programs, not
# the library itself.
#
L := -l
# C flag used to define a macro before the compilation of a given
# source object. Usually is '-D' like in "-DDEBUG"
#
D := -D
# Target flag - beware, there is a space after the 'o' !!
#
#
T := -o
# C flags
#
# These should concern :
#
# - debug output
# - optimization
# - warnings
# - ansi compliance..
#
ifndef CFLAGS
CFLAGS := -c -g -O6 -Wall
endif
# ANSIFLAGS : put there the flags used to make your compiler ANSI-compliant
# nothing (if it already is by default like LCC).
#
ANSIFLAGS := -ansi -pedantic
ifdef BUILD_FREETYPE
include $(TOP)/config/freetype.mk
clean_freetype: clean_freetype_dos
distclean_freetype: distclean_freetype_dos
# Librarian to use to build the static library
#
FT_LIBRARIAN := $(AR) -r
# This final rule is used to link all object files into a single
# library. It is part of the system-specific sub-Makefile because not
# all librarians accept a simple syntax like :
#
# librarian library_file {list of object files}
#
$(FT_LIBRARY): $(OBJECTS_LIST)
-$(DELETE) $(subst $(SEP),$(HOSTSEP),$(FT_LIBRARY)) 2> nul
$(FT_LIBRARIAN) $@ $(OBJECTS_LIST)
endif

View File

@ -1,202 +0,0 @@
#*******************************************************************
#*
#* FreeType 2 Configuration rules for Unix + gcc
#*
#* 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 purpose of this sub-Makefile is to define various build and
#* platform specific variables before including the sub-Makefile
#* containing the FreeType library rules, found in
#*
#* $(TOP)/config/freetype.mk
#*
#* The following variables must be defined before including this
#* file :
#*
#* TOP Pathname to the top of the FreeType sources
#* hierarchy
#*
#* This file should define the following variables before including
#* the FreeType library rules file :
#*
#* BUILD Pathname to the platform-specific files used
#* for the build. Usually `$(TOP)/config/<system>'
#*
#* SEP Directory separator used during compilation.
#* (usually "/" or "\"). Note that on Win32, both gcc
#* and Visual C++ use "/" as a directory separator !!
#*
#* HOSTSEP Directory separator for $(COPY) and $(DELETE)
#*
#* DELETE The forced remove/delete command to erase one or more
#* files
#*
#* INCLUDE The location of all public header files. e.g.
#* `$(TOP)/include'include' *
#*
#* SRC The directory containing all sources. e.g.
#* '$(TOP)/src'
#*
#* OBJ_DIR The location where compiled object files will be
#* placed, e.g. '$(TOP)/obj'
#*
#* LIB_DIR The location where the resulting library file will be
#* placed, e.g. '$(TOP)/obj'
#*
#* LIBRARY The filename of the resulting library file, without
#* its extension.. e.g. 'libfreetype' or 'freetype'
#*
#* O The object file suffix. Can be '.o', '.obj,' '.lo,'
#* ';coff,' etc.
#*
#* A The library file suffix. Can be '.a' '.so,' '.lib'
#* '.dll,' etc.
#*
#* I The path inclusion flag. Some compilers use a
#* different flag than '-I' to specify an additional
#* include path. Examples are '/i=' or '-J ', etc.
#*
#* D The macro definition flag. I haven't met compilers
#* which don't use the '-D' switch to define a macro, but
#* who knows...
#*
#* T The compilation flag used to identify the target. Some
#* compilers use a different flag than '-o ' to specify
#* the name of the target object file.
#*
#* CFLAGS The set of flags used to compile object files.
#* (usually contains the flag '-c').
#*
#*
#*
#*******************************************************************
ifndef TOP
TOP := .
endif
DELETE := del
SEP := /
HOSTSEP := \\
BUILD := $(TOP)$(SEP)config$(SEP)win32
PLATFORM := win32
CC := lcc
# the directory where all object files are placed
#
# Note that this is not $(TOP)/obj !!
# This lets you build the library in your own directory
# with something like :
#
# set TOP=....../path/to/freetype2/top/dir...
# mkdir obj
# make -f %TOP%/Makefile setup [options]
# make -f %TOP%/Makefile
#
#
OBJ_DIR := obj
# the directory where all library files are placed
#
# by default, this is the same as OBJ_DIR, however, this can be
# changed to suit particular needs..
#
LIB_DIR := $(OBJ_DIR)
# the object file extension, this can be .o, .tco, .obj, etc..
# depending on the platform
#
O := obj
# the library file extension, this can be .a, .lib, etc..
# depending on the platform
#
A := lib
# The name of the final library file.
# Note that the DOS-specific Makefile uses a shorter (8.3) name
#
LIBRARY := freetype
# path inclusion flag.
#
# Some compilers use a different flag than '-I' to specify an
# additional include path. Examples are "/i=" or "-J", etc...
#
I := -I
# C flag used to define a macro before the compilation of a given
# source object. Usually is '-D' like in "-DDEBUG"
#
D := -D
# Target flag - LCC uses "-Fo" instead of "-o ", what a broken compiler
#
#
T := -Fo
# The link flag used to specify a given library file on link.
# Note that this is only used to compile the demo programs, not
# the library itself.
#
L := -Fl
# C flags
#
# These should concern :
#
# - debug output
# - optimization
# - warnings
# - ansi compliance..
#
ifndef CFLAGS
CFLAGS := -c -g2 -O
endif
# ANSIFLAGS : put there the flags used to make your compiler ANSI-compliant
# nothing (if it already is by default like LCC).
#
ANSIFLAGS :=
ifdef BUILD_FREETYPE
include $(TOP)/config/freetype.mk
clean_freetype: clean_freetype_dos
distclean_freetype: distclean_freetype_dos
# This final rule is used to link all object files into a single
# library. It is part of the system-specific sub-Makefile because not
# all librarians accept a simple syntax like :
#
# librarian library_file {list of object files}
#
# The LCC-Win32 Librarian, called LCCLIB needs all object files in the current
# directory. That _is_ stupid, but we'll have to deal with it..
#
DIR_OBJ := $(subst /,\\,$(OBJ_DIR))
$(FT_LIBRARY): $(OBJECTS_LIST)
@$(TOP)/config/win32/lcclib.bat
endif

View File

@ -1,187 +0,0 @@
#*******************************************************************
#*
#* FreeType 2 Configuration rules for Visual C++ on Win32
#*
#* 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 purpose of this sub-Makefile is to define various build and
#* platform specific variables before including the sub-Makefile
#* containing the FreeType library rules, found in
#*
#* $(TOP)/config/freetype.mk
#*
#* The following variables must be defined before including this
#* file :
#*
#* TOP Pathname to the top of the FreeType sources
#* hierarchy
#*
#* This file should define the following variables before including
#* the FreeType library rules file :
#*
#* BUILD Pathname to the platform-specific files used
#* for the build. Usually `$(TOP)/config/<system>'
#*
#* SEP Directory separator for the current platform.
#* Either / or \ (maybe : on Macs)
#*
#* DELETE The forced remove/delete command to erase one or more
#* files
#*
#* INCLUDE The location of all public header files. e.g.
#* `$(TOP)/include'include' *
#*
#* SRC The directory containing all sources. e.g.
#* '$(TOP)/src'
#*
#* OBJ_DIR The location where compiled object files will be
#* placed, e.g. '$(TOP)/obj'
#*
#* LIB_DIR The location where the resulting library file will be
#* placed, e.g. '$(TOP)/obj'
#*
#* LIBRARY The filename of the resulting library file, without
#* its extension.. e.g. 'libfreetype' or 'freetype'
#*
#* O The object file suffix. Can be '.o', '.obj,' '.lo,'
#* ';coff,' etc.
#*
#* A The library file suffix. Can be '.a' '.so,' '.lib'
#* '.dll,' etc.
#*
#* I The path inclusion flag. Some compilers use a
#* different flag than '-I' to specify an additional
#* include path. Examples are '/i=' or '-J ', etc.
#*
#* D The macro definition flag. I haven't met compilers
#* which don't use the '-D' switch to define a macro, but
#* who knows...
#*
#* T The compilation flag used to identify the target. Some
#* compilers use a different flag than '-o ' to specify
#* the name of the target object file.
#*
#* CFLAGS The set of flags used to compile object files.
#* (usually contains the flag '-c').
#*
#*
#*
#*******************************************************************
DELETE := del
SEP := /
HOSTSEP := $(strip \ )
BUILD := $(TOP)$(SEP)config$(SEP)win32
PLATFORM := win32
CC := cl
# the directory where all object files are placed
#
# Note that this is not $(TOP)/obj !!
# This lets you build the library in your own directory
# with something like :
#
# set TOP=....../path/to/freetype2/top/dir...
# mkdir obj
# make -f %TOP%/Makefile setup [options]
# make -f %TOP%/Makefile
#
#
OBJ_DIR := obj
# the directory where all library files are placed
#
# by default, this is the same as OBJ_DIR, however, this can be
# changed to suit particular needs..
#
LIB_DIR := $(OBJ_DIR)
# the object file extension, this can be .o, .tco, .obj, etc..
# depending on the platform
#
O := obj
# the library file extension, this can be .a, .lib, etc..
# depending on the platform
#
A := lib
# The name of the final library file.
# Note that the DOS-specific Makefile uses a shorter (8.3) name
#
LIBRARY := freetype
# path inclusion flag.
#
# Some compilers use a different flag than '-I' to specify an
# additional include path. Examples are "/i=" or "-J", etc...
#
I := /I
# The link flag used to specify a given library file on link.
# Note that this is only used to compile the demo programs, not
# the library itself.
#
L := /Fl
# C flag used to define a macro before the compilation of a given
# source object. Usually is '-D' like in "-DDEBUG"
#
D := /D
# Target flag - LCC uses "-Fo" instead of "-o ", what a broken compiler
#
#
T := /Fo
# C flags
#
# These should concern :
#
# - debug output
# - optimization
# - warnings
# - ansi compliance..
#
ifndef CFLAGS
CFLAGS := /nologo /c /Ox /G5 /W3 /WX
endif
# ANSI_FLAGS : put there the flags used to make your compiler ANSI-compliant
# nothing (if it already is by default like LCC).
#
ANSI_FLAGS := /Za
ifdef BUILD_FREETYPE
include $(TOP)/config/freetype.mk
clean_freetype: clean_freetype_dos
distclean_freetype: distclean_freetype_dos
# This final rule is used to link all object files into a single
# library. It is part of the system-specific sub-Makefile because not
# all librarians accept a simple syntax like :
#
# librarian library_file {list of object files}
#
$(FT_LIBRARY): $(OBJECTS_LIST)
lib /nologo /out:$@ $(OBJECTS_LIST)
endif

View File

@ -43,40 +43,47 @@ PLATFORM := win32
DELETE := del
COPY := copy
CONFIG_FILE := Makefile.gcc # gcc Makefile by default - aren't we biased ;-)
CONFIG_FILE := w32-gcc.mk # gcc Makefile by default - aren't we biased ;-)
SEP := /
ifeq ($(CC),cc)
CC := gcc
endif
ifneq ($(findstring visualc,$(MAKECMDGOALS)),) # Visual C/C++
CONFIG_FILE := Makefile.vcc
CONFIG_FILE := w32-vcc.mk
SEP := $(BACKSLASH)
CC := cl
visualc: setup
endif
ifneq ($(findstring watcom,$(MAKECMDGOALS)),) # Watcom C/C++
CONFIG_FILE := Makefile.wat
CONFIG_FILE := w32-wat.mk
SEP := $(BACKSLASH)
CC := wcc386
watcom: setup
endif
ifneq ($(findstring visualage,$(MAKECMDGOALS)),) # Visual Age C++
CONFIG_FILE := Makefile.icc
CONFIG_FILE := w32-icc.mk
SEP := $(BACKSLASH)
CC := icc
visualage: setup
endif
ifneq ($(findstring lcc,$(MAKECMDGOALS)),) # LCC-Win32
CONFIG_FILE := Makefile.lcc
CONFIG_FILE := w32-lcc.mk
SEP := $(BACKSLASH)
CC := lcc
lcc: setup
endif
ifneq ($(findstring devel,$(MAKECMDGOALS)),)
CONFIG_FILE := w32-dev.mk
CC := gcc
SEP := /
devel: setup
endif
CONFIG_RULES := $(TOP)\config\win32\$(CONFIG_FILE)
setup: dos_setup

View File

@ -1,182 +0,0 @@
/***************************************************************************/
/* */
/* ftconfig.h */
/* */
/* ANSI-specific configuration file (specification only). */
/* */
/* 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 header file contains a number of macro definitions that are used */
/* by the rest of the engine. Porters are free to copy this file and */
/* adapt it to suit their own system. */
/* */
/* IMPORTANT NOTE: */
/* */
/* Porters, read carefully the comments in `ftsys.h' before trying to */
/* port this file to your system. It contains many essential */
/* remarks, and will ease your work greatly. */
/* */
/*************************************************************************/
#ifndef FTCONFIG_H
#define FTCONFIG_H
/* Include the header file containing all developer build options */
#include <ftoption.h>
/*************************************************************************/
/* */
/* PLATFORM-SPECIFIC CONFIGURATION MACROS */
/* */
/* These macros can be toggled to suit a specific system. The current */
/* ones are defaults used to compile FreeType in an ANSI C environment */
/* (16bit compilers are also supported). Copy this file to your own */
/* `freetype/arch/<system>' directory, and edit it to port the engine. */
/* */
/*************************************************************************/
/* Define to empty if the keyword does not work. */
/* #undef const */
/* Define if you have the ANSI C header files. */
#define STDC_HEADERS 1
/* We use <limits.h> values to know the sizes of the types. */
#include <limits.h>
/* The number of bytes in an `int' type. */
#if UINT_MAX == 0xFFFFFFFF
#define SIZEOF_INT 4
#elif UINT_MAX == 0xFFFF
#define SIZEOF_INT 2
#elif UINT_MAX > 0xFFFFFFFF && UINT_MAX == 0xFFFFFFFFFFFFFFFF
#define SIZEOF_INT 8
#else
#error "Unsupported number of bytes in `int' type!"
#endif
/* The number of bytes in a `long' type. */
#if ULONG_MAX == 0xFFFFFFFF
#define SIZEOF_LONG 4
#elif ULONG_MAX > 0xFFFFFFFF && ULONG_MAX == 0xFFFFFFFFFFFFFFFF
#define SIZEOF_LONG 8
#else
#error "Unsupported number of bytes in `long' type!"
#endif
/* Define if you have the memcpy function. */
#define HAVE_MEMCPY 1
/* Define if you have the <fcntl.h> header file. */
#define HAVE_FCNTL_H 0
/* Define if you have the <unistd.h> header file. */
#define HAVE_UNISTD_H 0
/* Preferred alignment of data */
#define FT_ALIGNMENT 8
/*************************************************************************/
/* */
/* AUTOMATIC CONFIGURATION MACROS */
/* */
/* These macros are computed from the ones defined above. Don't touch */
/* their definition, unless you know precisely what you're doing. No */
/* porter should need to mess with them. */
/* */
/*************************************************************************/
/*************************************************************************/
/* */
/* IntN types */
/* */
/* Used to guarantee the size of some specific integers. */
/* */
typedef signed short FT_Int16;
typedef unsigned short FT_Word16;
#if SIZEOF_INT == 4
typedef signed int FT_Int32;
typedef unsigned int FT_Word32;
#elif SIZEOF_LONG == 4
typedef signed long FT_Int32;
typedef unsigned long FT_Word32;
#else
#error "no 32bit type found - please check your configuration files"
#endif
#if SIZEOF_LONG == 8
/* LONG64 must be defined when a 64-bit type is available */
#define LONG64
#define INT64 long
#else
/*************************************************************************/
/* */
/* GCC provides the non-ANSI 'long long' 64-bit type. You can activate */
/* it by defining the FTCALC_USE_LONG_LONG macro in `ftconfig.h'. Note */
/* that this will produce many -ansi warnings during library */
/* compilation. */
/* */
#ifdef FTCALC_USE_LONG_LONG
#define LONG64
#define INT64 long long
#endif /* FTCALC_USE_LONG_LONG */
#endif
#ifdef FT_MAKE_OPTION_SINGLE_OBJECT
#define LOCAL_DEF static
#define LOCAL_FUNC static
#else
#define LOCAL_DEF extern
#define LOCAL_FUNC /* nothing */
#endif
#ifdef FT_MAKE_OPTION_SINGLE_LIBRARY_OBJECT
#define BASE_DEF LOCAL_DEF
#define BASE_FUNC LOCAL_FUNC
#else
#define BASE_DEF extern
#define BASE_FUNC /* nothing */
#endif
#ifndef EXPORT_DEF
#define EXPORT_DEF extern
#endif
#ifndef EXPORT_FUNC
#define EXPORT_FUNC /* nothing */
#endif
#endif /* FTCONFIG_H */
/* END */

View File

@ -1,5 +0,0 @@
FT_DRIVER(psnames_driver_interface)
FT_DRIVER(sfnt_driver_interface)
FT_DRIVER(tt_driver_interface)
FT_DRIVER(t1_driver_interface)

View File

@ -1,204 +0,0 @@
#ifndef FTOPTION_H
#define FTOPTION_H
/*************************************************************************/
/* */
/* USER-SELECTABLE CONFIGURATION MACROS */
/* */
/* These macros can be toggled by developers to enable or disable */
/* certain aspects of FreeType. This file contains macros that apply to */
/* all of FreeType. Driver-specific configurations are placed in each */
/* driver directory (e.g. `freetype/drivers/ttlib/ttconfig.h'). */
/* */
/*************************************************************************/
/*************************************************************************/
/* */
/* Alternate Glyph Image Format support */
/* */
/* By default, the glyph images returned by the FreeType glyph loader */
/* can either be a pixmap or a vectorial outline defined through */
/* bezier control points. When defining the following configuration */
/* macro, some font drivers will be able to register alternate */
/* glyph image formats. */
/* */
/* Unset this macro if you're sure that you'll never use a font driver */
/* with an alternate glyph format, this will reduce the size of the */
/* base layer code. */
/* */
#define FT_CONFIG_OPTION_ALTERNATE_GLYPH_FORMATS
/*************************************************************************/
/* */
/* Glyph Postscript Names handling */
/* */
/* By default, FreeType 2 is built with the "psnames" module compiled */
/* in. This module is in charge of converting a glyph name string into */
/* a Unicode value, or return a Macintosh standard glyph name for the */
/* use with the TrueType "post" table. */
/* */
/* Undefine this macro if you do not want the "psnames" compiled in */
/* your build of FreeType. This has the following effects : */
/* */
/* - the TrueType driver will provide its own set of glyph names, */
/* if you build it to support postscript names in the TrueType */
/* "post" table. */
/* */
/* - the Type 1 driver will not be able to synthetize a */
/* Unicode charmap out of the glyphs found in the fonts. */
/* */
/* You would normally undefine this configuration macro when */
/* building a version of FreeType that doesn't contain a Type 1 */
/* or CFF driver. */
/* */
#define FT_CONFIG_OPTION_POSTSCRIPT_NAMES
/*************************************************************************/
/* */
/* Postscript Names to Unicode Values support */
/* */
/* By default, FreeType 2 is built with the "psnames" module compiled */
/* in. Among other things, the module is used to convert a glyph */
/* name into a unicode value. This is especially useful in order to */
/* synthetize on the fly a Unicode charmap from the CFF/Type 1 driver */
/* through a big table named the "Adobe Glyph List". */
/* */
/* Undefine this macro if you do not want the Adobe Glyph List */
/* compiled in your "psnames" module. The Type 1 driver will not */
/* be able to synthetize a Unicode charmap out of the glyphs found */
/* in the fonts.. */
/* */
#define FT_CONFIG_OPTION_ADOBE_GLYPH_LIST
/*************************************************************************/
/* */
/* GCC provides the non-ANSI `long long' 64-bit type. You can activate */
/* it by defining the FTCALC_USE_LONG_LONG macro here. Note however */
/* that we did not experience any improvement in speed with gcc, and */
/* that the final code seems bigger when linked. */
/* */
#undef FTCALC_USE_LONG_LONG
/*************************************************************************/
/* */
/* When compiling FreeType as a DLL, some systems/compilers need a */
/* special keyword in front of each function definition instead of */
/* `extern'. */
/* */
/* The macros EXPORT_DEF and EXPORT_FUNC are thus used to define */
/* exported library function interfaces and exported library functions */
/* implementations respectively. */
/* */
/* If not defined here, they automatically default to `extern' and void */
/* later in this header file. */
/* */
#undef EXPORT_DEF
#undef EXPORT_FUNC
/*************************************************************************/
/* */
/* Debug level */
/* */
/* FreeType can be compiled in debug or trace mode. In debug mode, */
/* errors are reported through the `ftdebug' component. In trace */
/* mode, additional messages are sent to the standard output during */
/* execution. */
/* */
/* Define FT_DEBUG_LEVEL_ERROR to build the library in debug mode. */
/* Define FT_DEBUG_LEVEL_TRACE to build it in trace mode. */
/* */
/* Don't define any of these macros to compile in `release' mode. */
/* */
#undef FT_DEBUG_LEVEL_ERROR
#undef FT_DEBUG_LEVEL_TRACE
/*************************************************************************/
/* */
/* Anti-aliasing support */
/* */
/* Undefine this macro only if you want to disable the anti-aliasing */
/* support in FreeType. This will save you about 5 Kb of code. It */
/* may be important for some embedded systems. */
/* */
#define FT_CONFIG_OPTION_ANTI_ALIAS
/*************************************************************************/
/* */
/* Endianess performance improvement */
/* */
/* FreeType is completely endian-independent, and can thus be compiled */
/* directly on _any_ machine. However, some components of the library */
/* provide improved routines for the cases where endianess is known. */
/* */
/* It usually results in speed-ups and reduced code size. Note that */
/* you should not define both of these macros. */
/* */
/* */
/* NOTE: For now, only the scan-line converter (base/ftraster.c) uses */
/* these macros to speed-up some anti-alias rendering routines. */
/* */
#undef FT_CONFIG_OPTION_LITTLE_ENDIAN
#undef FT_CONFIG_OPTION_BIG_ENDIAN
/*************************************************************************/
/* */
/* Define this configuration macro whenever you want to build a version */
/* of FreeType that does not include a default `system' component. */
/* */
/* Note that this will prevent the compilation of `ftinit', hence the */
/* function FT_Init_FreeType */
/* */
#undef FT_CONFIG_OPTION_NO_DEFAULT_SYSTEM
/*************************************************************************/
/* */
/* The size in bytes of the render pool used by the scan-line */
/* converter to do all of its work. */
/* */
/* This must be greater than 4 Kb */
/* */
#define FT_RENDER_POOL_SIZE 32768
/*************************************************************************/
/* */
/* FT_MAX_DRIVERS */
/* */
/* The maximum number of font drivers that can be registered in a */
/* single FreeType library object. 8 seems to be a good choice due */
/* to the relative low actual number of drivers ;-) */
/* */
#define FT_MAX_DRIVERS 8
/*************************************************************************/
/* */
/* FT_MAX_EXTENSIONS */
/* */
/* The maximum number of extensions that can be registered in a */
/* single font driver. 8 seems to be a good choice for now.. */
/* */
#define FT_MAX_EXTENSIONS 8
/*************************************************************************/
/* */
/* FT_MAX_GLYPH_FORMATS */
/* */
/* The maximum number of glyph image formats that might be registered */
/* in a given library instance. 8 seems to be a good choice due to */
/* the relatively low number of current formats ;-) */
/* */
#define FT_MAX_GLYPH_FORMATS 8
#endif /* FTOPTION_H */

View File

@ -1,214 +0,0 @@
/**************************************************************************
*
* ftsystem.h 1.0
*
* ANSI-specific FreeType low-level system interface
*
* This file contains the definition of interface used by FreeType
* to access low-level, i.e. memory management, i/o access as well
* as thread synchronisation.
*
*
* Copyright 1996-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 <ftsystem.h>
#include <fterrors.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/*********************************************************************/
/* */
/* MEMORY MANAGEMENT INTERFACE */
/* */
/************************************************************************
*
* <FuncType>
* FT_Alloc_Func
*
* <Description>
* The memory allocator function type
*
* <Input>
* system :: pointer to the system object
* size :: requested size in bytes
*
* <Output>
* block :: address of newly allocated block
*
* <Return>
* Error code. 0 means success.
*
* <Note>
* If your allocation routine ALWAYS zeroes the new block, you
* should set the flag FT_SYSTEM_FLAG_ALLOC_ZEROES in your system
* object 'flags' field.
*
* If you have set the flag FT_SYSTEM_FLAG_REPORT_CURRENT_ALLOC in
* your system's "system_flags" field, this function should update
* the "current_alloc" field of the system object.
*
************************************************************************/
static
void* ft_alloc( FT_Memory memory,
long size )
{
(void)memory;
return malloc(size);
}
/************************************************************************
*
* <FuncType>
* FT_Realloc_Func
*
* <Description>
* The memory reallocator function type
*
* <Input>
* system :: pointer to the system object
* new_size :: new requested size in bytes
*
* <InOut>
* block :: address of block in memory
*
* <Return>
* Error code. 0 means success.
*
* <Note>
* This function is _never_ called when the system flag
* FT_SYSTEM_FLAG_NO_REALLOC is set. Instead, the engine will emulate
* realloc through "alloc" and "free".
*
* Note that this is possible due to the fact that FreeType's
* "FT_Realloc" always requests the _current_ size of the reallocated
* block as a parameter, thus avoiding memory leaks.
*
* If you have set the flag FT_SYSTEM_FLAG_REPORT_CURRENT_ALLOC in
* your system's "system_flags" field, this function should update
* the "current_alloc" field of the system object.
*
************************************************************************/
static
void* ft_realloc( FT_Memory memory,
long cur_size,
long new_size,
void* block )
{
(void)memory;
(void)cur_size;
return realloc( block, new_size );
}
/************************************************************************
*
* <FuncType>
* FT_Free_Func
*
* <Description>
* The memory release function type
*
* <Input>
* system :: pointer to the system object
* block :: address of block in memory
*
* <Note>
* If you have set the flag FT_SYSTEM_FLAG_REPORT_CURRENT_ALLOC in
* your system's "system_flags" field, this function should update
* the "current_alloc" field of the system object.
*
************************************************************************/
static
void ft_free( FT_Memory memory,
void* block )
{
(void)memory;
free( block );
}
/*********************************************************************/
/* */
/* RESOURCE MANAGEMENT INTERFACE */
/* */
#define STREAM_FILE(stream) ((FILE*)stream->descriptor.pointer)
static
void ft_close_stream( FT_Stream stream )
{
fclose( STREAM_FILE(stream) );
}
static
unsigned long ft_io_stream( FT_Stream stream,
unsigned long offset,
char* buffer,
unsigned long count )
{
FILE* file;
file = STREAM_FILE(stream);
fseek( file, offset, SEEK_SET );
return (unsigned long)fread( buffer, 1, count, file );
}
extern
int FT_New_Stream( const char* filepathname,
FT_Stream stream )
{
FILE* file;
file = fopen( filepathname, "rb" );
if (!file)
return FT_Err_Cannot_Open_Resource;
fseek( file, 0, SEEK_END );
stream->size = ftell(file);
fseek( file, 0, SEEK_SET );
stream->descriptor.pointer = file;
stream->pos = 0;
stream->read = ft_io_stream;
stream->close = ft_close_stream;
return 0;
}
extern
FT_Memory FT_New_Memory( void )
{
FT_Memory memory;
memory = (FT_Memory)malloc( sizeof(*memory) );
if (memory)
{
memory->user = 0;
memory->alloc = ft_alloc;
memory->realloc = ft_realloc;
memory->free = ft_free;
}
return memory;
}

View File

@ -1,12 +0,0 @@
@cd obj
@LCCLIB /out:freetype.lib *.obj
@echo The library file `obj/freetype.lib' was generated.
@exit 0
; the LCC Librarian has many flaws, one of them is that it *requires* that
; all object files be placed in the current directory. Another flaw is that
; it cannot accept a long list of object files.
;
; this file is used to build the library file `obj/freetype.lib'
;

142
config/win32/w32-dev.mk Normal file
View File

@ -0,0 +1,142 @@
#*******************************************************************
#*
#* FreeType 2 Configuration rules for Win32 + GCC
#* THIS VERSION DISABLES OPTIMIZATIONS FOR DEBUGGING !!
#*
#* Copyright 1996-2000 by
#* David Turner, Robert Wilhelm, and Werner Lemberg.
#*
#* This file is part of the FreeType project, and may only be used
#* modified and distributed under the terms of the FreeType project
#* license, LICENSE.TXT. By continuing to use, modify, or distribute
#* this file you indicate that you have read the license and
#* understand and accept it fully.
#*
#* Please read the file "freetype/docs/config.txt" to understand
#* what this file does..
#*
#*
#* NOTE : This version requires that GNU Make be invoked from the
#* Windows Shell (_not_ Cygwin BASH !!)
#*
#*******************************************************************
ifndef TOP
TOP := .
endif
DELETE := del
SEP := /
HOSTSEP := $(strip \ )
BUILD := $(TOP)/config/win32
PLATFORM := win32
CC := gcc
# the directory where all object files are placed
#
# Note that this is not $(TOP)/obj !!
# This lets you build the library in your own directory
# with something like :
#
# set TOP=....../path/to/freetype2/top/dir...
# mkdir obj
# make -f %TOP%/Makefile setup [options]
# make -f %TOP%/Makefile
#
#
OBJ_DIR := obj
# the directory where all library files are placed
#
# by default, this is the same as OBJ_DIR, however, this can be
# changed to suit particular needs..
#
LIB_DIR := $(OBJ_DIR)
# the object file extension, this can be .o, .tco, .obj, etc..
# depending on the platform
#
O := o
# the library file extension, this can be .a, .lib, etc..
# depending on the platform
#
A := a
# The name of the final library file.
# Note that the DOS-specific Makefile uses a shorter (8.3) name
#
LIBRARY := libfreetype
# path inclusion flag.
#
# Some compilers use a different flag than '-I' to specify an
# additional include path. Examples are "/i=" or "-J", etc...
#
I := -I
# The link flag used to specify a given library file on link.
# Note that this is only used to compile the demo programs, not
# the library itself.
#
L := -l
# C flag used to define a macro before the compilation of a given
# source object. Usually is '-D' like in "-DDEBUG"
#
D := -D
# Target flag - beware, there is a space after the 'o' !!
#
#
T := -o
# C flags
#
# These should concern :
#
# - debug output
# - optimization
# - warnings
# - ansi compliance..
#
ifndef CFLAGS
CFLAGS := -c -g -O0 -Wall
endif
# ANSIFLAGS : put there the flags used to make your compiler ANSI-compliant
# nothing (if it already is by default like LCC).
#
ANSIFLAGS := -ansi -pedantic
ifdef BUILD_FREETYPE
include $(TOP)/config/freetype.mk
clean_freetype: clean_freetype_dos
distclean_freetype: distclean_freetype_dos
# Librarian to use to build the static library
#
FT_LIBRARIAN := $(AR) -r
# This final rule is used to link all object files into a single
# library. It is part of the system-specific sub-Makefile because not
# all librarians accept a simple syntax like :
#
# librarian library_file {list of object files}
#
$(FT_LIBRARY): $(OBJECTS_LIST)
-$(DELETE) $(subst $(SEP),$(HOSTSEP),$(FT_LIBRARY)) 2> nul
$(FT_LIBRARIAN) $@ $(OBJECTS_LIST)
endif

141
config/win32/w32-gcc.mk Normal file
View File

@ -0,0 +1,141 @@
#*******************************************************************
#*
#* FreeType 2 Configuration rules for Win32 + GCC
#*
#* Copyright 1996-2000 by
#* David Turner, Robert Wilhelm, and Werner Lemberg.
#*
#* This file is part of the FreeType project, and may only be used
#* modified and distributed under the terms of the FreeType project
#* license, LICENSE.TXT. By continuing to use, modify, or distribute
#* this file you indicate that you have read the license and
#* understand and accept it fully.
#*
#* Please read the file "freetype/docs/config.txt" to understand
#* what this file does..
#*
#*
#* NOTE : This version requires that GNU Make be invoked from the
#* Windows Shell (_not_ Cygwin BASH !!)
#*
#*******************************************************************
ifndef TOP
TOP := .
endif
DELETE := del
SEP := /
HOSTSEP := $(strip \ )
BUILD := $(TOP)/config/win32
PLATFORM := win32
CC := gcc
# the directory where all object files are placed
#
# Note that this is not $(TOP)/obj !!
# This lets you build the library in your own directory
# with something like :
#
# set TOP=....../path/to/freetype2/top/dir...
# mkdir obj
# make -f %TOP%/Makefile setup [options]
# make -f %TOP%/Makefile
#
#
OBJ_DIR := obj
# the directory where all library files are placed
#
# by default, this is the same as OBJ_DIR, however, this can be
# changed to suit particular needs..
#
LIB_DIR := $(OBJ_DIR)
# the object file extension, this can be .o, .tco, .obj, etc..
# depending on the platform
#
O := o
# the library file extension, this can be .a, .lib, etc..
# depending on the platform
#
A := a
# The name of the final library file.
# Note that the DOS-specific Makefile uses a shorter (8.3) name
#
LIBRARY := libfreetype
# path inclusion flag.
#
# Some compilers use a different flag than '-I' to specify an
# additional include path. Examples are "/i=" or "-J", etc...
#
I := -I
# The link flag used to specify a given library file on link.
# Note that this is only used to compile the demo programs, not
# the library itself.
#
L := -l
# C flag used to define a macro before the compilation of a given
# source object. Usually is '-D' like in "-DDEBUG"
#
D := -D
# Target flag - beware, there is a space after the 'o' !!
#
#
T := -o
# C flags
#
# These should concern :
#
# - debug output
# - optimization
# - warnings
# - ansi compliance..
#
ifndef CFLAGS
CFLAGS := -c -g -O6 -Wall
endif
# ANSIFLAGS : put there the flags used to make your compiler ANSI-compliant
# nothing (if it already is by default like LCC).
#
ANSIFLAGS := -ansi -pedantic
ifdef BUILD_FREETYPE
include $(TOP)/config/freetype.mk
clean_freetype: clean_freetype_dos
distclean_freetype: distclean_freetype_dos
# Librarian to use to build the static library
#
FT_LIBRARIAN := $(AR) -r
# This final rule is used to link all object files into a single
# library. It is part of the system-specific sub-Makefile because not
# all librarians accept a simple syntax like :
#
# librarian library_file {list of object files}
#
$(FT_LIBRARY): $(OBJECTS_LIST)
-$(DELETE) $(subst $(SEP),$(HOSTSEP),$(FT_LIBRARY)) 2> nul
$(FT_LIBRARIAN) $@ $(OBJECTS_LIST)
endif

135
config/win32/w32-lcc.mk Normal file
View File

@ -0,0 +1,135 @@
#*******************************************************************
#*
#* FreeType 2 Configuration rules for Win32 + LCC
#*
#* Copyright 1996-2000 by
#* David Turner, Robert Wilhelm, and Werner Lemberg.
#*
#* This file is part of the FreeType project, and may only be used
#* modified and distributed under the terms of the FreeType project
#* license, LICENSE.TXT. By continuing to use, modify, or distribute
#* this file you indicate that you have read the license and
#* understand and accept it fully.
#*
#* Please read the file "freetype/docs/config.txt" to understand
#* what this file does..
#*
#*******************************************************************
ifndef TOP
TOP := .
endif
DELETE := del
SEP := /
HOSTSEP := \\
BUILD := $(TOP)$(SEP)config$(SEP)win32
PLATFORM := win32
CC := lcc
# the directory where all object files are placed
#
# Note that this is not $(TOP)/obj !!
# This lets you build the library in your own directory
# with something like :
#
# set TOP=....../path/to/freetype2/top/dir...
# mkdir obj
# make -f %TOP%/Makefile setup [options]
# make -f %TOP%/Makefile
#
#
OBJ_DIR := obj
# the directory where all library files are placed
#
# by default, this is the same as OBJ_DIR, however, this can be
# changed to suit particular needs..
#
LIB_DIR := $(OBJ_DIR)
# the object file extension, this can be .o, .tco, .obj, etc..
# depending on the platform
#
O := obj
# the library file extension, this can be .a, .lib, etc..
# depending on the platform
#
A := lib
# The name of the final library file.
# Note that the DOS-specific Makefile uses a shorter (8.3) name
#
LIBRARY := freetype
# path inclusion flag.
#
# Some compilers use a different flag than '-I' to specify an
# additional include path. Examples are "/i=" or "-J", etc...
#
I := -I
# C flag used to define a macro before the compilation of a given
# source object. Usually is '-D' like in "-DDEBUG"
#
D := -D
# Target flag - LCC uses "-Fo" instead of "-o ", what a broken compiler
#
#
T := -Fo
# The link flag used to specify a given library file on link.
# Note that this is only used to compile the demo programs, not
# the library itself.
#
L := -Fl
# C flags
#
# These should concern :
#
# - debug output
# - optimization
# - warnings
# - ansi compliance..
#
ifndef CFLAGS
CFLAGS := -c -g2 -O
endif
# ANSIFLAGS : put there the flags used to make your compiler ANSI-compliant
# nothing (if it already is by default like LCC).
#
ANSIFLAGS :=
ifdef BUILD_FREETYPE
include $(TOP)/config/freetype.mk
clean_freetype: clean_freetype_dos
distclean_freetype: distclean_freetype_dos
# This final rule is used to link all object files into a single
# library. It is part of the system-specific sub-Makefile because not
# all librarians accept a simple syntax like :
#
# librarian library_file {list of object files}
#
DIR_OBJ := $(subst /,\\,$(OBJ_DIR))
$(FT_LIBRARY): $(OBJECTS_LIST)
lcclnk -o $(subst /,\\,$@) $(subst /,\\,$<)
endif

127
config/win32/w32-vcc.mk Normal file
View File

@ -0,0 +1,127 @@
#*******************************************************************
#*
#* FreeType 2 Configuration rules for Win32 + Visual C++
#*
#* Copyright 1996-2000 by
#* David Turner, Robert Wilhelm, and Werner Lemberg.
#*
#* This file is part of the FreeType project, and may only be used
#* modified and distributed under the terms of the FreeType project
#* license, LICENSE.TXT. By continuing to use, modify, or distribute
#* this file you indicate that you have read the license and
#* understand and accept it fully.
#*
#* Please read the file "freetype/docs/config.txt" to understand
#* what this file does..
#*
#*******************************************************************
DELETE := del
SEP := /
HOSTSEP := $(strip \ )
BUILD := $(TOP)$(SEP)config$(SEP)win32
PLATFORM := win32
CC := cl
# the directory where all object files are placed
#
# Note that this is not $(TOP)/obj !!
# This lets you build the library in your own directory
# with something like :
#
# set TOP=....../path/to/freetype2/top/dir...
# mkdir obj
# make -f %TOP%/Makefile setup [options]
# make -f %TOP%/Makefile
#
#
OBJ_DIR := obj
# the directory where all library files are placed
#
# by default, this is the same as OBJ_DIR, however, this can be
# changed to suit particular needs..
#
LIB_DIR := $(OBJ_DIR)
# the object file extension, this can be .o, .tco, .obj, etc..
# depending on the platform
#
O := obj
# the library file extension, this can be .a, .lib, etc..
# depending on the platform
#
A := lib
# The name of the final library file.
# Note that the DOS-specific Makefile uses a shorter (8.3) name
#
LIBRARY := freetype
# path inclusion flag.
#
# Some compilers use a different flag than '-I' to specify an
# additional include path. Examples are "/i=" or "-J", etc...
#
I := /I
# The link flag used to specify a given library file on link.
# Note that this is only used to compile the demo programs, not
# the library itself.
#
L := /Fl
# C flag used to define a macro before the compilation of a given
# source object. Usually is '-D' like in "-DDEBUG"
#
D := /D
# Target flag - LCC uses "-Fo" instead of "-o ", what a broken compiler
#
#
T := /Fo
# C flags
#
# These should concern :
#
# - debug output
# - optimization
# - warnings
# - ansi compliance..
#
ifndef CFLAGS
CFLAGS := /nologo /c /Ox /G5 /W3 /WX
endif
# ANSI_FLAGS : put there the flags used to make your compiler ANSI-compliant
# nothing (if it already is by default like LCC).
#
ANSI_FLAGS := /Za
ifdef BUILD_FREETYPE
include $(TOP)/config/freetype.mk
clean_freetype: clean_freetype_dos
distclean_freetype: distclean_freetype_dos
# This final rule is used to link all object files into a single
# library. It is part of the system-specific sub-Makefile because not
# all librarians accept a simple syntax like :
#
# librarian library_file {list of object files}
#
$(FT_LIBRARY): $(OBJECTS_LIST)
lib /nologo /out:$@ $(OBJECTS_LIST)
endif