ReactOS 0.4.16-dev-334-g4d9f67c
basepic.c
Go to the documentation of this file.
1/***************************************************************************/
2/* */
3/* basepic.c */
4/* */
5/* The FreeType position independent code services for base. */
6/* */
7/* Copyright 2009-2018 by */
8/* Oran Agra and Mickey Gabel. */
9/* */
10/* This file is part of the FreeType project, and may only be used, */
11/* modified, and distributed under the terms of the FreeType project */
12/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
13/* this file you indicate that you have read the license and */
14/* understand and accept it fully. */
15/* */
16/***************************************************************************/
17
18
19#include <ft2build.h>
20#include FT_FREETYPE_H
21#include FT_INTERNAL_OBJECTS_H
22#include "basepic.h"
23
24
25#ifdef FT_CONFIG_OPTION_PIC
26
27 /* forward declaration of PIC init functions from ftglyph.c */
28 void
29 FT_Init_Class_ft_outline_glyph_class( FT_Glyph_Class* clazz );
30
31 void
32 FT_Init_Class_ft_bitmap_glyph_class( FT_Glyph_Class* clazz );
33
34#ifdef FT_CONFIG_OPTION_MAC_FONTS
35 /* forward declaration of PIC init function from ftrfork.c */
36 /* (not modularized) */
37 void
38 FT_Init_Table_ft_raccess_guess_table( ft_raccess_guess_rec* record );
39#endif
40
41 /* forward declaration of PIC init functions from ftinit.c */
43 ft_create_default_module_classes( FT_Library library );
44
45 void
46 ft_destroy_default_module_classes( FT_Library library );
47
48
49 void
50 ft_base_pic_free( FT_Library library )
51 {
52 FT_PIC_Container* pic_container = &library->pic_container;
54
55
56 if ( pic_container->base )
57 {
58 /* destroy default module classes */
59 /* (in case FT_Add_Default_Modules was used) */
60 ft_destroy_default_module_classes( library );
61
62 FT_FREE( pic_container->base );
63 pic_container->base = NULL;
64 }
65 }
66
67
69 ft_base_pic_init( FT_Library library )
70 {
71 FT_PIC_Container* pic_container = &library->pic_container;
73 BasePIC* container = NULL;
75
76
77 /* allocate pointer, clear and set global container pointer */
78 if ( FT_ALLOC( container, sizeof ( *container ) ) )
79 return error;
80 FT_MEM_SET( container, 0, sizeof ( *container ) );
81 pic_container->base = container;
82
83 /* initialize default modules list and pointers */
84 error = ft_create_default_module_classes( library );
85 if ( error )
86 goto Exit;
87
88 /* initialize pointer table - */
89 /* this is how the module usually expects this data */
90 FT_Init_Class_ft_outline_glyph_class(
91 &container->ft_outline_glyph_class );
92 FT_Init_Class_ft_bitmap_glyph_class(
93 &container->ft_bitmap_glyph_class );
94#ifdef FT_CONFIG_OPTION_MAC_FONTS
95 FT_Init_Table_ft_raccess_guess_table(
96 (ft_raccess_guess_rec*)&container->ft_raccess_guess_table );
97#endif
98
99 Exit:
100 if ( error )
101 ft_base_pic_free( library );
102 return error;
103 }
104
105#endif /* FT_CONFIG_OPTION_PIC */
106
107
108/* END */
FT_Library library
Definition: cffdrivr.c:654
#define NULL
Definition: types.h:112
return FT_Err_Ok
Definition: ftbbox.c:511
typedefFT_BEGIN_HEADER struct FT_Glyph_Class_ FT_Glyph_Class
Definition: ftglyph.h:69
#define FT_ALLOC(ptr, size)
Definition: ftmemory.h:303
#define FT_FREE(ptr)
Definition: ftmemory.h:329
#define FT_MEM_SET(dest, byte, count)
Definition: ftmemory.h:225
typedefFT_BEGIN_HEADER struct FT_MemoryRec_ * FT_Memory
Definition: ftsystem.h:66
int FT_Error
Definition: fttypes.h:300
#define error(str)
Definition: mkdosfs.c:1605
static char memory[1024 *256]
Definition: process.c:116
static void Exit(void)
Definition: sock.c:1330
FT_Memory memory
Definition: ftobjs.h:918