ReactOS 0.4.15-dev-7958-gcd0bb1a
cffpic.c
Go to the documentation of this file.
1/***************************************************************************/
2/* */
3/* cffpic.c */
4/* */
5/* The FreeType position independent code services for cff module. */
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 "cffcmap.h"
23#include "cffpic.h"
24#include "cfferrs.h"
25
26
27#ifdef FT_CONFIG_OPTION_PIC
28
29 /* forward declaration of PIC init functions from cffdrivr.c */
31 FT_Create_Class_cff_services( FT_Library library,
32 FT_ServiceDescRec** output_class );
33 void
34 FT_Destroy_Class_cff_services( FT_Library library,
35 FT_ServiceDescRec* clazz );
36 void
37 FT_Init_Class_cff_service_ps_info( FT_Library library,
38 FT_Service_PsInfoRec* clazz );
39 void
40 FT_Init_Class_cff_service_glyph_dict( FT_Library library,
41 FT_Service_GlyphDictRec* clazz );
42 void
43 FT_Init_Class_cff_service_ps_name( FT_Library library,
44 FT_Service_PsFontNameRec* clazz );
45 void
46 FT_Init_Class_cff_service_get_cmap_info( FT_Library library,
47 FT_Service_TTCMapsRec* clazz );
48 void
49 FT_Init_Class_cff_service_cid_info( FT_Library library,
50 FT_Service_CIDRec* clazz );
51
52 /* forward declaration of PIC init functions from cffparse.c */
54 FT_Create_Class_cff_field_handlers( FT_Library library,
55 CFF_Field_Handler** output_class );
56 void
57 FT_Destroy_Class_cff_field_handlers( FT_Library library,
58 CFF_Field_Handler* clazz );
59
60
61 void
62 cff_driver_class_pic_free( FT_Library library )
63 {
64 FT_PIC_Container* pic_container = &library->pic_container;
66
67
68 if ( pic_container->cff )
69 {
70 CffModulePIC* container = (CffModulePIC*)pic_container->cff;
71
72
73 if ( container->cff_services )
74 FT_Destroy_Class_cff_services( library,
75 container->cff_services );
76 container->cff_services = NULL;
77 if ( container->cff_field_handlers )
78 FT_Destroy_Class_cff_field_handlers(
79 library, container->cff_field_handlers );
80 container->cff_field_handlers = NULL;
82 pic_container->cff = NULL;
83 }
84 }
85
86
88 cff_driver_class_pic_init( FT_Library library )
89 {
90 FT_PIC_Container* pic_container = &library->pic_container;
92 CffModulePIC* container = NULL;
94
95
96 /* allocate pointer, clear and set global container pointer */
97 if ( FT_ALLOC ( container, sizeof ( *container ) ) )
98 return error;
99 FT_MEM_SET( container, 0, sizeof ( *container ) );
100 pic_container->cff = container;
101
102 /* initialize pointer table - */
103 /* this is how the module usually expects this data */
104 error = FT_Create_Class_cff_services( library,
105 &container->cff_services );
106 if ( error )
107 goto Exit;
108
109 error = FT_Create_Class_cff_field_handlers(
110 library, &container->cff_field_handlers );
111 if ( error )
112 goto Exit;
113
114 FT_Init_Class_cff_service_ps_info(
115 library, &container->cff_service_ps_info );
116 FT_Init_Class_cff_service_glyph_dict(
117 library, &container->cff_service_glyph_dict );
118 FT_Init_Class_cff_service_ps_name(
119 library, &container->cff_service_ps_name );
120 FT_Init_Class_cff_service_get_cmap_info(
121 library, &container->cff_service_get_cmap_info );
122 FT_Init_Class_cff_service_cid_info(
123 library, &container->cff_service_cid_info );
124 FT_Init_Class_cff_cmap_encoding_class_rec(
125 library, &container->cff_cmap_encoding_class_rec );
126 FT_Init_Class_cff_cmap_unicode_class_rec(
127 library, &container->cff_cmap_unicode_class_rec );
128
129 Exit:
130 if ( error )
131 cff_driver_class_pic_free( library );
132 return error;
133 }
134
135#endif /* FT_CONFIG_OPTION_PIC */
136
137
138/* END */
FT_Library library
Definition: cffdrivr.c:654
#define NULL
Definition: types.h:112
return FT_Err_Ok
Definition: ftbbox.c:511
#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
if(dx< 0)
Definition: linetemp.h:194
#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