| Index: third_party/harfbuzz-ng/src/hb-ot-layout-gpos-table.hh
|
| ===================================================================
|
| --- third_party/harfbuzz-ng/src/hb-ot-layout-gpos-table.hh (리비전 189447)
|
| +++ third_party/harfbuzz-ng/src/hb-ot-layout-gpos-table.hh (작업 사본)
|
| @@ -336,8 +336,10 @@
|
|
|
| struct AnchorMatrix
|
| {
|
| - inline const Anchor& get_anchor (unsigned int row, unsigned int col, unsigned int cols) const {
|
| + inline const Anchor& get_anchor (unsigned int row, unsigned int col, unsigned int cols, bool *found) const {
|
| + *found = false;
|
| if (unlikely (row >= rows || col >= cols)) return Null(Anchor);
|
| + *found = !matrix[row * cols + col].is_null ();
|
| return this+matrix[row * cols + col];
|
| }
|
|
|
| @@ -392,7 +394,11 @@
|
| unsigned int mark_class = record.klass;
|
|
|
| const Anchor& mark_anchor = this + record.markAnchor;
|
| - const Anchor& glyph_anchor = anchors.get_anchor (glyph_index, mark_class, class_count);
|
| + bool found;
|
| + const Anchor& glyph_anchor = anchors.get_anchor (glyph_index, mark_class, class_count, &found);
|
| + /* If this subtable doesn't have an anchor for this base and this class,
|
| + * return false such that the subsequent subtables have a chance at it. */
|
| + if (unlikely (!found)) return TRACE_RETURN (false);
|
|
|
| hb_position_t mark_x, mark_y, base_x, base_y;
|
|
|
| @@ -513,12 +519,12 @@
|
| struct SinglePos
|
| {
|
| template <typename context_t>
|
| - inline typename context_t::return_t process (context_t *c) const
|
| + inline typename context_t::return_t dispatch (context_t *c) const
|
| {
|
| - TRACE_PROCESS (this);
|
| + TRACE_DISPATCH (this);
|
| switch (u.format) {
|
| - case 1: return TRACE_RETURN (c->process (u.format1));
|
| - case 2: return TRACE_RETURN (c->process (u.format2));
|
| + case 1: return TRACE_RETURN (c->dispatch (u.format1));
|
| + case 2: return TRACE_RETURN (c->dispatch (u.format2));
|
| default:return TRACE_RETURN (c->default_return_value ());
|
| }
|
| }
|
| @@ -590,6 +596,7 @@
|
| unsigned int count = len;
|
| for (unsigned int i = 0; i < count; i++)
|
| {
|
| + /* TODO bsearch */
|
| if (c->buffer->info[pos].codepoint == record->secondGlyph)
|
| {
|
| valueFormats[0].apply_value (c->font, c->direction, this,
|
| @@ -652,7 +659,7 @@
|
| inline bool apply (hb_apply_context_t *c) const
|
| {
|
| TRACE_APPLY (this);
|
| - hb_apply_context_t::mark_skipping_forward_iterator_t skippy_iter (c, c->buffer->idx, 1);
|
| + hb_apply_context_t::skipping_forward_iterator_t skippy_iter (c, c->buffer->idx, 1);
|
| if (skippy_iter.has_no_chance ()) return TRACE_RETURN (false);
|
|
|
| unsigned int index = (this+coverage).get_coverage (c->buffer->cur().codepoint);
|
| @@ -724,7 +731,7 @@
|
| inline bool apply (hb_apply_context_t *c) const
|
| {
|
| TRACE_APPLY (this);
|
| - hb_apply_context_t::mark_skipping_forward_iterator_t skippy_iter (c, c->buffer->idx, 1);
|
| + hb_apply_context_t::skipping_forward_iterator_t skippy_iter (c, c->buffer->idx, 1);
|
| if (skippy_iter.has_no_chance ()) return TRACE_RETURN (false);
|
|
|
| unsigned int index = (this+coverage).get_coverage (c->buffer->cur().codepoint);
|
| @@ -803,12 +810,12 @@
|
| struct PairPos
|
| {
|
| template <typename context_t>
|
| - inline typename context_t::return_t process (context_t *c) const
|
| + inline typename context_t::return_t dispatch (context_t *c) const
|
| {
|
| - TRACE_PROCESS (this);
|
| + TRACE_DISPATCH (this);
|
| switch (u.format) {
|
| - case 1: return TRACE_RETURN (c->process (u.format1));
|
| - case 2: return TRACE_RETURN (c->process (u.format2));
|
| + case 1: return TRACE_RETURN (c->dispatch (u.format1));
|
| + case 2: return TRACE_RETURN (c->dispatch (u.format2));
|
| default:return TRACE_RETURN (c->default_return_value ());
|
| }
|
| }
|
| @@ -872,9 +879,9 @@
|
| TRACE_APPLY (this);
|
|
|
| /* We don't handle mark glyphs here. */
|
| - if (c->property & HB_OT_LAYOUT_GLYPH_PROPS_MARK) return TRACE_RETURN (false);
|
| + if (c->buffer->cur().glyph_props() & HB_OT_LAYOUT_GLYPH_PROPS_MARK) return TRACE_RETURN (false);
|
|
|
| - hb_apply_context_t::mark_skipping_forward_iterator_t skippy_iter (c, c->buffer->idx, 1);
|
| + hb_apply_context_t::skipping_forward_iterator_t skippy_iter (c, c->buffer->idx, 1);
|
| if (skippy_iter.has_no_chance ()) return TRACE_RETURN (false);
|
|
|
| const EntryExitRecord &this_record = entryExitRecord[(this+coverage).get_coverage (c->buffer->cur().codepoint)];
|
| @@ -969,11 +976,11 @@
|
| struct CursivePos
|
| {
|
| template <typename context_t>
|
| - inline typename context_t::return_t process (context_t *c) const
|
| + inline typename context_t::return_t dispatch (context_t *c) const
|
| {
|
| - TRACE_PROCESS (this);
|
| + TRACE_DISPATCH (this);
|
| switch (u.format) {
|
| - case 1: return TRACE_RETURN (c->process (u.format1));
|
| + case 1: return TRACE_RETURN (c->dispatch (u.format1));
|
| default:return TRACE_RETURN (c->default_return_value ());
|
| }
|
| }
|
| @@ -1022,17 +1029,17 @@
|
| if (likely (mark_index == NOT_COVERED)) return TRACE_RETURN (false);
|
|
|
| /* now we search backwards for a non-mark glyph */
|
| - unsigned int property;
|
| - hb_apply_context_t::mark_skipping_backward_iterator_t skippy_iter (c, c->buffer->idx, 1);
|
| + hb_apply_context_t::skipping_backward_iterator_t skippy_iter (c, c->buffer->idx, 1);
|
| + skippy_iter.set_lookup_props (LookupFlag::IgnoreMarks);
|
| do {
|
| - if (!skippy_iter.prev (&property, LookupFlag::IgnoreMarks)) return TRACE_RETURN (false);
|
| + if (!skippy_iter.prev ()) return TRACE_RETURN (false);
|
| /* We only want to attach to the first of a MultipleSubst sequence. Reject others. */
|
| if (0 == get_lig_comp (c->buffer->info[skippy_iter.idx])) break;
|
| skippy_iter.reject ();
|
| } while (1);
|
|
|
| /* The following assertion is too strong, so we've disabled it. */
|
| - if (!(property & HB_OT_LAYOUT_GLYPH_PROPS_BASE_GLYPH)) {/*return TRACE_RETURN (false);*/}
|
| + if (!(c->buffer->info[skippy_iter.idx].glyph_props() & HB_OT_LAYOUT_GLYPH_PROPS_BASE_GLYPH)) {/*return TRACE_RETURN (false);*/}
|
|
|
| unsigned int base_index = (this+baseCoverage).get_coverage (c->buffer->info[skippy_iter.idx].codepoint);
|
| if (base_index == NOT_COVERED) return TRACE_RETURN (false);
|
| @@ -1068,11 +1075,11 @@
|
| struct MarkBasePos
|
| {
|
| template <typename context_t>
|
| - inline typename context_t::return_t process (context_t *c) const
|
| + inline typename context_t::return_t dispatch (context_t *c) const
|
| {
|
| - TRACE_PROCESS (this);
|
| + TRACE_DISPATCH (this);
|
| switch (u.format) {
|
| - case 1: return TRACE_RETURN (c->process (u.format1));
|
| + case 1: return TRACE_RETURN (c->dispatch (u.format1));
|
| default:return TRACE_RETURN (c->default_return_value ());
|
| }
|
| }
|
| @@ -1126,12 +1133,12 @@
|
| if (likely (mark_index == NOT_COVERED)) return TRACE_RETURN (false);
|
|
|
| /* now we search backwards for a non-mark glyph */
|
| - unsigned int property;
|
| - hb_apply_context_t::mark_skipping_backward_iterator_t skippy_iter (c, c->buffer->idx, 1);
|
| - if (!skippy_iter.prev (&property, LookupFlag::IgnoreMarks)) return TRACE_RETURN (false);
|
| + hb_apply_context_t::skipping_backward_iterator_t skippy_iter (c, c->buffer->idx, 1);
|
| + skippy_iter.set_lookup_props (LookupFlag::IgnoreMarks);
|
| + if (!skippy_iter.prev ()) return TRACE_RETURN (false);
|
|
|
| /* The following assertion is too strong, so we've disabled it. */
|
| - if (!(property & HB_OT_LAYOUT_GLYPH_PROPS_LIGATURE)) {/*return TRACE_RETURN (false);*/}
|
| + if (!(c->buffer->info[skippy_iter.idx].glyph_props() & HB_OT_LAYOUT_GLYPH_PROPS_LIGATURE)) {/*return TRACE_RETURN (false);*/}
|
|
|
| unsigned int j = skippy_iter.idx;
|
| unsigned int lig_index = (this+ligatureCoverage).get_coverage (c->buffer->info[j].codepoint);
|
| @@ -1189,11 +1196,11 @@
|
| struct MarkLigPos
|
| {
|
| template <typename context_t>
|
| - inline typename context_t::return_t process (context_t *c) const
|
| + inline typename context_t::return_t dispatch (context_t *c) const
|
| {
|
| - TRACE_PROCESS (this);
|
| + TRACE_DISPATCH (this);
|
| switch (u.format) {
|
| - case 1: return TRACE_RETURN (c->process (u.format1));
|
| + case 1: return TRACE_RETURN (c->dispatch (u.format1));
|
| default:return TRACE_RETURN (c->default_return_value ());
|
| }
|
| }
|
| @@ -1242,11 +1249,11 @@
|
| if (likely (mark1_index == NOT_COVERED)) return TRACE_RETURN (false);
|
|
|
| /* now we search backwards for a suitable mark glyph until a non-mark glyph */
|
| - unsigned int property;
|
| - hb_apply_context_t::mark_skipping_backward_iterator_t skippy_iter (c, c->buffer->idx, 1);
|
| - if (!skippy_iter.prev (&property)) return TRACE_RETURN (false);
|
| + hb_apply_context_t::skipping_backward_iterator_t skippy_iter (c, c->buffer->idx, 1);
|
| + skippy_iter.set_lookup_props (c->lookup_props & ~LookupFlag::IgnoreFlags);
|
| + if (!skippy_iter.prev ()) return TRACE_RETURN (false);
|
|
|
| - if (!(property & HB_OT_LAYOUT_GLYPH_PROPS_MARK)) return TRACE_RETURN (false);
|
| + if (!(c->buffer->info[skippy_iter.idx].glyph_props() & HB_OT_LAYOUT_GLYPH_PROPS_MARK)) { return TRACE_RETURN (false); }
|
|
|
| unsigned int j = skippy_iter.idx;
|
|
|
| @@ -1308,11 +1315,11 @@
|
| struct MarkMarkPos
|
| {
|
| template <typename context_t>
|
| - inline typename context_t::return_t process (context_t *c) const
|
| + inline typename context_t::return_t dispatch (context_t *c) const
|
| {
|
| - TRACE_PROCESS (this);
|
| + TRACE_DISPATCH (this);
|
| switch (u.format) {
|
| - case 1: return TRACE_RETURN (c->process (u.format1));
|
| + case 1: return TRACE_RETURN (c->dispatch (u.format1));
|
| default:return TRACE_RETURN (c->default_return_value ());
|
| }
|
| }
|
| @@ -1367,19 +1374,19 @@
|
| };
|
|
|
| template <typename context_t>
|
| - inline typename context_t::return_t process (context_t *c, unsigned int lookup_type) const
|
| + inline typename context_t::return_t dispatch (context_t *c, unsigned int lookup_type) const
|
| {
|
| - TRACE_PROCESS (this);
|
| + TRACE_DISPATCH (this);
|
| switch (lookup_type) {
|
| - case Single: return TRACE_RETURN (u.single.process (c));
|
| - case Pair: return TRACE_RETURN (u.pair.process (c));
|
| - case Cursive: return TRACE_RETURN (u.cursive.process (c));
|
| - case MarkBase: return TRACE_RETURN (u.markBase.process (c));
|
| - case MarkLig: return TRACE_RETURN (u.markLig.process (c));
|
| - case MarkMark: return TRACE_RETURN (u.markMark.process (c));
|
| - case Context: return TRACE_RETURN (u.context.process (c));
|
| - case ChainContext: return TRACE_RETURN (u.chainContext.process (c));
|
| - case Extension: return TRACE_RETURN (u.extension.process (c));
|
| + case Single: return TRACE_RETURN (u.single.dispatch (c));
|
| + case Pair: return TRACE_RETURN (u.pair.dispatch (c));
|
| + case Cursive: return TRACE_RETURN (u.cursive.dispatch (c));
|
| + case MarkBase: return TRACE_RETURN (u.markBase.dispatch (c));
|
| + case MarkLig: return TRACE_RETURN (u.markLig.dispatch (c));
|
| + case MarkMark: return TRACE_RETURN (u.markMark.dispatch (c));
|
| + case Context: return TRACE_RETURN (u.context.dispatch (c));
|
| + case ChainContext: return TRACE_RETURN (u.chainContext.dispatch (c));
|
| + case Extension: return TRACE_RETURN (u.extension.dispatch (c));
|
| default: return TRACE_RETURN (c->default_return_value ());
|
| }
|
| }
|
| @@ -1427,27 +1434,11 @@
|
| inline const PosLookupSubTable& get_subtable (unsigned int i) const
|
| { return this+CastR<OffsetArrayOf<PosLookupSubTable> > (subTable)[i]; }
|
|
|
| - template <typename context_t>
|
| - inline typename context_t::return_t process (context_t *c) const
|
| - {
|
| - TRACE_PROCESS (this);
|
| - unsigned int lookup_type = get_type ();
|
| - unsigned int count = get_subtable_count ();
|
| - for (unsigned int i = 0; i < count; i++) {
|
| - typename context_t::return_t r = get_subtable (i).process (c, lookup_type);
|
| - if (c->stop_sublookup_iteration (r))
|
| - return TRACE_RETURN (r);
|
| - }
|
| - return TRACE_RETURN (c->default_return_value ());
|
| - }
|
| - template <typename context_t>
|
| - static inline typename context_t::return_t process_recurse_func (context_t *c, unsigned int lookup_index);
|
| -
|
| inline hb_collect_glyphs_context_t::return_t collect_glyphs_lookup (hb_collect_glyphs_context_t *c) const
|
| {
|
| TRACE_COLLECT_GLYPHS (this);
|
| c->set_recurse_func (NULL);
|
| - return TRACE_RETURN (process (c));
|
| + return TRACE_RETURN (dispatch (c));
|
| }
|
|
|
| template <typename set_t>
|
| @@ -1457,7 +1448,7 @@
|
| const Coverage *last = NULL;
|
| unsigned int count = get_subtable_count ();
|
| for (unsigned int i = 0; i < count; i++) {
|
| - const Coverage *coverage = &get_subtable (i).process (&c, get_type ());
|
| + const Coverage *coverage = &get_subtable (i).dispatch (&c, get_type ());
|
| if (coverage != last) {
|
| coverage->add_coverage (glyphs);
|
| last = coverage;
|
| @@ -1468,9 +1459,9 @@
|
| inline bool apply_once (hb_apply_context_t *c) const
|
| {
|
| TRACE_APPLY (this);
|
| - if (!c->check_glyph_property (&c->buffer->cur(), c->lookup_props, &c->property))
|
| + if (!c->check_glyph_property (&c->buffer->cur(), c->lookup_props))
|
| return TRACE_RETURN (false);
|
| - return TRACE_RETURN (process (c));
|
| + return TRACE_RETURN (dispatch (c));
|
| }
|
|
|
| static bool apply_recurse_func (hb_apply_context_t *c, unsigned int lookup_index);
|
| @@ -1500,6 +1491,23 @@
|
| return ret;
|
| }
|
|
|
| + template <typename context_t>
|
| + static inline typename context_t::return_t dispatch_recurse_func (context_t *c, unsigned int lookup_index);
|
| +
|
| + template <typename context_t>
|
| + inline typename context_t::return_t dispatch (context_t *c) const
|
| + {
|
| + TRACE_DISPATCH (this);
|
| + unsigned int lookup_type = get_type ();
|
| + unsigned int count = get_subtable_count ();
|
| + for (unsigned int i = 0; i < count; i++) {
|
| + typename context_t::return_t r = get_subtable (i).dispatch (c, lookup_type);
|
| + if (c->stop_sublookup_iteration (r))
|
| + return TRACE_RETURN (r);
|
| + }
|
| + return TRACE_RETURN (c->default_return_value ());
|
| + }
|
| +
|
| inline bool sanitize (hb_sanitize_context_t *c) {
|
| TRACE_SANITIZE (this);
|
| if (unlikely (!Lookup::sanitize (c))) return TRACE_RETURN (false);
|
| @@ -1522,7 +1530,7 @@
|
| { return CastR<PosLookup> (GSUBGPOS::get_lookup (i)); }
|
|
|
| static inline void position_start (hb_font_t *font, hb_buffer_t *buffer);
|
| - static inline void position_finish (hb_font_t *font, hb_buffer_t *buffer, hb_bool_t zero_width_attahced_marks);
|
| + static inline void position_finish (hb_font_t *font, hb_buffer_t *buffer);
|
|
|
| inline bool sanitize (hb_sanitize_context_t *c) {
|
| TRACE_SANITIZE (this);
|
| @@ -1555,17 +1563,13 @@
|
| }
|
|
|
| static void
|
| -fix_mark_attachment (hb_glyph_position_t *pos, unsigned int i, hb_direction_t direction, hb_bool_t zero_width_attached_marks)
|
| +fix_mark_attachment (hb_glyph_position_t *pos, unsigned int i, hb_direction_t direction)
|
| {
|
| if (likely (!(pos[i].attach_lookback())))
|
| return;
|
|
|
| unsigned int j = i - pos[i].attach_lookback();
|
|
|
| - if (zero_width_attached_marks) {
|
| - pos[i].x_advance = 0;
|
| - pos[i].y_advance = 0;
|
| - }
|
| pos[i].x_offset += pos[j].x_offset;
|
| pos[i].y_offset += pos[j].y_offset;
|
|
|
| @@ -1592,7 +1596,7 @@
|
| }
|
|
|
| void
|
| -GPOS::position_finish (hb_font_t *font HB_UNUSED, hb_buffer_t *buffer, hb_bool_t zero_width_attached_marks)
|
| +GPOS::position_finish (hb_font_t *font HB_UNUSED, hb_buffer_t *buffer)
|
| {
|
| unsigned int len;
|
| hb_glyph_position_t *pos = hb_buffer_get_glyph_positions (buffer, &len);
|
| @@ -1604,7 +1608,7 @@
|
|
|
| /* Handle attachments */
|
| for (unsigned int i = 0; i < len; i++)
|
| - fix_mark_attachment (pos, i, direction, zero_width_attached_marks);
|
| + fix_mark_attachment (pos, i, direction);
|
|
|
| HB_BUFFER_DEALLOCATE_VAR (buffer, syllable);
|
| HB_BUFFER_DEALLOCATE_VAR (buffer, lig_props);
|
| @@ -1615,11 +1619,11 @@
|
| /* Out-of-class implementation for methods recursing */
|
|
|
| template <typename context_t>
|
| -inline typename context_t::return_t PosLookup::process_recurse_func (context_t *c, unsigned int lookup_index)
|
| +inline typename context_t::return_t PosLookup::dispatch_recurse_func (context_t *c, unsigned int lookup_index)
|
| {
|
| const GPOS &gpos = *(hb_ot_layout_from_face (c->face)->gpos);
|
| const PosLookup &l = gpos.get_lookup (lookup_index);
|
| - return l.process (c);
|
| + return l.dispatch (c);
|
| }
|
|
|
| inline bool PosLookup::apply_recurse_func (hb_apply_context_t *c, unsigned int lookup_index)
|
| @@ -1627,11 +1631,9 @@
|
| const GPOS &gpos = *(hb_ot_layout_from_face (c->face)->gpos);
|
| const PosLookup &l = gpos.get_lookup (lookup_index);
|
| unsigned int saved_lookup_props = c->lookup_props;
|
| - unsigned int saved_property = c->property;
|
| c->set_lookup (l);
|
| bool ret = l.apply_once (c);
|
| c->lookup_props = saved_lookup_props;
|
| - c->property = saved_property;
|
| return ret;
|
| }
|
|
|
|
|