]> git.saurik.com Git - wxWidgets.git/blob - src/freetype/base/ftmm.c
case-insensitive sort of HTML help index
[wxWidgets.git] / src / freetype / base / ftmm.c
1 /***************************************************************************/
2 /* */
3 /* ftmm.c */
4 /* */
5 /* Multiple Master font support (body). */
6 /* */
7 /* Copyright 1996-2000 by */
8 /* David Turner, Robert Wilhelm, and Werner Lemberg. */
9 /* */
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 */
12 /* license, LICENSE.TXT. By continuing to use, modify, or distribute */
13 /* this file you indicate that you have read the license and */
14 /* understand and accept it fully. */
15 /* */
16 /***************************************************************************/
17
18
19 #include <freetype/ftmm.h>
20 #include <freetype/internal/ftobjs.h>
21
22
23 /*************************************************************************/
24 /* */
25 /* The macro FT_COMPONENT is used in trace mode. It is an implicit */
26 /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */
27 /* messages during execution. */
28 /* */
29 #undef FT_COMPONENT
30 #define FT_COMPONENT trace_mm
31
32
33 /*************************************************************************/
34 /* */
35 /* <Function> */
36 /* FT_Get_Multi_Master */
37 /* */
38 /* <Description> */
39 /* Retrieves the Multiple Master descriptor of a given font. */
40 /* */
41 /* <Input> */
42 /* face :: A handle to the source face. */
43 /* */
44 /* <Output> */
45 /* master :: The Multiple Masters descriptor. */
46 /* */
47 /* <Return> */
48 /* FreeType error code. 0 means success. */
49 /* */
50 FT_EXPORT_FUNC( FT_Error ) FT_Get_Multi_Master( FT_Face face,
51 FT_Multi_Master* master )
52 {
53 FT_Error error;
54
55
56 if ( !face )
57 return FT_Err_Invalid_Face_Handle;
58
59 error = FT_Err_Invalid_Argument;
60
61 if ( FT_HAS_MULTIPLE_MASTERS( face ) )
62 {
63 FT_Driver driver = face->driver;
64 FT_Get_MM_Func func;
65
66
67 func = (FT_Get_MM_Func)driver->root.clazz->get_interface(
68 FT_MODULE( driver ), "get_mm" );
69 if ( func )
70 error = func( face, master );
71 }
72
73 return error;
74 }
75
76
77 /*************************************************************************/
78 /* */
79 /* <Function> */
80 /* FT_Set_MM_Design_Coordinates */
81 /* */
82 /* <Description> */
83 /* For Multiple Masters fonts, choose an interpolated font design */
84 /* through design coordinates. */
85 /* */
86 /* <Input> */
87 /* face :: A handle to the source face. */
88 /* */
89 /* num_coords :: The number of design coordinates (must be equal to */
90 /* the number of axes in the font). */
91 /* */
92 /* coords :: The design coordinates. */
93 /* */
94 /* <Return> */
95 /* FreeType error code. 0 means success. */
96 /* */
97 FT_EXPORT_FUNC( FT_Error ) FT_Set_MM_Design_Coordinates(
98 FT_Face face,
99 FT_UInt num_coords,
100 FT_Long* coords )
101 {
102 FT_Error error;
103
104
105 if ( !face )
106 return FT_Err_Invalid_Face_Handle;
107
108 error = FT_Err_Invalid_Argument;
109
110 if ( FT_HAS_MULTIPLE_MASTERS( face ) )
111 {
112 FT_Driver driver = face->driver;
113 FT_Set_MM_Design_Func func;
114
115
116 func = (FT_Set_MM_Design_Func)driver->root.clazz->get_interface(
117 FT_MODULE( driver ), "set_mm_design" );
118 if ( func )
119 error = func( face, num_coords, coords );
120 }
121
122 return error;
123 }
124
125
126 /*************************************************************************/
127 /* */
128 /* <Function> */
129 /* FT_Set_MM_Blend_Coordinates */
130 /* */
131 /* <Description> */
132 /* For Multiple Masters fonts, choose an interpolated font design */
133 /* through normalized blend coordinates. */
134 /* */
135 /* <Input> */
136 /* face :: A handle to the source face. */
137 /* */
138 /* num_coords :: The number of design coordinates (must be equal to */
139 /* the number of axes in the font). */
140 /* */
141 /* coords :: The design coordinates (each one must be between 0 */
142 /* and 1.0). */
143 /* */
144 /* <Return> */
145 /* FreeType error code. 0 means success. */
146 /* */
147 FT_EXPORT_FUNC( FT_Error ) FT_Set_MM_Blend_Coordinates(
148 FT_Face face,
149 FT_UInt num_coords,
150 FT_Fixed* coords )
151 {
152 FT_Error error;
153
154
155 if ( !face )
156 return FT_Err_Invalid_Face_Handle;
157
158 error = FT_Err_Invalid_Argument;
159
160 if ( FT_HAS_MULTIPLE_MASTERS( face ) )
161 {
162 FT_Driver driver = face->driver;
163 FT_Set_MM_Blend_Func func;
164
165
166 func = (FT_Set_MM_Blend_Func)driver->root.clazz->get_interface(
167 FT_MODULE( driver ), "set_mm_blend" );
168 if ( func )
169 error = func( face, num_coords, coords );
170 }
171
172 return error;
173 }
174
175
176 /* END */