• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /****************************************************************************
2  *
3  * svmm.h
4  *
5  *   The FreeType Multiple Masters and GX var services (specification).
6  *
7  * Copyright (C) 2003-2023 by
8  * David Turner, Robert Wilhelm, Werner Lemberg, and Dominik Röttsches.
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 #ifndef SVMM_H_
20 #define SVMM_H_
21 
22 #include <freetype/ftmm.h>
23 #include <freetype/internal/ftserv.h>
24 #include <freetype/internal/ftmmtypes.h>
25 
26 
27 FT_BEGIN_HEADER
28 
29 
30   /*
31    * A service used to manage multiple-masters data in a given face.
32    *
33    * See the related APIs in `ftmm.h' (FT_MULTIPLE_MASTERS_H).
34    *
35    */
36 
37 #define FT_SERVICE_ID_MULTI_MASTERS  "multi-masters"
38 
39 
40   typedef FT_Error
41   (*FT_Get_MM_Func)( FT_Face           face,
42                      FT_Multi_Master*  master );
43 
44   typedef FT_Error
45   (*FT_Get_MM_Var_Func)( FT_Face      face,
46                          FT_MM_Var*  *master );
47 
48   typedef FT_Error
49   (*FT_Set_MM_Design_Func)( FT_Face   face,
50                             FT_UInt   num_coords,
51                             FT_Long*  coords );
52 
53   /* use return value -1 to indicate that the new coordinates  */
54   /* are equal to the current ones; no changes are thus needed */
55   typedef FT_Error
56   (*FT_Set_Var_Design_Func)( FT_Face    face,
57                              FT_UInt    num_coords,
58                              FT_Fixed*  coords );
59 
60   /* use return value -1 to indicate that the new coordinates  */
61   /* are equal to the current ones; no changes are thus needed */
62   typedef FT_Error
63   (*FT_Set_MM_Blend_Func)( FT_Face   face,
64                            FT_UInt   num_coords,
65                            FT_Long*  coords );
66 
67   typedef FT_Error
68   (*FT_Get_Var_Design_Func)( FT_Face    face,
69                              FT_UInt    num_coords,
70                              FT_Fixed*  coords );
71 
72   typedef FT_Error
73   (*FT_Set_Instance_Func)( FT_Face  face,
74                            FT_UInt  instance_index );
75 
76   typedef FT_Error
77   (*FT_Get_MM_Blend_Func)( FT_Face   face,
78                            FT_UInt   num_coords,
79                            FT_Long*  coords );
80 
81   typedef FT_Error
82   (*FT_Get_Var_Blend_Func)( FT_Face      face,
83                             FT_UInt     *num_coords,
84                             FT_Fixed*   *coords,
85                             FT_Fixed*   *normalizedcoords,
86                             FT_MM_Var*  *mm_var );
87 
88   typedef void
89   (*FT_Done_Blend_Func)( FT_Face );
90 
91   typedef FT_Error
92   (*FT_Set_MM_WeightVector_Func)( FT_Face    face,
93                                   FT_UInt    len,
94                                   FT_Fixed*  weight_vector );
95 
96   typedef FT_Error
97   (*FT_Get_MM_WeightVector_Func)( FT_Face    face,
98                                   FT_UInt*   len,
99                                   FT_Fixed*  weight_vector );
100 
101   typedef FT_Error
102   (*FT_Var_Load_Delta_Set_Idx_Map_Func)( FT_Face            face,
103                                          FT_ULong           offset,
104                                          GX_DeltaSetIdxMap  map,
105                                          GX_ItemVarStore    itemStore,
106                                          FT_ULong           table_len );
107 
108   typedef FT_Error
109   (*FT_Var_Load_Item_Var_Store_Func)( FT_Face          face,
110                                       FT_ULong         offset,
111                                       GX_ItemVarStore  itemStore );
112 
113   typedef FT_ItemVarDelta
114   (*FT_Var_Get_Item_Delta_Func)( FT_Face          face,
115                                  GX_ItemVarStore  itemStore,
116                                  FT_UInt          outerIndex,
117                                  FT_UInt          innerIndex );
118 
119   typedef void
120   (*FT_Var_Done_Item_Var_Store_Func)( FT_Face          face,
121                                       GX_ItemVarStore  itemStore );
122 
123   typedef void
124   (*FT_Var_Done_Delta_Set_Idx_Map_Func)( FT_Face            face,
125                                          GX_DeltaSetIdxMap  deltaSetIdxMap );
126 
127 
FT_DEFINE_SERVICE(MultiMasters)128   FT_DEFINE_SERVICE( MultiMasters )
129   {
130     FT_Get_MM_Func                        get_mm;
131     FT_Set_MM_Design_Func                 set_mm_design;
132     FT_Set_MM_Blend_Func                  set_mm_blend;
133     FT_Get_MM_Blend_Func                  get_mm_blend;
134     FT_Get_MM_Var_Func                    get_mm_var;
135     FT_Set_Var_Design_Func                set_var_design;
136     FT_Get_Var_Design_Func                get_var_design;
137     FT_Set_Instance_Func                  set_instance;
138     FT_Set_MM_WeightVector_Func           set_mm_weightvector;
139     FT_Get_MM_WeightVector_Func           get_mm_weightvector;
140 
141     /* for internal use; only needed for code sharing between modules */
142     FT_Var_Load_Delta_Set_Idx_Map_Func    load_delta_set_idx_map;
143     FT_Var_Load_Item_Var_Store_Func       load_item_var_store;
144     FT_Var_Get_Item_Delta_Func            get_item_delta;
145     FT_Var_Done_Item_Var_Store_Func       done_item_var_store;
146     FT_Var_Done_Delta_Set_Idx_Map_Func    done_delta_set_idx_map;
147     FT_Get_Var_Blend_Func                 get_var_blend;
148     FT_Done_Blend_Func                    done_blend;
149   };
150 
151 
152 #define FT_DEFINE_SERVICE_MULTIMASTERSREC( class_,                  \
153                                            get_mm_,                 \
154                                            set_mm_design_,          \
155                                            set_mm_blend_,           \
156                                            get_mm_blend_,           \
157                                            get_mm_var_,             \
158                                            set_var_design_,         \
159                                            get_var_design_,         \
160                                            set_instance_,           \
161                                            set_weightvector_,       \
162                                            get_weightvector_,       \
163                                            load_delta_set_idx_map_, \
164                                            load_item_var_store_,    \
165                                            get_item_delta_,         \
166                                            done_item_var_store_,    \
167                                            done_delta_set_idx_map_, \
168                                            get_var_blend_,          \
169                                            done_blend_ )            \
170   static const FT_Service_MultiMastersRec  class_ =                 \
171   {                                                                 \
172     get_mm_,                                                        \
173     set_mm_design_,                                                 \
174     set_mm_blend_,                                                  \
175     get_mm_blend_,                                                  \
176     get_mm_var_,                                                    \
177     set_var_design_,                                                \
178     get_var_design_,                                                \
179     set_instance_,                                                  \
180     set_weightvector_,                                              \
181     get_weightvector_,                                              \
182     load_delta_set_idx_map_,                                        \
183     load_item_var_store_,                                           \
184     get_item_delta_,                                                \
185     done_item_var_store_,                                           \
186     done_delta_set_idx_map_,                                        \
187     get_var_blend_,                                                 \
188     done_blend_                                                     \
189   };
190 
191   /* */
192 
193 
194 FT_END_HEADER
195 
196 #endif /* SVMM_H_ */
197 
198 
199 /* END */
200