1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/gfx/harfbuzz/src/hb-ot-layout.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,294 @@ 1.4 +/* 1.5 + * Copyright © 2007,2008,2009 Red Hat, Inc. 1.6 + * 1.7 + * This is part of HarfBuzz, a text shaping library. 1.8 + * 1.9 + * Permission is hereby granted, without written agreement and without 1.10 + * license or royalty fees, to use, copy, modify, and distribute this 1.11 + * software and its documentation for any purpose, provided that the 1.12 + * above copyright notice and the following two paragraphs appear in 1.13 + * all copies of this software. 1.14 + * 1.15 + * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR 1.16 + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 1.17 + * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN 1.18 + * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH 1.19 + * DAMAGE. 1.20 + * 1.21 + * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, 1.22 + * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 1.23 + * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS 1.24 + * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO 1.25 + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. 1.26 + * 1.27 + * Red Hat Author(s): Behdad Esfahbod 1.28 + */ 1.29 + 1.30 +#ifndef HB_OT_H_IN 1.31 +#error "Include <hb-ot.h> instead." 1.32 +#endif 1.33 + 1.34 +#ifndef HB_OT_LAYOUT_H 1.35 +#define HB_OT_LAYOUT_H 1.36 + 1.37 +#include "hb.h" 1.38 + 1.39 +#include "hb-ot-tag.h" 1.40 + 1.41 +HB_BEGIN_DECLS 1.42 + 1.43 + 1.44 +#define HB_OT_TAG_GDEF HB_TAG('G','D','E','F') 1.45 +#define HB_OT_TAG_GSUB HB_TAG('G','S','U','B') 1.46 +#define HB_OT_TAG_GPOS HB_TAG('G','P','O','S') 1.47 +#define HB_OT_TAG_JSTF HB_TAG('J','S','T','F') 1.48 + 1.49 + 1.50 +/* 1.51 + * GDEF 1.52 + */ 1.53 + 1.54 +hb_bool_t 1.55 +hb_ot_layout_has_glyph_classes (hb_face_t *face); 1.56 + 1.57 +typedef enum { 1.58 + HB_OT_LAYOUT_GLYPH_CLASS_UNCLASSIFIED = 0, 1.59 + HB_OT_LAYOUT_GLYPH_CLASS_BASE_GLYPH = 1, 1.60 + HB_OT_LAYOUT_GLYPH_CLASS_LIGATURE = 2, 1.61 + HB_OT_LAYOUT_GLYPH_CLASS_MARK = 3, 1.62 + HB_OT_LAYOUT_GLYPH_CLASS_COMPONENT = 4 1.63 +} hb_ot_layout_glyph_class_t; 1.64 + 1.65 +hb_ot_layout_glyph_class_t 1.66 +hb_ot_layout_get_glyph_class (hb_face_t *face, 1.67 + hb_codepoint_t glyph); 1.68 + 1.69 +void 1.70 +hb_ot_layout_get_glyphs_in_class (hb_face_t *face, 1.71 + hb_ot_layout_glyph_class_t klass, 1.72 + hb_set_t *glyphs /* OUT */); 1.73 + 1.74 + 1.75 +/* Not that useful. Provides list of attach points for a glyph that a 1.76 + * client may want to cache */ 1.77 +unsigned int 1.78 +hb_ot_layout_get_attach_points (hb_face_t *face, 1.79 + hb_codepoint_t glyph, 1.80 + unsigned int start_offset, 1.81 + unsigned int *point_count /* IN/OUT */, 1.82 + unsigned int *point_array /* OUT */); 1.83 + 1.84 +/* Ligature caret positions */ 1.85 +unsigned int 1.86 +hb_ot_layout_get_ligature_carets (hb_font_t *font, 1.87 + hb_direction_t direction, 1.88 + hb_codepoint_t glyph, 1.89 + unsigned int start_offset, 1.90 + unsigned int *caret_count /* IN/OUT */, 1.91 + hb_position_t *caret_array /* OUT */); 1.92 + 1.93 + 1.94 +/* 1.95 + * GSUB/GPOS feature query and enumeration interface 1.96 + */ 1.97 + 1.98 +#define HB_OT_LAYOUT_NO_SCRIPT_INDEX ((unsigned int) 0xFFFF) 1.99 +#define HB_OT_LAYOUT_NO_FEATURE_INDEX ((unsigned int) 0xFFFF) 1.100 +#define HB_OT_LAYOUT_DEFAULT_LANGUAGE_INDEX ((unsigned int) 0xFFFF) 1.101 + 1.102 +unsigned int 1.103 +hb_ot_layout_table_get_script_tags (hb_face_t *face, 1.104 + hb_tag_t table_tag, 1.105 + unsigned int start_offset, 1.106 + unsigned int *script_count /* IN/OUT */, 1.107 + hb_tag_t *script_tags /* OUT */); 1.108 + 1.109 +hb_bool_t 1.110 +hb_ot_layout_table_find_script (hb_face_t *face, 1.111 + hb_tag_t table_tag, 1.112 + hb_tag_t script_tag, 1.113 + unsigned int *script_index); 1.114 + 1.115 +/* Like find_script, but takes zero-terminated array of scripts to test */ 1.116 +hb_bool_t 1.117 +hb_ot_layout_table_choose_script (hb_face_t *face, 1.118 + hb_tag_t table_tag, 1.119 + const hb_tag_t *script_tags, 1.120 + unsigned int *script_index, 1.121 + hb_tag_t *chosen_script); 1.122 + 1.123 +unsigned int 1.124 +hb_ot_layout_table_get_feature_tags (hb_face_t *face, 1.125 + hb_tag_t table_tag, 1.126 + unsigned int start_offset, 1.127 + unsigned int *feature_count /* IN/OUT */, 1.128 + hb_tag_t *feature_tags /* OUT */); 1.129 + 1.130 +unsigned int 1.131 +hb_ot_layout_script_get_language_tags (hb_face_t *face, 1.132 + hb_tag_t table_tag, 1.133 + unsigned int script_index, 1.134 + unsigned int start_offset, 1.135 + unsigned int *language_count /* IN/OUT */, 1.136 + hb_tag_t *language_tags /* OUT */); 1.137 + 1.138 +hb_bool_t 1.139 +hb_ot_layout_script_find_language (hb_face_t *face, 1.140 + hb_tag_t table_tag, 1.141 + unsigned int script_index, 1.142 + hb_tag_t language_tag, 1.143 + unsigned int *language_index); 1.144 + 1.145 +hb_bool_t 1.146 +hb_ot_layout_language_get_required_feature_index (hb_face_t *face, 1.147 + hb_tag_t table_tag, 1.148 + unsigned int script_index, 1.149 + unsigned int language_index, 1.150 + unsigned int *feature_index); 1.151 + 1.152 +unsigned int 1.153 +hb_ot_layout_language_get_feature_indexes (hb_face_t *face, 1.154 + hb_tag_t table_tag, 1.155 + unsigned int script_index, 1.156 + unsigned int language_index, 1.157 + unsigned int start_offset, 1.158 + unsigned int *feature_count /* IN/OUT */, 1.159 + unsigned int *feature_indexes /* OUT */); 1.160 + 1.161 +unsigned int 1.162 +hb_ot_layout_language_get_feature_tags (hb_face_t *face, 1.163 + hb_tag_t table_tag, 1.164 + unsigned int script_index, 1.165 + unsigned int language_index, 1.166 + unsigned int start_offset, 1.167 + unsigned int *feature_count /* IN/OUT */, 1.168 + hb_tag_t *feature_tags /* OUT */); 1.169 + 1.170 +hb_bool_t 1.171 +hb_ot_layout_language_find_feature (hb_face_t *face, 1.172 + hb_tag_t table_tag, 1.173 + unsigned int script_index, 1.174 + unsigned int language_index, 1.175 + hb_tag_t feature_tag, 1.176 + unsigned int *feature_index); 1.177 + 1.178 +unsigned int 1.179 +hb_ot_layout_feature_get_lookups (hb_face_t *face, 1.180 + hb_tag_t table_tag, 1.181 + unsigned int feature_index, 1.182 + unsigned int start_offset, 1.183 + unsigned int *lookup_count /* IN/OUT */, 1.184 + unsigned int *lookup_indexes /* OUT */); 1.185 + 1.186 +unsigned int 1.187 +hb_ot_layout_table_get_lookup_count (hb_face_t *face, 1.188 + hb_tag_t table_tag); 1.189 + 1.190 + 1.191 +void 1.192 +hb_ot_layout_collect_lookups (hb_face_t *face, 1.193 + hb_tag_t table_tag, 1.194 + const hb_tag_t *scripts, 1.195 + const hb_tag_t *languages, 1.196 + const hb_tag_t *features, 1.197 + hb_set_t *lookup_indexes /* OUT */); 1.198 + 1.199 +void 1.200 +hb_ot_layout_lookup_collect_glyphs (hb_face_t *face, 1.201 + hb_tag_t table_tag, 1.202 + unsigned int lookup_index, 1.203 + hb_set_t *glyphs_before, /* OUT. May be NULL */ 1.204 + hb_set_t *glyphs_input, /* OUT. May be NULL */ 1.205 + hb_set_t *glyphs_after, /* OUT. May be NULL */ 1.206 + hb_set_t *glyphs_output /* OUT. May be NULL */); 1.207 + 1.208 +#ifdef HB_NOT_IMPLEMENTED 1.209 +typedef struct 1.210 +{ 1.211 + const hb_codepoint_t *before, 1.212 + unsigned int before_length, 1.213 + const hb_codepoint_t *input, 1.214 + unsigned int input_length, 1.215 + const hb_codepoint_t *after, 1.216 + unsigned int after_length, 1.217 +} hb_ot_layout_glyph_sequence_t; 1.218 + 1.219 +typedef hb_bool_t 1.220 +(*hb_ot_layout_glyph_sequence_func_t) (hb_font_t *font, 1.221 + hb_tag_t table_tag, 1.222 + unsigned int lookup_index, 1.223 + const hb_ot_layout_glyph_sequence_t *sequence, 1.224 + void *user_data); 1.225 + 1.226 +void 1.227 +Xhb_ot_layout_lookup_enumerate_sequences (hb_face_t *face, 1.228 + hb_tag_t table_tag, 1.229 + unsigned int lookup_index, 1.230 + hb_ot_layout_glyph_sequence_func_t callback, 1.231 + void *user_data); 1.232 +#endif 1.233 + 1.234 + 1.235 +/* 1.236 + * GSUB 1.237 + */ 1.238 + 1.239 +hb_bool_t 1.240 +hb_ot_layout_has_substitution (hb_face_t *face); 1.241 + 1.242 +hb_bool_t 1.243 +hb_ot_layout_lookup_would_substitute (hb_face_t *face, 1.244 + unsigned int lookup_index, 1.245 + const hb_codepoint_t *glyphs, 1.246 + unsigned int glyphs_length, 1.247 + hb_bool_t zero_context); 1.248 + 1.249 +void 1.250 +hb_ot_layout_lookup_substitute_closure (hb_face_t *face, 1.251 + unsigned int lookup_index, 1.252 + hb_set_t *glyphs 1.253 + /*TODO , hb_bool_t inclusive */); 1.254 + 1.255 +#ifdef HB_NOT_IMPLEMENTED 1.256 +/* Note: You better have GDEF when using this API, or marks won't do much. */ 1.257 +hb_bool_t 1.258 +Xhb_ot_layout_lookup_substitute (hb_font_t *font, 1.259 + unsigned int lookup_index, 1.260 + const hb_ot_layout_glyph_sequence_t *sequence, 1.261 + unsigned int out_size, 1.262 + hb_codepoint_t *glyphs_out, /* OUT */ 1.263 + unsigned int *clusters_out, /* OUT */ 1.264 + unsigned int *out_length /* OUT */); 1.265 +#endif 1.266 + 1.267 + 1.268 +/* 1.269 + * GPOS 1.270 + */ 1.271 + 1.272 +hb_bool_t 1.273 +hb_ot_layout_has_positioning (hb_face_t *face); 1.274 + 1.275 +#ifdef HB_NOT_IMPLEMENTED 1.276 +/* Note: You better have GDEF when using this API, or marks won't do much. */ 1.277 +hb_bool_t 1.278 +Xhb_ot_layout_lookup_position (hb_font_t *font, 1.279 + unsigned int lookup_index, 1.280 + const hb_ot_layout_glyph_sequence_t *sequence, 1.281 + hb_glyph_position_t *positions /* IN / OUT */); 1.282 +#endif 1.283 + 1.284 +/* Optical 'size' feature info. Returns true if found. 1.285 + * http://www.microsoft.com/typography/otspec/features_pt.htm#size */ 1.286 +hb_bool_t 1.287 +hb_ot_layout_get_size_params (hb_face_t *face, 1.288 + unsigned int *design_size, /* OUT. May be NULL */ 1.289 + unsigned int *subfamily_id, /* OUT. May be NULL */ 1.290 + unsigned int *subfamily_name_id, /* OUT. May be NULL */ 1.291 + unsigned int *range_start, /* OUT. May be NULL */ 1.292 + unsigned int *range_end /* OUT. May be NULL */); 1.293 + 1.294 + 1.295 +HB_END_DECLS 1.296 + 1.297 +#endif /* HB_OT_LAYOUT_H */