| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright © 2007,2008,2009 Red Hat, Inc. | 2 * Copyright © 2007,2008,2009 Red Hat, Inc. |
| 3 * Copyright © 2012 Google, Inc. | 3 * Copyright © 2012,2013 Google, Inc. |
| 4 * | 4 * |
| 5 * This is part of HarfBuzz, a text shaping library. | 5 * This is part of HarfBuzz, a text shaping library. |
| 6 * | 6 * |
| 7 * Permission is hereby granted, without written agreement and without | 7 * Permission is hereby granted, without written agreement and without |
| 8 * license or royalty fees, to use, copy, modify, and distribute this | 8 * license or royalty fees, to use, copy, modify, and distribute this |
| 9 * software and its documentation for any purpose, provided that the | 9 * software and its documentation for any purpose, provided that the |
| 10 * above copyright notice and the following two paragraphs appear in | 10 * above copyright notice and the following two paragraphs appear in |
| 11 * all copies of this software. | 11 * all copies of this software. |
| 12 * | 12 * |
| 13 * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR | 13 * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR |
| (...skipping 17 matching lines...) Expand all Loading... |
| 31 | 31 |
| 32 #include "hb-private.hh" | 32 #include "hb-private.hh" |
| 33 | 33 |
| 34 #include "hb-ot-layout.h" | 34 #include "hb-ot-layout.h" |
| 35 | 35 |
| 36 #include "hb-font-private.hh" | 36 #include "hb-font-private.hh" |
| 37 #include "hb-buffer-private.hh" | 37 #include "hb-buffer-private.hh" |
| 38 #include "hb-set-private.hh" | 38 #include "hb-set-private.hh" |
| 39 | 39 |
| 40 | 40 |
| 41 /* buffer var allocations, used during the GSUB/GPOS processing */ | 41 /* |
| 42 #define glyph_props()» » var1.u16[0] /* GDEF glyph properties */ | 42 * GDEF |
| 43 #define syllable()» » var1.u8[2] /* GSUB/GPOS shaping boundaries */ | 43 */ |
| 44 #define lig_props()» » var1.u8[3] /* GSUB/GPOS ligature tracking */ | 44 |
| 45 typedef enum |
| 46 { |
| 47 /* The following three match LookupFlags::Ignore* numbers. */ |
| 48 HB_OT_LAYOUT_GLYPH_PROPS_BASE_GLYPH» = 0x02u, |
| 49 HB_OT_LAYOUT_GLYPH_PROPS_LIGATURE» = 0x04u, |
| 50 HB_OT_LAYOUT_GLYPH_PROPS_MARK»» = 0x08u, |
| 51 |
| 52 /* The following are used internally; not derived from GDEF. */ |
| 53 HB_OT_LAYOUT_GLYPH_PROPS_SUBSTITUTED» = 0x10u, |
| 54 HB_OT_LAYOUT_GLYPH_PROPS_LIGATED» = 0x20u, |
| 55 |
| 56 HB_OT_LAYOUT_GLYPH_PROPS_PRESERVE = HB_OT_LAYOUT_GLYPH_PROPS_SUBSTITUTED | |
| 57 » » » » » HB_OT_LAYOUT_GLYPH_PROPS_LIGATED |
| 58 } hb_ot_layout_glyph_class_mask_t; |
| 59 |
| 60 |
| 61 /* |
| 62 * GSUB/GPOS |
| 63 */ |
| 64 |
| 65 HB_INTERNAL hb_bool_t |
| 66 hb_ot_layout_lookup_would_substitute_fast (hb_face_t *face, |
| 67 » » » » » unsigned int lookup_index, |
| 68 » » » » » const hb_codepoint_t *glyphs, |
| 69 » » » » » unsigned int glyphs_length, |
| 70 » » » » » hb_bool_t zero_context); |
| 71 |
| 72 |
| 73 /* Should be called before all the substitute_lookup's are done. */ |
| 74 HB_INTERNAL void |
| 75 hb_ot_layout_substitute_start (hb_font_t *font, |
| 76 » » » hb_buffer_t *buffer); |
| 77 |
| 78 |
| 79 struct hb_ot_layout_lookup_accelerator_t; |
| 80 |
| 81 namespace OT { |
| 82 struct hb_apply_context_t; |
| 83 struct SubstLookup; |
| 84 } |
| 85 |
| 86 HB_INTERNAL void |
| 87 hb_ot_layout_substitute_lookup (OT::hb_apply_context_t *c, |
| 88 » » » » const OT::SubstLookup &lookup, |
| 89 » » » » const hb_ot_layout_lookup_accelerator_t &accel); |
| 90 |
| 91 |
| 92 /* Should be called after all the substitute_lookup's are done */ |
| 93 HB_INTERNAL void |
| 94 hb_ot_layout_substitute_finish (hb_font_t *font, |
| 95 » » » » hb_buffer_t *buffer); |
| 96 |
| 97 |
| 98 /* Should be called before all the position_lookup's are done. Resets positions
to zero. */ |
| 99 HB_INTERNAL void |
| 100 hb_ot_layout_position_start (hb_font_t *font, |
| 101 » » » hb_buffer_t *buffer); |
| 102 |
| 103 /* Should be called after all the position_lookup's are done */ |
| 104 HB_INTERNAL void |
| 105 hb_ot_layout_position_finish (hb_font_t *font, |
| 106 » » » hb_buffer_t *buffer); |
| 107 |
| 108 |
| 109 |
| 110 /* |
| 111 * hb_ot_layout_t |
| 112 */ |
| 113 |
| 114 namespace OT { |
| 115 struct GDEF; |
| 116 struct GSUB; |
| 117 struct GPOS; |
| 118 } |
| 119 |
| 120 struct hb_ot_layout_lookup_accelerator_t |
| 121 { |
| 122 template <typename TLookup> |
| 123 inline void init (const TLookup &lookup) |
| 124 { |
| 125 digest.init (); |
| 126 lookup.add_coverage (&digest); |
| 127 } |
| 128 |
| 129 template <typename TLookup> |
| 130 inline void fini (const TLookup &lookup) |
| 131 { |
| 132 } |
| 133 |
| 134 hb_set_digest_t digest; |
| 135 }; |
| 136 |
| 137 struct hb_ot_layout_t |
| 138 { |
| 139 hb_blob_t *gdef_blob; |
| 140 hb_blob_t *gsub_blob; |
| 141 hb_blob_t *gpos_blob; |
| 142 |
| 143 const struct OT::GDEF *gdef; |
| 144 const struct OT::GSUB *gsub; |
| 145 const struct OT::GPOS *gpos; |
| 146 |
| 147 unsigned int gsub_lookup_count; |
| 148 unsigned int gpos_lookup_count; |
| 149 |
| 150 hb_ot_layout_lookup_accelerator_t *gsub_accels; |
| 151 hb_ot_layout_lookup_accelerator_t *gpos_accels; |
| 152 }; |
| 153 |
| 154 |
| 155 HB_INTERNAL hb_ot_layout_t * |
| 156 _hb_ot_layout_create (hb_face_t *face); |
| 157 |
| 158 HB_INTERNAL void |
| 159 _hb_ot_layout_destroy (hb_ot_layout_t *layout); |
| 160 |
| 161 |
| 162 #define hb_ot_layout_from_face(face) ((hb_ot_layout_t *) face->shaper_data.ot) |
| 163 |
| 164 |
| 165 /* |
| 166 * Buffer var routines. |
| 167 */ |
| 45 | 168 |
| 46 /* buffer var allocations, used during the entire shaping process */ | 169 /* buffer var allocations, used during the entire shaping process */ |
| 47 #define unicode_props0() var2.u8[0] | 170 #define unicode_props0() var2.u8[0] |
| 48 #define unicode_props1() var2.u8[1] | 171 #define unicode_props1() var2.u8[1] |
| 49 | 172 |
| 173 /* buffer var allocations, used during the GSUB/GPOS processing */ |
| 174 #define glyph_props() var1.u16[0] /* GDEF glyph properties */ |
| 175 #define lig_props() var1.u8[2] /* GSUB/GPOS ligature tracking */ |
| 176 #define syllable() var1.u8[3] /* GSUB/GPOS shaping boundaries */ |
| 177 |
| 178 /* unicode_props */ |
| 179 |
| 180 enum { |
| 181 MASK0_ZWJ = 0x20u, |
| 182 MASK0_ZWNJ = 0x40u, |
| 183 MASK0_IGNORABLE = 0x80u, |
| 184 MASK0_GEN_CAT = 0x1Fu |
| 185 }; |
| 50 | 186 |
| 51 inline void | 187 inline void |
| 52 _hb_glyph_info_set_unicode_props (hb_glyph_info_t *info, hb_unicode_funcs_t *uni
code) | 188 _hb_glyph_info_set_unicode_props (hb_glyph_info_t *info, hb_unicode_funcs_t *uni
code) |
| 53 { | 189 { |
| 190 /* XXX This shouldn't be inlined, or at least not while is_default_ignorable()
is inline. */ |
| 54 info->unicode_props0() = ((unsigned int) unicode->general_category (info->code
point)) | | 191 info->unicode_props0() = ((unsigned int) unicode->general_category (info->code
point)) | |
| 55 » » » (unicode->is_default_ignorable (info->codepoint) ? 0x
80 : 0) | | 192 » » » (unicode->is_default_ignorable (info->codepoint) ? MA
SK0_IGNORABLE : 0) | |
| 56 » » » (info->codepoint == 0x200C ? 0x40 : 0) | | 193 » » » (info->codepoint == 0x200C ? MASK0_ZWNJ : 0) | |
| 57 » » » (info->codepoint == 0x200D ? 0x20 : 0); | 194 » » » (info->codepoint == 0x200D ? MASK0_ZWJ : 0); |
| 58 info->unicode_props1() = unicode->modified_combining_class (info->codepoint); | 195 info->unicode_props1() = unicode->modified_combining_class (info->codepoint); |
| 59 } | 196 } |
| 60 | 197 |
| 198 inline void |
| 199 _hb_glyph_info_set_general_category (hb_glyph_info_t *info, |
| 200 hb_unicode_general_category_t gen_cat) |
| 201 { |
| 202 info->unicode_props0() = (unsigned int) gen_cat | ((info->unicode_props0()) &
~MASK0_GEN_CAT); |
| 203 } |
| 204 |
| 61 inline hb_unicode_general_category_t | 205 inline hb_unicode_general_category_t |
| 62 _hb_glyph_info_get_general_category (const hb_glyph_info_t *info) | 206 _hb_glyph_info_get_general_category (const hb_glyph_info_t *info) |
| 63 { | 207 { |
| 64 return (hb_unicode_general_category_t) (info->unicode_props0() & 0x1F); | 208 return (hb_unicode_general_category_t) (info->unicode_props0() & MASK0_GEN_CAT
); |
| 65 } | 209 } |
| 66 | 210 |
| 67 inline void | 211 inline void |
| 68 _hb_glyph_info_set_modified_combining_class (hb_glyph_info_t *info, unsigned int
modified_class) | 212 _hb_glyph_info_set_modified_combining_class (hb_glyph_info_t *info, |
| 213 » » » » » unsigned int modified_class) |
| 69 { | 214 { |
| 70 info->unicode_props1() = modified_class; | 215 info->unicode_props1() = modified_class; |
| 71 } | 216 } |
| 72 | 217 |
| 73 inline unsigned int | 218 inline unsigned int |
| 74 _hb_glyph_info_get_modified_combining_class (const hb_glyph_info_t *info) | 219 _hb_glyph_info_get_modified_combining_class (const hb_glyph_info_t *info) |
| 75 { | 220 { |
| 76 return info->unicode_props1(); | 221 return info->unicode_props1(); |
| 77 } | 222 } |
| 78 | 223 |
| 79 inline hb_bool_t | 224 inline hb_bool_t |
| 80 _hb_glyph_info_is_default_ignorable (const hb_glyph_info_t *info) | 225 _hb_glyph_info_is_default_ignorable (const hb_glyph_info_t *info) |
| 81 { | 226 { |
| 82 return !!(info->unicode_props0() & 0x80); | 227 return !!(info->unicode_props0() & MASK0_IGNORABLE); |
| 83 } | 228 } |
| 84 | 229 |
| 85 inline hb_bool_t | 230 inline hb_bool_t |
| 86 _hb_glyph_info_is_zwnj (const hb_glyph_info_t *info) | 231 _hb_glyph_info_is_zwnj (const hb_glyph_info_t *info) |
| 87 { | 232 { |
| 88 return !!(info->unicode_props0() & 0x40); | 233 return !!(info->unicode_props0() & MASK0_ZWNJ); |
| 89 } | 234 } |
| 90 | 235 |
| 91 inline hb_bool_t | 236 inline hb_bool_t |
| 92 _hb_glyph_info_is_zwj (const hb_glyph_info_t *info) | 237 _hb_glyph_info_is_zwj (const hb_glyph_info_t *info) |
| 93 { | 238 { |
| 94 return !!(info->unicode_props0() & 0x20); | 239 return !!(info->unicode_props0() & MASK0_ZWJ); |
| 95 } | 240 } |
| 96 | 241 |
| 242 inline void |
| 243 _hb_glyph_info_flip_joiners (hb_glyph_info_t *info) |
| 244 { |
| 245 info->unicode_props0() ^= MASK0_ZWNJ | MASK0_ZWJ; |
| 246 } |
| 97 | 247 |
| 98 #define hb_ot_layout_from_face(face) ((hb_ot_layout_t *) face->shaper_data.ot) | 248 /* lig_props: aka lig_id / lig_comp |
| 99 | |
| 100 /* | |
| 101 * GDEF | |
| 102 */ | |
| 103 | |
| 104 typedef enum { | |
| 105 HB_OT_LAYOUT_GLYPH_PROPS_UNCLASSIFIED»= 1 << HB_OT_LAYOUT_GLYPH_CLASS_UNCLASSI
FIED, | |
| 106 HB_OT_LAYOUT_GLYPH_PROPS_BASE_GLYPH» = 1 << HB_OT_LAYOUT_GLYPH_CLASS_BASE_GLY
PH, | |
| 107 HB_OT_LAYOUT_GLYPH_PROPS_LIGATURE» = 1 << HB_OT_LAYOUT_GLYPH_CLASS_LIGATURE
, | |
| 108 HB_OT_LAYOUT_GLYPH_PROPS_MARK»» = 1 << HB_OT_LAYOUT_GLYPH_CLASS_MARK, | |
| 109 HB_OT_LAYOUT_GLYPH_PROPS_COMPONENT» = 1 << HB_OT_LAYOUT_GLYPH_CLASS_COMPONEN
T | |
| 110 } hb_ot_layout_glyph_class_mask_t; | |
| 111 | |
| 112 | |
| 113 | |
| 114 /* | |
| 115 * GSUB/GPOS | |
| 116 */ | |
| 117 | |
| 118 /* lig_id / lig_comp | |
| 119 * | 249 * |
| 120 * When a ligature is formed: | 250 * When a ligature is formed: |
| 121 * | 251 * |
| 122 * - The ligature glyph and any marks in between all the same newly allocated | 252 * - The ligature glyph and any marks in between all the same newly allocated |
| 123 * lig_id, | 253 * lig_id, |
| 124 * - The ligature glyph will get lig_num_comps set to the number of components | 254 * - The ligature glyph will get lig_num_comps set to the number of components |
| 125 * - The marks get lig_comp > 0, reflecting which component of the ligature | 255 * - The marks get lig_comp > 0, reflecting which component of the ligature |
| 126 * they were applied to. | 256 * they were applied to. |
| 127 * - This is used in GPOS to attach marks to the right component of a ligature | 257 * - This is used in GPOS to attach marks to the right component of a ligature |
| 128 * in MarkLigPos. | 258 * in MarkLigPos, |
| 259 * - Note that when marks are ligated together, much of the above is skipped |
| 260 * and the current lig_id reused. |
| 129 * | 261 * |
| 130 * When a multiple-substitution is done: | 262 * When a multiple-substitution is done: |
| 131 * | 263 * |
| 132 * - All resulting glyphs will have lig_id = 0, | 264 * - All resulting glyphs will have lig_id = 0, |
| 133 * - The resulting glyphs will have lig_comp = 0, 1, 2, ... respectively. | 265 * - The resulting glyphs will have lig_comp = 0, 1, 2, ... respectively. |
| 134 * - This is used in GPOS to attach marks to the first component of a | 266 * - This is used in GPOS to attach marks to the first component of a |
| 135 * multiple substitution in MarkBasePos. | 267 * multiple substitution in MarkBasePos. |
| 136 * | 268 * |
| 137 * The numbers are also used in GPOS to do mark-to-mark positioning only | 269 * The numbers are also used in GPOS to do mark-to-mark positioning only |
| 138 * to marks that belong to the same component of a ligature in MarkMarPos. | 270 * to marks that belong to the same component of the same ligature. |
| 139 */ | 271 */ |
| 272 |
| 273 static inline void |
| 274 _hb_glyph_info_clear_lig_props (hb_glyph_info_t *info) |
| 275 { |
| 276 info->lig_props() = 0; |
| 277 } |
| 278 |
| 140 #define IS_LIG_BASE 0x10 | 279 #define IS_LIG_BASE 0x10 |
| 280 |
| 141 static inline void | 281 static inline void |
| 142 set_lig_props_for_ligature (hb_glyph_info_t &info, unsigned int lig_id, unsigned
int lig_num_comps) | 282 _hb_glyph_info_set_lig_props_for_ligature (hb_glyph_info_t *info, |
| 283 » » » » » unsigned int lig_id, |
| 284 » » » » » unsigned int lig_num_comps) |
| 143 { | 285 { |
| 144 info.lig_props() = (lig_id << 5) | IS_LIG_BASE | (lig_num_comps & 0x0F); | 286 info->lig_props() = (lig_id << 5) | IS_LIG_BASE | (lig_num_comps & 0x0F); |
| 145 } | 287 } |
| 288 |
| 146 static inline void | 289 static inline void |
| 147 set_lig_props_for_mark (hb_glyph_info_t &info, unsigned int lig_id, unsigned int
lig_comp) | 290 _hb_glyph_info_set_lig_props_for_mark (hb_glyph_info_t *info, |
| 291 » » » » unsigned int lig_id, |
| 292 » » » » unsigned int lig_comp) |
| 148 { | 293 { |
| 149 info.lig_props() = (lig_id << 5) | (lig_comp & 0x0F); | 294 info->lig_props() = (lig_id << 5) | (lig_comp & 0x0F); |
| 150 } | 295 } |
| 296 |
| 151 static inline void | 297 static inline void |
| 152 set_lig_props_for_component (hb_glyph_info_t &info, unsigned int comp) | 298 _hb_glyph_info_set_lig_props_for_component (hb_glyph_info_t *info, unsigned int
comp) |
| 153 { | 299 { |
| 154 set_lig_props_for_mark (info, 0, comp); | 300 _hb_glyph_info_set_lig_props_for_mark (info, 0, comp); |
| 155 } | 301 } |
| 156 | 302 |
| 157 static inline unsigned int | 303 static inline unsigned int |
| 158 get_lig_id (const hb_glyph_info_t &info) | 304 _hb_glyph_info_get_lig_id (const hb_glyph_info_t *info) |
| 159 { | 305 { |
| 160 return info.lig_props() >> 5; | 306 return info->lig_props() >> 5; |
| 161 } | 307 } |
| 308 |
| 162 static inline bool | 309 static inline bool |
| 163 is_a_ligature (const hb_glyph_info_t &info) | 310 _hb_glyph_info_ligated_internal (const hb_glyph_info_t *info) |
| 164 { | 311 { |
| 165 return !!(info.lig_props() & IS_LIG_BASE); | 312 return !!(info->lig_props() & IS_LIG_BASE); |
| 166 } | 313 } |
| 314 |
| 167 static inline unsigned int | 315 static inline unsigned int |
| 168 get_lig_comp (const hb_glyph_info_t &info) | 316 _hb_glyph_info_get_lig_comp (const hb_glyph_info_t *info) |
| 169 { | 317 { |
| 170 if (is_a_ligature (info)) | 318 if (_hb_glyph_info_ligated_internal (info)) |
| 171 return 0; | 319 return 0; |
| 172 else | 320 else |
| 173 return info.lig_props() & 0x0F; | 321 return info->lig_props() & 0x0F; |
| 174 } | 322 } |
| 323 |
| 175 static inline unsigned int | 324 static inline unsigned int |
| 176 get_lig_num_comps (const hb_glyph_info_t &info) | 325 _hb_glyph_info_get_lig_num_comps (const hb_glyph_info_t *info) |
| 177 { | 326 { |
| 178 if ((info.glyph_props() & HB_OT_LAYOUT_GLYPH_PROPS_LIGATURE) && is_a_ligature
(info)) | 327 if ((info->glyph_props() & HB_OT_LAYOUT_GLYPH_PROPS_LIGATURE) && |
| 179 return info.lig_props() & 0x0F; | 328 _hb_glyph_info_ligated_internal (info)) |
| 329 return info->lig_props() & 0x0F; |
| 180 else | 330 else |
| 181 return 1; | 331 return 1; |
| 182 } | 332 } |
| 183 | 333 |
| 184 static inline uint8_t allocate_lig_id (hb_buffer_t *buffer) { | 334 static inline uint8_t |
| 335 _hb_allocate_lig_id (hb_buffer_t *buffer) { |
| 185 uint8_t lig_id = buffer->next_serial () & 0x07; | 336 uint8_t lig_id = buffer->next_serial () & 0x07; |
| 186 if (unlikely (!lig_id)) | 337 if (unlikely (!lig_id)) |
| 187 lig_id = allocate_lig_id (buffer); /* in case of overflow */ | 338 lig_id = _hb_allocate_lig_id (buffer); /* in case of overflow */ |
| 188 return lig_id; | 339 return lig_id; |
| 189 } | 340 } |
| 190 | 341 |
| 342 /* glyph_props: */ |
| 191 | 343 |
| 192 HB_INTERNAL hb_bool_t | 344 inline void |
| 193 hb_ot_layout_lookup_would_substitute_fast (hb_face_t *face, | 345 _hb_glyph_info_set_glyph_props (hb_glyph_info_t *info, unsigned int props) |
| 194 » » » » » unsigned int lookup_index, | 346 { |
| 195 » » » » » const hb_codepoint_t *glyphs, | 347 info->glyph_props() = props; |
| 196 » » » » » unsigned int glyphs_length, | |
| 197 » » » » » hb_bool_t zero_context); | |
| 198 | |
| 199 | |
| 200 /* Should be called before all the substitute_lookup's are done. */ | |
| 201 HB_INTERNAL void | |
| 202 hb_ot_layout_substitute_start (hb_font_t *font, | |
| 203 » » » hb_buffer_t *buffer); | |
| 204 | |
| 205 HB_INTERNAL hb_bool_t | |
| 206 hb_ot_layout_substitute_lookup (hb_font_t *font, | |
| 207 » » » » hb_buffer_t *buffer, | |
| 208 » » » » unsigned int lookup_index, | |
| 209 » » » » hb_mask_t mask, | |
| 210 » » » » hb_bool_t auto_zwj); | |
| 211 | |
| 212 /* Should be called after all the substitute_lookup's are done */ | |
| 213 HB_INTERNAL void | |
| 214 hb_ot_layout_substitute_finish (hb_font_t *font, | |
| 215 » » » » hb_buffer_t *buffer); | |
| 216 | |
| 217 | |
| 218 /* Should be called before all the position_lookup's are done. Resets positions
to zero. */ | |
| 219 HB_INTERNAL void | |
| 220 hb_ot_layout_position_start (hb_font_t *font, | |
| 221 » » » hb_buffer_t *buffer); | |
| 222 | |
| 223 HB_INTERNAL hb_bool_t | |
| 224 hb_ot_layout_position_lookup (hb_font_t *font, | |
| 225 » » » hb_buffer_t *buffer, | |
| 226 » » » unsigned int lookup_index, | |
| 227 » » » hb_mask_t mask, | |
| 228 » » » hb_bool_t auto_zwj); | |
| 229 | |
| 230 /* Should be called after all the position_lookup's are done */ | |
| 231 HB_INTERNAL void | |
| 232 hb_ot_layout_position_finish (hb_font_t *font, | |
| 233 » » » hb_buffer_t *buffer); | |
| 234 | |
| 235 | |
| 236 | |
| 237 /* | |
| 238 * hb_ot_layout_t | |
| 239 */ | |
| 240 | |
| 241 namespace OT { | |
| 242 struct GDEF; | |
| 243 struct GSUB; | |
| 244 struct GPOS; | |
| 245 } | 348 } |
| 246 | 349 |
| 247 struct hb_ot_layout_t | 350 inline unsigned int |
| 351 _hb_glyph_info_get_glyph_props (const hb_glyph_info_t *info) |
| 248 { | 352 { |
| 249 hb_blob_t *gdef_blob; | 353 return info->glyph_props(); |
| 250 hb_blob_t *gsub_blob; | 354 } |
| 251 hb_blob_t *gpos_blob; | |
| 252 | 355 |
| 253 const struct OT::GDEF *gdef; | 356 inline bool |
| 254 const struct OT::GSUB *gsub; | 357 _hb_glyph_info_is_base_glyph (const hb_glyph_info_t *info) |
| 255 const struct OT::GPOS *gpos; | 358 { |
| 359 return !!(info->glyph_props() & HB_OT_LAYOUT_GLYPH_PROPS_BASE_GLYPH); |
| 360 } |
| 256 | 361 |
| 257 unsigned int gsub_lookup_count; | 362 inline bool |
| 258 unsigned int gpos_lookup_count; | 363 _hb_glyph_info_is_ligature (const hb_glyph_info_t *info) |
| 364 { |
| 365 return !!(info->glyph_props() & HB_OT_LAYOUT_GLYPH_PROPS_LIGATURE); |
| 366 } |
| 259 | 367 |
| 260 hb_set_digest_t *gsub_digests; | 368 inline bool |
| 261 hb_set_digest_t *gpos_digests; | 369 _hb_glyph_info_is_mark (const hb_glyph_info_t *info) |
| 262 }; | 370 { |
| 371 return !!(info->glyph_props() & HB_OT_LAYOUT_GLYPH_PROPS_MARK); |
| 372 } |
| 263 | 373 |
| 374 static inline bool |
| 375 _hb_glyph_info_substituted (const hb_glyph_info_t *info) |
| 376 { |
| 377 return !!(info->glyph_props() & HB_OT_LAYOUT_GLYPH_PROPS_SUBSTITUTED); |
| 378 } |
| 264 | 379 |
| 265 HB_INTERNAL hb_ot_layout_t * | 380 static inline bool |
| 266 _hb_ot_layout_create (hb_face_t *face); | 381 _hb_glyph_info_ligated (const hb_glyph_info_t *info) |
| 382 { |
| 383 return !!(info->glyph_props() & HB_OT_LAYOUT_GLYPH_PROPS_LIGATED); |
| 384 } |
| 267 | 385 |
| 268 HB_INTERNAL void | 386 /* Allocation / deallocation. */ |
| 269 _hb_ot_layout_destroy (hb_ot_layout_t *layout); | |
| 270 | 387 |
| 388 inline void |
| 389 _hb_buffer_allocate_unicode_vars (hb_buffer_t *buffer) |
| 390 { |
| 391 HB_BUFFER_ALLOCATE_VAR (buffer, unicode_props0); |
| 392 HB_BUFFER_ALLOCATE_VAR (buffer, unicode_props1); |
| 393 } |
| 394 |
| 395 inline void |
| 396 _hb_buffer_deallocate_unicode_vars (hb_buffer_t *buffer) |
| 397 { |
| 398 HB_BUFFER_DEALLOCATE_VAR (buffer, unicode_props0); |
| 399 HB_BUFFER_DEALLOCATE_VAR (buffer, unicode_props1); |
| 400 } |
| 401 |
| 402 inline void |
| 403 _hb_buffer_allocate_gsubgpos_vars (hb_buffer_t *buffer) |
| 404 { |
| 405 HB_BUFFER_ALLOCATE_VAR (buffer, glyph_props); |
| 406 HB_BUFFER_ALLOCATE_VAR (buffer, lig_props); |
| 407 HB_BUFFER_ALLOCATE_VAR (buffer, syllable); |
| 408 } |
| 409 |
| 410 inline void |
| 411 _hb_buffer_deallocate_gsubgpos_vars (hb_buffer_t *buffer) |
| 412 { |
| 413 HB_BUFFER_DEALLOCATE_VAR (buffer, syllable); |
| 414 HB_BUFFER_DEALLOCATE_VAR (buffer, lig_props); |
| 415 HB_BUFFER_DEALLOCATE_VAR (buffer, glyph_props); |
| 416 } |
| 417 |
| 418 /* Make sure no one directly touches our props... */ |
| 419 #undef unicode_props0 |
| 420 #undef unicode_props1 |
| 421 #undef lig_props |
| 422 #undef glyph_props |
| 271 | 423 |
| 272 | 424 |
| 273 #endif /* HB_OT_LAYOUT_PRIVATE_HH */ | 425 #endif /* HB_OT_LAYOUT_PRIVATE_HH */ |
| OLD | NEW |