Commit c289782f authored by David Turner's avatar David Turner
Browse files

re-adding a "unix-dev.mk". Debugging libtool output

is just too much of a pain for me, I prefer a good old
static lib without optimizations :-)

"make devel" is back on Unix then..
parent e4fc656e
LATEST CHANGES
- fixed two memory leaks:
- the memory manager (16 bytes) isn't released in FT_Done_FreeType !!
- using custom input streams, the copy of the original stream
was never released
- fixed the auto-hinter by performing automatic computation of the
"filling direction" of each glyph. This is done through a simple and
fast approximation, and seems to work (problems spotted by Werner
though). The Arphic fonts are a lot nicer though there are still a
lot of things to do to handle Asian fonts correctly..
===========================================================================
BETA-8 (RELEASE CANDIDATE) CHANGES
- deactivated the trueType bytecode interpreter by default
- deactivated the "src/type1" font driver. Now "src/type1z" is
......
......@@ -22,30 +22,29 @@ ifeq ($(PLATFORM),ansi)
COPY := cp
DELETE := rm -f
# If a Unix platform is detected, the configure script is called and
# `unix.mk' is created.
#
# Arguments to `configure' should be in the CFG variable. Example:
#
# make CFG="--prefix=/usr --disable-static"
#
# If you need to set CFLAGS or LDFLAGS, do it here also.
#
# Feel free to add support for other platform specific compilers in this
# directory (e.g. solaris.mk + changes here to detect the platform).
#
CONFIG_FILE := unix.mk
setup: unix.mk
unix: setup
# If `devel' is the requested target, use `-g -O0' as the default value
# for CFLAGS if CFLAGS isn't set.
# If `devel' is the requested target, we use a special configuration
# file named "unix-dev.mk". It disables optimization and libtool..
#
ifneq ($(findstring devel,$(MAKECMDGOALS)),)
ifndef CFLAGS
USE_CFLAGS := CFLAGS="-g -O0"
endif
CONFIG_FILE := unix-dev.mk
devel: setup
else
# If a Unix platform is detected, the configure script is called and
# `unix.mk' is created.
#
# Arguments to `configure' should be in the CFG variable. Example:
#
# make CFG="--prefix=/usr --disable-static"
#
# If you need to set CFLAGS or LDFLAGS, do it here also.
#
# Feel free to add support for other platform specific compilers in this
# directory (e.g. solaris.mk + changes here to detect the platform).
#
CONFIG_FILE := unix.mk
setup: unix.mk
unix: setup
endif
setup: std_setup
......
......@@ -302,5 +302,21 @@
return memory;
}
/*************************************************************************/
/* */
/* <Function> */
/* FT_Done_Memory */
/* */
/* <Description> */
/* Discards memory manager. */
/* */
/* <Input> */
/* memory :: handle to memory manager */
/* */
FT_EXPORT_FUNC( void ) FT_Done_Memory( FT_Memory memory )
{
free( memory );
}
/* END */
#
# FreeType 2 Configuration rules for Unix + GCC
#
# Development version without optimizations & libtool
#
# 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.
#
# NOTE: This version requires that GNU Make is invoked from the Windows
# Shell (_not_ Cygwin BASH)!
#
ifndef TOP
TOP := .
endif
DELETE := rm -f
SEP := /
HOSTSEP := $(SEP)
BUILD := $(TOP)/builds/unix
PLATFORM := unixdev # do not set it to "unix", or libtool will trick you..
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 (for standard and static libraries). This can be
# .o, .tco, .obj, etc., depending on the platform.
#
O := o
SO := o
# The library file extension (for standard and static libraries). This can
# be .a, .lib, etc., depending on the platform.
#
A := a
SA := 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'.
#
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
# 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
# Target flag.
#
T := -o # Don't remove this comment line! We need the space after `-o'.
# 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 -g -O0 -Wall -W
endif
# ANSIFLAGS: Put there the flags used to make your compiler ANSI-compliant.
#
ANSIFLAGS := -ansi -pedantic
ifdef BUILD_FREETYPE
# Now include the main sub-makefile. It contains all the rules used to
# build the library with the previous variables defined.
#
include $(TOP)/builds/freetype.mk
# The cleanup targets.
#
clean_freetype: clean_freetype_std
distclean_freetype: distclean_freetype_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) $(subst $(SEP),$(HOSTSEP),$(FT_LIBRARY)) 2> nul
$(FT_LIBRARIAN) $@ $(OBJECTS_LIST)
endif
# EOF
......@@ -506,6 +506,7 @@
FT_EXPORT_DEF( FT_Memory ) FT_New_Memory( void );
FT_EXPORT_DEF( void ) FT_Done_Memory( FT_Memory memory );
#endif /* !FT_CONFIG_OPTION_NO_DEFAULT_SYSTEM */
......
......@@ -322,10 +322,13 @@
outline->max_contours = new_contours;
}
/* then, realloc the points, segments & edges arrays if needed */
if ( num_points > outline->max_points )
/* then, realloc the points, segments & edges arrays if needed */
/* note that we reserved two additional point positions, used to */
/* hint metrics appropriately.. */
/* */
if ( num_points+2 > outline->max_points )
{
FT_Int news = ( num_points + 7 ) & -8;
FT_Int news = ( num_points+2 + 7 ) & -8;
FT_Int max = outline->max_points;
......
......@@ -152,4 +152,38 @@ const FT_Module_Class* ft_default_modules[] =
}
/*************************************************************************/
/* */
/* <Function> */
/* FT_Done_FreeType */
/* */
/* <Description> */
/* Destroys a given FreeType library object and all of its childs, */
/* including resources, drivers, faces, sizes, etc. */
/* */
/* <Input> */
/* library :: A handle to the target library object. */
/* */
/* <Return> */
/* FreeType error code. 0 means success. */
/* */
FT_EXPORT_FUNC( FT_Error ) FT_Done_FreeType( FT_Library library )
{
if (library)
{
FT_Memory memory = library->memory;
/* Discard the library object */
FT_Done_Library( library );
/* discard memory manager */
FT_Done_Memory( memory );
}
return FT_Err_Ok;
}
/* END */
......@@ -265,8 +265,10 @@
}
else if ( args->flags & ft_open_stream && args->stream )
{
*stream = *(args->stream);
stream->memory = memory;
/* in this case, we do not need to allocate a new stream */
/* object. The caller is responsible for closing it himself!! */
FREE(stream);
stream = args->stream;
}
else
error = FT_Err_Invalid_Argument;
......@@ -300,16 +302,19 @@
static
void ft_done_stream( FT_Stream* astream )
void ft_done_stream( FT_Stream* astream, FT_Int external )
{
FT_Stream stream = *astream;
FT_Memory memory = stream->memory;
if ( stream->close )
stream->close( stream );
FREE( stream );
if (!external)
{
FT_Memory memory = stream->memory;
FREE( stream );
}
*astream = 0;
}
......@@ -1146,8 +1151,8 @@
clazz->done_face( face );
/* close the stream for this face if needed */
if ( ( face->face_flags & FT_FACE_FLAG_EXTERNAL_STREAM ) == 0 )
ft_done_stream( &face->stream );
ft_done_stream( &face->stream,
(face->face_flags & FT_FACE_FLAG_EXTERNAL_STREAM) != 0 );
/* get rid of it */
FREE( face );
......@@ -1392,7 +1397,7 @@
FT_Stream stream;
FT_Face face = 0;
FT_ListNode node = 0;
FT_Bool external_stream;
/* test for valid `library' and `args' delayed to */
/* ft_new_input_stream() */
......@@ -1402,6 +1407,8 @@
*aface = 0;
external_stream = ( args->flags & ft_open_stream && args->stream );
/* create input stream */
error = ft_new_input_stream( library, args, &stream );
if ( error )
......@@ -1436,7 +1443,7 @@
else
error = FT_Err_Invalid_Handle;
ft_done_stream( &stream );
ft_done_stream( &stream, external_stream );
goto Fail;
}
else
......@@ -1473,7 +1480,7 @@
}
}
ft_done_stream( &stream );
ft_done_stream( &stream, external_stream );
/* no driver is able to handle this format */
error = FT_Err_Unknown_File_Format;
......@@ -1484,7 +1491,7 @@
FT_TRACE4(( "FT_New_Face: New face object, adding to list\n" ));
/* set the FT_FACE_FLAG_EXTERNAL_STREAM bit for FT_Done_Face */
if ( args->flags & ft_open_stream && args->stream )
if ( external_stream )
face->face_flags |= FT_FACE_FLAG_EXTERNAL_STREAM;
/* add the face object to its driver's list */
......@@ -1654,8 +1661,9 @@
error = clazz->attach_file( face, stream );
/* close the attached stream */
if ( !parameters->stream || ( parameters->flags & ft_open_stream ) )
ft_done_stream( &stream );
ft_done_stream( &stream,
(FT_Bool)(parameters->stream &&
(parameters->flags & ft_open_stream)) );
Exit:
return error;
......@@ -3217,30 +3225,4 @@
}
/*************************************************************************/
/* */
/* <Function> */
/* FT_Done_FreeType */
/* */
/* <Description> */
/* Destroys a given FreeType library object and all of its childs, */
/* including resources, drivers, faces, sizes, etc. */
/* */
/* <Input> */
/* library :: A handle to the target library object. */
/* */
/* <Return> */
/* FreeType error code. 0 means success. */
/* */
FT_EXPORT_FUNC( FT_Error ) FT_Done_FreeType( FT_Library library )
{
/* test for valid `library' delayed to FT_Done_Library() */
/* Discard the library object */
FT_Done_Library( library );
return FT_Err_Ok;
}
/* END */
......@@ -296,4 +296,20 @@
}
/*************************************************************************/
/* */
/* <Function> */
/* FT_Done_Memory */
/* */
/* <Description> */
/* Discards memory manager. */
/* */
/* <Input> */
/* memory :: handle to memory manager */
/* */
FT_EXPORT_FUNC( void ) FT_Done_Memory( FT_Memory memory )
{
free( memory );
}
/* END */
......@@ -18,7 +18,7 @@
#define FT_MAKE_OPTION_SINGLE_OBJECT
#include <psmodule.c>
#include <psnames/psmodule.c>
/* END */
......@@ -539,6 +539,8 @@
FT_Error error = FT_Err_Ok;
FT_UNUSED(debug); /* used by truetype interpreter only */
n_ins = load->glyph->control_len;
/* add shadow points */
......@@ -674,7 +676,8 @@
FT_GlyphLoader* gloader = loader->gloader;
FT_Bool opened_frame = 0;
FT_UNUSED(stream); /* used with bytecode interpreter only */
/* check glyph index */
index = glyph_index;
if ( index >= (FT_UInt)face->root.num_glyphs )
......
......@@ -143,7 +143,6 @@
return error;
}
#endif /* TT_CONFIG_OPTION_BYTECODE_INTERPRETER */
......@@ -730,7 +729,8 @@
TT_Destroy_Context( driver->context, driver->root.root.memory );
driver->context = NULL;
}
#else
FT_UNUSED(driver);
#endif
}
......
......@@ -119,6 +119,7 @@
#endif /* TT_CONFIG_OPTION_BYTECODE_INTERPRETER */
/*************************************************************************/
/* */
/* EXECUTION SUBTABLES */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment