hb-ot-layout.h revision 2014b8d110231b13e524008282ece7451f1ae9e7
1/* 2 * Copyright (C) 2007,2008,2009 Red Hat, Inc. 3 * 4 * This is part of HarfBuzz, an OpenType Layout engine 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_OT_LAYOUT_H 28#define HB_OT_LAYOUT_H 29 30#include "hb-common.h" 31#include "hb-buffer.h" 32#include "hb-font.h" 33 34#include "hb-ot-tag.h" 35 36HB_BEGIN_DECLS 37 38#define HB_OT_TAG_GDEF HB_TAG('G','D','E','F') 39#define HB_OT_TAG_GSUB HB_TAG('G','S','U','B') 40#define HB_OT_TAG_GPOS HB_TAG('G','P','O','S') 41 42/* 43 * GDEF 44 */ 45 46typedef enum { 47 HB_OT_LAYOUT_GLYPH_CLASS_UNCLASSIFIED = 0x0000, 48 HB_OT_LAYOUT_GLYPH_CLASS_BASE_GLYPH = 0x0002, 49 HB_OT_LAYOUT_GLYPH_CLASS_LIGATURE = 0x0004, 50 HB_OT_LAYOUT_GLYPH_CLASS_MARK = 0x0008, 51 HB_OT_LAYOUT_GLYPH_CLASS_COMPONENT = 0x0010 52} hb_ot_layout_glyph_class_t; 53 54/* XXX These should eventually be removed as we move synthesized glyph 55 * classes in harfbuzz. */ 56 57hb_bool_t 58hb_ot_layout_has_glyph_classes (hb_face_t *face); 59 60hb_ot_layout_glyph_class_t 61hb_ot_layout_get_glyph_class (hb_face_t *face, 62 hb_codepoint_t glyph); 63 64void 65hb_ot_layout_set_glyph_class (hb_face_t *face, 66 hb_codepoint_t glyph, 67 hb_ot_layout_glyph_class_t klass); 68 69void 70hb_ot_layout_build_glyph_classes (hb_face_t *face, 71 uint16_t num_total_glyphs, 72 hb_codepoint_t *glyphs, 73 unsigned char *klasses, 74 uint16_t count); 75 76/* Not that useful. Provides list of attach points for a glyph that a 77 * client may want to cache */ 78unsigned int 79hb_ot_layout_get_attach_points (hb_face_t *face, 80 hb_codepoint_t glyph, 81 unsigned int start_offset, 82 unsigned int *point_count /* IN/OUT */, 83 unsigned int *point_array /* OUT */); 84 85/* Ligature caret positions */ 86unsigned int 87hb_ot_layout_get_lig_carets (hb_font_t *font, 88 hb_face_t *face, 89 hb_codepoint_t glyph, 90 unsigned int start_offset, 91 unsigned int *caret_count /* IN/OUT */, 92 int *caret_array /* OUT */); 93 94 95/* 96 * GSUB/GPOS feature query and enumeration interface 97 */ 98 99#define HB_OT_LAYOUT_NO_SCRIPT_INDEX ((unsigned int) 0xFFFF) 100#define HB_OT_LAYOUT_NO_FEATURE_INDEX ((unsigned int) 0xFFFF) 101#define HB_OT_LAYOUT_DEFAULT_LANGUAGE_INDEX ((unsigned int) 0xFFFF) 102 103unsigned int 104hb_ot_layout_table_get_script_tags (hb_face_t *face, 105 hb_tag_t table_tag, 106 unsigned int start_offset, 107 unsigned int *script_count /* IN/OUT */, 108 hb_tag_t *script_tags /* OUT */); 109 110hb_bool_t 111hb_ot_layout_table_find_script (hb_face_t *face, 112 hb_tag_t table_tag, 113 hb_tag_t script_tag, 114 unsigned int *script_index); 115 116/* Like find_script, but takes zero-terminated array of scripts to test */ 117hb_bool_t 118hb_ot_layout_table_choose_script (hb_face_t *face, 119 hb_tag_t table_tag, 120 const hb_tag_t *script_tags, 121 unsigned int *script_index); 122 123unsigned int 124hb_ot_layout_table_get_feature_tags (hb_face_t *face, 125 hb_tag_t table_tag, 126 unsigned int start_offset, 127 unsigned int *feature_count /* IN/OUT */, 128 hb_tag_t *feature_tags /* OUT */); 129 130unsigned int 131hb_ot_layout_script_get_language_tags (hb_face_t *face, 132 hb_tag_t table_tag, 133 unsigned int script_index, 134 unsigned int start_offset, 135 unsigned int *language_count /* IN/OUT */, 136 hb_tag_t *language_tags /* OUT */); 137 138hb_bool_t 139hb_ot_layout_script_find_language (hb_face_t *face, 140 hb_tag_t table_tag, 141 unsigned int script_index, 142 hb_tag_t language_tag, 143 unsigned int *language_index); 144 145hb_bool_t 146hb_ot_layout_language_get_required_feature_index (hb_face_t *face, 147 hb_tag_t table_tag, 148 unsigned int script_index, 149 unsigned int language_index, 150 unsigned int *feature_index); 151 152unsigned int 153hb_ot_layout_language_get_feature_indexes (hb_face_t *face, 154 hb_tag_t table_tag, 155 unsigned int script_index, 156 unsigned int language_index, 157 unsigned int start_offset, 158 unsigned int *feature_count /* IN/OUT */, 159 unsigned int *feature_indexes /* OUT */); 160 161unsigned int 162hb_ot_layout_language_get_feature_tags (hb_face_t *face, 163 hb_tag_t table_tag, 164 unsigned int script_index, 165 unsigned int language_index, 166 unsigned int start_offset, 167 unsigned int *feature_count /* IN/OUT */, 168 hb_tag_t *feature_tags /* OUT */); 169 170hb_bool_t 171hb_ot_layout_language_find_feature (hb_face_t *face, 172 hb_tag_t table_tag, 173 unsigned int script_index, 174 unsigned int language_index, 175 hb_tag_t feature_tag, 176 unsigned int *feature_index); 177 178unsigned int 179hb_ot_layout_feature_get_lookup_indexes (hb_face_t *face, 180 hb_tag_t table_tag, 181 unsigned int feature_index, 182 unsigned int start_offset, 183 unsigned int *lookup_count /* IN/OUT */, 184 unsigned int *lookup_indexes /* OUT */); 185 186 187/* 188 * GSUB 189 */ 190 191hb_bool_t 192hb_ot_layout_has_substitution (hb_face_t *face); 193 194hb_bool_t 195hb_ot_layout_substitute_lookup (hb_face_t *face, 196 hb_buffer_t *buffer, 197 unsigned int lookup_index, 198 hb_mask_t mask); 199 200/* 201 * GPOS 202 */ 203 204hb_bool_t 205hb_ot_layout_has_positioning (hb_face_t *face); 206 207hb_bool_t 208hb_ot_layout_position_lookup (hb_font_t *font, 209 hb_face_t *face, 210 hb_buffer_t *buffer, 211 unsigned int lookup_index, 212 hb_mask_t mask); 213 214/* Should be called after all the position_lookup's are done */ 215void 216hb_ot_layout_position_finish (hb_font_t *font, 217 hb_face_t *face, 218 hb_buffer_t *buffer); 219 220 221HB_END_DECLS 222 223#endif /* HB_OT_LAYOUT_H */ 224