122 HB_INTERNAL inline void apply (const Proxy &proxy, 123 const struct hb_ot_shape_plan_t *plan, hb_font_t *font, hb_buffer_t *buffer) const; 124 HB_INTERNAL void substitute (const struct hb_ot_shape_plan_t *plan, hb_font_t *font, hb_buffer_t *buffer) const; 125 HB_INTERNAL void position (const struct hb_ot_shape_plan_t *plan, hb_font_t *font, hb_buffer_t *buffer) const; 126 127 inline void finish (void) { 128 features.finish (); 129 for (unsigned int table_index = 0; table_index < 2; table_index++) 130 { 131 lookups[table_index].finish (); 132 stages[table_index].finish (); 133 } 134 } 135 136 public: 137 hb_tag_t chosen_script[2]; 138 bool found_script[2]; 139 140 private: 141 142 HB_INTERNAL void add_lookups (hb_face_t *face, 143 unsigned int table_index, 144 unsigned int feature_index, 145 hb_mask_t mask, 146 bool auto_zwj); 147 148 hb_mask_t global_mask; 149 150 hb_prealloced_array_t<feature_map_t, 8> features; 151 hb_prealloced_array_t<lookup_map_t, 32> lookups[2]; /* GSUB/GPOS */ 152 hb_prealloced_array_t<stage_map_t, 4> stages[2]; /* GSUB/GPOS */ 153 }; 154 155 enum hb_ot_map_feature_flags_t { 156 F_NONE = 0x0000u, 157 F_GLOBAL = 0x0001u, /* Feature applies to all characters; results in no mask allocated for it. */ 158 F_HAS_FALLBACK = 0x0002u, /* Has fallback implementation, so include mask bit even if feature not found. */ 159 F_MANUAL_ZWJ = 0x0004u, /* Don't skip over ZWJ when matching. */ 160 F_GLOBAL_SEARCH = 0x0008u /* If feature not found in LangSys, look for it in global feature list and pick one. */ 161 }; 162 HB_MARK_AS_FLAG_T (hb_ot_map_feature_flags_t); 163 /* Macro version for where const is desired. */ 164 #define F_COMBINE(l,r) (hb_ot_map_feature_flags_t ((unsigned int) (l) | (unsigned int) (r))) 165 166 167 struct hb_ot_map_builder_t 168 { 169 public: 170 171 HB_INTERNAL hb_ot_map_builder_t (hb_face_t *face_, 172 const hb_segment_properties_t *props_); 173 174 HB_INTERNAL void add_feature (hb_tag_t tag, unsigned int value, 175 hb_ot_map_feature_flags_t flags); 176 177 inline void add_global_bool_feature (hb_tag_t tag) 178 { add_feature (tag, 1, F_GLOBAL); } 179 180 inline void add_gsub_pause (hb_ot_map_t::pause_func_t pause_func) 181 { add_pause (0, pause_func); } 182 inline void add_gpos_pause (hb_ot_map_t::pause_func_t pause_func) 183 { add_pause (1, pause_func); } 184 185 HB_INTERNAL void compile (struct hb_ot_map_t &m); 186 187 inline void finish (void) { 188 feature_infos.finish (); 189 for (unsigned int table_index = 0; table_index < 2; table_index++) 190 { 191 stages[table_index].finish (); 192 } 193 } 194 195 private: 196 197 struct feature_info_t { 198 hb_tag_t tag; 199 unsigned int seq; /* sequence#, used for stable sorting only */ 200 unsigned int max_value; 201 hb_ot_map_feature_flags_t flags; 202 unsigned int default_value; /* for non-global features, what should the unset glyphs take */ 203 unsigned int stage[2]; /* GSUB/GPOS */ 204 205 static int cmp (const feature_info_t *a, const feature_info_t *b) 206 { return (a->tag != b->tag) ? (a->tag < b->tag ? -1 : 1) : 207 (a->seq < b->seq ? -1 : a->seq > b->seq ? 1 : 0); } 208 }; 209 210 struct stage_info_t { 211 unsigned int index; 212 hb_ot_map_t::pause_func_t pause_func; 213 }; 214 215 HB_INTERNAL void add_pause (unsigned int table_index, hb_ot_map_t::pause_func_t pause_func); | 122 HB_INTERNAL inline void apply (const Proxy &proxy, 123 const struct hb_ot_shape_plan_t *plan, hb_font_t *font, hb_buffer_t *buffer) const; 124 HB_INTERNAL void substitute (const struct hb_ot_shape_plan_t *plan, hb_font_t *font, hb_buffer_t *buffer) const; 125 HB_INTERNAL void position (const struct hb_ot_shape_plan_t *plan, hb_font_t *font, hb_buffer_t *buffer) const; 126 127 inline void finish (void) { 128 features.finish (); 129 for (unsigned int table_index = 0; table_index < 2; table_index++) 130 { 131 lookups[table_index].finish (); 132 stages[table_index].finish (); 133 } 134 } 135 136 public: 137 hb_tag_t chosen_script[2]; 138 bool found_script[2]; 139 140 private: 141 142 hb_mask_t global_mask; 143 144 hb_prealloced_array_t<feature_map_t, 8> features; 145 hb_prealloced_array_t<lookup_map_t, 32> lookups[2]; /* GSUB/GPOS */ 146 hb_prealloced_array_t<stage_map_t, 4> stages[2]; /* GSUB/GPOS */ 147 }; 148 149 enum hb_ot_map_feature_flags_t { 150 F_NONE = 0x0000u, 151 F_GLOBAL = 0x0001u, /* Feature applies to all characters; results in no mask allocated for it. */ 152 F_HAS_FALLBACK = 0x0002u, /* Has fallback implementation, so include mask bit even if feature not found. */ 153 F_MANUAL_ZWJ = 0x0004u, /* Don't skip over ZWJ when matching. */ 154 F_GLOBAL_SEARCH = 0x0008u /* If feature not found in LangSys, look for it in global feature list and pick one. */ 155 }; 156 HB_MARK_AS_FLAG_T (hb_ot_map_feature_flags_t); 157 /* Macro version for where const is desired. */ 158 #define F_COMBINE(l,r) (hb_ot_map_feature_flags_t ((unsigned int) (l) | (unsigned int) (r))) 159 160 161 struct hb_ot_map_builder_t 162 { 163 public: 164 165 HB_INTERNAL hb_ot_map_builder_t (hb_face_t *face_, 166 const hb_segment_properties_t *props_); 167 168 HB_INTERNAL void add_feature (hb_tag_t tag, unsigned int value, 169 hb_ot_map_feature_flags_t flags); 170 171 inline void add_global_bool_feature (hb_tag_t tag) 172 { add_feature (tag, 1, F_GLOBAL); } 173 174 inline void add_gsub_pause (hb_ot_map_t::pause_func_t pause_func) 175 { add_pause (0, pause_func); } 176 inline void add_gpos_pause (hb_ot_map_t::pause_func_t pause_func) 177 { add_pause (1, pause_func); } 178 179 HB_INTERNAL void compile (hb_ot_map_t &m, 180 const int *coords, 181 unsigned int num_coords); 182 183 inline void finish (void) { 184 feature_infos.finish (); 185 for (unsigned int table_index = 0; table_index < 2; table_index++) 186 { 187 stages[table_index].finish (); 188 } 189 } 190 191 private: 192 193 HB_INTERNAL void add_lookups (hb_ot_map_t &m, 194 hb_face_t *face, 195 unsigned int table_index, 196 unsigned int feature_index, 197 unsigned int variations_index, 198 hb_mask_t mask, 199 bool auto_zwj); 200 201 struct feature_info_t { 202 hb_tag_t tag; 203 unsigned int seq; /* sequence#, used for stable sorting only */ 204 unsigned int max_value; 205 hb_ot_map_feature_flags_t flags; 206 unsigned int default_value; /* for non-global features, what should the unset glyphs take */ 207 unsigned int stage[2]; /* GSUB/GPOS */ 208 209 static int cmp (const feature_info_t *a, const feature_info_t *b) 210 { return (a->tag != b->tag) ? (a->tag < b->tag ? -1 : 1) : 211 (a->seq < b->seq ? -1 : a->seq > b->seq ? 1 : 0); } 212 }; 213 214 struct stage_info_t { 215 unsigned int index; 216 hb_ot_map_t::pause_func_t pause_func; 217 }; 218 219 HB_INTERNAL void add_pause (unsigned int table_index, hb_ot_map_t::pause_func_t pause_func); |