|
Packit |
cf904d |
/***************************************************************************/
|
|
Packit |
cf904d |
/* */
|
|
Packit |
cf904d |
/* ttpic.c */
|
|
Packit |
cf904d |
/* */
|
|
Packit |
cf904d |
/* The FreeType position independent code services for truetype module. */
|
|
Packit |
cf904d |
/* */
|
|
Packit |
cf904d |
/* Copyright 2009-2017 by */
|
|
Packit |
cf904d |
/* Oran Agra and Mickey Gabel. */
|
|
Packit |
cf904d |
/* */
|
|
Packit |
cf904d |
/* This file is part of the FreeType project, and may only be used, */
|
|
Packit |
cf904d |
/* modified, and distributed under the terms of the FreeType project */
|
|
Packit |
cf904d |
/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
|
|
Packit |
cf904d |
/* this file you indicate that you have read the license and */
|
|
Packit |
cf904d |
/* understand and accept it fully. */
|
|
Packit |
cf904d |
/* */
|
|
Packit |
cf904d |
/***************************************************************************/
|
|
Packit |
cf904d |
|
|
Packit |
cf904d |
|
|
Packit |
cf904d |
#include <ft2build.h>
|
|
Packit |
cf904d |
#include FT_FREETYPE_H
|
|
Packit |
cf904d |
#include FT_INTERNAL_OBJECTS_H
|
|
Packit |
cf904d |
#include "ttpic.h"
|
|
Packit |
cf904d |
#include "tterrors.h"
|
|
Packit |
cf904d |
|
|
Packit |
cf904d |
|
|
Packit |
cf904d |
#ifdef FT_CONFIG_OPTION_PIC
|
|
Packit |
cf904d |
|
|
Packit |
cf904d |
/* forward declaration of PIC init functions from ttdriver.c */
|
|
Packit |
cf904d |
FT_Error
|
|
Packit |
cf904d |
FT_Create_Class_tt_services( FT_Library library,
|
|
Packit |
cf904d |
FT_ServiceDescRec** output_class );
|
|
Packit |
cf904d |
void
|
|
Packit |
cf904d |
FT_Destroy_Class_tt_services( FT_Library library,
|
|
Packit |
cf904d |
FT_ServiceDescRec* clazz );
|
|
Packit |
cf904d |
void
|
|
Packit |
cf904d |
FT_Init_Class_tt_service_gx_multi_masters(
|
|
Packit |
cf904d |
FT_Service_MultiMastersRec* sv_mm );
|
|
Packit |
cf904d |
void
|
|
Packit |
cf904d |
FT_Init_Class_tt_service_truetype_glyf(
|
|
Packit |
cf904d |
FT_Service_TTGlyfRec* sv_ttglyf );
|
|
Packit |
cf904d |
|
|
Packit |
cf904d |
|
|
Packit |
cf904d |
void
|
|
Packit |
cf904d |
tt_driver_class_pic_free( FT_Library library )
|
|
Packit |
cf904d |
{
|
|
Packit |
cf904d |
FT_PIC_Container* pic_container = &library->pic_container;
|
|
Packit |
cf904d |
FT_Memory memory = library->memory;
|
|
Packit |
cf904d |
|
|
Packit |
cf904d |
|
|
Packit |
cf904d |
if ( pic_container->truetype )
|
|
Packit |
cf904d |
{
|
|
Packit |
cf904d |
TTModulePIC* container = (TTModulePIC*)pic_container->truetype;
|
|
Packit |
cf904d |
|
|
Packit |
cf904d |
|
|
Packit |
cf904d |
if ( container->tt_services )
|
|
Packit |
cf904d |
FT_Destroy_Class_tt_services( library, container->tt_services );
|
|
Packit |
cf904d |
container->tt_services = NULL;
|
|
Packit |
cf904d |
FT_FREE( container );
|
|
Packit |
cf904d |
pic_container->truetype = NULL;
|
|
Packit |
cf904d |
}
|
|
Packit |
cf904d |
}
|
|
Packit |
cf904d |
|
|
Packit |
cf904d |
|
|
Packit |
cf904d |
FT_Error
|
|
Packit |
cf904d |
tt_driver_class_pic_init( FT_Library library )
|
|
Packit |
cf904d |
{
|
|
Packit |
cf904d |
FT_PIC_Container* pic_container = &library->pic_container;
|
|
Packit |
cf904d |
FT_Error error = FT_Err_Ok;
|
|
Packit |
cf904d |
TTModulePIC* container = NULL;
|
|
Packit |
cf904d |
FT_Memory memory = library->memory;
|
|
Packit |
cf904d |
|
|
Packit |
cf904d |
|
|
Packit |
cf904d |
/* allocate pointer, clear and set global container pointer */
|
|
Packit |
cf904d |
if ( FT_ALLOC( container, sizeof ( *container ) ) )
|
|
Packit |
cf904d |
return error;
|
|
Packit |
cf904d |
FT_MEM_SET( container, 0, sizeof ( *container ) );
|
|
Packit |
cf904d |
pic_container->truetype = container;
|
|
Packit |
cf904d |
|
|
Packit |
cf904d |
/* initialize pointer table - this is how the module usually */
|
|
Packit |
cf904d |
/* expects this data */
|
|
Packit |
cf904d |
error = FT_Create_Class_tt_services( library,
|
|
Packit |
cf904d |
&container->tt_services );
|
|
Packit |
cf904d |
if ( error )
|
|
Packit |
cf904d |
goto Exit;
|
|
Packit |
cf904d |
#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
|
|
Packit |
cf904d |
FT_Init_Class_tt_service_gx_multi_masters(
|
|
Packit |
cf904d |
&container->tt_service_gx_multi_masters );
|
|
Packit |
cf904d |
#endif
|
|
Packit |
cf904d |
FT_Init_Class_tt_service_truetype_glyf(
|
|
Packit |
cf904d |
&container->tt_service_truetype_glyf );
|
|
Packit |
cf904d |
|
|
Packit |
cf904d |
Exit:
|
|
Packit |
cf904d |
if ( error )
|
|
Packit |
cf904d |
tt_driver_class_pic_free( library );
|
|
Packit |
cf904d |
return error;
|
|
Packit |
cf904d |
}
|
|
Packit |
cf904d |
|
|
Packit |
cf904d |
#endif /* FT_CONFIG_OPTION_PIC */
|
|
Packit |
cf904d |
|
|
Packit |
cf904d |
|
|
Packit |
cf904d |
/* END */
|