OLD | NEW |
| (Empty) |
1 #if !defined(_FXFT_VERSION_) || _FXFT_VERSION_ == 2501 | |
2 /***************************************************************************/ | |
3 /* */ | |
4 /* ftmm.c */ | |
5 /* */ | |
6 /* Multiple Master font support (body). */ | |
7 /* */ | |
8 /* Copyright 1996-2001, 2003, 2004, 2009, 2013 by */ | |
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 #define FT2_BUILD_LIBRARY | |
20 #include "../../include/ft2build.h" | |
21 #include "../../include/freetype/internal/ftdebug.h" | |
22 #include "../../include/freetype/ftmm.h" | |
23 #include "../../include/freetype/internal/ftobjs.h" | |
24 #include "../../include/freetype/internal/services/svmm.h" | |
25 | |
26 | |
27 /*************************************************************************/ | |
28 /* */ | |
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 */ | |
31 /* messages during execution. */ | |
32 /* */ | |
33 #undef FT_COMPONENT | |
34 #define FT_COMPONENT trace_mm | |
35 | |
36 | |
37 static FT_Error | |
38 ft_face_get_mm_service( FT_Face face, | |
39 FT_Service_MultiMasters *aservice ) | |
40 { | |
41 FT_Error error; | |
42 | |
43 | |
44 *aservice = NULL; | |
45 | |
46 if ( !face ) | |
47 return FT_THROW( Invalid_Face_Handle ); | |
48 | |
49 error = FT_ERR( Invalid_Argument ); | |
50 | |
51 if ( FT_HAS_MULTIPLE_MASTERS( face ) ) | |
52 { | |
53 FT_FACE_LOOKUP_SERVICE( face, | |
54 *aservice, | |
55 MULTI_MASTERS ); | |
56 | |
57 if ( *aservice ) | |
58 error = FT_Err_Ok; | |
59 } | |
60 | |
61 return error; | |
62 } | |
63 | |
64 | |
65 /* documentation is in ftmm.h */ | |
66 | |
67 FT_EXPORT_DEF( FT_Error ) | |
68 FT_Get_Multi_Master( FT_Face face, | |
69 FT_Multi_Master *amaster ) | |
70 { | |
71 FT_Error error; | |
72 FT_Service_MultiMasters service; | |
73 | |
74 | |
75 error = ft_face_get_mm_service( face, &service ); | |
76 if ( !error ) | |
77 { | |
78 error = FT_ERR( Invalid_Argument ); | |
79 if ( service->get_mm ) | |
80 error = service->get_mm( face, amaster ); | |
81 } | |
82 | |
83 return error; | |
84 } | |
85 | |
86 | |
87 /* documentation is in ftmm.h */ | |
88 | |
89 FT_EXPORT_DEF( FT_Error ) | |
90 FT_Get_MM_Var( FT_Face face, | |
91 FT_MM_Var* *amaster ) | |
92 { | |
93 FT_Error error; | |
94 FT_Service_MultiMasters service; | |
95 | |
96 | |
97 error = ft_face_get_mm_service( face, &service ); | |
98 if ( !error ) | |
99 { | |
100 error = FT_ERR( Invalid_Argument ); | |
101 if ( service->get_mm_var ) | |
102 error = service->get_mm_var( face, amaster ); | |
103 } | |
104 | |
105 return error; | |
106 } | |
107 | |
108 | |
109 /* documentation is in ftmm.h */ | |
110 | |
111 FT_EXPORT_DEF( FT_Error ) | |
112 FT_Set_MM_Design_Coordinates( FT_Face face, | |
113 FT_UInt num_coords, | |
114 FT_Long* coords ) | |
115 { | |
116 FT_Error error; | |
117 FT_Service_MultiMasters service; | |
118 | |
119 | |
120 error = ft_face_get_mm_service( face, &service ); | |
121 if ( !error ) | |
122 { | |
123 error = FT_ERR( Invalid_Argument ); | |
124 if ( service->set_mm_design ) | |
125 error = service->set_mm_design( face, num_coords, coords ); | |
126 } | |
127 | |
128 return error; | |
129 } | |
130 | |
131 | |
132 /* documentation is in ftmm.h */ | |
133 | |
134 FT_EXPORT_DEF( FT_Error ) | |
135 FT_Set_Var_Design_Coordinates( FT_Face face, | |
136 FT_UInt num_coords, | |
137 FT_Fixed* coords ) | |
138 { | |
139 FT_Error error; | |
140 FT_Service_MultiMasters service; | |
141 | |
142 | |
143 error = ft_face_get_mm_service( face, &service ); | |
144 if ( !error ) | |
145 { | |
146 error = FT_ERR( Invalid_Argument ); | |
147 if ( service->set_var_design ) | |
148 error = service->set_var_design( face, num_coords, coords ); | |
149 } | |
150 | |
151 return error; | |
152 } | |
153 | |
154 | |
155 /* documentation is in ftmm.h */ | |
156 | |
157 FT_EXPORT_DEF( FT_Error ) | |
158 FT_Set_MM_Blend_Coordinates( FT_Face face, | |
159 FT_UInt num_coords, | |
160 FT_Fixed* coords ) | |
161 { | |
162 FT_Error error; | |
163 FT_Service_MultiMasters service; | |
164 | |
165 | |
166 error = ft_face_get_mm_service( face, &service ); | |
167 if ( !error ) | |
168 { | |
169 error = FT_ERR( Invalid_Argument ); | |
170 if ( service->set_mm_blend ) | |
171 error = service->set_mm_blend( face, num_coords, coords ); | |
172 } | |
173 | |
174 return error; | |
175 } | |
176 | |
177 | |
178 /* documentation is in ftmm.h */ | |
179 | |
180 /* This is exactly the same as the previous function. It exists for */ | |
181 /* orthogonality. */ | |
182 | |
183 FT_EXPORT_DEF( FT_Error ) | |
184 FT_Set_Var_Blend_Coordinates( FT_Face face, | |
185 FT_UInt num_coords, | |
186 FT_Fixed* coords ) | |
187 { | |
188 FT_Error error; | |
189 FT_Service_MultiMasters service; | |
190 | |
191 | |
192 error = ft_face_get_mm_service( face, &service ); | |
193 if ( !error ) | |
194 { | |
195 error = FT_ERR( Invalid_Argument ); | |
196 if ( service->set_mm_blend ) | |
197 error = service->set_mm_blend( face, num_coords, coords ); | |
198 } | |
199 | |
200 return error; | |
201 } | |
202 | |
203 | |
204 /* END */ | |
205 #endif | |
206 | |
OLD | NEW |