1 /***************************************************************************/ |
1 /**************************************************************************** |
2 /* */ |
2 * |
3 /* ftmm.c */ |
3 * ftmm.c |
4 /* */ |
4 * |
5 /* Multiple Master font support (body). */ |
5 * Multiple Master font support (body). |
6 /* */ |
6 * |
7 /* Copyright 1996-2018 by */ |
7 * Copyright (C) 1996-2019 by |
8 /* David Turner, Robert Wilhelm, and Werner Lemberg. */ |
8 * David Turner, Robert Wilhelm, and Werner Lemberg. |
9 /* */ |
9 * |
10 /* 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, |
11 /* modified, and distributed under the terms of the FreeType project */ |
11 * modified, and distributed under the terms of the FreeType project |
12 /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ |
12 * license, LICENSE.TXT. By continuing to use, modify, or distribute |
13 /* this file you indicate that you have read the license and */ |
13 * this file you indicate that you have read the license and |
14 /* understand and accept it fully. */ |
14 * understand and accept it fully. |
15 /* */ |
15 * |
16 /***************************************************************************/ |
16 */ |
17 |
17 |
18 |
18 |
19 #include <ft2build.h> |
19 #include <ft2build.h> |
20 #include FT_INTERNAL_DEBUG_H |
20 #include FT_INTERNAL_DEBUG_H |
21 |
21 |
23 #include FT_INTERNAL_OBJECTS_H |
23 #include FT_INTERNAL_OBJECTS_H |
24 #include FT_SERVICE_MULTIPLE_MASTERS_H |
24 #include FT_SERVICE_MULTIPLE_MASTERS_H |
25 #include FT_SERVICE_METRICS_VARIATIONS_H |
25 #include FT_SERVICE_METRICS_VARIATIONS_H |
26 |
26 |
27 |
27 |
28 /*************************************************************************/ |
28 /************************************************************************** |
29 /* */ |
29 * |
30 /* The macro FT_COMPONENT is used in trace mode. It is an implicit */ |
30 * The macro FT_COMPONENT is used in trace mode. It is an implicit |
31 /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */ |
31 * parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log |
32 /* messages during execution. */ |
32 * messages during execution. |
33 /* */ |
33 */ |
34 #undef FT_COMPONENT |
34 #undef FT_COMPONENT |
35 #define FT_COMPONENT trace_mm |
35 #define FT_COMPONENT mm |
36 |
36 |
37 |
37 |
38 static FT_Error |
38 static FT_Error |
39 ft_face_get_mm_service( FT_Face face, |
39 ft_face_get_mm_service( FT_Face face, |
40 FT_Service_MultiMasters *aservice ) |
40 FT_Service_MultiMasters *aservice ) |
200 |
200 |
201 |
201 |
202 /* documentation is in ftmm.h */ |
202 /* documentation is in ftmm.h */ |
203 |
203 |
204 FT_EXPORT_DEF( FT_Error ) |
204 FT_EXPORT_DEF( FT_Error ) |
|
205 FT_Set_MM_WeightVector( FT_Face face, |
|
206 FT_UInt len, |
|
207 FT_Fixed* weightvector ) |
|
208 { |
|
209 FT_Error error; |
|
210 FT_Service_MultiMasters service; |
|
211 |
|
212 |
|
213 /* check of `face' delayed to `ft_face_get_mm_service' */ |
|
214 |
|
215 if ( len && !weightvector ) |
|
216 return FT_THROW( Invalid_Argument ); |
|
217 |
|
218 error = ft_face_get_mm_service( face, &service ); |
|
219 if ( !error ) |
|
220 { |
|
221 error = FT_ERR( Invalid_Argument ); |
|
222 if ( service->set_mm_weightvector ) |
|
223 error = service->set_mm_weightvector( face, len, weightvector ); |
|
224 } |
|
225 |
|
226 /* enforce recomputation of auto-hinting data */ |
|
227 if ( !error && face->autohint.finalizer ) |
|
228 { |
|
229 face->autohint.finalizer( face->autohint.data ); |
|
230 face->autohint.data = NULL; |
|
231 } |
|
232 |
|
233 return error; |
|
234 } |
|
235 |
|
236 |
|
237 FT_EXPORT_DEF( FT_Error ) |
|
238 FT_Get_MM_WeightVector( FT_Face face, |
|
239 FT_UInt* len, |
|
240 FT_Fixed* weightvector ) |
|
241 { |
|
242 FT_Error error; |
|
243 FT_Service_MultiMasters service; |
|
244 |
|
245 |
|
246 /* check of `face' delayed to `ft_face_get_mm_service' */ |
|
247 |
|
248 if ( len && !weightvector ) |
|
249 return FT_THROW( Invalid_Argument ); |
|
250 |
|
251 error = ft_face_get_mm_service( face, &service ); |
|
252 if ( !error ) |
|
253 { |
|
254 error = FT_ERR( Invalid_Argument ); |
|
255 if ( service->get_mm_weightvector ) |
|
256 error = service->get_mm_weightvector( face, len, weightvector ); |
|
257 } |
|
258 |
|
259 return error; |
|
260 } |
|
261 |
|
262 |
|
263 /* documentation is in ftmm.h */ |
|
264 |
|
265 FT_EXPORT_DEF( FT_Error ) |
205 FT_Set_Var_Design_Coordinates( FT_Face face, |
266 FT_Set_Var_Design_Coordinates( FT_Face face, |
206 FT_UInt num_coords, |
267 FT_UInt num_coords, |
207 FT_Fixed* coords ) |
268 FT_Fixed* coords ) |
208 { |
269 { |
209 FT_Error error; |
270 FT_Error error; |