| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright © 2007,2008,2009 Red Hat, Inc. | 2 * Copyright © 2007,2008,2009 Red Hat, Inc. |
| 3 * Copyright © 2012,2013 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 |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 struct hb_apply_context_t; | 92 struct hb_apply_context_t; |
| 93 struct SubstLookup; | 93 struct SubstLookup; |
| 94 } | 94 } |
| 95 | 95 |
| 96 HB_INTERNAL void | 96 HB_INTERNAL void |
| 97 hb_ot_layout_substitute_lookup (OT::hb_apply_context_t *c, | 97 hb_ot_layout_substitute_lookup (OT::hb_apply_context_t *c, |
| 98 const OT::SubstLookup &lookup, | 98 const OT::SubstLookup &lookup, |
| 99 const hb_ot_layout_lookup_accelerator_t &accel); | 99 const hb_ot_layout_lookup_accelerator_t &accel); |
| 100 | 100 |
| 101 | 101 |
| 102 /* Should be called after all the substitute_lookup's are done */ | 102 /* Should be called before all the position_lookup's are done. */ |
| 103 HB_INTERNAL void | |
| 104 hb_ot_layout_substitute_finish (hb_font_t *font, | |
| 105 » » » » hb_buffer_t *buffer); | |
| 106 | |
| 107 | |
| 108 /* Should be called before all the position_lookup's are done. Resets positions
to zero. */ | |
| 109 HB_INTERNAL void | 103 HB_INTERNAL void |
| 110 hb_ot_layout_position_start (hb_font_t *font, | 104 hb_ot_layout_position_start (hb_font_t *font, |
| 111 hb_buffer_t *buffer); | 105 hb_buffer_t *buffer); |
| 112 | 106 |
| 113 /* Should be called after all the position_lookup's are done */ | 107 /* Should be called after all the position_lookup's are done, to finish advances
. */ |
| 114 HB_INTERNAL void | 108 HB_INTERNAL void |
| 115 hb_ot_layout_position_finish (hb_font_t *font, | 109 hb_ot_layout_position_finish_advances (hb_font_t *font, |
| 116 » » » hb_buffer_t *buffer); | 110 » » » » hb_buffer_t *buffer); |
| 111 |
| 112 /* Should be called after hb_ot_layout_position_finish_advances, to finish offse
ts. */ |
| 113 HB_INTERNAL void |
| 114 hb_ot_layout_position_finish_offsets (hb_font_t *font, |
| 115 » » » » hb_buffer_t *buffer); |
| 117 | 116 |
| 118 | 117 |
| 119 | 118 |
| 120 /* | 119 /* |
| 121 * hb_ot_layout_t | 120 * hb_ot_layout_t |
| 122 */ | 121 */ |
| 123 | 122 |
| 124 namespace OT { | 123 namespace OT { |
| 125 struct GDEF; | 124 struct GDEF; |
| 126 struct GSUB; | 125 struct GSUB; |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 250 if (u >= 0x80) | 249 if (u >= 0x80) |
| 251 { | 250 { |
| 252 buffer->scratch_flags |= HB_BUFFER_SCRATCH_FLAG_HAS_NON_ASCII; | 251 buffer->scratch_flags |= HB_BUFFER_SCRATCH_FLAG_HAS_NON_ASCII; |
| 253 if (unlikely (unicode->is_default_ignorable (u))) | 252 if (unlikely (unicode->is_default_ignorable (u))) |
| 254 { | 253 { |
| 255 buffer->scratch_flags |= HB_BUFFER_SCRATCH_FLAG_HAS_DEFAULT_IGNORABLES; | 254 buffer->scratch_flags |= HB_BUFFER_SCRATCH_FLAG_HAS_DEFAULT_IGNORABLES; |
| 256 props |= UPROPS_MASK_IGNORABLE; | 255 props |= UPROPS_MASK_IGNORABLE; |
| 257 if (u == 0x200Cu) props |= UPROPS_MASK_ZWNJ; | 256 if (u == 0x200Cu) props |= UPROPS_MASK_ZWNJ; |
| 258 if (u == 0x200Du) props |= UPROPS_MASK_ZWJ; | 257 if (u == 0x200Du) props |= UPROPS_MASK_ZWJ; |
| 259 } | 258 } |
| 260 else if (unlikely (HB_UNICODE_GENERAL_CATEGORY_IS_NON_ENCLOSING_MARK (gen_ca
t))) | 259 else if (unlikely (HB_UNICODE_GENERAL_CATEGORY_IS_NON_ENCLOSING_MARK_OR_MODI
FIER_SYMBOL (gen_cat))) |
| 261 { | 260 { |
| 261 /* The above check is just an optimization to let in only things we need f
urther |
| 262 * processing on. */ |
| 263 |
| 262 /* Only Mn and Mc can have non-zero ccc: | 264 /* Only Mn and Mc can have non-zero ccc: |
| 263 * http://www.unicode.org/policies/stability_policy.html#Property_Value | 265 * http://www.unicode.org/policies/stability_policy.html#Property_Value |
| 264 * """ | 266 * """ |
| 265 * Canonical_Combining_Class, General_Category | 267 * Canonical_Combining_Class, General_Category |
| 266 * All characters other than those with General_Category property values | 268 * All characters other than those with General_Category property values |
| 267 * Spacing_Mark (Mc) and Nonspacing_Mark (Mn) have the Canonical_Combining
_Class | 269 * Spacing_Mark (Mc) and Nonspacing_Mark (Mn) have the Canonical_Combining
_Class |
| 268 * property value 0. | 270 * property value 0. |
| 269 * 1.1.5+ | 271 * 1.1.5+ |
| 270 * """ | 272 * """ |
| 271 * | 273 * |
| 272 * Also, all Mn's that are Default_Ignorable, have ccc=0, hence | 274 * Also, all Mn's that are Default_Ignorable, have ccc=0, hence |
| 273 * the "else if". | 275 * the "else if". |
| 274 */ | 276 */ |
| 275 props |= unicode->modified_combining_class (info->codepoint)<<8; | 277 props |= unicode->modified_combining_class (info->codepoint)<<8; |
| 278 |
| 279 /* Recategorize emoji skin-tone modifiers as Unicode mark, so they |
| 280 * behave correctly in non-native directionality. They originally |
| 281 * are MODIFIER_SYMBOL. Fixes: |
| 282 * https://github.com/behdad/harfbuzz/issues/169 |
| 283 */ |
| 284 if (unlikely (hb_in_range (u, 0x1F3FBu, 0x1F3FFu))) |
| 285 { |
| 286 props = gen_cat = HB_UNICODE_GENERAL_CATEGORY_ENCLOSING_MARK; |
| 287 } |
| 276 } | 288 } |
| 277 } | 289 } |
| 278 | 290 |
| 279 info->unicode_props() = props; | 291 info->unicode_props() = props; |
| 280 } | 292 } |
| 281 | 293 |
| 282 static inline void | 294 static inline void |
| 283 _hb_glyph_info_set_general_category (hb_glyph_info_t *info, | 295 _hb_glyph_info_set_general_category (hb_glyph_info_t *info, |
| 284 hb_unicode_general_category_t gen_cat) | 296 hb_unicode_general_category_t gen_cat) |
| 285 { | 297 { |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 346 { | 358 { |
| 347 return !!(info->unicode_props() & UPROPS_MASK_ZWNJ); | 359 return !!(info->unicode_props() & UPROPS_MASK_ZWNJ); |
| 348 } | 360 } |
| 349 | 361 |
| 350 static inline hb_bool_t | 362 static inline hb_bool_t |
| 351 _hb_glyph_info_is_zwj (const hb_glyph_info_t *info) | 363 _hb_glyph_info_is_zwj (const hb_glyph_info_t *info) |
| 352 { | 364 { |
| 353 return !!(info->unicode_props() & UPROPS_MASK_ZWJ); | 365 return !!(info->unicode_props() & UPROPS_MASK_ZWJ); |
| 354 } | 366 } |
| 355 | 367 |
| 368 static inline hb_bool_t |
| 369 _hb_glyph_info_is_joiner (const hb_glyph_info_t *info) |
| 370 { |
| 371 return !!(info->unicode_props() & (UPROPS_MASK_ZWNJ | UPROPS_MASK_ZWJ)); |
| 372 } |
| 373 |
| 356 static inline void | 374 static inline void |
| 357 _hb_glyph_info_flip_joiners (hb_glyph_info_t *info) | 375 _hb_glyph_info_flip_joiners (hb_glyph_info_t *info) |
| 358 { | 376 { |
| 359 info->unicode_props() ^= UPROPS_MASK_ZWNJ | UPROPS_MASK_ZWJ; | 377 info->unicode_props() ^= UPROPS_MASK_ZWNJ | UPROPS_MASK_ZWJ; |
| 360 } | 378 } |
| 361 | 379 |
| 362 /* lig_props: aka lig_id / lig_comp | 380 /* lig_props: aka lig_id / lig_comp |
| 363 * | 381 * |
| 364 * When a ligature is formed: | 382 * When a ligature is formed: |
| 365 * | 383 * |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 568 } | 586 } |
| 569 | 587 |
| 570 /* Make sure no one directly touches our props... */ | 588 /* Make sure no one directly touches our props... */ |
| 571 #undef unicode_props0 | 589 #undef unicode_props0 |
| 572 #undef unicode_props1 | 590 #undef unicode_props1 |
| 573 #undef lig_props | 591 #undef lig_props |
| 574 #undef glyph_props | 592 #undef glyph_props |
| 575 | 593 |
| 576 | 594 |
| 577 #endif /* HB_OT_LAYOUT_PRIVATE_HH */ | 595 #endif /* HB_OT_LAYOUT_PRIVATE_HH */ |
| OLD | NEW |