1 | /**************************************************************************** |
2 | * |
3 | * ftgxval.c |
4 | * |
5 | * FreeType API for validating TrueTypeGX/AAT tables (body). |
6 | * |
7 | * Copyright (C) 2004-2023 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 <freetype/internal/ftdebug.h> |
29 | |
30 | #include <freetype/internal/ftobjs.h> |
31 | #include <freetype/internal/services/svgxval.h> |
32 | |
33 | |
34 | /* documentation is in ftgxval.h */ |
35 | |
36 | FT_EXPORT_DEF( FT_Error ) |
37 | FT_TrueTypeGX_Validate( FT_Face face, |
38 | FT_UInt validation_flags, |
39 | FT_Bytes tables[FT_VALIDATE_GX_LENGTH], |
40 | FT_UInt table_length ) |
41 | { |
42 | FT_Service_GXvalidate service; |
43 | FT_Error error; |
44 | |
45 | |
46 | if ( !face ) |
47 | { |
48 | error = FT_THROW( Invalid_Face_Handle ); |
49 | goto Exit; |
50 | } |
51 | |
52 | if ( !tables ) |
53 | { |
54 | error = FT_THROW( Invalid_Argument ); |
55 | goto Exit; |
56 | } |
57 | |
58 | FT_FACE_FIND_GLOBAL_SERVICE( face, service, GX_VALIDATE ); |
59 | |
60 | if ( service ) |
61 | error = service->validate( face, |
62 | validation_flags, |
63 | tables, |
64 | table_length ); |
65 | else |
66 | error = FT_THROW( Unimplemented_Feature ); |
67 | |
68 | Exit: |
69 | return error; |
70 | } |
71 | |
72 | |
73 | FT_EXPORT_DEF( void ) |
74 | FT_TrueTypeGX_Free( FT_Face face, |
75 | FT_Bytes table ) |
76 | { |
77 | FT_Memory memory; |
78 | |
79 | |
80 | if ( !face ) |
81 | return; |
82 | |
83 | memory = FT_FACE_MEMORY( face ); |
84 | |
85 | FT_FREE( table ); |
86 | } |
87 | |
88 | |
89 | FT_EXPORT_DEF( FT_Error ) |
90 | FT_ClassicKern_Validate( FT_Face face, |
91 | FT_UInt validation_flags, |
92 | FT_Bytes *ckern_table ) |
93 | { |
94 | FT_Service_CKERNvalidate service; |
95 | FT_Error error; |
96 | |
97 | |
98 | if ( !face ) |
99 | { |
100 | error = FT_THROW( Invalid_Face_Handle ); |
101 | goto Exit; |
102 | } |
103 | |
104 | if ( !ckern_table ) |
105 | { |
106 | error = FT_THROW( Invalid_Argument ); |
107 | goto Exit; |
108 | } |
109 | |
110 | FT_FACE_FIND_GLOBAL_SERVICE( face, service, CLASSICKERN_VALIDATE ); |
111 | |
112 | if ( service ) |
113 | error = service->validate( face, |
114 | validation_flags, |
115 | ckern_table ); |
116 | else |
117 | error = FT_THROW( Unimplemented_Feature ); |
118 | |
119 | Exit: |
120 | return error; |
121 | } |
122 | |
123 | |
124 | FT_EXPORT_DEF( void ) |
125 | FT_ClassicKern_Free( FT_Face face, |
126 | FT_Bytes table ) |
127 | { |
128 | FT_Memory memory; |
129 | |
130 | |
131 | if ( !face ) |
132 | return; |
133 | |
134 | memory = FT_FACE_MEMORY( face ); |
135 | |
136 | |
137 | FT_FREE( table ); |
138 | } |
139 | |
140 | |
141 | /* END */ |
142 | |