OLD | NEW |
1 #if !defined(_FXFT_VERSION_) || _FXFT_VERSION_ == 2501 | |
2 /***************************************************************************/ | 1 /***************************************************************************/ |
3 /* */ | 2 /* */ |
4 /* ftmm.c */ | 3 /* ftmm.c */ |
5 /* */ | 4 /* */ |
6 /* Multiple Master font support (body). */ | 5 /* Multiple Master font support (body). */ |
7 /* */ | 6 /* */ |
8 /* Copyright 1996-2001, 2003, 2004, 2009, 2013 by */ | 7 /* Copyright 1996-2001, 2003, 2004, 2009, 2013, 2014 by */ |
9 /* David Turner, Robert Wilhelm, and Werner Lemberg. */ | 8 /* David Turner, Robert Wilhelm, and Werner Lemberg. */ |
10 /* */ | 9 /* */ |
11 /* This file is part of the FreeType project, and may only be used, */ | 10 /* This file is part of the FreeType project, and may only be used, */ |
12 /* modified, and distributed under the terms of the FreeType project */ | 11 /* modified, and distributed under the terms of the FreeType project */ |
13 /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ | 12 /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ |
14 /* this file you indicate that you have read the license and */ | 13 /* this file you indicate that you have read the license and */ |
15 /* understand and accept it fully. */ | 14 /* understand and accept it fully. */ |
16 /* */ | 15 /* */ |
17 /***************************************************************************/ | 16 /***************************************************************************/ |
18 | 17 |
19 #define FT2_BUILD_LIBRARY | 18 |
20 #include "../../include/ft2build.h" | 19 #include <ft2build.h> |
21 #include "../../include/freetype/internal/ftdebug.h" | 20 #include FT_INTERNAL_DEBUG_H |
22 #include "../../include/freetype/ftmm.h" | 21 |
23 #include "../../include/freetype/internal/ftobjs.h" | 22 #include FT_MULTIPLE_MASTERS_H |
24 #include "../../include/freetype/internal/services/svmm.h" | 23 #include FT_INTERNAL_OBJECTS_H |
| 24 #include FT_SERVICE_MULTIPLE_MASTERS_H |
25 | 25 |
26 | 26 |
27 /*************************************************************************/ | 27 /*************************************************************************/ |
28 /* */ | 28 /* */ |
29 /* The macro FT_COMPONENT is used in trace mode. It is an implicit */ | 29 /* The macro FT_COMPONENT is used in trace mode. It is an implicit */ |
30 /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */ | 30 /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */ |
31 /* messages during execution. */ | 31 /* messages during execution. */ |
32 /* */ | 32 /* */ |
33 #undef FT_COMPONENT | 33 #undef FT_COMPONENT |
34 #define FT_COMPONENT trace_mm | 34 #define FT_COMPONENT trace_mm |
(...skipping 30 matching lines...) Expand all Loading... |
65 /* documentation is in ftmm.h */ | 65 /* documentation is in ftmm.h */ |
66 | 66 |
67 FT_EXPORT_DEF( FT_Error ) | 67 FT_EXPORT_DEF( FT_Error ) |
68 FT_Get_Multi_Master( FT_Face face, | 68 FT_Get_Multi_Master( FT_Face face, |
69 FT_Multi_Master *amaster ) | 69 FT_Multi_Master *amaster ) |
70 { | 70 { |
71 FT_Error error; | 71 FT_Error error; |
72 FT_Service_MultiMasters service; | 72 FT_Service_MultiMasters service; |
73 | 73 |
74 | 74 |
| 75 /* check of `face' delayed to `ft_face_get_mm_service' */ |
| 76 |
| 77 if ( !amaster ) |
| 78 return FT_THROW( Invalid_Argument ); |
| 79 |
75 error = ft_face_get_mm_service( face, &service ); | 80 error = ft_face_get_mm_service( face, &service ); |
76 if ( !error ) | 81 if ( !error ) |
77 { | 82 { |
78 error = FT_ERR( Invalid_Argument ); | 83 error = FT_ERR( Invalid_Argument ); |
79 if ( service->get_mm ) | 84 if ( service->get_mm ) |
80 error = service->get_mm( face, amaster ); | 85 error = service->get_mm( face, amaster ); |
81 } | 86 } |
82 | 87 |
83 return error; | 88 return error; |
84 } | 89 } |
85 | 90 |
86 | 91 |
87 /* documentation is in ftmm.h */ | 92 /* documentation is in ftmm.h */ |
88 | 93 |
89 FT_EXPORT_DEF( FT_Error ) | 94 FT_EXPORT_DEF( FT_Error ) |
90 FT_Get_MM_Var( FT_Face face, | 95 FT_Get_MM_Var( FT_Face face, |
91 FT_MM_Var* *amaster ) | 96 FT_MM_Var* *amaster ) |
92 { | 97 { |
93 FT_Error error; | 98 FT_Error error; |
94 FT_Service_MultiMasters service; | 99 FT_Service_MultiMasters service; |
95 | 100 |
96 | 101 |
| 102 /* check of `face' delayed to `ft_face_get_mm_service' */ |
| 103 |
| 104 if ( !amaster ) |
| 105 return FT_THROW( Invalid_Argument ); |
| 106 |
97 error = ft_face_get_mm_service( face, &service ); | 107 error = ft_face_get_mm_service( face, &service ); |
98 if ( !error ) | 108 if ( !error ) |
99 { | 109 { |
100 error = FT_ERR( Invalid_Argument ); | 110 error = FT_ERR( Invalid_Argument ); |
101 if ( service->get_mm_var ) | 111 if ( service->get_mm_var ) |
102 error = service->get_mm_var( face, amaster ); | 112 error = service->get_mm_var( face, amaster ); |
103 } | 113 } |
104 | 114 |
105 return error; | 115 return error; |
106 } | 116 } |
107 | 117 |
108 | 118 |
109 /* documentation is in ftmm.h */ | 119 /* documentation is in ftmm.h */ |
110 | 120 |
111 FT_EXPORT_DEF( FT_Error ) | 121 FT_EXPORT_DEF( FT_Error ) |
112 FT_Set_MM_Design_Coordinates( FT_Face face, | 122 FT_Set_MM_Design_Coordinates( FT_Face face, |
113 FT_UInt num_coords, | 123 FT_UInt num_coords, |
114 FT_Long* coords ) | 124 FT_Long* coords ) |
115 { | 125 { |
116 FT_Error error; | 126 FT_Error error; |
117 FT_Service_MultiMasters service; | 127 FT_Service_MultiMasters service; |
118 | 128 |
119 | 129 |
| 130 /* check of `face' delayed to `ft_face_get_mm_service' */ |
| 131 |
| 132 if ( !coords ) |
| 133 return FT_THROW( Invalid_Argument ); |
| 134 |
120 error = ft_face_get_mm_service( face, &service ); | 135 error = ft_face_get_mm_service( face, &service ); |
121 if ( !error ) | 136 if ( !error ) |
122 { | 137 { |
123 error = FT_ERR( Invalid_Argument ); | 138 error = FT_ERR( Invalid_Argument ); |
124 if ( service->set_mm_design ) | 139 if ( service->set_mm_design ) |
125 error = service->set_mm_design( face, num_coords, coords ); | 140 error = service->set_mm_design( face, num_coords, coords ); |
126 } | 141 } |
127 | 142 |
128 return error; | 143 return error; |
129 } | 144 } |
130 | 145 |
131 | 146 |
132 /* documentation is in ftmm.h */ | 147 /* documentation is in ftmm.h */ |
133 | 148 |
134 FT_EXPORT_DEF( FT_Error ) | 149 FT_EXPORT_DEF( FT_Error ) |
135 FT_Set_Var_Design_Coordinates( FT_Face face, | 150 FT_Set_Var_Design_Coordinates( FT_Face face, |
136 FT_UInt num_coords, | 151 FT_UInt num_coords, |
137 FT_Fixed* coords ) | 152 FT_Fixed* coords ) |
138 { | 153 { |
139 FT_Error error; | 154 FT_Error error; |
140 FT_Service_MultiMasters service; | 155 FT_Service_MultiMasters service; |
141 | 156 |
142 | 157 |
| 158 /* check of `face' delayed to `ft_face_get_mm_service' */ |
| 159 |
| 160 if ( !coords ) |
| 161 return FT_THROW( Invalid_Argument ); |
| 162 |
143 error = ft_face_get_mm_service( face, &service ); | 163 error = ft_face_get_mm_service( face, &service ); |
144 if ( !error ) | 164 if ( !error ) |
145 { | 165 { |
146 error = FT_ERR( Invalid_Argument ); | 166 error = FT_ERR( Invalid_Argument ); |
147 if ( service->set_var_design ) | 167 if ( service->set_var_design ) |
148 error = service->set_var_design( face, num_coords, coords ); | 168 error = service->set_var_design( face, num_coords, coords ); |
149 } | 169 } |
150 | 170 |
151 return error; | 171 return error; |
152 } | 172 } |
153 | 173 |
154 | 174 |
155 /* documentation is in ftmm.h */ | 175 /* documentation is in ftmm.h */ |
156 | 176 |
157 FT_EXPORT_DEF( FT_Error ) | 177 FT_EXPORT_DEF( FT_Error ) |
158 FT_Set_MM_Blend_Coordinates( FT_Face face, | 178 FT_Set_MM_Blend_Coordinates( FT_Face face, |
159 FT_UInt num_coords, | 179 FT_UInt num_coords, |
160 FT_Fixed* coords ) | 180 FT_Fixed* coords ) |
161 { | 181 { |
162 FT_Error error; | 182 FT_Error error; |
163 FT_Service_MultiMasters service; | 183 FT_Service_MultiMasters service; |
164 | 184 |
165 | 185 |
| 186 /* check of `face' delayed to `ft_face_get_mm_service' */ |
| 187 |
| 188 if ( !coords ) |
| 189 return FT_THROW( Invalid_Argument ); |
| 190 |
166 error = ft_face_get_mm_service( face, &service ); | 191 error = ft_face_get_mm_service( face, &service ); |
167 if ( !error ) | 192 if ( !error ) |
168 { | 193 { |
169 error = FT_ERR( Invalid_Argument ); | 194 error = FT_ERR( Invalid_Argument ); |
170 if ( service->set_mm_blend ) | 195 if ( service->set_mm_blend ) |
171 error = service->set_mm_blend( face, num_coords, coords ); | 196 error = service->set_mm_blend( face, num_coords, coords ); |
172 } | 197 } |
173 | 198 |
174 return error; | 199 return error; |
175 } | 200 } |
176 | 201 |
177 | 202 |
178 /* documentation is in ftmm.h */ | 203 /* documentation is in ftmm.h */ |
179 | 204 |
180 /* This is exactly the same as the previous function. It exists for */ | 205 /* This is exactly the same as the previous function. It exists for */ |
181 /* orthogonality. */ | 206 /* orthogonality. */ |
182 | 207 |
183 FT_EXPORT_DEF( FT_Error ) | 208 FT_EXPORT_DEF( FT_Error ) |
184 FT_Set_Var_Blend_Coordinates( FT_Face face, | 209 FT_Set_Var_Blend_Coordinates( FT_Face face, |
185 FT_UInt num_coords, | 210 FT_UInt num_coords, |
186 FT_Fixed* coords ) | 211 FT_Fixed* coords ) |
187 { | 212 { |
188 FT_Error error; | 213 FT_Error error; |
189 FT_Service_MultiMasters service; | 214 FT_Service_MultiMasters service; |
190 | 215 |
191 | 216 |
| 217 /* check of `face' delayed to `ft_face_get_mm_service' */ |
| 218 |
| 219 if ( !coords ) |
| 220 return FT_THROW( Invalid_Argument ); |
| 221 |
192 error = ft_face_get_mm_service( face, &service ); | 222 error = ft_face_get_mm_service( face, &service ); |
193 if ( !error ) | 223 if ( !error ) |
194 { | 224 { |
195 error = FT_ERR( Invalid_Argument ); | 225 error = FT_ERR( Invalid_Argument ); |
196 if ( service->set_mm_blend ) | 226 if ( service->set_mm_blend ) |
197 error = service->set_mm_blend( face, num_coords, coords ); | 227 error = service->set_mm_blend( face, num_coords, coords ); |
198 } | 228 } |
199 | 229 |
200 return error; | 230 return error; |
201 } | 231 } |
202 | 232 |
203 | 233 |
204 /* END */ | 234 /* END */ |
205 #endif | |
206 | |
OLD | NEW |