1 module ft.types;
2 
3 import core.stdc.config : c_long, c_ulong;
4 
5 alias FT_Int32 = int;
6 alias FT_UInt32 = uint;
7 
8 alias FT_Bool = bool;
9 alias FT_FWord = short;
10 alias FT_UFWord = ushort;
11 alias FT_Char = char;
12 alias FT_Byte = ubyte;
13 alias FT_Bytes = const(FT_Byte)*;
14 alias FT_Tag = FT_UInt32;
15 alias FT_String = char;
16 alias FT_Short = short;
17 alias FT_UShort = ushort;
18 alias FT_Int = int;
19 alias FT_UInt = uint;
20 alias FT_Long = c_long;
21 alias FT_ULong = c_ulong;
22 alias FT_F2Dot14 = short;
23 alias FT_F26Dot6 = c_long;
24 alias FT_Fixed = c_long;
25 alias FT_Error = int;
26 alias FT_Pointer = void*;
27 alias FT_Offset = size_t;
28 alias FT_PtrDist = ptrdiff_t;
29 
30 struct FT_UnitVector
31 {
32     FT_F2Dot14 x;
33     FT_F2Dot14 y;
34 }
35 
36 struct FT_Matrix
37 {
38     FT_Fixed xx, xy;
39     FT_Fixed yx, yy;
40 }
41 
42 struct FT_Data
43 {
44     const(FT_Byte)* pointer;
45     FT_Int          length;
46 }
47 
48 
49 extern(C) nothrow
50 {
51     alias FT_Generic_Finalizer = void function (void* object);
52 }
53 
54 struct FT_Generic
55 {
56     void* data;
57     FT_Generic_Finalizer finalizer;
58 }
59 
60 template makeTag(char a, char b, char c, char d)
61 {
62     enum FT_Tag makeTag = (uint(a) << 24) | (uint(b) << 16) | (uint(c) << 8) | uint(d);
63 }
64 
65 FT_Tag makeTag(in char a, in char b, in char c, in char d) pure nothrow @safe
66 {
67     return (uint(a) << 24) | (uint(b) << 16) | (uint(c) << 8) | uint(d);
68 }
69 
70 struct FT_ListNodeRec
71 {
72     FT_ListNode prev;
73     FT_ListNode next;
74     void *data;
75 }
76 alias FT_ListNode = FT_ListNodeRec*;
77 
78 struct FT_ListRec
79 {
80     FT_ListNode head;
81     FT_ListNode tail;
82 }
83 alias FT_List = FT_ListRec*;
84 
85 FT_Error FT_ERROR_BASE(X)(in X x)
86 {
87     return x & 0xFF;
88 }
89 
90 FT_Error FT_ERROR_MODULE(X)(in X x)
91 {
92     return x & 0xFF00;
93 }