1999-12-17 00:11:37 +01:00
|
|
|
/***************************************************************************/
|
|
|
|
/* */
|
|
|
|
/* ftinit.c */
|
|
|
|
/* */
|
|
|
|
/* FreeType initialisation layer (body). */
|
|
|
|
/* */
|
2000-01-10 18:19:45 +01:00
|
|
|
/* Copyright 1996-2000 by */
|
1999-12-17 00:11:37 +01:00
|
|
|
/* 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. */
|
|
|
|
/* */
|
|
|
|
/***************************************************************************/
|
|
|
|
|
2000-01-10 18:19:45 +01:00
|
|
|
/*************************************************************************/
|
|
|
|
/* */
|
2000-05-31 08:55:12 +02:00
|
|
|
/* The purpose of this file is to implement the following two */
|
2000-01-10 18:19:45 +01:00
|
|
|
/* functions: */
|
|
|
|
/* */
|
2000-05-31 08:55:12 +02:00
|
|
|
/* FT_Default_Drivers(): */
|
2000-01-10 18:19:45 +01:00
|
|
|
/* This function is used to add the set of default drivers to a */
|
2000-05-31 08:55:12 +02:00
|
|
|
/* fresh new library object. The set is taken from the header file */
|
|
|
|
/* `freetype/config/ftmodule.h'. See the document `FreeType 2.0 */
|
|
|
|
/* Build System' for more information. */
|
2000-01-10 18:19:45 +01:00
|
|
|
/* */
|
2000-05-31 08:55:12 +02:00
|
|
|
/* FT_Init_FreeType(): */
|
2000-01-10 18:19:45 +01:00
|
|
|
/* This function creates a system object for the current platform, */
|
|
|
|
/* builds a library out of it, then calls FT_Default_Drivers(). */
|
|
|
|
/* */
|
|
|
|
/* 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'. */
|
|
|
|
/* */
|
|
|
|
/*************************************************************************/
|
|
|
|
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2000-05-11 20:23:52 +02:00
|
|
|
#include <freetype/config/ftconfig.h>
|
|
|
|
#include <freetype/internal/ftobjs.h>
|
|
|
|
#include <freetype/internal/ftdebug.h>
|
|
|
|
#include <freetype/internal/ftdriver.h>
|
1999-12-17 00:11:37 +01:00
|
|
|
|
|
|
|
#undef FT_COMPONENT
|
|
|
|
#define FT_COMPONENT trace_init
|
|
|
|
|
1999-12-29 01:22:24 +01:00
|
|
|
#undef FT_DRIVER
|
2000-01-10 18:19:45 +01:00
|
|
|
#define FT_DRIVER( x ) extern FT_DriverInterface x;
|
|
|
|
|
2000-05-11 20:23:52 +02:00
|
|
|
#include <freetype/config/ftmodule.h>
|
1999-12-17 00:11:37 +01:00
|
|
|
|
1999-12-29 01:22:24 +01:00
|
|
|
#undef FT_DRIVER
|
2000-01-10 18:19:45 +01:00
|
|
|
#define FT_DRIVER( x ) &x,
|
1999-12-17 00:11:37 +01:00
|
|
|
|
1999-12-29 01:22:24 +01:00
|
|
|
static
|
2000-01-10 18:19:45 +01:00
|
|
|
const FT_DriverInterface* ft_default_drivers[] =
|
|
|
|
{
|
2000-05-11 20:23:52 +02:00
|
|
|
#include <freetype/config/ftmodule.h>
|
2000-01-10 18:19:45 +01:00
|
|
|
0
|
|
|
|
};
|
|
|
|
|
1999-12-17 00:11:37 +01:00
|
|
|
|
|
|
|
/*************************************************************************/
|
|
|
|
/* */
|
|
|
|
/* <Function> */
|
|
|
|
/* FT_Default_Drivers */
|
|
|
|
/* */
|
|
|
|
/* <Description> */
|
|
|
|
/* Adds the set of default drivers to a given library object. */
|
|
|
|
/* */
|
2000-01-10 18:19:45 +01:00
|
|
|
/* <InOut> */
|
1999-12-17 00:11:37 +01:00
|
|
|
/* library :: A handle to a new library object. */
|
|
|
|
/* */
|
2000-05-31 08:55:12 +02:00
|
|
|
FT_EXPORT_FUNC( void ) FT_Default_Drivers( FT_Library library )
|
1999-12-17 00:11:37 +01:00
|
|
|
{
|
2000-06-02 02:01:14 +02:00
|
|
|
FT_Error error;
|
|
|
|
const FT_DriverInterface** cur;
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2000-01-10 18:19:45 +01:00
|
|
|
|
2000-06-02 02:01:14 +02:00
|
|
|
/* test for valid library delayed to FT_Add_Driver() */
|
|
|
|
|
1999-12-29 01:22:24 +01:00
|
|
|
cur = ft_default_drivers;
|
2000-01-10 18:19:45 +01:00
|
|
|
while ( *cur )
|
1999-12-17 00:11:37 +01:00
|
|
|
{
|
1999-12-29 01:22:24 +01:00
|
|
|
error = FT_Add_Driver( library, *cur );
|
1999-12-17 00:11:37 +01:00
|
|
|
/* notify errors, but don't stop */
|
2000-01-10 18:19:45 +01:00
|
|
|
if ( error )
|
2000-05-12 17:01:18 +02:00
|
|
|
{
|
2000-05-31 08:55:12 +02:00
|
|
|
FT_ERROR(( "FT_Default_Drivers: Cannot install `%s', error = %x\n",
|
1999-12-29 01:22:24 +01:00
|
|
|
(*cur)->driver_name, error ));
|
2000-05-12 17:01:18 +02:00
|
|
|
}
|
1999-12-29 01:22:24 +01:00
|
|
|
cur++;
|
1999-12-17 00:11:37 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*************************************************************************/
|
|
|
|
/* */
|
|
|
|
/* <Function> */
|
|
|
|
/* FT_Init_FreeType */
|
|
|
|
/* */
|
|
|
|
/* <Description> */
|
|
|
|
/* Initializes a new FreeType library object. The set of drivers */
|
|
|
|
/* that are registered by this function is determined at build time. */
|
|
|
|
/* */
|
|
|
|
/* <Output> */
|
|
|
|
/* library :: A handle to a new library object. */
|
|
|
|
/* */
|
|
|
|
/* <Return> */
|
2000-01-10 18:19:45 +01:00
|
|
|
/* FreeTyoe error code. 0 means success. */
|
1999-12-17 00:11:37 +01:00
|
|
|
/* */
|
2000-05-31 08:55:12 +02:00
|
|
|
FT_EXPORT_FUNC( FT_Error ) FT_Init_FreeType( FT_Library* library )
|
1999-12-17 00:11:37 +01:00
|
|
|
{
|
|
|
|
FT_Error error;
|
|
|
|
FT_Memory memory;
|
|
|
|
|
2000-01-10 18:19:45 +01:00
|
|
|
|
2000-05-31 08:55:12 +02:00
|
|
|
/* First of all, allocate a new system object -- this function is part */
|
2000-01-10 18:19:45 +01:00
|
|
|
/* of the system-specific component, i.e. `ftsystem.c'. */
|
|
|
|
|
1999-12-17 00:11:37 +01:00
|
|
|
memory = FT_New_Memory();
|
2000-01-10 18:19:45 +01:00
|
|
|
if ( !memory )
|
1999-12-17 00:11:37 +01:00
|
|
|
{
|
|
|
|
FT_ERROR(( "FT_Init_FreeType:" ));
|
|
|
|
FT_ERROR(( " cannot find memory manager" ));
|
|
|
|
return FT_Err_Unimplemented_Feature;
|
|
|
|
}
|
2000-01-10 18:19:45 +01:00
|
|
|
|
1999-12-17 00:11:37 +01:00
|
|
|
/* builds a library out of it, then fill it with the set of */
|
2000-01-10 18:19:45 +01:00
|
|
|
/* default drivers. */
|
|
|
|
|
1999-12-17 00:11:37 +01:00
|
|
|
error = FT_New_Library( memory, library );
|
|
|
|
if ( !error )
|
2000-01-10 18:19:45 +01:00
|
|
|
FT_Default_Drivers( *library );
|
|
|
|
|
1999-12-17 00:11:37 +01:00
|
|
|
return error;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* END */
|