Sync with trunk head (r49139)
[reactos.git] / lib / 3rdparty / freetype / src / base / ftgxval.c
1 /***************************************************************************/
2 /* */
3 /* ftgxval.c */
4 /* */
5 /* FreeType API for validating TrueTyepGX/AAT tables (body). */
6 /* */
7 /* Copyright 2004, 2005, 2006 by */
8 /* Masatake YAMATO, Redhat K.K, */
9 /* David Turner, Robert Wilhelm, and Werner Lemberg. */
10 /* */
11 /* This file is part of the FreeType project, and may only be used, */
12 /* modified, and distributed under the terms of the FreeType project */
13 /* license, LICENSE.TXT. By continuing to use, modify, or distribute */
14 /* this file you indicate that you have read the license and */
15 /* understand and accept it fully. */
16 /* */
17 /***************************************************************************/
18
19 /***************************************************************************/
20 /* */
21 /* gxvalid is derived from both gxlayout module and otvalid module. */
22 /* Development of gxlayout is supported by the Information-technology */
23 /* Promotion Agency(IPA), Japan. */
24 /* */
25 /***************************************************************************/
26
27
28 #include <ft2build.h>
29 #include FT_INTERNAL_OBJECTS_H
30 #include FT_SERVICE_GX_VALIDATE_H
31
32
33 /* documentation is in ftgxval.h */
34
35 FT_EXPORT_DEF( FT_Error )
36 FT_TrueTypeGX_Validate( FT_Face face,
37 FT_UInt validation_flags,
38 FT_Bytes tables[FT_VALIDATE_GX_LENGTH],
39 FT_UInt table_length )
40 {
41 FT_Service_GXvalidate service;
42 FT_Error error;
43
44
45 if ( !face )
46 {
47 error = FT_Err_Invalid_Face_Handle;
48 goto Exit;
49 }
50
51 if ( tables == NULL )
52 {
53 error = FT_Err_Invalid_Argument;
54 goto Exit;
55 }
56
57 FT_FACE_FIND_GLOBAL_SERVICE( face, service, GX_VALIDATE );
58
59 if ( service )
60 error = service->validate( face,
61 validation_flags,
62 tables,
63 table_length );
64 else
65 error = FT_Err_Unimplemented_Feature;
66
67 Exit:
68 return error;
69 }
70
71
72 FT_EXPORT_DEF( void )
73 FT_TrueTypeGX_Free( FT_Face face,
74 FT_Bytes table )
75 {
76 FT_Memory memory = FT_FACE_MEMORY( face );
77
78
79 FT_FREE( table );
80 }
81
82
83 FT_EXPORT_DEF( FT_Error )
84 FT_ClassicKern_Validate( FT_Face face,
85 FT_UInt validation_flags,
86 FT_Bytes *ckern_table )
87 {
88 FT_Service_CKERNvalidate service;
89 FT_Error error;
90
91
92 if ( !face )
93 {
94 error = FT_Err_Invalid_Face_Handle;
95 goto Exit;
96 }
97
98 if ( ckern_table == NULL )
99 {
100 error = FT_Err_Invalid_Argument;
101 goto Exit;
102 }
103
104 FT_FACE_FIND_GLOBAL_SERVICE( face, service, CLASSICKERN_VALIDATE );
105
106 if ( service )
107 error = service->validate( face,
108 validation_flags,
109 ckern_table );
110 else
111 error = FT_Err_Unimplemented_Feature;
112
113 Exit:
114 return error;
115 }
116
117
118 FT_EXPORT_DEF( void )
119 FT_ClassicKern_Free( FT_Face face,
120 FT_Bytes table )
121 {
122 FT_Memory memory = FT_FACE_MEMORY( face );
123
124
125 FT_FREE( table );
126 }
127
128
129 /* END */