| 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_FACE_H |
| 32 | #define HB_FACE_H |
| 33 | |
| 34 | #include "hb-common.h" |
| 35 | #include "hb-blob.h" |
| 36 | #include "hb-set.h" |
| 37 | |
| 38 | HB_BEGIN_DECLS |
| 39 | |
| 40 | |
| 41 | HB_EXTERN unsigned int |
| 42 | hb_face_count (hb_blob_t *blob); |
| 43 | |
| 44 | |
| 45 | /* |
| 46 | * hb_face_t |
| 47 | */ |
| 48 | |
| 49 | typedef struct hb_face_t hb_face_t; |
| 50 | |
| 51 | HB_EXTERN hb_face_t * |
| 52 | hb_face_create (hb_blob_t *blob, |
| 53 | unsigned int index); |
| 54 | |
| 55 | typedef hb_blob_t * (*hb_reference_table_func_t) (hb_face_t *face, hb_tag_t tag, void *user_data); |
| 56 | |
| 57 | /* calls destroy() when not needing user_data anymore */ |
| 58 | HB_EXTERN hb_face_t * |
| 59 | hb_face_create_for_tables (hb_reference_table_func_t reference_table_func, |
| 60 | void *user_data, |
| 61 | hb_destroy_func_t destroy); |
| 62 | |
| 63 | HB_EXTERN hb_face_t * |
| 64 | hb_face_get_empty (void); |
| 65 | |
| 66 | HB_EXTERN hb_face_t * |
| 67 | hb_face_reference (hb_face_t *face); |
| 68 | |
| 69 | HB_EXTERN void |
| 70 | hb_face_destroy (hb_face_t *face); |
| 71 | |
| 72 | HB_EXTERN hb_bool_t |
| 73 | hb_face_set_user_data (hb_face_t *face, |
| 74 | hb_user_data_key_t *key, |
| 75 | void * data, |
| 76 | hb_destroy_func_t destroy, |
| 77 | hb_bool_t replace); |
| 78 | |
| 79 | HB_EXTERN void * |
| 80 | hb_face_get_user_data (const hb_face_t *face, |
| 81 | hb_user_data_key_t *key); |
| 82 | |
| 83 | HB_EXTERN void |
| 84 | hb_face_make_immutable (hb_face_t *face); |
| 85 | |
| 86 | HB_EXTERN hb_bool_t |
| 87 | hb_face_is_immutable (const hb_face_t *face); |
| 88 | |
| 89 | |
| 90 | HB_EXTERN hb_blob_t * |
| 91 | hb_face_reference_table (const hb_face_t *face, |
| 92 | hb_tag_t tag); |
| 93 | |
| 94 | HB_EXTERN hb_blob_t * |
| 95 | hb_face_reference_blob (hb_face_t *face); |
| 96 | |
| 97 | HB_EXTERN void |
| 98 | hb_face_set_index (hb_face_t *face, |
| 99 | unsigned int index); |
| 100 | |
| 101 | HB_EXTERN unsigned int |
| 102 | hb_face_get_index (const hb_face_t *face); |
| 103 | |
| 104 | HB_EXTERN void |
| 105 | hb_face_set_upem (hb_face_t *face, |
| 106 | unsigned int upem); |
| 107 | |
| 108 | HB_EXTERN unsigned int |
| 109 | hb_face_get_upem (const hb_face_t *face); |
| 110 | |
| 111 | HB_EXTERN void |
| 112 | hb_face_set_glyph_count (hb_face_t *face, |
| 113 | unsigned int glyph_count); |
| 114 | |
| 115 | HB_EXTERN unsigned int |
| 116 | hb_face_get_glyph_count (const hb_face_t *face); |
| 117 | |
| 118 | HB_EXTERN unsigned int |
| 119 | hb_face_get_table_tags (const hb_face_t *face, |
| 120 | unsigned int start_offset, |
| 121 | unsigned int *table_count, /* IN/OUT */ |
| 122 | hb_tag_t *table_tags /* OUT */); |
| 123 | |
| 124 | |
| 125 | /* |
| 126 | * Character set. |
| 127 | */ |
| 128 | |
| 129 | HB_EXTERN void |
| 130 | hb_face_collect_unicodes (hb_face_t *face, |
| 131 | hb_set_t *out); |
| 132 | |
| 133 | HB_EXTERN void |
| 134 | hb_face_collect_variation_selectors (hb_face_t *face, |
| 135 | hb_set_t *out); |
| 136 | |
| 137 | HB_EXTERN void |
| 138 | hb_face_collect_variation_unicodes (hb_face_t *face, |
| 139 | hb_codepoint_t variation_selector, |
| 140 | hb_set_t *out); |
| 141 | |
| 142 | |
| 143 | /* |
| 144 | * Builder face. |
| 145 | */ |
| 146 | |
| 147 | HB_EXTERN hb_face_t * |
| 148 | hb_face_builder_create (void); |
| 149 | |
| 150 | HB_EXTERN hb_bool_t |
| 151 | hb_face_builder_add_table (hb_face_t *face, |
| 152 | hb_tag_t tag, |
| 153 | hb_blob_t *blob); |
| 154 | |
| 155 | |
| 156 | HB_END_DECLS |
| 157 | |
| 158 | #endif /* HB_FACE_H */ |
| 159 | |