michael@0: /* michael@0: * Copyright © 2007,2008,2009 Red Hat, Inc. michael@0: * michael@0: * This is part of HarfBuzz, a text shaping library. michael@0: * michael@0: * Permission is hereby granted, without written agreement and without michael@0: * license or royalty fees, to use, copy, modify, and distribute this michael@0: * software and its documentation for any purpose, provided that the michael@0: * above copyright notice and the following two paragraphs appear in michael@0: * all copies of this software. michael@0: * michael@0: * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR michael@0: * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES michael@0: * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN michael@0: * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH michael@0: * DAMAGE. michael@0: * michael@0: * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, michael@0: * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND michael@0: * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS michael@0: * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO michael@0: * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. michael@0: * michael@0: * Red Hat Author(s): Behdad Esfahbod michael@0: */ michael@0: michael@0: #ifndef HB_OT_H_IN michael@0: #error "Include instead." michael@0: #endif michael@0: michael@0: #ifndef HB_OT_LAYOUT_H michael@0: #define HB_OT_LAYOUT_H michael@0: michael@0: #include "hb.h" michael@0: michael@0: #include "hb-ot-tag.h" michael@0: michael@0: HB_BEGIN_DECLS michael@0: michael@0: michael@0: #define HB_OT_TAG_GDEF HB_TAG('G','D','E','F') michael@0: #define HB_OT_TAG_GSUB HB_TAG('G','S','U','B') michael@0: #define HB_OT_TAG_GPOS HB_TAG('G','P','O','S') michael@0: #define HB_OT_TAG_JSTF HB_TAG('J','S','T','F') michael@0: michael@0: michael@0: /* michael@0: * GDEF michael@0: */ michael@0: michael@0: hb_bool_t michael@0: hb_ot_layout_has_glyph_classes (hb_face_t *face); michael@0: michael@0: typedef enum { michael@0: HB_OT_LAYOUT_GLYPH_CLASS_UNCLASSIFIED = 0, michael@0: HB_OT_LAYOUT_GLYPH_CLASS_BASE_GLYPH = 1, michael@0: HB_OT_LAYOUT_GLYPH_CLASS_LIGATURE = 2, michael@0: HB_OT_LAYOUT_GLYPH_CLASS_MARK = 3, michael@0: HB_OT_LAYOUT_GLYPH_CLASS_COMPONENT = 4 michael@0: } hb_ot_layout_glyph_class_t; michael@0: michael@0: hb_ot_layout_glyph_class_t michael@0: hb_ot_layout_get_glyph_class (hb_face_t *face, michael@0: hb_codepoint_t glyph); michael@0: michael@0: void michael@0: hb_ot_layout_get_glyphs_in_class (hb_face_t *face, michael@0: hb_ot_layout_glyph_class_t klass, michael@0: hb_set_t *glyphs /* OUT */); michael@0: michael@0: michael@0: /* Not that useful. Provides list of attach points for a glyph that a michael@0: * client may want to cache */ michael@0: unsigned int michael@0: hb_ot_layout_get_attach_points (hb_face_t *face, michael@0: hb_codepoint_t glyph, michael@0: unsigned int start_offset, michael@0: unsigned int *point_count /* IN/OUT */, michael@0: unsigned int *point_array /* OUT */); michael@0: michael@0: /* Ligature caret positions */ michael@0: unsigned int michael@0: hb_ot_layout_get_ligature_carets (hb_font_t *font, michael@0: hb_direction_t direction, michael@0: hb_codepoint_t glyph, michael@0: unsigned int start_offset, michael@0: unsigned int *caret_count /* IN/OUT */, michael@0: hb_position_t *caret_array /* OUT */); michael@0: michael@0: michael@0: /* michael@0: * GSUB/GPOS feature query and enumeration interface michael@0: */ michael@0: michael@0: #define HB_OT_LAYOUT_NO_SCRIPT_INDEX ((unsigned int) 0xFFFF) michael@0: #define HB_OT_LAYOUT_NO_FEATURE_INDEX ((unsigned int) 0xFFFF) michael@0: #define HB_OT_LAYOUT_DEFAULT_LANGUAGE_INDEX ((unsigned int) 0xFFFF) michael@0: michael@0: unsigned int michael@0: hb_ot_layout_table_get_script_tags (hb_face_t *face, michael@0: hb_tag_t table_tag, michael@0: unsigned int start_offset, michael@0: unsigned int *script_count /* IN/OUT */, michael@0: hb_tag_t *script_tags /* OUT */); michael@0: michael@0: hb_bool_t michael@0: hb_ot_layout_table_find_script (hb_face_t *face, michael@0: hb_tag_t table_tag, michael@0: hb_tag_t script_tag, michael@0: unsigned int *script_index); michael@0: michael@0: /* Like find_script, but takes zero-terminated array of scripts to test */ michael@0: hb_bool_t michael@0: hb_ot_layout_table_choose_script (hb_face_t *face, michael@0: hb_tag_t table_tag, michael@0: const hb_tag_t *script_tags, michael@0: unsigned int *script_index, michael@0: hb_tag_t *chosen_script); michael@0: michael@0: unsigned int michael@0: hb_ot_layout_table_get_feature_tags (hb_face_t *face, michael@0: hb_tag_t table_tag, michael@0: unsigned int start_offset, michael@0: unsigned int *feature_count /* IN/OUT */, michael@0: hb_tag_t *feature_tags /* OUT */); michael@0: michael@0: unsigned int michael@0: hb_ot_layout_script_get_language_tags (hb_face_t *face, michael@0: hb_tag_t table_tag, michael@0: unsigned int script_index, michael@0: unsigned int start_offset, michael@0: unsigned int *language_count /* IN/OUT */, michael@0: hb_tag_t *language_tags /* OUT */); michael@0: michael@0: hb_bool_t michael@0: hb_ot_layout_script_find_language (hb_face_t *face, michael@0: hb_tag_t table_tag, michael@0: unsigned int script_index, michael@0: hb_tag_t language_tag, michael@0: unsigned int *language_index); michael@0: michael@0: hb_bool_t michael@0: hb_ot_layout_language_get_required_feature_index (hb_face_t *face, michael@0: hb_tag_t table_tag, michael@0: unsigned int script_index, michael@0: unsigned int language_index, michael@0: unsigned int *feature_index); michael@0: michael@0: unsigned int michael@0: hb_ot_layout_language_get_feature_indexes (hb_face_t *face, michael@0: hb_tag_t table_tag, michael@0: unsigned int script_index, michael@0: unsigned int language_index, michael@0: unsigned int start_offset, michael@0: unsigned int *feature_count /* IN/OUT */, michael@0: unsigned int *feature_indexes /* OUT */); michael@0: michael@0: unsigned int michael@0: hb_ot_layout_language_get_feature_tags (hb_face_t *face, michael@0: hb_tag_t table_tag, michael@0: unsigned int script_index, michael@0: unsigned int language_index, michael@0: unsigned int start_offset, michael@0: unsigned int *feature_count /* IN/OUT */, michael@0: hb_tag_t *feature_tags /* OUT */); michael@0: michael@0: hb_bool_t michael@0: hb_ot_layout_language_find_feature (hb_face_t *face, michael@0: hb_tag_t table_tag, michael@0: unsigned int script_index, michael@0: unsigned int language_index, michael@0: hb_tag_t feature_tag, michael@0: unsigned int *feature_index); michael@0: michael@0: unsigned int michael@0: hb_ot_layout_feature_get_lookups (hb_face_t *face, michael@0: hb_tag_t table_tag, michael@0: unsigned int feature_index, michael@0: unsigned int start_offset, michael@0: unsigned int *lookup_count /* IN/OUT */, michael@0: unsigned int *lookup_indexes /* OUT */); michael@0: michael@0: unsigned int michael@0: hb_ot_layout_table_get_lookup_count (hb_face_t *face, michael@0: hb_tag_t table_tag); michael@0: michael@0: michael@0: void michael@0: hb_ot_layout_collect_lookups (hb_face_t *face, michael@0: hb_tag_t table_tag, michael@0: const hb_tag_t *scripts, michael@0: const hb_tag_t *languages, michael@0: const hb_tag_t *features, michael@0: hb_set_t *lookup_indexes /* OUT */); michael@0: michael@0: void michael@0: hb_ot_layout_lookup_collect_glyphs (hb_face_t *face, michael@0: hb_tag_t table_tag, michael@0: unsigned int lookup_index, michael@0: hb_set_t *glyphs_before, /* OUT. May be NULL */ michael@0: hb_set_t *glyphs_input, /* OUT. May be NULL */ michael@0: hb_set_t *glyphs_after, /* OUT. May be NULL */ michael@0: hb_set_t *glyphs_output /* OUT. May be NULL */); michael@0: michael@0: #ifdef HB_NOT_IMPLEMENTED michael@0: typedef struct michael@0: { michael@0: const hb_codepoint_t *before, michael@0: unsigned int before_length, michael@0: const hb_codepoint_t *input, michael@0: unsigned int input_length, michael@0: const hb_codepoint_t *after, michael@0: unsigned int after_length, michael@0: } hb_ot_layout_glyph_sequence_t; michael@0: michael@0: typedef hb_bool_t michael@0: (*hb_ot_layout_glyph_sequence_func_t) (hb_font_t *font, michael@0: hb_tag_t table_tag, michael@0: unsigned int lookup_index, michael@0: const hb_ot_layout_glyph_sequence_t *sequence, michael@0: void *user_data); michael@0: michael@0: void michael@0: Xhb_ot_layout_lookup_enumerate_sequences (hb_face_t *face, michael@0: hb_tag_t table_tag, michael@0: unsigned int lookup_index, michael@0: hb_ot_layout_glyph_sequence_func_t callback, michael@0: void *user_data); michael@0: #endif michael@0: michael@0: michael@0: /* michael@0: * GSUB michael@0: */ michael@0: michael@0: hb_bool_t michael@0: hb_ot_layout_has_substitution (hb_face_t *face); michael@0: michael@0: hb_bool_t michael@0: hb_ot_layout_lookup_would_substitute (hb_face_t *face, michael@0: unsigned int lookup_index, michael@0: const hb_codepoint_t *glyphs, michael@0: unsigned int glyphs_length, michael@0: hb_bool_t zero_context); michael@0: michael@0: void michael@0: hb_ot_layout_lookup_substitute_closure (hb_face_t *face, michael@0: unsigned int lookup_index, michael@0: hb_set_t *glyphs michael@0: /*TODO , hb_bool_t inclusive */); michael@0: michael@0: #ifdef HB_NOT_IMPLEMENTED michael@0: /* Note: You better have GDEF when using this API, or marks won't do much. */ michael@0: hb_bool_t michael@0: Xhb_ot_layout_lookup_substitute (hb_font_t *font, michael@0: unsigned int lookup_index, michael@0: const hb_ot_layout_glyph_sequence_t *sequence, michael@0: unsigned int out_size, michael@0: hb_codepoint_t *glyphs_out, /* OUT */ michael@0: unsigned int *clusters_out, /* OUT */ michael@0: unsigned int *out_length /* OUT */); michael@0: #endif michael@0: michael@0: michael@0: /* michael@0: * GPOS michael@0: */ michael@0: michael@0: hb_bool_t michael@0: hb_ot_layout_has_positioning (hb_face_t *face); michael@0: michael@0: #ifdef HB_NOT_IMPLEMENTED michael@0: /* Note: You better have GDEF when using this API, or marks won't do much. */ michael@0: hb_bool_t michael@0: Xhb_ot_layout_lookup_position (hb_font_t *font, michael@0: unsigned int lookup_index, michael@0: const hb_ot_layout_glyph_sequence_t *sequence, michael@0: hb_glyph_position_t *positions /* IN / OUT */); michael@0: #endif michael@0: michael@0: /* Optical 'size' feature info. Returns true if found. michael@0: * http://www.microsoft.com/typography/otspec/features_pt.htm#size */ michael@0: hb_bool_t michael@0: hb_ot_layout_get_size_params (hb_face_t *face, michael@0: unsigned int *design_size, /* OUT. May be NULL */ michael@0: unsigned int *subfamily_id, /* OUT. May be NULL */ michael@0: unsigned int *subfamily_name_id, /* OUT. May be NULL */ michael@0: unsigned int *range_start, /* OUT. May be NULL */ michael@0: unsigned int *range_end /* OUT. May be NULL */); michael@0: michael@0: michael@0: HB_END_DECLS michael@0: michael@0: #endif /* HB_OT_LAYOUT_H */