ftcalc.c, ftextend.c, ftoutln.c, ftraster.c, ftstream.c:

Removing trailing spaces.

ftlist.h:
  Removing duplicated documentation (which is in ftlist.c also).

ftinit.c, ftlist.c, ftobjs.c:
  Formatting, adding documentation.
This commit is contained in:
Werner Lemberg 2000-01-10 17:19:45 +00:00
parent ecbfb5fa9a
commit 7880dd6630
9 changed files with 466 additions and 493 deletions

View File

@ -4,7 +4,7 @@
/* */
/* FreeType initialisation layer (body). */
/* */
/* 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 */
@ -15,37 +15,31 @@
/* */
/***************************************************************************/
/**************************************************************************
*
* The purpose of this file is to implement the three following
* functions:
*
* FT_Default_Drivers:
* This function is used to add the set of default drivers
* to a fresh new library object. The set is computed at compile
* time from the Makefiles inclusions in Makefile.lib. See the
* document "FreeType Internals" for more info.
*
*
* FT_Init_FreeType:
* This function creates a system object for the current platform,
* builds a library out of it, then calls FT_Default_Drivers
*
*
* FT_Done_FreeType:
* This function simply finalise the library and the corresponding
* system object.
*
*
* Note that even if FT_Init_FreeType uses the implementation of the
* system object defined at build time, client applications are still
* able to provide their own "ftsystem.c"
*
*
*
*
*
************************************************************************/
/*************************************************************************/
/* */
/* The purpose of this file is to implement the three following */
/* functions: */
/* */
/* FT_Default_Drivers: */
/* This function is used to add the set of default drivers to a */
/* fresh new library object. The set is computed at compile time */
/* from the Makefiles inclusions in Makefile.lib. See the document */
/* `FreeType Internals' for more info. */
/* */
/* FT_Init_FreeType: */
/* This function creates a system object for the current platform, */
/* builds a library out of it, then calls FT_Default_Drivers(). */
/* */
/* FT_Done_FreeType: */
/* This function simply finalizes the library and the corresponding */
/* system object. */
/* */
/* Note that even if FT_Init_FreeType() uses the implementation of the */
/* system object defined at build time, client applications are still */
/* able to provide their own `ftsystem.c'. */
/* */
/*************************************************************************/
#include <ftobjs.h>
#include <ftconfig.h>
@ -56,17 +50,20 @@
#define FT_COMPONENT trace_init
#undef FT_DRIVER
#define FT_DRIVER(x) extern FT_DriverInterface x;
#define FT_DRIVER( x ) extern FT_DriverInterface x;
#include <ftmodule.h>
#undef FT_DRIVER
#define FT_DRIVER(x) &x,
#define FT_DRIVER( x ) &x,
static
const FT_DriverInterface* ft_default_drivers[] = {
const FT_DriverInterface* ft_default_drivers[] =
{
#include <ftmodule.h>
0
};
};
/*************************************************************************/
/* */
@ -76,7 +73,7 @@ const FT_DriverInterface* ft_default_drivers[] = {
/* <Description> */
/* Adds the set of default drivers to a given library object. */
/* */
/* <Input> */
/* <InOut> */
/* library :: A handle to a new library object. */
/* */
EXPORT_FUNC
@ -85,16 +82,15 @@ const FT_DriverInterface* ft_default_drivers[] = {
FT_Error error;
const FT_DriverInterface* *cur;
cur = ft_default_drivers;
while (*cur)
while ( *cur )
{
error = FT_Add_Driver( library, *cur );
/* notify errors, but don't stop */
if (error)
{
FT_ERROR(( "FT.Default_Drivers: cannot install `%s', error = %x\n",
if ( error )
FT_ERROR(( "FT.Default_Drivers: Cannot install `%s', error = %x\n",
(*cur)->driver_name, error ));
}
cur++;
}
}
@ -113,7 +109,7 @@ const FT_DriverInterface* ft_default_drivers[] = {
/* library :: A handle to a new library object. */
/* */
/* <Return> */
/* Error code. 0 means success. */
/* FreeTyoe error code. 0 means success. */
/* */
EXPORT_FUNC
FT_Error FT_Init_FreeType( FT_Library* library )
@ -121,10 +117,12 @@ const FT_DriverInterface* ft_default_drivers[] = {
FT_Error error;
FT_Memory memory;
/* First of all, allocate a new system object -this function is part */
/* of the system-specific component, i.e. ftsystem.c */
/* First of all, allocate a new system object - -this function is part */
/* of the system-specific component, i.e. `ftsystem.c'. */
memory = FT_New_Memory();
if (!memory)
if ( !memory )
{
FT_ERROR(( "FT_Init_FreeType:" ));
FT_ERROR(( " cannot find memory manager" ));
@ -132,10 +130,11 @@ const FT_DriverInterface* ft_default_drivers[] = {
}
/* builds a library out of it, then fill it with the set of */
/* default drivers.. */
/* default drivers. */
error = FT_New_Library( memory, library );
if ( !error )
FT_Default_Drivers(*library);
FT_Default_Drivers( *library );
return error;
}

View File

@ -4,7 +4,7 @@
/* */
/* Generic list support for FreeType (body). */
/* */
/* 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 */
@ -15,11 +15,10 @@
/* */
/***************************************************************************/
/*************************************************************************/
/* */
/* This file implements functions relative to list processing. Its */
/* data structures are defined in freetype.h. */
/* data structures are defined in `freetype.h'. */
/* */
/*************************************************************************/
@ -54,7 +53,7 @@
cur = list->head;
while ( cur )
{
if (cur->data == data)
if ( cur->data == data )
return cur;
cur = cur->next;
@ -70,7 +69,7 @@
/* FT_List_Add */
/* */
/* <Description> */
/* Appends an element at the end of a list. */
/* Appends an element to the end of a list. */
/* */
/* <InOut> */
/* list :: A pointer to the parent list. */
@ -222,7 +221,7 @@
/* argument to the iterator. */
/* */
/* <Return> */
/* The result of the last iterator call. */
/* The result (an error code) of the last iterator call. */
/* */
BASE_FUNC
FT_Error FT_List_Iterate( FT_List list,

View File

@ -4,7 +4,7 @@
/* */
/* Generic list support for FreeType (specification). */
/* */
/* 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 */
@ -15,11 +15,10 @@
/* */
/***************************************************************************/
/*************************************************************************/
/* */
/* This file implements functions relative to list processing. Its */
/* data structures are defined in freetype.h. */
/* data structures are defined in `freetype.h'. */
/* */
/*************************************************************************/
@ -34,93 +33,22 @@
#endif
/*************************************************************************/
/* */
/* <Function> */
/* FT_List_Find */
/* */
/* <Description> */
/* Finds the list node for a given listed object. */
/* */
/* <Input> */
/* list :: A pointer to the parent list. */
/* data :: The address of the listed object. */
/* */
/* <Return> */
/* List node. NULL if it wasn't found. */
/* */
EXPORT_DEF
FT_ListNode FT_List_Find( FT_List list,
void* data );
/*************************************************************************/
/* */
/* <Function> */
/* FT_List_Add */
/* */
/* <Description> */
/* Appends an element at the end of a list. */
/* */
/* <InOut> */
/* list :: A pointer to the parent list. */
/* node :: The node to append. */
/* */
EXPORT_DEF
void FT_List_Add( FT_List list,
FT_ListNode node );
/*************************************************************************/
/* */
/* <Function> */
/* FT_List_Insert */
/* */
/* <Description> */
/* Inserts an element at the head of a list. */
/* */
/* <InOut> */
/* list :: A pointer to parent list. */
/* node :: The node to insert. */
/* */
EXPORT_DEF
void FT_List_Insert( FT_List list,
FT_ListNode node );
/*************************************************************************/
/* */
/* <Function> */
/* FT_List_Remove */
/* */
/* <Description> */
/* Removes a node from a list. This function doesn't check whether */
/* the node is in the list! */
/* */
/* <Input> */
/* node :: The node to remove. */
/* */
/* <InOut> */
/* list :: A pointer to the parent list. */
/* */
EXPORT_DEF
void FT_List_Remove( FT_List list,
FT_ListNode node );
/*************************************************************************/
/* */
/* <Function> */
/* FT_List_Up */
/* */
/* <Description> */
/* Moves a node to the head/top of a list. Used to maintain LRU */
/* lists. */
/* */
/* <InOut> */
/* list :: A pointer to the parent list. */
/* node :: The node to move. */
/* */
EXPORT_DEF
void FT_List_Up( FT_List list,
FT_ListNode node );
@ -144,26 +72,6 @@
void* user );
/*************************************************************************/
/* */
/* <Function> */
/* FT_List_Iterate */
/* */
/* <Description> */
/* Parses a list and calls a given iterator function on each element. */
/* Note that parsing is stopped as soon as one of the iterator calls */
/* returns a non-zero value. */
/* */
/* <Input> */
/* list :: A handle to the list. */
/* iterator :: An interator function, called on each node of the */
/* list. */
/* user :: A user-supplied field which is passed as the second */
/* argument to the iterator. */
/* */
/* <Return> */
/* The result of the last iterator call. */
/* */
EXPORT_DEF
FT_Error FT_List_Iterate( FT_List list,
FT_List_Iterator iterator,
@ -177,40 +85,20 @@
/* */
/* <Description> */
/* An FT_List iterator function which is called during a list */
/* finalisation by FT_List_Finalize() to destroy all elements in a */
/* finalization by FT_List_Finalize() to destroy all elements in a */
/* given list. */
/* */
/* <Input> */
/* system :: The current system object. */
/* data :: The current object to destroy. */
/* user :: A typeless pointer passed to FT_List_Iterate(). It can */
/* used to point to the iteration's state. */
/* be used to point to the iteration's state. */
/* */
typedef void (*FT_List_Destructor)( FT_Memory memory,
void* data,
void* user );
/*************************************************************************/
/* */
/* <Function> */
/* FT_List_Finalize */
/* */
/* <Description> */
/* Destroys all elements in the list as well as the list itself. */
/* */
/* <Input> */
/* list :: A handle to the list. */
/* */
/* destroy :: A list destructor that will be applied to each element */
/* of the list. */
/* */
/* system :: The current system object where destructions take */
/* place. */
/* */
/* user :: A user-supplied field which is passed as the last */
/* argument to the destructor. */
/* */
EXPORT_DEF
void FT_List_Finalize( FT_List list,
FT_List_Destructor destroy,

View File

@ -4,7 +4,7 @@
/* */
/* The FreeType private base classes (base). */
/* */
/* 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 */
@ -20,6 +20,8 @@
#include <ftdebug.h>
#include <ftstream.h>
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
@ -35,7 +37,7 @@
/*************************************************************************/
/* */
/* The macro FT_COMPONENT is used in trace mode. It is an implicit */
/* parameter of the PTRACE() and PERROR() macros, used to print/log */
/* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */
/* messages during execution. */
/* */
#undef FT_COMPONENT
@ -71,13 +73,13 @@
{
FT_Assert( P != 0 );
if (size > 0)
if ( size > 0 )
{
*P = memory->alloc( memory, size );
if (!*P)
if ( !*P )
{
FT_ERROR(( "FT.Alloc:" ));
FT_ERROR(( " out of memory ? (%ld requested)\n",
FT_ERROR(( " Out of memory? (%ld requested)\n",
size ));
return FT_Err_Out_Of_Memory;
@ -122,10 +124,10 @@
/* All callers of FT_Realloc _must_ provide the current block size */
/* as well as the new one. */
/* */
/* When the memory object's flag FT_SYSTEM_FLAG_NO_REALLOC is */
/* set, this function will try to emulate a realloc through uses */
/* of FT_Alloc and FT_Free. Otherwise, it will call the system- */
/* specific "realloc" implementation. */
/* If the memory object's flag FT_SYSTEM_FLAG_NO_REALLOC is set, this */
/* function will try to emulate a reallocation using FT_Alloc() and */
/* FT_Free(). Otherwise, it will call the system-specific `realloc' */
/* implementation. */
/* */
/* (Some embedded systems do not have a working realloc). */
/* */
@ -137,6 +139,7 @@
{
void* Q;
FT_Assert( P != 0 );
/* if the original pointer is NULL, call FT_Alloc() */
@ -151,14 +154,15 @@
}
Q = memory->realloc( memory, current, size, *P );
if ( !Q ) goto Fail;
if ( !Q )
goto Fail;
*P = Q;
return FT_Err_Ok;
Fail:
FT_ERROR(( "FT.Realloc:" ));
FT_ERROR(( " failed (current %ld, requested %ld)\n",
FT_ERROR(( " Failed (current %ld, requested %ld)\n",
current, size ));
return FT_Err_Out_Of_Memory;
}
@ -204,6 +208,8 @@
}
}
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
@ -267,12 +273,9 @@
/* Destroys a given driver object. This also destroys all child */
/* faces. */
/* */
/* <Input> */
/* <InOut> */
/* driver :: A handle to the target driver object. */
/* */
/* <Return> */
/* Error code. 0 means success. */
/* */
/* <Note> */
/* The driver _must_ be LOCKED! */
/* */
@ -281,6 +284,7 @@
{
FT_Memory memory = driver->memory;
/* now, finalize all faces in the driver list */
FT_List_Finalize( &driver->faces_list,
(FT_List_Destructor)destroy_face,
@ -288,21 +292,33 @@
driver );
/* finalize the driver object */
if (driver->interface.done_driver)
driver->interface.done_driver(driver);
if ( driver->interface.done_driver )
driver->interface.done_driver( driver );
/* finalize client-data */
if (driver->generic.finalizer)
driver->generic.finalizer(driver);
if ( driver->generic.finalizer )
driver->generic.finalizer( driver );
/* discard it */
FREE( driver );
}
/*************************************************************************/
/* */
/* <Function> */
/* FT_Get_Glyph_Format */
/* */
/* <Description> */
/* Gets the glyph format for a given format tag. */
/* */
/* <Input> */
/* library :: A handle to the library object. */
/* format_tag :: A tag identifying the glyph format. */
/* */
/* <Return> */
/* A pointer to a glyph format. 0 if `format_tag' isn't defined. */
/* */
BASE_FUNC
FT_Glyph_Format* FT_Get_Glyph_Format( FT_Library library,
FT_Glyph_Tag format_tag )
@ -310,6 +326,7 @@
FT_Glyph_Format* cur = library->glyph_formats;
FT_Glyph_Format* limit = cur + FT_MAX_GLYPH_FORMATS;
for ( ; cur < limit; cur ++ )
{
if ( cur->format_tag == format_tag )
@ -326,18 +343,19 @@
/* FT_Set_Raster */
/* */
/* <Description> */
/* This function is used to change the raster module used to convert */
/* from a given memory object. It is thus possible to use libraries */
/* with distinct memory allocators within the same program. */
/* This function changes the raster module used to convert from a */
/* given memory object. It is thus possible to use libraries with */
/* distinct memory allocators within the same program. */
/* */
/* <Input> */
/* memory :: A handle to the original memory object. */
/* library :: A handle to the library object. */
/* interface :: A pointer to the interface of the new raster module. */
/* */
/* <Output> */
/* library :: A handle to a new library object. */
/* raster :: A handle to the raster object. */
/* */
/* <Return> */
/* Error code. 0 means success. */
/* FreeType error code. 0 means success. */
/* */
EXPORT_FUNC
FT_Error FT_Set_Raster( FT_Library library,
@ -348,6 +366,7 @@
FT_Error error = FT_Err_Ok;
FT_Glyph_Format* format;
/* allocate the render pool if necessary */
if ( !library->raster_pool &&
ALLOC( library->raster_pool, FT_RENDER_POOL_SIZE ) )
@ -355,21 +374,21 @@
/* find the glyph formatter for the raster's format */
format = FT_Get_Glyph_Format( library, interface->format_tag );
if (!format)
if ( !format )
{
error = FT_Err_Invalid_Argument;
goto Exit;
}
/* free previous raster object if necessary */
if (format->raster_allocated)
if ( format->raster_allocated )
{
FREE( format->raster );
format->raster_allocated = 0;
}
/* allocate new raster object is necessary */
if (!raster)
if ( !raster )
{
if ( ALLOC( raster, interface->size ) )
goto Exit;
@ -383,9 +402,9 @@
error = interface->init( raster,
(char*)library->raster_pool,
FT_RENDER_POOL_SIZE );
if (error)
if ( error )
{
if (format->raster_allocated)
if ( format->raster_allocated )
{
FREE( format->raster );
format->raster_allocated = 0;
@ -396,19 +415,54 @@
return error;
}
/*************************************************************************/
/* */
/* <Function> */
/* FT_Set_Debug_Hook */
/* */
/* <Description> */
/* Sets a debug hook function for debugging the interpreter of a */
/* font format. */
/* */
/* <Input> */
/* library :: A handle to the library object. */
/* hook_index :: The index of the debug hook. You should use the */
/* values defined in ftobjs.h, e.g. */
/* FT_DEBUG_HOOK_TRUETYPE */
/* debug_hook :: The function used to debug the interpreter. */
/* */
/* <Note> */
/* Currently, four debug hook slots are available, but only two (for */
/* the TrueType and the Type 1 interpreter) are defined. */
/* */
EXPORT_FUNC
void FT_Set_Debug_Hook( FT_Library library,
FT_UInt hook_index,
FT_DebugHook_Func debug_hook )
{
if (hook_index < (sizeof(library->debug_hooks)/sizeof(void*)))
{
if ( hook_index < ( sizeof ( library->debug_hooks ) / sizeof ( void* ) ) )
library->debug_hooks[hook_index] = debug_hook;
}
}
/*************************************************************************/
/* */
/* <Function> */
/* FT_Add_Glyph_Format */
/* */
/* <Description> */
/* Adds a glyph format to the library. */
/* */
/* <InOut> */
/* library :: A handle to the library object. */
/* */
/* <Input> */
/* format :: A pointer to the new glyph format. */
/* */
/* <Return> */
/* FreeType error code. 0 means success. */
/* */
BASE_FUNC
FT_Error FT_Add_Glyph_Format( FT_Library library,
FT_Glyph_Format* format )
@ -419,6 +473,7 @@
FT_Glyph_Format* cur = library->glyph_formats;
FT_Glyph_Format* limit = cur + FT_MAX_GLYPH_FORMATS;
for ( ; cur < limit; cur++ )
{
/* return an error if the format is already registered */
@ -443,7 +498,23 @@
}
/*************************************************************************/
/* */
/* <Function> */
/* FT_Remove_Glyph_Format */
/* */
/* <Description> */
/* Removes a glyph format from the library. */
/* */
/* <InOut> */
/* library :: A handle to the library object. */
/* */
/* <Input> */
/* format_tag :: A tag identifying the format to be removed. */
/* */
/* <Return> */
/* FreeType error code. 0 means success. */
/* */
BASE_FUNC
FT_Error FT_Remove_Glyph_Format( FT_Library library,
FT_Glyph_Tag format_tag )
@ -452,13 +523,14 @@
FT_Glyph_Format* cur = library->glyph_formats;
FT_Glyph_Format* limit = cur + FT_MAX_GLYPH_FORMATS;
memory = library->memory;
for ( ; cur < limit; cur++ )
{
if (cur->format_tag == format_tag)
if ( cur->format_tag == format_tag )
{
if (cur->raster_allocated)
if ( cur->raster_allocated )
{
FREE( cur->raster );
cur->raster_allocated = 0;
@ -486,10 +558,10 @@
/* memory :: A handle to the original memory object. */
/* */
/* <Output> */
/* library :: A handle to a new library object. */
/* alibrary :: A pointer to handle of a new library object. */
/* */
/* <Return> */
/* Error code. 0 means success. */
/* FreeType error code. 0 means success. */
/* */
EXPORT_FUNC
FT_Error FT_New_Library( FT_Memory memory,
@ -498,6 +570,7 @@
FT_Library library = 0;
FT_Error error;
/* First of all, allocate the library object */
if ( ALLOC( library, sizeof ( *library ) ) )
return error;
@ -514,6 +587,7 @@
0
};
error = FT_Add_Glyph_Format( library, &outline_format );
}
@ -537,7 +611,7 @@
/* library :: A handle to the target library */
/* */
/* <Return> */
/* Error code. 0 means success. */
/* FreeType error code. 0 means success. */
/* */
EXPORT_FUNC
FT_Error FT_Done_Library( FT_Library library )
@ -552,7 +626,7 @@
memory = library->memory;
/* Discard client-data */
if( library->generic.finalizer )
if ( library->generic.finalizer )
library->generic.finalizer( library );
/* Close all drivers in the library */
@ -560,6 +634,7 @@
{
FT_Driver driver = library->drivers[n];
if ( driver )
{
Destroy_Driver( driver );
@ -574,6 +649,7 @@
FT_Glyph_Format* cur = library->glyph_formats;
FT_Glyph_Format* limit = cur + FT_MAX_GLYPH_FORMATS;
for ( ; cur < limit; cur++ )
{
if ( cur->raster_allocated )
@ -596,15 +672,18 @@
/* FT_Set_Raster_Mode */
/* */
/* <Description> */
/* Set a raster-specific mode. */
/* Sets a raster-specific mode. */
/* */
/* <InOut> */
/* library :: A handle to a target library object. */
/* */
/* <Input> */
/* library :: A handle to a target library object. */
/* format :: the glyph format used to select the raster */
/* mode :: the raster-specific mode descriptor */
/* args :: the mode arguments */
/* format :: The glyph format used to select the raster. */
/* mode :: The raster-specific mode descriptor. */
/* args :: The mode arguments. */
/* */
/* <Return> */
/* Error code. 0 means success. */
/* FreeType error code. 0 means success. */
/* */
EXPORT_FUNC
FT_Error FT_Set_Raster_Mode( FT_Library library,
@ -616,13 +695,15 @@
FT_Error error;
FT_Glyph_Format* format = 0;
{
FT_Glyph_Format* cur = library->glyph_formats;
FT_Glyph_Format* limit = cur + FT_MAX_GLYPH_FORMATS;
for (; cur < limit; cur++)
for ( ; cur < limit; cur++ )
{
if (cur->format_tag == format_tag)
if ( cur->format_tag == format_tag )
{
format = cur;
break;
@ -630,14 +711,15 @@
}
}
if (!format)
if ( !format )
return FT_Err_Invalid_Argument;
memory = library->memory;
error = FT_Err_Ok;
if (format->raster)
error = format->raster_interface->set_mode( format->raster, mode, args );
if ( format->raster )
error = format->raster_interface->set_mode( format->raster,
mode, args );
return error;
}
@ -650,16 +732,17 @@
/* */
/* <Description> */
/* Registers a new driver in a given library object. This function */
/* takes only a pointer to a driver interface. It uses it to create */
/* takes only a pointer to a driver interface; it uses it to create */
/* the new driver, then sets up some important fields. */
/* */
/* <Input> */
/* <InOut> */
/* library :: A handle to the target library object. */
/* */
/* <Input> */
/* driver_interface :: A pointer to a driver interface table. */
/* */
/* <Return> */
/* Error code. 0 means success. */
/* FreeType error code. 0 means success. */
/* */
/* <Note> */
/* This function doesn't check whether the driver is already */
@ -673,6 +756,7 @@
FT_Driver driver;
FT_Memory memory;
if ( !library || !driver_interface )
return FT_Err_Invalid_Library_Handle;
@ -690,10 +774,11 @@
driver->memory = memory;
driver->interface = *driver_interface;
if (driver_interface->init_driver)
if ( driver_interface->init_driver )
{
error = driver_interface->init_driver( driver );
if ( error ) goto Fail;
if ( error )
goto Fail;
}
library->drivers[library->num_drivers++] = driver;
@ -714,7 +799,7 @@
/* FT_Remove_Driver */
/* */
/* <Description> */
/* Unregister a given driver. This closes the driver, which in turn */
/* Unregisters a given driver. This closes the driver, which in turn */
/* destroys all faces, sizes, slots, etc. associated with it. */
/* */
/* This function also DESTROYS the driver object. */
@ -723,7 +808,7 @@
/* driver :: A handle to target driver object. */
/* */
/* <Return> */
/* Error code. 0 means success. */
/* FreeType error code. 0 means success. */
/* */
EXPORT_FUNC
FT_Error FT_Remove_Driver( FT_Driver driver )
@ -756,7 +841,7 @@
Destroy_Driver( driver );
/* now move the last driver in the table to the vacant slot */
if (cur < last)
if ( cur < last )
{
*cur = *last;
*last = 0;
@ -778,15 +863,15 @@
/* FT_Get_Driver */
/* */
/* <Description> */
/* returns the handle of the driver responsible for a given format */
/* Returns the handle of the driver responsible for a given format */
/* (or service) according to its `name'. */
/* */
/* <Input> */
/* library :: handle to library object. */
/* driver_name :: name of driver to look-up. */
/* library :: A handle to the library object. */
/* driver_name :: The name of the driver to look up. */
/* */
/* <Return> */
/* handle to driver object. 0 otherwise */
/* A handle to the driver object, 0 otherwise. */
/* */
EXPORT_FUNC
FT_Driver FT_Get_Driver( FT_Library library,
@ -794,7 +879,8 @@
{
FT_Driver *cur, *limit;
if (!library || !driver_name)
if ( !library || !driver_name )
return 0;
cur = library->drivers;
@ -808,7 +894,6 @@
}
static
FT_Error open_face( FT_Driver driver,
FT_Stream stream,
@ -868,7 +953,7 @@
/* face :: A handle to a new face object. */
/* */
/* <Return> */
/* Error code. 0 means success. */
/* FreeType error code. 0 means success. */
/* */
/* <Note> */
/* Unlike FreeType 1.1, this function automatically creates a glyph */
@ -895,8 +980,9 @@
FT_Memory memory;
FT_Error error;
memory = library->memory;
if ( ALLOC( stream, sizeof(*stream) ) )
if ( ALLOC( stream, sizeof ( *stream ) ) )
goto Fail;
stream->memory = memory;
@ -905,18 +991,19 @@
if (error) goto Fail_Stream;
error = FT_Open_Face( library, stream, face_index, aface );
if (!error)
if ( !error )
return error;
/* close stream in case of error */
stream->close( stream );
Fail_Stream:
FREE(stream);
FREE( stream );
Fail:
return error;
}
EXPORT_FUNC
FT_Error FT_New_Memory_Face( FT_Library library,
void* file_base,