summaryrefslogtreecommitdiffstats
path: root/src/base/ftinit.c
diff options
context:
space:
mode:
authorDavid 'Digit' Turner <digit@google.com>2010-03-03 14:24:57 -0800
committerDavid 'Digit' Turner <digit@google.com>2010-03-03 15:33:53 -0800
commit295ffce55e0198e7a9f7d46b33f5c2b4147bf821 (patch)
treebda1a337e630483e46b2e4d4db803814437b765d /src/base/ftinit.c
parent6fb02c1f75ab969890012dd1f01939d3444ddbc1 (diff)
downloadandroid_external_freetype-295ffce55e0198e7a9f7d46b33f5c2b4147bf821.tar.gz
android_external_freetype-295ffce55e0198e7a9f7d46b33f5c2b4147bf821.tar.bz2
android_external_freetype-295ffce55e0198e7a9f7d46b33f5c2b4147bf821.zip
Update to FreeType 2.3.12
Diffstat (limited to 'src/base/ftinit.c')
-rw-r--r--src/base/ftinit.c111
1 files changed, 100 insertions, 11 deletions
diff --git a/src/base/ftinit.c b/src/base/ftinit.c
index dac30b0..1914228 100644
--- a/src/base/ftinit.c
+++ b/src/base/ftinit.c
@@ -4,7 +4,7 @@
/* */
/* FreeType initialization layer (body). */
/* */
-/* Copyright 1996-2001, 2002, 2005, 2007 by */
+/* Copyright 1996-2001, 2002, 2005, 2007, 2009 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -42,6 +42,7 @@
#include FT_INTERNAL_OBJECTS_H
#include FT_INTERNAL_DEBUG_H
#include FT_MODULE_H
+#include "basepic.h"
/*************************************************************************/
@@ -53,6 +54,8 @@
#undef FT_COMPONENT
#define FT_COMPONENT trace_init
+#ifndef FT_CONFIG_OPTION_PIC
+
#undef FT_USE_MODULE
#ifdef __cplusplus
#define FT_USE_MODULE( type, x ) extern "C" const type x;
@@ -74,6 +77,99 @@
0
};
+#else /* FT_CONFIG_OPTION_PIC */
+
+#ifdef __cplusplus
+#define FT_EXTERNC extern "C"
+#else
+#define FT_EXTERNC extern
+#endif
+
+ /* declare the module's class creation/destruction functions */
+#undef FT_USE_MODULE
+#define FT_USE_MODULE( type, x ) \
+ FT_EXTERNC FT_Error FT_Create_Class_##x( FT_Library library, FT_Module_Class** output_class ); \
+ FT_EXTERNC void FT_Destroy_Class_##x( FT_Library library, FT_Module_Class* clazz );
+
+#include FT_CONFIG_MODULES_H
+
+
+ /* count all module classes */
+#undef FT_USE_MODULE
+#define FT_USE_MODULE( type, x ) MODULE_CLASS_##x,
+
+ enum {
+#include FT_CONFIG_MODULES_H
+ FT_NUM_MODULE_CLASSES
+ };
+
+ /* destroy all module classes */
+#undef FT_USE_MODULE
+#define FT_USE_MODULE( type, x ) \
+ if ( classes[i] ) { FT_Destroy_Class_##x(library, classes[i]); } \
+ i++; \
+
+ FT_BASE_DEF( void )
+ ft_destroy_default_module_classes( FT_Library library )
+ {
+ FT_Module_Class** classes;
+ FT_Memory memory;
+ FT_UInt i;
+ BasePIC* pic_container = (BasePIC*)library->pic_container.base;
+
+ if ( !pic_container->default_module_classes )
+ return;
+
+ memory = library->memory;
+ classes = pic_container->default_module_classes;
+ i = 0;
+
+#include FT_CONFIG_MODULES_H
+
+ FT_FREE( classes );
+ pic_container->default_module_classes = 0;
+ }
+
+ /* initialize all module classes and the pointer table */
+#undef FT_USE_MODULE
+#define FT_USE_MODULE( type, x ) \
+ error = FT_Create_Class_##x(library, &clazz); \
+ if (error) goto Exit; \
+ classes[i++] = clazz;
+
+ FT_BASE_DEF( FT_Error )
+ ft_create_default_module_classes( FT_Library library )
+ {
+ FT_Error error;
+ FT_Memory memory;
+ FT_Module_Class** classes;
+ FT_Module_Class* clazz;
+ FT_UInt i;
+ BasePIC* pic_container = (BasePIC*)library->pic_container.base;
+
+ memory = library->memory;
+ pic_container->default_module_classes = 0;
+
+ if ( FT_ALLOC(classes, sizeof(FT_Module_Class*) * (FT_NUM_MODULE_CLASSES + 1) ) )
+ return error;
+ /* initialize all pointers to 0, especially the last one */
+ for (i = 0; i < FT_NUM_MODULE_CLASSES; i++)
+ classes[i] = 0;
+ classes[FT_NUM_MODULE_CLASSES] = 0;
+
+ i = 0;
+
+#include FT_CONFIG_MODULES_H
+
+Exit:
+ if (error) ft_destroy_default_module_classes( library );
+ else pic_container->default_module_classes = classes;
+
+ return error;
+ }
+
+
+#endif /* FT_CONFIG_OPTION_PIC */
/* documentation is in ftmodapi.h */
@@ -86,16 +182,15 @@
/* test for valid `library' delayed to FT_Add_Module() */
- cur = ft_default_modules;
+ cur = FT_DEFAULT_MODULES_GET;
while ( *cur )
{
error = FT_Add_Module( library, *cur );
/* notify errors, but don't stop */
if ( error )
- {
- FT_ERROR(( "FT_Add_Default_Module: Cannot install `%s', error = 0x%x\n",
+ FT_TRACE0(( "FT_Add_Default_Module:"
+ " Cannot install `%s', error = 0x%x\n",
(*cur)->module_name, error ));
- }
cur++;
}
}
@@ -127,13 +222,7 @@
if ( error )
FT_Done_Memory( memory );
else
- {
- (*alibrary)->version_major = FREETYPE_MAJOR;
- (*alibrary)->version_minor = FREETYPE_MINOR;
- (*alibrary)->version_patch = FREETYPE_PATCH;
-
FT_Add_Default_Modules( *alibrary );
- }
return error;
}