1 
2 //          Copyright 2019 - 2021 Michael D. Parker
3 // Distributed under the Boost Software License, Version 1.0.
4 //    (See accompanying file LICENSE_1_0.txt or copy at
5 //          http://www.boost.org/LICENSE_1_0.txt)
6 
7 module bindbc.freetype.bind.ftmm;
8 
9 import bindbc.freetype.config;
10 import bindbc.freetype.bind.freetype,
11        bindbc.freetype.bind.fttypes;
12 
13 struct FT_MM_Axis {
14     FT_String* name;
15     FT_Long minimum;
16     FT_Long maximum;
17 }
18 
19 struct FT_Multi_Master {
20     FT_UInt num_axis;
21     FT_UInt num_designs;
22     FT_MM_Axis[4] axis;
23 }
24 
25 struct FT_Var_Axis {
26     FT_String* name;
27     FT_Fixed minimum;
28     FT_Fixed def;
29     FT_Fixed maximum;
30     FT_ULong tag;
31     FT_UInt strid;
32 }
33 
34 struct FT_Var_Named_Style {
35     FT_Fixed* coords;
36     FT_UInt strid;
37     static if(ftSupport >= FTSupport.ft27) {
38         FT_UInt psid;
39     }
40 }
41 
42 struct FT_MM_Var {
43     FT_UInt num_axis;
44     FT_UInt num_designs;
45     FT_UInt num_namedstyles;
46     FT_Var_Axis* axis;
47     FT_Var_Named_Style* namedstyle;
48 }
49 
50 // Added in Freetype 2.8
51 enum FT_VAR_AXIS_FLAG_HIDDEN = 1;
52 
53 static if(staticBinding) {
54 	extern(C) @nogc nothrow {
55         FT_Error FT_Get_Multi_Master(FT_Face face, FT_Multi_Master* amaster);
56         FT_Error FT_Get_MM_Var(FT_Face face, FT_MM_Var** amaster);
57         FT_Error FT_Set_MM_Design_Coordinates(FT_Face face, FT_UInt num_coords, FT_Long* coords);
58         FT_Error FT_Set_Var_Design_Coordinates(FT_Face face, FT_UInt num_coords, FT_Fixed* coords);
59         FT_Error FT_Set_MM_Blend_Coordinates(FT_Face face, FT_UInt num_coords, FT_Fixed* coords);
60         FT_Error FT_Set_Var_Blend_Coordinates(FT_Face face, FT_UInt num_coords, FT_Fixed* coords);
61 
62         static if(ftSupport >= FTSupport.ft27) {
63             FT_Error FT_Get_Var_Design_Coordinates(FT_Face face, FT_UInt num_coords, FT_Fixed* coords);
64             FT_Error FT_Get_MM_Blend_Coordinates(FT_Face face, FT_UInt num_coords, FT_Fixed* coords);
65             FT_Error FT_Get_Var_Blend_Coordinates(FT_Face face, FT_UInt num_coords, FT_Fixed* coords);
66         }
67         static if(ftSupport >= FTSupport.ft28) {
68             FT_Error FT_Get_Var_Axis_Flags(FT_MM_Var* master, FT_UInt axis_index, FT_UInt* flags);
69         }
70         static if(ftSupport >= FTSupport.ft29) {
71             FT_Error FT_Done_MM_Var(FT_Library library, FT_MM_Var* amaster);
72             FT_Error FT_Set_Named_Instance(FT_Face face, FT_UInt instance_index);
73         }
74         static if(ftSupport >= FTSupport.ft210) {
75             FT_Error FT_Set_MM_WeightVector(FT_Face face, FT_UInt len, FT_Fixed* weightvector);
76             FT_Error FT_Get_MM_WeightVector(FT_Face face, FT_UInt len, FT_Fixed* weightvector);
77         }
78     }
79 }
80 else {
81     extern(C) @nogc nothrow {
82         alias pFT_Get_Multi_Master = FT_Error function(FT_Face face, FT_Multi_Master* amaster);
83         alias pFT_Get_MM_Var = FT_Error function(FT_Face face, FT_MM_Var** amaster);
84         alias pFT_Set_MM_Design_Coordinates = FT_Error function(FT_Face face, FT_UInt num_coords, FT_Long* coords);
85         alias pFT_Set_Var_Design_Coordinates = FT_Error function(FT_Face face, FT_UInt num_coords, FT_Fixed* coords);
86         alias pFT_Set_MM_Blend_Coordinates = FT_Error function(FT_Face face, FT_UInt num_coords, FT_Fixed* coords);
87         alias pFT_Set_Var_Blend_Coordinates = FT_Error function(FT_Face face, FT_UInt num_coords, FT_Fixed* coords);
88 
89         static if(ftSupport >= FTSupport.ft27) {
90             alias pFT_Get_Var_Design_Coordinates = FT_Error function(FT_Face face, FT_UInt num_coords, FT_Fixed* coords);
91             alias pFT_Get_MM_Blend_Coordinates = FT_Error function(FT_Face face, FT_UInt num_coords, FT_Fixed* coords);
92             alias pFT_Get_Var_Blend_Coordinates = FT_Error function(FT_Face face, FT_UInt num_coords, FT_Fixed* coords);
93         }
94 
95         static if(ftSupport >= FTSupport.ft28) {
96             alias pFT_Get_Var_Axis_Flags = FT_Error function(FT_MM_Var* master, FT_UInt axis_index, FT_UInt* flags);
97         }
98 
99         static if(ftSupport >= FTSupport.ft29) {
100             alias pFT_Done_MM_Var = FT_Error function(FT_Library library, FT_MM_Var* amaster);
101             alias pFT_Set_Named_Instance = FT_Error function(FT_Face face, FT_UInt instance_index);
102         }
103         static if(ftSupport >= FTSupport.ft210) {
104             alias pFT_Set_MM_WeightVector = FT_Error function(FT_Face face, FT_UInt len, FT_Fixed* weightvector);
105             alias pFT_Get_MM_WeightVector = FT_Error function(FT_Face face, FT_UInt len, FT_Fixed* weightvector);
106         }
107     }
108 
109     __gshared {
110         pFT_Get_Multi_Master FT_Get_Multi_Master;
111         pFT_Get_MM_Var FT_Get_MM_Var;
112         pFT_Set_MM_Design_Coordinates FT_Set_MM_Design_Coordinates;
113         pFT_Set_Var_Design_Coordinates FT_Set_Var_Design_Coordinates;
114         pFT_Set_MM_Blend_Coordinates FT_Set_MM_Blend_Coordinates;
115         pFT_Set_Var_Blend_Coordinates FT_Set_Var_Blend_Coordinates;
116 
117         static if(ftSupport >= FTSupport.ft27) {
118             pFT_Get_Var_Design_Coordinates FT_Get_Var_Design_Coordinates;
119             pFT_Get_MM_Blend_Coordinates FT_Get_MM_Blend_Coordinates;
120             pFT_Get_Var_Blend_Coordinates FT_Get_Var_Blend_Coordinates;
121         }
122         static if(ftSupport >= FTSupport.ft28) {
123             pFT_Get_Var_Axis_Flags FT_Get_Var_Axis_Flags;
124         }
125         static if(ftSupport >= FTSupport.ft29) {
126             pFT_Done_MM_Var FT_Done_MM_Var;
127             pFT_Set_Named_Instance FT_Set_Named_Instance;
128         }
129         static if(ftSupport >= FTSupport.ft210) {
130             pFT_Set_MM_WeightVector FT_Set_MM_WeightVector;
131             pFT_Get_MM_WeightVector FT_Get_MM_WeightVector;
132         }
133     }
134 
135 }