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 #if !defined(HB_H_IN) && !defined(HB_NO_SINGLE_HEADER_ERROR) 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 /** 50 * hb_face_t: 51 * 52 * Data type for holding font faces. 53 * 54 **/ 55 typedef struct hb_face_t hb_face_t; 56 57 HB_EXTERN hb_face_t * 58 hb_face_create (hb_blob_t *blob, 59 unsigned int index); 60 61 /** 62 * hb_reference_table_func_t: 63 * @face: an #hb_face_t to reference table for 64 * @tag: the tag of the table to reference 65 * @user_data: User data pointer passed by the caller 66 * 67 * Callback function for hb_face_create_for_tables(). 68 * 69 * Return value: (transfer full): A pointer to the @tag table within @face 70 * 71 * Since: 0.9.2 72 */ 73 74 typedef hb_blob_t * (*hb_reference_table_func_t) (hb_face_t *face, hb_tag_t tag, void *user_data); 75 76 /* calls destroy() when not needing user_data anymore */ 77 HB_EXTERN hb_face_t * 78 hb_face_create_for_tables (hb_reference_table_func_t reference_table_func, 79 void *user_data, 80 hb_destroy_func_t destroy); 81 82 HB_EXTERN hb_face_t * 83 hb_face_get_empty (void); 84 85 HB_EXTERN hb_face_t * 86 hb_face_reference (hb_face_t *face); 87 88 HB_EXTERN void 89 hb_face_destroy (hb_face_t *face); 90 91 HB_EXTERN hb_bool_t 92 hb_face_set_user_data (hb_face_t *face, 93 hb_user_data_key_t *key, 94 void * data, 95 hb_destroy_func_t destroy, 96 hb_bool_t replace); 97 98 HB_EXTERN void * 99 hb_face_get_user_data (const hb_face_t *face, 100 hb_user_data_key_t *key); 101 102 HB_EXTERN void 103 hb_face_make_immutable (hb_face_t *face); 104 105 HB_EXTERN hb_bool_t 106 hb_face_is_immutable (const hb_face_t *face); 107 108 109 HB_EXTERN hb_blob_t * 110 hb_face_reference_table (const hb_face_t *face, 111 hb_tag_t tag); 112 113 HB_EXTERN hb_blob_t * 114 hb_face_reference_blob (hb_face_t *face); 115 116 HB_EXTERN void 117 hb_face_set_index (hb_face_t *face, 118 unsigned int index); 119 120 HB_EXTERN unsigned int 121 hb_face_get_index (const hb_face_t *face); 122 123 HB_EXTERN void 124 hb_face_set_upem (hb_face_t *face, 125 unsigned int upem); 126 127 HB_EXTERN unsigned int 128 hb_face_get_upem (const hb_face_t *face); 129 130 HB_EXTERN void 131 hb_face_set_glyph_count (hb_face_t *face, 132 unsigned int glyph_count); 133 134 HB_EXTERN unsigned int 135 hb_face_get_glyph_count (const hb_face_t *face); 136 137 HB_EXTERN unsigned int 138 hb_face_get_table_tags (const hb_face_t *face, 139 unsigned int start_offset, 140 unsigned int *table_count, /* IN/OUT */ 141 hb_tag_t *table_tags /* OUT */); 142 143 144 /* 145 * Character set. 146 */ 147 148 HB_EXTERN void 149 hb_face_collect_unicodes (hb_face_t *face, 150 hb_set_t *out); 151 152 HB_EXTERN void 153 hb_face_collect_variation_selectors (hb_face_t *face, 154 hb_set_t *out); 155 156 HB_EXTERN void 157 hb_face_collect_variation_unicodes (hb_face_t *face, 158 hb_codepoint_t variation_selector, 159 hb_set_t *out); 160 161 162 /* 163 * Builder face. 164 */ 165 166 HB_EXTERN hb_face_t * 167 hb_face_builder_create (void); 168 169 HB_EXTERN hb_bool_t 170 hb_face_builder_add_table (hb_face_t *face, 171 hb_tag_t tag, 172 hb_blob_t *blob); 173 174 175 HB_END_DECLS 176 177 #endif /* HB_FACE_H */ 178