| 1 | /* | 
|---|
| 2 | * Copyright © 2009  Red Hat, Inc. | 
|---|
| 3 | * | 
|---|
| 4 | *  This is part of HarfBuzz, a text shaping library. | 
|---|
| 5 | * | 
|---|
| 6 | * Permission is hereby granted, without written agreement and without | 
|---|
| 7 | * license or royalty fees, to use, copy, modify, and distribute this | 
|---|
| 8 | * software and its documentation for any purpose, provided that the | 
|---|
| 9 | * above copyright notice and the following two paragraphs appear in | 
|---|
| 10 | * all copies of this software. | 
|---|
| 11 | * | 
|---|
| 12 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR | 
|---|
| 13 | * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES | 
|---|
| 14 | * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN | 
|---|
| 15 | * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH | 
|---|
| 16 | * DAMAGE. | 
|---|
| 17 | * | 
|---|
| 18 | * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, | 
|---|
| 19 | * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND | 
|---|
| 20 | * FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS | 
|---|
| 21 | * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO | 
|---|
| 22 | * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. | 
|---|
| 23 | * | 
|---|
| 24 | * Red Hat Author(s): Behdad Esfahbod | 
|---|
| 25 | */ | 
|---|
| 26 |  | 
|---|
| 27 | #ifndef HB_H_IN | 
|---|
| 28 | #error "Include <hb.h> instead." | 
|---|
| 29 | #endif | 
|---|
| 30 |  | 
|---|
| 31 | #ifndef HB_FONT_H | 
|---|
| 32 | #define HB_FONT_H | 
|---|
| 33 |  | 
|---|
| 34 | #include "hb-common.h" | 
|---|
| 35 | #include "hb-face.h" | 
|---|
| 36 |  | 
|---|
| 37 | HB_BEGIN_DECLS | 
|---|
| 38 |  | 
|---|
| 39 |  | 
|---|
| 40 | typedef struct hb_font_t hb_font_t; | 
|---|
| 41 |  | 
|---|
| 42 |  | 
|---|
| 43 | /* | 
|---|
| 44 | * hb_font_funcs_t | 
|---|
| 45 | */ | 
|---|
| 46 |  | 
|---|
| 47 | typedef struct hb_font_funcs_t hb_font_funcs_t; | 
|---|
| 48 |  | 
|---|
| 49 | HB_EXTERN hb_font_funcs_t * | 
|---|
| 50 | hb_font_funcs_create (void); | 
|---|
| 51 |  | 
|---|
| 52 | HB_EXTERN hb_font_funcs_t * | 
|---|
| 53 | hb_font_funcs_get_empty (void); | 
|---|
| 54 |  | 
|---|
| 55 | HB_EXTERN hb_font_funcs_t * | 
|---|
| 56 | hb_font_funcs_reference (hb_font_funcs_t *ffuncs); | 
|---|
| 57 |  | 
|---|
| 58 | HB_EXTERN void | 
|---|
| 59 | hb_font_funcs_destroy (hb_font_funcs_t *ffuncs); | 
|---|
| 60 |  | 
|---|
| 61 | HB_EXTERN hb_bool_t | 
|---|
| 62 | hb_font_funcs_set_user_data (hb_font_funcs_t    *ffuncs, | 
|---|
| 63 | hb_user_data_key_t *key, | 
|---|
| 64 | void *              data, | 
|---|
| 65 | hb_destroy_func_t   destroy, | 
|---|
| 66 | hb_bool_t           replace); | 
|---|
| 67 |  | 
|---|
| 68 |  | 
|---|
| 69 | HB_EXTERN void * | 
|---|
| 70 | hb_font_funcs_get_user_data (hb_font_funcs_t    *ffuncs, | 
|---|
| 71 | hb_user_data_key_t *key); | 
|---|
| 72 |  | 
|---|
| 73 |  | 
|---|
| 74 | HB_EXTERN void | 
|---|
| 75 | hb_font_funcs_make_immutable (hb_font_funcs_t *ffuncs); | 
|---|
| 76 |  | 
|---|
| 77 | HB_EXTERN hb_bool_t | 
|---|
| 78 | hb_font_funcs_is_immutable (hb_font_funcs_t *ffuncs); | 
|---|
| 79 |  | 
|---|
| 80 |  | 
|---|
| 81 | /* font and glyph extents */ | 
|---|
| 82 |  | 
|---|
| 83 | /* Note that typically ascender is positive and descender negative in coordinate systems that grow up. */ | 
|---|
| 84 | typedef struct hb_font_extents_t | 
|---|
| 85 | { | 
|---|
| 86 | hb_position_t ascender; /* typographic ascender. */ | 
|---|
| 87 | hb_position_t descender; /* typographic descender. */ | 
|---|
| 88 | hb_position_t line_gap; /* suggested line spacing gap. */ | 
|---|
| 89 | /*< private >*/ | 
|---|
| 90 | hb_position_t reserved9; | 
|---|
| 91 | hb_position_t reserved8; | 
|---|
| 92 | hb_position_t reserved7; | 
|---|
| 93 | hb_position_t reserved6; | 
|---|
| 94 | hb_position_t reserved5; | 
|---|
| 95 | hb_position_t reserved4; | 
|---|
| 96 | hb_position_t reserved3; | 
|---|
| 97 | hb_position_t reserved2; | 
|---|
| 98 | hb_position_t reserved1; | 
|---|
| 99 | } hb_font_extents_t; | 
|---|
| 100 |  | 
|---|
| 101 | /* Note that height is negative in coordinate systems that grow up. */ | 
|---|
| 102 | typedef struct hb_glyph_extents_t | 
|---|
| 103 | { | 
|---|
| 104 | hb_position_t x_bearing; /* left side of glyph from origin. */ | 
|---|
| 105 | hb_position_t y_bearing; /* top side of glyph from origin. */ | 
|---|
| 106 | hb_position_t width; /* distance from left to right side. */ | 
|---|
| 107 | hb_position_t height; /* distance from top to bottom side. */ | 
|---|
| 108 | } hb_glyph_extents_t; | 
|---|
| 109 |  | 
|---|
| 110 | /* func types */ | 
|---|
| 111 |  | 
|---|
| 112 | typedef hb_bool_t (*hb_font_get_font_extents_func_t) (hb_font_t *font, void *font_data, | 
|---|
| 113 | hb_font_extents_t *extents, | 
|---|
| 114 | void *user_data); | 
|---|
| 115 | typedef hb_font_get_font_extents_func_t hb_font_get_font_h_extents_func_t; | 
|---|
| 116 | typedef hb_font_get_font_extents_func_t hb_font_get_font_v_extents_func_t; | 
|---|
| 117 |  | 
|---|
| 118 |  | 
|---|
| 119 | typedef hb_bool_t (*hb_font_get_nominal_glyph_func_t) (hb_font_t *font, void *font_data, | 
|---|
| 120 | hb_codepoint_t unicode, | 
|---|
| 121 | hb_codepoint_t *glyph, | 
|---|
| 122 | void *user_data); | 
|---|
| 123 | typedef hb_bool_t (*hb_font_get_variation_glyph_func_t) (hb_font_t *font, void *font_data, | 
|---|
| 124 | hb_codepoint_t unicode, hb_codepoint_t variation_selector, | 
|---|
| 125 | hb_codepoint_t *glyph, | 
|---|
| 126 | void *user_data); | 
|---|
| 127 |  | 
|---|
| 128 | typedef unsigned int (*hb_font_get_nominal_glyphs_func_t) (hb_font_t *font, void *font_data, | 
|---|
| 129 | unsigned int count, | 
|---|
| 130 | const hb_codepoint_t *first_unicode, | 
|---|
| 131 | unsigned int unicode_stride, | 
|---|
| 132 | hb_codepoint_t *first_glyph, | 
|---|
| 133 | unsigned int glyph_stride, | 
|---|
| 134 | void *user_data); | 
|---|
| 135 |  | 
|---|
| 136 |  | 
|---|
| 137 | typedef hb_position_t (*hb_font_get_glyph_advance_func_t) (hb_font_t *font, void *font_data, | 
|---|
| 138 | hb_codepoint_t glyph, | 
|---|
| 139 | void *user_data); | 
|---|
| 140 | typedef hb_font_get_glyph_advance_func_t hb_font_get_glyph_h_advance_func_t; | 
|---|
| 141 | typedef hb_font_get_glyph_advance_func_t hb_font_get_glyph_v_advance_func_t; | 
|---|
| 142 |  | 
|---|
| 143 | typedef void (*hb_font_get_glyph_advances_func_t) (hb_font_t* font, void* font_data, | 
|---|
| 144 | unsigned int count, | 
|---|
| 145 | const hb_codepoint_t *first_glyph, | 
|---|
| 146 | unsigned glyph_stride, | 
|---|
| 147 | hb_position_t *first_advance, | 
|---|
| 148 | unsigned advance_stride, | 
|---|
| 149 | void *user_data); | 
|---|
| 150 | typedef hb_font_get_glyph_advances_func_t hb_font_get_glyph_h_advances_func_t; | 
|---|
| 151 | typedef hb_font_get_glyph_advances_func_t hb_font_get_glyph_v_advances_func_t; | 
|---|
| 152 |  | 
|---|
| 153 | typedef hb_bool_t (*hb_font_get_glyph_origin_func_t) (hb_font_t *font, void *font_data, | 
|---|
| 154 | hb_codepoint_t glyph, | 
|---|
| 155 | hb_position_t *x, hb_position_t *y, | 
|---|
| 156 | void *user_data); | 
|---|
| 157 | typedef hb_font_get_glyph_origin_func_t hb_font_get_glyph_h_origin_func_t; | 
|---|
| 158 | typedef hb_font_get_glyph_origin_func_t hb_font_get_glyph_v_origin_func_t; | 
|---|
| 159 |  | 
|---|
| 160 |  | 
|---|
| 161 | typedef hb_bool_t (*hb_font_get_glyph_extents_func_t) (hb_font_t *font, void *font_data, | 
|---|
| 162 | hb_codepoint_t glyph, | 
|---|
| 163 | hb_glyph_extents_t *extents, | 
|---|
| 164 | void *user_data); | 
|---|
| 165 | typedef hb_bool_t (*hb_font_get_glyph_contour_point_func_t) (hb_font_t *font, void *font_data, | 
|---|
| 166 | hb_codepoint_t glyph, unsigned int point_index, | 
|---|
| 167 | hb_position_t *x, hb_position_t *y, | 
|---|
| 168 | void *user_data); | 
|---|
| 169 |  | 
|---|
| 170 |  | 
|---|
| 171 | typedef hb_bool_t (*hb_font_get_glyph_name_func_t) (hb_font_t *font, void *font_data, | 
|---|
| 172 | hb_codepoint_t glyph, | 
|---|
| 173 | char *name, unsigned int size, | 
|---|
| 174 | void *user_data); | 
|---|
| 175 | typedef hb_bool_t (*hb_font_get_glyph_from_name_func_t) (hb_font_t *font, void *font_data, | 
|---|
| 176 | const char *name, int len, /* -1 means nul-terminated */ | 
|---|
| 177 | hb_codepoint_t *glyph, | 
|---|
| 178 | void *user_data); | 
|---|
| 179 |  | 
|---|
| 180 |  | 
|---|
| 181 | /* func setters */ | 
|---|
| 182 |  | 
|---|
| 183 | /** | 
|---|
| 184 | * hb_font_funcs_set_font_h_extents_func: | 
|---|
| 185 | * @ffuncs: font functions. | 
|---|
| 186 | * @func: (closure user_data) (destroy destroy) (scope notified): | 
|---|
| 187 | * @user_data: | 
|---|
| 188 | * @destroy: | 
|---|
| 189 | * | 
|---|
| 190 | * | 
|---|
| 191 | * | 
|---|
| 192 | * Since: 1.1.2 | 
|---|
| 193 | **/ | 
|---|
| 194 | HB_EXTERN void | 
|---|
| 195 | hb_font_funcs_set_font_h_extents_func (hb_font_funcs_t *ffuncs, | 
|---|
| 196 | hb_font_get_font_h_extents_func_t func, | 
|---|
| 197 | void *user_data, hb_destroy_func_t destroy); | 
|---|
| 198 |  | 
|---|
| 199 | /** | 
|---|
| 200 | * hb_font_funcs_set_font_v_extents_func: | 
|---|
| 201 | * @ffuncs: font functions. | 
|---|
| 202 | * @func: (closure user_data) (destroy destroy) (scope notified): | 
|---|
| 203 | * @user_data: | 
|---|
| 204 | * @destroy: | 
|---|
| 205 | * | 
|---|
| 206 | * | 
|---|
| 207 | * | 
|---|
| 208 | * Since: 1.1.2 | 
|---|
| 209 | **/ | 
|---|
| 210 | HB_EXTERN void | 
|---|
| 211 | hb_font_funcs_set_font_v_extents_func (hb_font_funcs_t *ffuncs, | 
|---|
| 212 | hb_font_get_font_v_extents_func_t func, | 
|---|
| 213 | void *user_data, hb_destroy_func_t destroy); | 
|---|
| 214 |  | 
|---|
| 215 | /** | 
|---|
| 216 | * hb_font_funcs_set_nominal_glyph_func: | 
|---|
| 217 | * @ffuncs: font functions. | 
|---|
| 218 | * @func: (closure user_data) (destroy destroy) (scope notified): | 
|---|
| 219 | * @user_data: | 
|---|
| 220 | * @destroy: | 
|---|
| 221 | * | 
|---|
| 222 | * | 
|---|
| 223 | * | 
|---|
| 224 | * Since: 1.2.3 | 
|---|
| 225 | **/ | 
|---|
| 226 | HB_EXTERN void | 
|---|
| 227 | hb_font_funcs_set_nominal_glyph_func (hb_font_funcs_t *ffuncs, | 
|---|
| 228 | hb_font_get_nominal_glyph_func_t func, | 
|---|
| 229 | void *user_data, hb_destroy_func_t destroy); | 
|---|
| 230 |  | 
|---|
| 231 | /** | 
|---|
| 232 | * hb_font_funcs_set_nominal_glyphs_func: | 
|---|
| 233 | * @ffuncs: font functions. | 
|---|
| 234 | * @func: (closure user_data) (destroy destroy) (scope notified): | 
|---|
| 235 | * @user_data: | 
|---|
| 236 | * @destroy: | 
|---|
| 237 | * | 
|---|
| 238 | * | 
|---|
| 239 | * | 
|---|
| 240 | * Since: 2.0.0 | 
|---|
| 241 | **/ | 
|---|
| 242 | HB_EXTERN void | 
|---|
| 243 | hb_font_funcs_set_nominal_glyphs_func (hb_font_funcs_t *ffuncs, | 
|---|
| 244 | hb_font_get_nominal_glyphs_func_t func, | 
|---|
| 245 | void *user_data, hb_destroy_func_t destroy); | 
|---|
| 246 |  | 
|---|
| 247 | /** | 
|---|
| 248 | * hb_font_funcs_set_variation_glyph_func: | 
|---|
| 249 | * @ffuncs: font functions. | 
|---|
| 250 | * @func: (closure user_data) (destroy destroy) (scope notified): | 
|---|
| 251 | * @user_data: | 
|---|
| 252 | * @destroy: | 
|---|
| 253 | * | 
|---|
| 254 | * | 
|---|
| 255 | * | 
|---|
| 256 | * Since: 1.2.3 | 
|---|
| 257 | **/ | 
|---|
| 258 | HB_EXTERN void | 
|---|
| 259 | hb_font_funcs_set_variation_glyph_func (hb_font_funcs_t *ffuncs, | 
|---|
| 260 | hb_font_get_variation_glyph_func_t func, | 
|---|
| 261 | void *user_data, hb_destroy_func_t destroy); | 
|---|
| 262 |  | 
|---|
| 263 | /** | 
|---|
| 264 | * hb_font_funcs_set_glyph_h_advance_func: | 
|---|
| 265 | * @ffuncs: font functions. | 
|---|
| 266 | * @func: (closure user_data) (destroy destroy) (scope notified): | 
|---|
| 267 | * @user_data: | 
|---|
| 268 | * @destroy: | 
|---|
| 269 | * | 
|---|
| 270 | * | 
|---|
| 271 | * | 
|---|
| 272 | * Since: 0.9.2 | 
|---|
| 273 | **/ | 
|---|
| 274 | HB_EXTERN void | 
|---|
| 275 | hb_font_funcs_set_glyph_h_advance_func (hb_font_funcs_t *ffuncs, | 
|---|
| 276 | hb_font_get_glyph_h_advance_func_t func, | 
|---|
| 277 | void *user_data, hb_destroy_func_t destroy); | 
|---|
| 278 |  | 
|---|
| 279 | /** | 
|---|
| 280 | * hb_font_funcs_set_glyph_v_advance_func: | 
|---|
| 281 | * @ffuncs: font functions. | 
|---|
| 282 | * @func: (closure user_data) (destroy destroy) (scope notified): | 
|---|
| 283 | * @user_data: | 
|---|
| 284 | * @destroy: | 
|---|
| 285 | * | 
|---|
| 286 | * | 
|---|
| 287 | * | 
|---|
| 288 | * Since: 0.9.2 | 
|---|
| 289 | **/ | 
|---|
| 290 | HB_EXTERN void | 
|---|
| 291 | hb_font_funcs_set_glyph_v_advance_func (hb_font_funcs_t *ffuncs, | 
|---|
| 292 | hb_font_get_glyph_v_advance_func_t func, | 
|---|
| 293 | void *user_data, hb_destroy_func_t destroy); | 
|---|
| 294 |  | 
|---|
| 295 | /** | 
|---|
| 296 | * hb_font_funcs_set_glyph_h_advances_func: | 
|---|
| 297 | * @ffuncs: font functions. | 
|---|
| 298 | * @func: (closure user_data) (destroy destroy) (scope notified): | 
|---|
| 299 | * @user_data: | 
|---|
| 300 | * @destroy: | 
|---|
| 301 | * | 
|---|
| 302 | * | 
|---|
| 303 | * | 
|---|
| 304 | * Since: 1.8.6 | 
|---|
| 305 | **/ | 
|---|
| 306 | HB_EXTERN void | 
|---|
| 307 | hb_font_funcs_set_glyph_h_advances_func (hb_font_funcs_t *ffuncs, | 
|---|
| 308 | hb_font_get_glyph_h_advances_func_t func, | 
|---|
| 309 | void *user_data, hb_destroy_func_t destroy); | 
|---|
| 310 |  | 
|---|
| 311 | /** | 
|---|
| 312 | * hb_font_funcs_set_glyph_v_advances_func: | 
|---|
| 313 | * @ffuncs: font functions. | 
|---|
| 314 | * @func: (closure user_data) (destroy destroy) (scope notified): | 
|---|
| 315 | * @user_data: | 
|---|
| 316 | * @destroy: | 
|---|
| 317 | * | 
|---|
| 318 | * | 
|---|
| 319 | * | 
|---|
| 320 | * Since: 1.8.6 | 
|---|
| 321 | **/ | 
|---|
| 322 | HB_EXTERN void | 
|---|
| 323 | hb_font_funcs_set_glyph_v_advances_func (hb_font_funcs_t *ffuncs, | 
|---|
| 324 | hb_font_get_glyph_v_advances_func_t func, | 
|---|
| 325 | void *user_data, hb_destroy_func_t destroy); | 
|---|
| 326 |  | 
|---|
| 327 | /** | 
|---|
| 328 | * hb_font_funcs_set_glyph_h_origin_func: | 
|---|
| 329 | * @ffuncs: font functions. | 
|---|
| 330 | * @func: (closure user_data) (destroy destroy) (scope notified): | 
|---|
| 331 | * @user_data: | 
|---|
| 332 | * @destroy: | 
|---|
| 333 | * | 
|---|
| 334 | * | 
|---|
| 335 | * | 
|---|
| 336 | * Since: 0.9.2 | 
|---|
| 337 | **/ | 
|---|
| 338 | HB_EXTERN void | 
|---|
| 339 | hb_font_funcs_set_glyph_h_origin_func (hb_font_funcs_t *ffuncs, | 
|---|
| 340 | hb_font_get_glyph_h_origin_func_t func, | 
|---|
| 341 | void *user_data, hb_destroy_func_t destroy); | 
|---|
| 342 |  | 
|---|
| 343 | /** | 
|---|
| 344 | * hb_font_funcs_set_glyph_v_origin_func: | 
|---|
| 345 | * @ffuncs: font functions. | 
|---|
| 346 | * @func: (closure user_data) (destroy destroy) (scope notified): | 
|---|
| 347 | * @user_data: | 
|---|
| 348 | * @destroy: | 
|---|
| 349 | * | 
|---|
| 350 | * | 
|---|
| 351 | * | 
|---|
| 352 | * Since: 0.9.2 | 
|---|
| 353 | **/ | 
|---|
| 354 | HB_EXTERN void | 
|---|
| 355 | hb_font_funcs_set_glyph_v_origin_func (hb_font_funcs_t *ffuncs, | 
|---|
| 356 | hb_font_get_glyph_v_origin_func_t func, | 
|---|
| 357 | void *user_data, hb_destroy_func_t destroy); | 
|---|
| 358 |  | 
|---|
| 359 | /** | 
|---|
| 360 | * hb_font_funcs_set_glyph_extents_func: | 
|---|
| 361 | * @ffuncs: font functions. | 
|---|
| 362 | * @func: (closure user_data) (destroy destroy) (scope notified): | 
|---|
| 363 | * @user_data: | 
|---|
| 364 | * @destroy: | 
|---|
| 365 | * | 
|---|
| 366 | * | 
|---|
| 367 | * | 
|---|
| 368 | * Since: 0.9.2 | 
|---|
| 369 | **/ | 
|---|
| 370 | HB_EXTERN void | 
|---|
| 371 | hb_font_funcs_set_glyph_extents_func (hb_font_funcs_t *ffuncs, | 
|---|
| 372 | hb_font_get_glyph_extents_func_t func, | 
|---|
| 373 | void *user_data, hb_destroy_func_t destroy); | 
|---|
| 374 |  | 
|---|
| 375 | /** | 
|---|
| 376 | * hb_font_funcs_set_glyph_contour_point_func: | 
|---|
| 377 | * @ffuncs: font functions. | 
|---|
| 378 | * @func: (closure user_data) (destroy destroy) (scope notified): | 
|---|
| 379 | * @user_data: | 
|---|
| 380 | * @destroy: | 
|---|
| 381 | * | 
|---|
| 382 | * | 
|---|
| 383 | * | 
|---|
| 384 | * Since: 0.9.2 | 
|---|
| 385 | **/ | 
|---|
| 386 | HB_EXTERN void | 
|---|
| 387 | hb_font_funcs_set_glyph_contour_point_func (hb_font_funcs_t *ffuncs, | 
|---|
| 388 | hb_font_get_glyph_contour_point_func_t func, | 
|---|
| 389 | void *user_data, hb_destroy_func_t destroy); | 
|---|
| 390 |  | 
|---|
| 391 | /** | 
|---|
| 392 | * hb_font_funcs_set_glyph_name_func: | 
|---|
| 393 | * @ffuncs: font functions. | 
|---|
| 394 | * @func: (closure user_data) (destroy destroy) (scope notified): | 
|---|
| 395 | * @user_data: | 
|---|
| 396 | * @destroy: | 
|---|
| 397 | * | 
|---|
| 398 | * | 
|---|
| 399 | * | 
|---|
| 400 | * Since: 0.9.2 | 
|---|
| 401 | **/ | 
|---|
| 402 | HB_EXTERN void | 
|---|
| 403 | hb_font_funcs_set_glyph_name_func (hb_font_funcs_t *ffuncs, | 
|---|
| 404 | hb_font_get_glyph_name_func_t func, | 
|---|
| 405 | void *user_data, hb_destroy_func_t destroy); | 
|---|
| 406 |  | 
|---|
| 407 | /** | 
|---|
| 408 | * hb_font_funcs_set_glyph_from_name_func: | 
|---|
| 409 | * @ffuncs: font functions. | 
|---|
| 410 | * @func: (closure user_data) (destroy destroy) (scope notified): | 
|---|
| 411 | * @user_data: | 
|---|
| 412 | * @destroy: | 
|---|
| 413 | * | 
|---|
| 414 | * | 
|---|
| 415 | * | 
|---|
| 416 | * Since: 0.9.2 | 
|---|
| 417 | **/ | 
|---|
| 418 | HB_EXTERN void | 
|---|
| 419 | hb_font_funcs_set_glyph_from_name_func (hb_font_funcs_t *ffuncs, | 
|---|
| 420 | hb_font_get_glyph_from_name_func_t func, | 
|---|
| 421 | void *user_data, hb_destroy_func_t destroy); | 
|---|
| 422 |  | 
|---|
| 423 | /* func dispatch */ | 
|---|
| 424 |  | 
|---|
| 425 | HB_EXTERN hb_bool_t | 
|---|
| 426 | hb_font_get_h_extents (hb_font_t *font, | 
|---|
| 427 | hb_font_extents_t *extents); | 
|---|
| 428 | HB_EXTERN hb_bool_t | 
|---|
| 429 | hb_font_get_v_extents (hb_font_t *font, | 
|---|
| 430 | hb_font_extents_t *extents); | 
|---|
| 431 |  | 
|---|
| 432 | HB_EXTERN hb_bool_t | 
|---|
| 433 | hb_font_get_nominal_glyph (hb_font_t *font, | 
|---|
| 434 | hb_codepoint_t unicode, | 
|---|
| 435 | hb_codepoint_t *glyph); | 
|---|
| 436 | HB_EXTERN hb_bool_t | 
|---|
| 437 | hb_font_get_variation_glyph (hb_font_t *font, | 
|---|
| 438 | hb_codepoint_t unicode, hb_codepoint_t variation_selector, | 
|---|
| 439 | hb_codepoint_t *glyph); | 
|---|
| 440 |  | 
|---|
| 441 | HB_EXTERN hb_position_t | 
|---|
| 442 | hb_font_get_glyph_h_advance (hb_font_t *font, | 
|---|
| 443 | hb_codepoint_t glyph); | 
|---|
| 444 | HB_EXTERN hb_position_t | 
|---|
| 445 | hb_font_get_glyph_v_advance (hb_font_t *font, | 
|---|
| 446 | hb_codepoint_t glyph); | 
|---|
| 447 |  | 
|---|
| 448 | HB_EXTERN void | 
|---|
| 449 | hb_font_get_glyph_h_advances (hb_font_t* font, | 
|---|
| 450 | unsigned int count, | 
|---|
| 451 | const hb_codepoint_t *first_glyph, | 
|---|
| 452 | unsigned glyph_stride, | 
|---|
| 453 | hb_position_t *first_advance, | 
|---|
| 454 | unsigned advance_stride); | 
|---|
| 455 | HB_EXTERN void | 
|---|
| 456 | hb_font_get_glyph_v_advances (hb_font_t* font, | 
|---|
| 457 | unsigned int count, | 
|---|
| 458 | const hb_codepoint_t *first_glyph, | 
|---|
| 459 | unsigned glyph_stride, | 
|---|
| 460 | hb_position_t *first_advance, | 
|---|
| 461 | unsigned advance_stride); | 
|---|
| 462 |  | 
|---|
| 463 | HB_EXTERN hb_bool_t | 
|---|
| 464 | hb_font_get_glyph_h_origin (hb_font_t *font, | 
|---|
| 465 | hb_codepoint_t glyph, | 
|---|
| 466 | hb_position_t *x, hb_position_t *y); | 
|---|
| 467 | HB_EXTERN hb_bool_t | 
|---|
| 468 | hb_font_get_glyph_v_origin (hb_font_t *font, | 
|---|
| 469 | hb_codepoint_t glyph, | 
|---|
| 470 | hb_position_t *x, hb_position_t *y); | 
|---|
| 471 |  | 
|---|
| 472 | HB_EXTERN hb_bool_t | 
|---|
| 473 | hb_font_get_glyph_extents (hb_font_t *font, | 
|---|
| 474 | hb_codepoint_t glyph, | 
|---|
| 475 | hb_glyph_extents_t *extents); | 
|---|
| 476 |  | 
|---|
| 477 | HB_EXTERN hb_bool_t | 
|---|
| 478 | hb_font_get_glyph_contour_point (hb_font_t *font, | 
|---|
| 479 | hb_codepoint_t glyph, unsigned int point_index, | 
|---|
| 480 | hb_position_t *x, hb_position_t *y); | 
|---|
| 481 |  | 
|---|
| 482 | HB_EXTERN hb_bool_t | 
|---|
| 483 | hb_font_get_glyph_name (hb_font_t *font, | 
|---|
| 484 | hb_codepoint_t glyph, | 
|---|
| 485 | char *name, unsigned int size); | 
|---|
| 486 | HB_EXTERN hb_bool_t | 
|---|
| 487 | hb_font_get_glyph_from_name (hb_font_t *font, | 
|---|
| 488 | const char *name, int len, /* -1 means nul-terminated */ | 
|---|
| 489 | hb_codepoint_t *glyph); | 
|---|
| 490 |  | 
|---|
| 491 |  | 
|---|
| 492 | /* high-level funcs, with fallback */ | 
|---|
| 493 |  | 
|---|
| 494 | /* Calls either hb_font_get_nominal_glyph() if variation_selector is 0, | 
|---|
| 495 | * otherwise calls hb_font_get_variation_glyph(). */ | 
|---|
| 496 | HB_EXTERN hb_bool_t | 
|---|
| 497 | hb_font_get_glyph (hb_font_t *font, | 
|---|
| 498 | hb_codepoint_t unicode, hb_codepoint_t variation_selector, | 
|---|
| 499 | hb_codepoint_t *glyph); | 
|---|
| 500 |  | 
|---|
| 501 | HB_EXTERN void | 
|---|
| 502 | hb_font_get_extents_for_direction (hb_font_t *font, | 
|---|
| 503 | hb_direction_t direction, | 
|---|
| 504 | hb_font_extents_t *extents); | 
|---|
| 505 | HB_EXTERN void | 
|---|
| 506 | hb_font_get_glyph_advance_for_direction (hb_font_t *font, | 
|---|
| 507 | hb_codepoint_t glyph, | 
|---|
| 508 | hb_direction_t direction, | 
|---|
| 509 | hb_position_t *x, hb_position_t *y); | 
|---|
| 510 | HB_EXTERN void | 
|---|
| 511 | hb_font_get_glyph_advances_for_direction (hb_font_t* font, | 
|---|
| 512 | hb_direction_t direction, | 
|---|
| 513 | unsigned int count, | 
|---|
| 514 | const hb_codepoint_t *first_glyph, | 
|---|
| 515 | unsigned glyph_stride, | 
|---|
| 516 | hb_position_t *first_advance, | 
|---|
| 517 | unsigned advance_stride); | 
|---|
| 518 | HB_EXTERN void | 
|---|
| 519 | hb_font_get_glyph_origin_for_direction (hb_font_t *font, | 
|---|
| 520 | hb_codepoint_t glyph, | 
|---|
| 521 | hb_direction_t direction, | 
|---|
| 522 | hb_position_t *x, hb_position_t *y); | 
|---|
| 523 | HB_EXTERN void | 
|---|
| 524 | hb_font_add_glyph_origin_for_direction (hb_font_t *font, | 
|---|
| 525 | hb_codepoint_t glyph, | 
|---|
| 526 | hb_direction_t direction, | 
|---|
| 527 | hb_position_t *x, hb_position_t *y); | 
|---|
| 528 | HB_EXTERN void | 
|---|
| 529 | hb_font_subtract_glyph_origin_for_direction (hb_font_t *font, | 
|---|
| 530 | hb_codepoint_t glyph, | 
|---|
| 531 | hb_direction_t direction, | 
|---|
| 532 | hb_position_t *x, hb_position_t *y); | 
|---|
| 533 |  | 
|---|
| 534 | HB_EXTERN hb_bool_t | 
|---|
| 535 | hb_font_get_glyph_extents_for_origin (hb_font_t *font, | 
|---|
| 536 | hb_codepoint_t glyph, | 
|---|
| 537 | hb_direction_t direction, | 
|---|
| 538 | hb_glyph_extents_t *extents); | 
|---|
| 539 |  | 
|---|
| 540 | HB_EXTERN hb_bool_t | 
|---|
| 541 | hb_font_get_glyph_contour_point_for_origin (hb_font_t *font, | 
|---|
| 542 | hb_codepoint_t glyph, unsigned int point_index, | 
|---|
| 543 | hb_direction_t direction, | 
|---|
| 544 | hb_position_t *x, hb_position_t *y); | 
|---|
| 545 |  | 
|---|
| 546 | /* Generates gidDDD if glyph has no name. */ | 
|---|
| 547 | HB_EXTERN void | 
|---|
| 548 | hb_font_glyph_to_string (hb_font_t *font, | 
|---|
| 549 | hb_codepoint_t glyph, | 
|---|
| 550 | char *s, unsigned int size); | 
|---|
| 551 | /* Parses gidDDD and uniUUUU strings automatically. */ | 
|---|
| 552 | HB_EXTERN hb_bool_t | 
|---|
| 553 | hb_font_glyph_from_string (hb_font_t *font, | 
|---|
| 554 | const char *s, int len, /* -1 means nul-terminated */ | 
|---|
| 555 | hb_codepoint_t *glyph); | 
|---|
| 556 |  | 
|---|
| 557 |  | 
|---|
| 558 | /* | 
|---|
| 559 | * hb_font_t | 
|---|
| 560 | */ | 
|---|
| 561 |  | 
|---|
| 562 | /* Fonts are very light-weight objects */ | 
|---|
| 563 |  | 
|---|
| 564 | HB_EXTERN hb_font_t * | 
|---|
| 565 | hb_font_create (hb_face_t *face); | 
|---|
| 566 |  | 
|---|
| 567 | HB_EXTERN hb_font_t * | 
|---|
| 568 | hb_font_create_sub_font (hb_font_t *parent); | 
|---|
| 569 |  | 
|---|
| 570 | HB_EXTERN hb_font_t * | 
|---|
| 571 | hb_font_get_empty (void); | 
|---|
| 572 |  | 
|---|
| 573 | HB_EXTERN hb_font_t * | 
|---|
| 574 | hb_font_reference (hb_font_t *font); | 
|---|
| 575 |  | 
|---|
| 576 | HB_EXTERN void | 
|---|
| 577 | hb_font_destroy (hb_font_t *font); | 
|---|
| 578 |  | 
|---|
| 579 | HB_EXTERN hb_bool_t | 
|---|
| 580 | hb_font_set_user_data (hb_font_t          *font, | 
|---|
| 581 | hb_user_data_key_t *key, | 
|---|
| 582 | void *              data, | 
|---|
| 583 | hb_destroy_func_t   destroy, | 
|---|
| 584 | hb_bool_t           replace); | 
|---|
| 585 |  | 
|---|
| 586 |  | 
|---|
| 587 | HB_EXTERN void * | 
|---|
| 588 | hb_font_get_user_data (hb_font_t          *font, | 
|---|
| 589 | hb_user_data_key_t *key); | 
|---|
| 590 |  | 
|---|
| 591 | HB_EXTERN void | 
|---|
| 592 | hb_font_make_immutable (hb_font_t *font); | 
|---|
| 593 |  | 
|---|
| 594 | HB_EXTERN hb_bool_t | 
|---|
| 595 | hb_font_is_immutable (hb_font_t *font); | 
|---|
| 596 |  | 
|---|
| 597 | HB_EXTERN void | 
|---|
| 598 | hb_font_set_parent (hb_font_t *font, | 
|---|
| 599 | hb_font_t *parent); | 
|---|
| 600 |  | 
|---|
| 601 | HB_EXTERN hb_font_t * | 
|---|
| 602 | hb_font_get_parent (hb_font_t *font); | 
|---|
| 603 |  | 
|---|
| 604 | HB_EXTERN void | 
|---|
| 605 | hb_font_set_face (hb_font_t *font, | 
|---|
| 606 | hb_face_t *face); | 
|---|
| 607 |  | 
|---|
| 608 | HB_EXTERN hb_face_t * | 
|---|
| 609 | hb_font_get_face (hb_font_t *font); | 
|---|
| 610 |  | 
|---|
| 611 |  | 
|---|
| 612 | HB_EXTERN void | 
|---|
| 613 | hb_font_set_funcs (hb_font_t         *font, | 
|---|
| 614 | hb_font_funcs_t   *klass, | 
|---|
| 615 | void              *font_data, | 
|---|
| 616 | hb_destroy_func_t  destroy); | 
|---|
| 617 |  | 
|---|
| 618 | /* Be *very* careful with this function! */ | 
|---|
| 619 | HB_EXTERN void | 
|---|
| 620 | hb_font_set_funcs_data (hb_font_t         *font, | 
|---|
| 621 | void              *font_data, | 
|---|
| 622 | hb_destroy_func_t  destroy); | 
|---|
| 623 |  | 
|---|
| 624 |  | 
|---|
| 625 | HB_EXTERN void | 
|---|
| 626 | hb_font_set_scale (hb_font_t *font, | 
|---|
| 627 | int x_scale, | 
|---|
| 628 | int y_scale); | 
|---|
| 629 |  | 
|---|
| 630 | HB_EXTERN void | 
|---|
| 631 | hb_font_get_scale (hb_font_t *font, | 
|---|
| 632 | int *x_scale, | 
|---|
| 633 | int *y_scale); | 
|---|
| 634 |  | 
|---|
| 635 | /* | 
|---|
| 636 | * A zero value means "no hinting in that direction" | 
|---|
| 637 | */ | 
|---|
| 638 | HB_EXTERN void | 
|---|
| 639 | hb_font_set_ppem (hb_font_t *font, | 
|---|
| 640 | unsigned int x_ppem, | 
|---|
| 641 | unsigned int y_ppem); | 
|---|
| 642 |  | 
|---|
| 643 | HB_EXTERN void | 
|---|
| 644 | hb_font_get_ppem (hb_font_t *font, | 
|---|
| 645 | unsigned int *x_ppem, | 
|---|
| 646 | unsigned int *y_ppem); | 
|---|
| 647 |  | 
|---|
| 648 | /* | 
|---|
| 649 | * Point size per EM.  Used for optical-sizing in CoreText. | 
|---|
| 650 | * A value of zero means "not set". | 
|---|
| 651 | */ | 
|---|
| 652 | HB_EXTERN void | 
|---|
| 653 | hb_font_set_ptem (hb_font_t *font, float ptem); | 
|---|
| 654 |  | 
|---|
| 655 | HB_EXTERN float | 
|---|
| 656 | hb_font_get_ptem (hb_font_t *font); | 
|---|
| 657 |  | 
|---|
| 658 | HB_EXTERN void | 
|---|
| 659 | hb_font_set_variations (hb_font_t *font, | 
|---|
| 660 | const hb_variation_t *variations, | 
|---|
| 661 | unsigned int variations_length); | 
|---|
| 662 |  | 
|---|
| 663 | HB_EXTERN void | 
|---|
| 664 | hb_font_set_var_coords_design (hb_font_t *font, | 
|---|
| 665 | const float *coords, | 
|---|
| 666 | unsigned int coords_length); | 
|---|
| 667 |  | 
|---|
| 668 | HB_EXTERN void | 
|---|
| 669 | hb_font_set_var_coords_normalized (hb_font_t *font, | 
|---|
| 670 | const int *coords, /* 2.14 normalized */ | 
|---|
| 671 | unsigned int coords_length); | 
|---|
| 672 |  | 
|---|
| 673 | HB_EXTERN const int * | 
|---|
| 674 | hb_font_get_var_coords_normalized (hb_font_t *font, | 
|---|
| 675 | unsigned int *length); | 
|---|
| 676 |  | 
|---|
| 677 | HB_END_DECLS | 
|---|
| 678 |  | 
|---|
| 679 | #endif /* HB_FONT_H */ | 
|---|
| 680 |  | 
|---|