1 2 // Copyright Ahmet Sait Koçak 2020. 3 // Distributed under the Boost Software License, Version 1.0. 4 // (See accompanying file LICENSE_1_0.txt or copy at 5 // https://www.boost.org/LICENSE_1_0.txt) 6 7 module bindbc.hb.bind.ot.var; 8 9 import bindbc.hb.config; 10 11 import bindbc.hb.bind.common; 12 import bindbc.hb.bind.face; 13 import bindbc.hb.bind.ot.name; 14 15 extern(C) @nogc nothrow: 16 17 enum HB_OT_TAG_VAR_AXIS_ITALIC = HB_TAG('i', 't', 'a', 'l'); 18 enum HB_OT_TAG_VAR_AXIS_OPTICAL_SIZE = HB_TAG('o', 'p', 's', 'z'); 19 enum HB_OT_TAG_VAR_AXIS_SLANT = HB_TAG('s', 'l', 'n', 't'); 20 enum HB_OT_TAG_VAR_AXIS_WIDTH = HB_TAG('w', 'd', 't', 'h'); 21 enum HB_OT_TAG_VAR_AXIS_WEIGHT = HB_TAG('w', 'g', 'h', 't'); 22 23 /* 24 * fvar / avar 25 */ 26 27 version(BindHB_Static) 28 hb_bool_t hb_ot_var_has_data (hb_face_t* face); 29 else 30 { 31 private alias fp_hb_ot_var_has_data = hb_bool_t function (hb_face_t* face); 32 __gshared fp_hb_ot_var_has_data hb_ot_var_has_data; 33 } 34 35 /* 36 * Variation axes. 37 */ 38 39 version(BindHB_Static) 40 uint hb_ot_var_get_axis_count (hb_face_t* face); 41 else 42 { 43 private alias fp_hb_ot_var_get_axis_count = uint function (hb_face_t* face); 44 __gshared fp_hb_ot_var_get_axis_count hb_ot_var_get_axis_count; 45 } 46 47 static if (hbSupport >= HBSupport.v2_6_3) 48 { 49 /** 50 * hb_ot_var_axis_flags_t: 51 * @HB_OT_VAR_AXIS_FLAG_HIDDEN: The axis should not be exposed directly in user interfaces. 52 * 53 * Since: 2.2.0 54 */ 55 enum : hb_tag_t 56 { 57 /*< flags >*/ 58 HB_OT_VAR_AXIS_FLAG_HIDDEN = 0x00000001u, 59 60 _HB_OT_VAR_AXIS_FLAG_MAX_VALUE = HB_TAG_MAX_SIGNED /*< skip >*/ 61 } 62 alias hb_ot_var_axis_flags_t = hb_tag_t; 63 64 /** 65 * hb_ot_var_axis_info_t: 66 * 67 * Since: 2.2.0 68 */ 69 struct hb_ot_var_axis_info_t 70 { 71 uint axis_index; 72 hb_tag_t tag; 73 hb_ot_name_id_t name_id; 74 hb_ot_var_axis_flags_t flags; 75 float min_value; 76 float default_value; 77 float max_value; 78 /*< private >*/ 79 uint reserved; 80 } 81 82 /* IN/OUT */ 83 /* OUT */ 84 version(BindHB_Static) 85 uint hb_ot_var_get_axis_infos ( 86 hb_face_t* face, 87 uint start_offset, 88 uint* axes_count, 89 hb_ot_var_axis_info_t* axes_array); 90 else 91 { 92 private alias fp_hb_ot_var_get_axis_infos = uint function ( 93 hb_face_t* face, 94 uint start_offset, 95 uint* axes_count, 96 hb_ot_var_axis_info_t* axes_array); 97 __gshared fp_hb_ot_var_get_axis_infos hb_ot_var_get_axis_infos; 98 } 99 100 version(BindHB_Static) 101 hb_bool_t hb_ot_var_find_axis_info ( 102 hb_face_t* face, 103 hb_tag_t axis_tag, 104 hb_ot_var_axis_info_t* axis_info); 105 else 106 { 107 private alias fp_hb_ot_var_find_axis_info = hb_bool_t function ( 108 hb_face_t* face, 109 hb_tag_t axis_tag, 110 hb_ot_var_axis_info_t* axis_info); 111 __gshared fp_hb_ot_var_find_axis_info hb_ot_var_find_axis_info; 112 } 113 114 /* 115 * Named instances. 116 */ 117 118 version(BindHB_Static) 119 uint hb_ot_var_get_named_instance_count (hb_face_t* face); 120 else 121 { 122 private alias fp_hb_ot_var_get_named_instance_count = uint function (hb_face_t* face); 123 __gshared fp_hb_ot_var_get_named_instance_count hb_ot_var_get_named_instance_count; 124 } 125 126 version(BindHB_Static) 127 hb_ot_name_id_t hb_ot_var_named_instance_get_subfamily_name_id ( 128 hb_face_t* face, 129 uint instance_index); 130 else 131 { 132 private alias fp_hb_ot_var_named_instance_get_subfamily_name_id = hb_ot_name_id_t function ( 133 hb_face_t* face, 134 uint instance_index); 135 __gshared fp_hb_ot_var_named_instance_get_subfamily_name_id hb_ot_var_named_instance_get_subfamily_name_id; 136 } 137 138 version(BindHB_Static) 139 hb_ot_name_id_t hb_ot_var_named_instance_get_postscript_name_id ( 140 hb_face_t* face, 141 uint instance_index); 142 else 143 { 144 private alias fp_hb_ot_var_named_instance_get_postscript_name_id = hb_ot_name_id_t function ( 145 hb_face_t* face, 146 uint instance_index); 147 __gshared fp_hb_ot_var_named_instance_get_postscript_name_id hb_ot_var_named_instance_get_postscript_name_id; 148 } 149 150 /* IN/OUT */ 151 /* OUT */ 152 version(BindHB_Static) 153 uint hb_ot_var_named_instance_get_design_coords ( 154 hb_face_t* face, 155 uint instance_index, 156 uint* coords_length, 157 float* coords); 158 else 159 { 160 private alias fp_hb_ot_var_named_instance_get_design_coords = uint function ( 161 hb_face_t* face, 162 uint instance_index, 163 uint* coords_length, 164 float* coords); 165 __gshared fp_hb_ot_var_named_instance_get_design_coords hb_ot_var_named_instance_get_design_coords; 166 } 167 } 168 169 /* 170 * Conversions. 171 */ 172 173 /* IN */ 174 175 /* OUT */ 176 version(BindHB_Static) 177 void hb_ot_var_normalize_variations ( 178 hb_face_t* face, 179 const(hb_variation_t)* variations, 180 uint variations_length, 181 int* coords, 182 uint coords_length); 183 else 184 { 185 private alias fp_hb_ot_var_normalize_variations = void function ( 186 hb_face_t* face, 187 const(hb_variation_t)* variations, 188 uint variations_length, 189 int* coords, 190 uint coords_length); 191 __gshared fp_hb_ot_var_normalize_variations hb_ot_var_normalize_variations; 192 } 193 194 /* IN */ 195 /* OUT */ 196 version(BindHB_Static) 197 void hb_ot_var_normalize_coords ( 198 hb_face_t* face, 199 uint coords_length, 200 const(float)* design_coords, 201 int* normalized_coords); 202 else 203 { 204 private alias fp_hb_ot_var_normalize_coords = void function ( 205 hb_face_t* face, 206 uint coords_length, 207 const(float)* design_coords, 208 int* normalized_coords); 209 __gshared fp_hb_ot_var_normalize_coords hb_ot_var_normalize_coords; 210 }