Fri, 16 Jan 2015 18:13:44 +0100
Integrate suggestion from review to improve consistency with existing code.
michael@0 | 1 | /* |
michael@0 | 2 | * Copyright © 2007,2008,2009 Red Hat, Inc. |
michael@0 | 3 | * |
michael@0 | 4 | * This is part of HarfBuzz, a text shaping library. |
michael@0 | 5 | * |
michael@0 | 6 | * Permission is hereby granted, without written agreement and without |
michael@0 | 7 | * license or royalty fees, to use, copy, modify, and distribute this |
michael@0 | 8 | * software and its documentation for any purpose, provided that the |
michael@0 | 9 | * above copyright notice and the following two paragraphs appear in |
michael@0 | 10 | * all copies of this software. |
michael@0 | 11 | * |
michael@0 | 12 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR |
michael@0 | 13 | * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES |
michael@0 | 14 | * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN |
michael@0 | 15 | * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH |
michael@0 | 16 | * DAMAGE. |
michael@0 | 17 | * |
michael@0 | 18 | * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, |
michael@0 | 19 | * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND |
michael@0 | 20 | * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS |
michael@0 | 21 | * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO |
michael@0 | 22 | * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. |
michael@0 | 23 | * |
michael@0 | 24 | * Red Hat Author(s): Behdad Esfahbod |
michael@0 | 25 | */ |
michael@0 | 26 | |
michael@0 | 27 | #ifndef HB_OT_H_IN |
michael@0 | 28 | #error "Include <hb-ot.h> instead." |
michael@0 | 29 | #endif |
michael@0 | 30 | |
michael@0 | 31 | #ifndef HB_OT_LAYOUT_H |
michael@0 | 32 | #define HB_OT_LAYOUT_H |
michael@0 | 33 | |
michael@0 | 34 | #include "hb.h" |
michael@0 | 35 | |
michael@0 | 36 | #include "hb-ot-tag.h" |
michael@0 | 37 | |
michael@0 | 38 | HB_BEGIN_DECLS |
michael@0 | 39 | |
michael@0 | 40 | |
michael@0 | 41 | #define HB_OT_TAG_GDEF HB_TAG('G','D','E','F') |
michael@0 | 42 | #define HB_OT_TAG_GSUB HB_TAG('G','S','U','B') |
michael@0 | 43 | #define HB_OT_TAG_GPOS HB_TAG('G','P','O','S') |
michael@0 | 44 | #define HB_OT_TAG_JSTF HB_TAG('J','S','T','F') |
michael@0 | 45 | |
michael@0 | 46 | |
michael@0 | 47 | /* |
michael@0 | 48 | * GDEF |
michael@0 | 49 | */ |
michael@0 | 50 | |
michael@0 | 51 | hb_bool_t |
michael@0 | 52 | hb_ot_layout_has_glyph_classes (hb_face_t *face); |
michael@0 | 53 | |
michael@0 | 54 | typedef enum { |
michael@0 | 55 | HB_OT_LAYOUT_GLYPH_CLASS_UNCLASSIFIED = 0, |
michael@0 | 56 | HB_OT_LAYOUT_GLYPH_CLASS_BASE_GLYPH = 1, |
michael@0 | 57 | HB_OT_LAYOUT_GLYPH_CLASS_LIGATURE = 2, |
michael@0 | 58 | HB_OT_LAYOUT_GLYPH_CLASS_MARK = 3, |
michael@0 | 59 | HB_OT_LAYOUT_GLYPH_CLASS_COMPONENT = 4 |
michael@0 | 60 | } hb_ot_layout_glyph_class_t; |
michael@0 | 61 | |
michael@0 | 62 | hb_ot_layout_glyph_class_t |
michael@0 | 63 | hb_ot_layout_get_glyph_class (hb_face_t *face, |
michael@0 | 64 | hb_codepoint_t glyph); |
michael@0 | 65 | |
michael@0 | 66 | void |
michael@0 | 67 | hb_ot_layout_get_glyphs_in_class (hb_face_t *face, |
michael@0 | 68 | hb_ot_layout_glyph_class_t klass, |
michael@0 | 69 | hb_set_t *glyphs /* OUT */); |
michael@0 | 70 | |
michael@0 | 71 | |
michael@0 | 72 | /* Not that useful. Provides list of attach points for a glyph that a |
michael@0 | 73 | * client may want to cache */ |
michael@0 | 74 | unsigned int |
michael@0 | 75 | hb_ot_layout_get_attach_points (hb_face_t *face, |
michael@0 | 76 | hb_codepoint_t glyph, |
michael@0 | 77 | unsigned int start_offset, |
michael@0 | 78 | unsigned int *point_count /* IN/OUT */, |
michael@0 | 79 | unsigned int *point_array /* OUT */); |
michael@0 | 80 | |
michael@0 | 81 | /* Ligature caret positions */ |
michael@0 | 82 | unsigned int |
michael@0 | 83 | hb_ot_layout_get_ligature_carets (hb_font_t *font, |
michael@0 | 84 | hb_direction_t direction, |
michael@0 | 85 | hb_codepoint_t glyph, |
michael@0 | 86 | unsigned int start_offset, |
michael@0 | 87 | unsigned int *caret_count /* IN/OUT */, |
michael@0 | 88 | hb_position_t *caret_array /* OUT */); |
michael@0 | 89 | |
michael@0 | 90 | |
michael@0 | 91 | /* |
michael@0 | 92 | * GSUB/GPOS feature query and enumeration interface |
michael@0 | 93 | */ |
michael@0 | 94 | |
michael@0 | 95 | #define HB_OT_LAYOUT_NO_SCRIPT_INDEX ((unsigned int) 0xFFFF) |
michael@0 | 96 | #define HB_OT_LAYOUT_NO_FEATURE_INDEX ((unsigned int) 0xFFFF) |
michael@0 | 97 | #define HB_OT_LAYOUT_DEFAULT_LANGUAGE_INDEX ((unsigned int) 0xFFFF) |
michael@0 | 98 | |
michael@0 | 99 | unsigned int |
michael@0 | 100 | hb_ot_layout_table_get_script_tags (hb_face_t *face, |
michael@0 | 101 | hb_tag_t table_tag, |
michael@0 | 102 | unsigned int start_offset, |
michael@0 | 103 | unsigned int *script_count /* IN/OUT */, |
michael@0 | 104 | hb_tag_t *script_tags /* OUT */); |
michael@0 | 105 | |
michael@0 | 106 | hb_bool_t |
michael@0 | 107 | hb_ot_layout_table_find_script (hb_face_t *face, |
michael@0 | 108 | hb_tag_t table_tag, |
michael@0 | 109 | hb_tag_t script_tag, |
michael@0 | 110 | unsigned int *script_index); |
michael@0 | 111 | |
michael@0 | 112 | /* Like find_script, but takes zero-terminated array of scripts to test */ |
michael@0 | 113 | hb_bool_t |
michael@0 | 114 | hb_ot_layout_table_choose_script (hb_face_t *face, |
michael@0 | 115 | hb_tag_t table_tag, |
michael@0 | 116 | const hb_tag_t *script_tags, |
michael@0 | 117 | unsigned int *script_index, |
michael@0 | 118 | hb_tag_t *chosen_script); |
michael@0 | 119 | |
michael@0 | 120 | unsigned int |
michael@0 | 121 | hb_ot_layout_table_get_feature_tags (hb_face_t *face, |
michael@0 | 122 | hb_tag_t table_tag, |
michael@0 | 123 | unsigned int start_offset, |
michael@0 | 124 | unsigned int *feature_count /* IN/OUT */, |
michael@0 | 125 | hb_tag_t *feature_tags /* OUT */); |
michael@0 | 126 | |
michael@0 | 127 | unsigned int |
michael@0 | 128 | hb_ot_layout_script_get_language_tags (hb_face_t *face, |
michael@0 | 129 | hb_tag_t table_tag, |
michael@0 | 130 | unsigned int script_index, |
michael@0 | 131 | unsigned int start_offset, |
michael@0 | 132 | unsigned int *language_count /* IN/OUT */, |
michael@0 | 133 | hb_tag_t *language_tags /* OUT */); |
michael@0 | 134 | |
michael@0 | 135 | hb_bool_t |
michael@0 | 136 | hb_ot_layout_script_find_language (hb_face_t *face, |
michael@0 | 137 | hb_tag_t table_tag, |
michael@0 | 138 | unsigned int script_index, |
michael@0 | 139 | hb_tag_t language_tag, |
michael@0 | 140 | unsigned int *language_index); |
michael@0 | 141 | |
michael@0 | 142 | hb_bool_t |
michael@0 | 143 | hb_ot_layout_language_get_required_feature_index (hb_face_t *face, |
michael@0 | 144 | hb_tag_t table_tag, |
michael@0 | 145 | unsigned int script_index, |
michael@0 | 146 | unsigned int language_index, |
michael@0 | 147 | unsigned int *feature_index); |
michael@0 | 148 | |
michael@0 | 149 | unsigned int |
michael@0 | 150 | hb_ot_layout_language_get_feature_indexes (hb_face_t *face, |
michael@0 | 151 | hb_tag_t table_tag, |
michael@0 | 152 | unsigned int script_index, |
michael@0 | 153 | unsigned int language_index, |
michael@0 | 154 | unsigned int start_offset, |
michael@0 | 155 | unsigned int *feature_count /* IN/OUT */, |
michael@0 | 156 | unsigned int *feature_indexes /* OUT */); |
michael@0 | 157 | |
michael@0 | 158 | unsigned int |
michael@0 | 159 | hb_ot_layout_language_get_feature_tags (hb_face_t *face, |
michael@0 | 160 | hb_tag_t table_tag, |
michael@0 | 161 | unsigned int script_index, |
michael@0 | 162 | unsigned int language_index, |
michael@0 | 163 | unsigned int start_offset, |
michael@0 | 164 | unsigned int *feature_count /* IN/OUT */, |
michael@0 | 165 | hb_tag_t *feature_tags /* OUT */); |
michael@0 | 166 | |
michael@0 | 167 | hb_bool_t |
michael@0 | 168 | hb_ot_layout_language_find_feature (hb_face_t *face, |
michael@0 | 169 | hb_tag_t table_tag, |
michael@0 | 170 | unsigned int script_index, |
michael@0 | 171 | unsigned int language_index, |
michael@0 | 172 | hb_tag_t feature_tag, |
michael@0 | 173 | unsigned int *feature_index); |
michael@0 | 174 | |
michael@0 | 175 | unsigned int |
michael@0 | 176 | hb_ot_layout_feature_get_lookups (hb_face_t *face, |
michael@0 | 177 | hb_tag_t table_tag, |
michael@0 | 178 | unsigned int feature_index, |
michael@0 | 179 | unsigned int start_offset, |
michael@0 | 180 | unsigned int *lookup_count /* IN/OUT */, |
michael@0 | 181 | unsigned int *lookup_indexes /* OUT */); |
michael@0 | 182 | |
michael@0 | 183 | unsigned int |
michael@0 | 184 | hb_ot_layout_table_get_lookup_count (hb_face_t *face, |
michael@0 | 185 | hb_tag_t table_tag); |
michael@0 | 186 | |
michael@0 | 187 | |
michael@0 | 188 | void |
michael@0 | 189 | hb_ot_layout_collect_lookups (hb_face_t *face, |
michael@0 | 190 | hb_tag_t table_tag, |
michael@0 | 191 | const hb_tag_t *scripts, |
michael@0 | 192 | const hb_tag_t *languages, |
michael@0 | 193 | const hb_tag_t *features, |
michael@0 | 194 | hb_set_t *lookup_indexes /* OUT */); |
michael@0 | 195 | |
michael@0 | 196 | void |
michael@0 | 197 | hb_ot_layout_lookup_collect_glyphs (hb_face_t *face, |
michael@0 | 198 | hb_tag_t table_tag, |
michael@0 | 199 | unsigned int lookup_index, |
michael@0 | 200 | hb_set_t *glyphs_before, /* OUT. May be NULL */ |
michael@0 | 201 | hb_set_t *glyphs_input, /* OUT. May be NULL */ |
michael@0 | 202 | hb_set_t *glyphs_after, /* OUT. May be NULL */ |
michael@0 | 203 | hb_set_t *glyphs_output /* OUT. May be NULL */); |
michael@0 | 204 | |
michael@0 | 205 | #ifdef HB_NOT_IMPLEMENTED |
michael@0 | 206 | typedef struct |
michael@0 | 207 | { |
michael@0 | 208 | const hb_codepoint_t *before, |
michael@0 | 209 | unsigned int before_length, |
michael@0 | 210 | const hb_codepoint_t *input, |
michael@0 | 211 | unsigned int input_length, |
michael@0 | 212 | const hb_codepoint_t *after, |
michael@0 | 213 | unsigned int after_length, |
michael@0 | 214 | } hb_ot_layout_glyph_sequence_t; |
michael@0 | 215 | |
michael@0 | 216 | typedef hb_bool_t |
michael@0 | 217 | (*hb_ot_layout_glyph_sequence_func_t) (hb_font_t *font, |
michael@0 | 218 | hb_tag_t table_tag, |
michael@0 | 219 | unsigned int lookup_index, |
michael@0 | 220 | const hb_ot_layout_glyph_sequence_t *sequence, |
michael@0 | 221 | void *user_data); |
michael@0 | 222 | |
michael@0 | 223 | void |
michael@0 | 224 | Xhb_ot_layout_lookup_enumerate_sequences (hb_face_t *face, |
michael@0 | 225 | hb_tag_t table_tag, |
michael@0 | 226 | unsigned int lookup_index, |
michael@0 | 227 | hb_ot_layout_glyph_sequence_func_t callback, |
michael@0 | 228 | void *user_data); |
michael@0 | 229 | #endif |
michael@0 | 230 | |
michael@0 | 231 | |
michael@0 | 232 | /* |
michael@0 | 233 | * GSUB |
michael@0 | 234 | */ |
michael@0 | 235 | |
michael@0 | 236 | hb_bool_t |
michael@0 | 237 | hb_ot_layout_has_substitution (hb_face_t *face); |
michael@0 | 238 | |
michael@0 | 239 | hb_bool_t |
michael@0 | 240 | hb_ot_layout_lookup_would_substitute (hb_face_t *face, |
michael@0 | 241 | unsigned int lookup_index, |
michael@0 | 242 | const hb_codepoint_t *glyphs, |
michael@0 | 243 | unsigned int glyphs_length, |
michael@0 | 244 | hb_bool_t zero_context); |
michael@0 | 245 | |
michael@0 | 246 | void |
michael@0 | 247 | hb_ot_layout_lookup_substitute_closure (hb_face_t *face, |
michael@0 | 248 | unsigned int lookup_index, |
michael@0 | 249 | hb_set_t *glyphs |
michael@0 | 250 | /*TODO , hb_bool_t inclusive */); |
michael@0 | 251 | |
michael@0 | 252 | #ifdef HB_NOT_IMPLEMENTED |
michael@0 | 253 | /* Note: You better have GDEF when using this API, or marks won't do much. */ |
michael@0 | 254 | hb_bool_t |
michael@0 | 255 | Xhb_ot_layout_lookup_substitute (hb_font_t *font, |
michael@0 | 256 | unsigned int lookup_index, |
michael@0 | 257 | const hb_ot_layout_glyph_sequence_t *sequence, |
michael@0 | 258 | unsigned int out_size, |
michael@0 | 259 | hb_codepoint_t *glyphs_out, /* OUT */ |
michael@0 | 260 | unsigned int *clusters_out, /* OUT */ |
michael@0 | 261 | unsigned int *out_length /* OUT */); |
michael@0 | 262 | #endif |
michael@0 | 263 | |
michael@0 | 264 | |
michael@0 | 265 | /* |
michael@0 | 266 | * GPOS |
michael@0 | 267 | */ |
michael@0 | 268 | |
michael@0 | 269 | hb_bool_t |
michael@0 | 270 | hb_ot_layout_has_positioning (hb_face_t *face); |
michael@0 | 271 | |
michael@0 | 272 | #ifdef HB_NOT_IMPLEMENTED |
michael@0 | 273 | /* Note: You better have GDEF when using this API, or marks won't do much. */ |
michael@0 | 274 | hb_bool_t |
michael@0 | 275 | Xhb_ot_layout_lookup_position (hb_font_t *font, |
michael@0 | 276 | unsigned int lookup_index, |
michael@0 | 277 | const hb_ot_layout_glyph_sequence_t *sequence, |
michael@0 | 278 | hb_glyph_position_t *positions /* IN / OUT */); |
michael@0 | 279 | #endif |
michael@0 | 280 | |
michael@0 | 281 | /* Optical 'size' feature info. Returns true if found. |
michael@0 | 282 | * http://www.microsoft.com/typography/otspec/features_pt.htm#size */ |
michael@0 | 283 | hb_bool_t |
michael@0 | 284 | hb_ot_layout_get_size_params (hb_face_t *face, |
michael@0 | 285 | unsigned int *design_size, /* OUT. May be NULL */ |
michael@0 | 286 | unsigned int *subfamily_id, /* OUT. May be NULL */ |
michael@0 | 287 | unsigned int *subfamily_name_id, /* OUT. May be NULL */ |
michael@0 | 288 | unsigned int *range_start, /* OUT. May be NULL */ |
michael@0 | 289 | unsigned int *range_end /* OUT. May be NULL */); |
michael@0 | 290 | |
michael@0 | 291 | |
michael@0 | 292 | HB_END_DECLS |
michael@0 | 293 | |
michael@0 | 294 | #endif /* HB_OT_LAYOUT_H */ |