| 1 | // Public types from fontconfig/fontconfig.h. The C header owns the ABI; |
| 2 | // constants are generated into constants.v. |
| 3 | module fontconfig |
| 4 | |
| 5 | #pkgconfig fontconfig |
| 6 | #include <fontconfig/fontconfig.h> |
| 7 | #include "@VMODROOT/fontconfig/types.h" |
| 8 | #include "@VMODROOT/fontconfig/bridge.h" |
| 9 | |
| 10 | pub type FcChar8 = u8 |
| 11 | pub type FcChar16 = u16 |
| 12 | pub type FcChar32 = u32 |
| 13 | pub type FcBool = i32 |
| 14 | pub type FcObject = i32 |
| 15 | |
| 16 | // C enums are int-sized; enum output pointers cross typed adapters in bridge.h. |
| 17 | pub type FcType = i32 |
| 18 | pub type FcResult = i32 |
| 19 | pub type FcValueBinding = i32 |
| 20 | pub type FcMatchKind = i32 |
| 21 | pub type FcLangResult = i32 |
| 22 | pub type FcSetName = i32 |
| 23 | pub type FcEndian = i32 |
| 24 | |
| 25 | // Callbacks for config_set_font_set_filter. Exact C widths: FcBool is C int. |
| 26 | pub type FcDestroyFunc = fn (data voidptr) |
| 27 | |
| 28 | pub type FcFilterFontSetFunc = fn (font &FcPattern, user_data voidptr) FcBool |
| 29 | |
| 30 | @[typedef] |
| 31 | pub struct C.FcMatrix { |
| 32 | pub mut: |
| 33 | xx f64 |
| 34 | xy f64 |
| 35 | yx f64 |
| 36 | yy f64 |
| 37 | } |
| 38 | |
| 39 | pub type FcMatrix = C.FcMatrix |
| 40 | |
| 41 | @[typedef] |
| 42 | pub struct C.FcObjectType { |
| 43 | pub mut: |
| 44 | object &char |
| 45 | @type FcType |
| 46 | } |
| 47 | |
| 48 | pub type FcObjectType = C.FcObjectType |
| 49 | |
| 50 | @[typedef] |
| 51 | pub struct C.FcConstant { |
| 52 | pub mut: |
| 53 | name &u8 |
| 54 | object &char |
| 55 | value i32 |
| 56 | } |
| 57 | |
| 58 | pub type FcConstant = C.FcConstant |
| 59 | |
| 60 | // Opaque handles; use them only through pointers. |
| 61 | @[typedef] |
| 62 | pub struct C.FcCharSet {} |
| 63 | |
| 64 | pub type FcCharSet = C.FcCharSet |
| 65 | |
| 66 | @[typedef] |
| 67 | pub struct C.FcPattern {} |
| 68 | |
| 69 | pub type FcPattern = C.FcPattern |
| 70 | |
| 71 | @[typedef] |
| 72 | pub struct C.FcLangSet {} |
| 73 | |
| 74 | pub type FcLangSet = C.FcLangSet |
| 75 | |
| 76 | @[typedef] |
| 77 | pub struct C.FcRange {} |
| 78 | |
| 79 | pub type FcRange = C.FcRange |
| 80 | |
| 81 | @[typedef] |
| 82 | pub struct C.FcAtomic {} |
| 83 | |
| 84 | pub type FcAtomic = C.FcAtomic |
| 85 | |
| 86 | @[typedef] |
| 87 | pub struct C.FcConfig {} |
| 88 | |
| 89 | pub type FcConfig = C.FcConfig |
| 90 | |
| 91 | @[typedef] |
| 92 | pub struct C.FcFileCache {} |
| 93 | |
| 94 | pub type FcFileCache = C.FcFileCache |
| 95 | |
| 96 | @[typedef] |
| 97 | pub struct C.FcBlanks {} |
| 98 | |
| 99 | pub type FcBlanks = C.FcBlanks |
| 100 | |
| 101 | @[typedef] |
| 102 | pub struct C.FcStrList {} |
| 103 | |
| 104 | pub type FcStrList = C.FcStrList |
| 105 | |
| 106 | @[typedef] |
| 107 | pub struct C.FcStrSet {} |
| 108 | |
| 109 | pub type FcStrSet = C.FcStrSet |
| 110 | |
| 111 | @[typedef] |
| 112 | pub struct C.FcCache {} |
| 113 | |
| 114 | pub type FcCache = C.FcCache |
| 115 | |
| 116 | // FcPatternIter is caller-allocated state for the pattern_iter_* calls. |
| 117 | @[typedef] |
| 118 | pub struct C.FcPatternIter { |
| 119 | pub mut: |
| 120 | dummy1 voidptr |
| 121 | dummy2 voidptr |
| 122 | } |
| 123 | |
| 124 | pub type FcPatternIter = C.FcPatternIter |
| 125 | |
| 126 | // FcValueUnion is FcValue's anonymous union, named in types.h. Read the member |
| 127 | // that matches FcValue.type. |
| 128 | @[typedef] |
| 129 | pub union C.vx11_FcValueUnion { |
| 130 | pub mut: |
| 131 | s &u8 |
| 132 | i i32 |
| 133 | b FcBool |
| 134 | d f64 |
| 135 | m &FcMatrix |
| 136 | c &FcCharSet |
| 137 | f voidptr |
| 138 | l &FcLangSet |
| 139 | r &FcRange |
| 140 | } |
| 141 | |
| 142 | pub type FcValueUnion = C.vx11_FcValueUnion |
| 143 | |
| 144 | // FcValue borrows the data its pointers reference, except values returned by |
| 145 | // value_save, which value_destroy releases. |
| 146 | @[typedef] |
| 147 | pub struct C.FcValue { |
| 148 | pub mut: |
| 149 | @type FcType |
| 150 | u FcValueUnion |
| 151 | } |
| 152 | |
| 153 | pub type FcValue = C.FcValue |
| 154 | |
| 155 | @[typedef] |
| 156 | pub struct C.FcFontSet { |
| 157 | pub mut: |
| 158 | nfont i32 |
| 159 | sfont i32 |
| 160 | fonts &&FcPattern |
| 161 | } |
| 162 | |
| 163 | pub type FcFontSet = C.FcFontSet |
| 164 | |
| 165 | // The object name fields are deprecated by Fontconfig. |
| 166 | @[typedef] |
| 167 | pub struct C.FcObjectSet { |
| 168 | pub mut: |
| 169 | nobject i32 |
| 170 | sobject i32 |
| 171 | objects &&char |
| 172 | nobjIds i32 |
| 173 | objIds &FcObject |
| 174 | } |
| 175 | |
| 176 | pub type FcObjectSet = C.FcObjectSet |
| 177 | |
| 178 | // FcConfigFileInfoIter is caller-allocated state for config_file_info_iter_*. |
| 179 | @[typedef] |
| 180 | pub struct C.FcConfigFileInfoIter { |
| 181 | pub mut: |
| 182 | dummy1 voidptr |
| 183 | dummy2 voidptr |
| 184 | dummy3 voidptr |
| 185 | } |
| 186 | |
| 187 | pub type FcConfigFileInfoIter = C.FcConfigFileInfoIter |
| 188 | |