| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright © 2007,2008,2009,2010 Red Hat, Inc. | 2 * Copyright © 2007,2008,2009,2010 Red Hat, Inc. |
| 3 * Copyright © 2010,2012,2013 Google, Inc. | 3 * Copyright © 2010,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 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 419 | 419 |
| 420 hb_position_t mark_x, mark_y, base_x, base_y; | 420 hb_position_t mark_x, mark_y, base_x, base_y; |
| 421 | 421 |
| 422 mark_anchor.get_anchor (c->font, buffer->cur().codepoint, &mark_x, &mark_y); | 422 mark_anchor.get_anchor (c->font, buffer->cur().codepoint, &mark_x, &mark_y); |
| 423 glyph_anchor.get_anchor (c->font, buffer->info[glyph_pos].codepoint, &base_x
, &base_y); | 423 glyph_anchor.get_anchor (c->font, buffer->info[glyph_pos].codepoint, &base_x
, &base_y); |
| 424 | 424 |
| 425 hb_glyph_position_t &o = buffer->cur_pos(); | 425 hb_glyph_position_t &o = buffer->cur_pos(); |
| 426 o.x_offset = base_x - mark_x; | 426 o.x_offset = base_x - mark_x; |
| 427 o.y_offset = base_y - mark_y; | 427 o.y_offset = base_y - mark_y; |
| 428 o.attach_lookback() = buffer->idx - glyph_pos; | 428 o.attach_lookback() = buffer->idx - glyph_pos; |
| 429 buffer->scratch_flags |= HB_BUFFER_SCRATCH_FLAG_HAS_GPOS_ATTACHMENT; |
| 429 | 430 |
| 430 buffer->idx++; | 431 buffer->idx++; |
| 431 return_trace (true); | 432 return_trace (true); |
| 432 } | 433 } |
| 433 | 434 |
| 434 inline bool sanitize (hb_sanitize_context_t *c) const | 435 inline bool sanitize (hb_sanitize_context_t *c) const |
| 435 { | 436 { |
| 436 TRACE_SANITIZE (this); | 437 TRACE_SANITIZE (this); |
| 437 return_trace (ArrayOf<MarkRecord>::sanitize (c, this)); | 438 return_trace (ArrayOf<MarkRecord>::sanitize (c, this)); |
| 438 } | 439 } |
| (...skipping 547 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 986 } | 987 } |
| 987 | 988 |
| 988 /* If child was already connected to someone else, walk through its old | 989 /* If child was already connected to someone else, walk through its old |
| 989 * chain and reverse the link direction, such that the whole tree of its | 990 * chain and reverse the link direction, such that the whole tree of its |
| 990 * previous connection now attaches to new parent. Watch out for case | 991 * previous connection now attaches to new parent. Watch out for case |
| 991 * where new parent is on the path from old chain... | 992 * where new parent is on the path from old chain... |
| 992 */ | 993 */ |
| 993 reverse_cursive_minor_offset (pos, child, c->direction, parent); | 994 reverse_cursive_minor_offset (pos, child, c->direction, parent); |
| 994 | 995 |
| 995 pos[child].cursive_chain() = parent - child; | 996 pos[child].cursive_chain() = parent - child; |
| 997 buffer->scratch_flags |= HB_BUFFER_SCRATCH_FLAG_HAS_GPOS_CURSIVE; |
| 996 if (likely (HB_DIRECTION_IS_HORIZONTAL (c->direction))) | 998 if (likely (HB_DIRECTION_IS_HORIZONTAL (c->direction))) |
| 997 pos[child].y_offset = y_offset; | 999 pos[child].y_offset = y_offset; |
| 998 else | 1000 else |
| 999 pos[child].x_offset = x_offset; | 1001 pos[child].x_offset = x_offset; |
| 1000 | 1002 |
| 1001 buffer->idx = j; | 1003 buffer->idx = j; |
| 1002 return_trace (true); | 1004 return_trace (true); |
| 1003 } | 1005 } |
| 1004 | 1006 |
| 1005 inline bool sanitize (hb_sanitize_context_t *c) const | 1007 inline bool sanitize (hb_sanitize_context_t *c) const |
| (...skipping 586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1592 void | 1594 void |
| 1593 GPOS::position_finish (hb_font_t *font HB_UNUSED, hb_buffer_t *buffer) | 1595 GPOS::position_finish (hb_font_t *font HB_UNUSED, hb_buffer_t *buffer) |
| 1594 { | 1596 { |
| 1595 _hb_buffer_assert_gsubgpos_vars (buffer); | 1597 _hb_buffer_assert_gsubgpos_vars (buffer); |
| 1596 | 1598 |
| 1597 unsigned int len; | 1599 unsigned int len; |
| 1598 hb_glyph_position_t *pos = hb_buffer_get_glyph_positions (buffer, &len); | 1600 hb_glyph_position_t *pos = hb_buffer_get_glyph_positions (buffer, &len); |
| 1599 hb_direction_t direction = buffer->props.direction; | 1601 hb_direction_t direction = buffer->props.direction; |
| 1600 | 1602 |
| 1601 /* Handle cursive connections */ | 1603 /* Handle cursive connections */ |
| 1602 for (unsigned int i = 0; i < len; i++) | 1604 if (buffer->scratch_flags & HB_BUFFER_SCRATCH_FLAG_HAS_GPOS_CURSIVE) |
| 1603 fix_cursive_minor_offset (pos, i, direction); | 1605 for (unsigned int i = 0; i < len; i++) |
| 1606 fix_cursive_minor_offset (pos, i, direction); |
| 1604 | 1607 |
| 1605 /* Handle attachments */ | 1608 /* Handle attachments */ |
| 1606 for (unsigned int i = 0; i < len; i++) | 1609 if (buffer->scratch_flags & HB_BUFFER_SCRATCH_FLAG_HAS_GPOS_ATTACHMENT) |
| 1607 fix_mark_attachment (pos, i, direction); | 1610 for (unsigned int i = 0; i < len; i++) |
| 1611 fix_mark_attachment (pos, i, direction); |
| 1608 } | 1612 } |
| 1609 | 1613 |
| 1610 | 1614 |
| 1611 /* Out-of-class implementation for methods recursing */ | 1615 /* Out-of-class implementation for methods recursing */ |
| 1612 | 1616 |
| 1613 template <typename context_t> | 1617 template <typename context_t> |
| 1614 /*static*/ inline typename context_t::return_t PosLookup::dispatch_recurse_func
(context_t *c, unsigned int lookup_index) | 1618 /*static*/ inline typename context_t::return_t PosLookup::dispatch_recurse_func
(context_t *c, unsigned int lookup_index) |
| 1615 { | 1619 { |
| 1616 const GPOS &gpos = *(hb_ot_layout_from_face (c->face)->gpos); | 1620 const GPOS &gpos = *(hb_ot_layout_from_face (c->face)->gpos); |
| 1617 const PosLookup &l = gpos.get_lookup (lookup_index); | 1621 const PosLookup &l = gpos.get_lookup (lookup_index); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 1634 | 1638 |
| 1635 | 1639 |
| 1636 #undef attach_lookback | 1640 #undef attach_lookback |
| 1637 #undef cursive_chain | 1641 #undef cursive_chain |
| 1638 | 1642 |
| 1639 | 1643 |
| 1640 } /* namespace OT */ | 1644 } /* namespace OT */ |
| 1641 | 1645 |
| 1642 | 1646 |
| 1643 #endif /* HB_OT_LAYOUT_GPOS_TABLE_HH */ | 1647 #endif /* HB_OT_LAYOUT_GPOS_TABLE_HH */ |
| OLD | NEW |