[aat] Add hb_aat_apply_context_t

pull/719/head
Behdad Esfahbod 7 years ago
parent fd03449094
commit 046690a4df
  1. 23
      src/hb-aat-layout-common-private.hh
  2. 27
      src/hb-aat-layout-morx-table.hh
  3. 2
      src/hb-aat-layout-private.hh
  4. 8
      src/hb-aat-layout.cc
  5. 3
      src/hb-ot-shape.cc

@ -691,6 +691,29 @@ struct StateTableDriver
};
struct hb_aat_apply_context_t :
hb_dispatch_context_t<hb_aat_apply_context_t, bool, HB_DEBUG_APPLY>
{
inline const char *get_name (void) { return "APPLY"; }
template <typename T>
inline return_t dispatch (const T &obj) { return obj.apply (this); }
static return_t default_return_value (void) { return false; }
bool stop_sublookup_iteration (return_t r) const { return r; }
hb_font_t *font;
hb_face_t *face;
hb_buffer_t *buffer;
const char *end;
hb_aat_apply_context_t (hb_font_t *font_,
hb_buffer_t *buffer_,
const char *end_) :
font (font_), face (font->face), buffer (buffer_),
end (end_) {}
};
} /* namespace AAT */

@ -148,7 +148,7 @@ struct RearrangementSubtable
unsigned int last_zero_before_start;
};
inline bool apply (hb_ot_apply_context_t *c) const
inline bool apply (hb_aat_apply_context_t *c) const
{
TRACE_APPLY (this);
@ -245,7 +245,7 @@ struct ContextualSubtable
const UnsizedOffsetListOf<Lookup<GlyphID>, HBUINT32> &subs;
};
inline bool apply (hb_ot_apply_context_t *c) const
inline bool apply (hb_aat_apply_context_t *c) const
{
TRACE_APPLY (this);
@ -326,7 +326,7 @@ struct LigatureSubtable
private:
};
inline bool apply (hb_ot_apply_context_t *c) const
inline bool apply (hb_aat_apply_context_t *c) const
{
TRACE_APPLY (this);
@ -360,7 +360,7 @@ struct LigatureSubtable
struct NoncontextualSubtable
{
inline bool apply (hb_ot_apply_context_t *c) const
inline bool apply (hb_aat_apply_context_t *c) const
{
TRACE_APPLY (this);
@ -396,7 +396,7 @@ struct NoncontextualSubtable
struct InsertionSubtable
{
inline bool apply (hb_ot_apply_context_t *c) const
inline bool apply (hb_aat_apply_context_t *c) const
{
TRACE_APPLY (this);
/* TODO */
@ -448,13 +448,13 @@ struct ChainSubtable
Insertion = 5
};
inline void apply (hb_ot_apply_context_t *c, const char *end) const
inline void apply (hb_aat_apply_context_t *c) const
{
dispatch (c, end);
dispatch (c);
}
template <typename context_t>
inline typename context_t::return_t dispatch (context_t *c, const char *end) const
inline typename context_t::return_t dispatch (context_t *c) const
{
unsigned int subtable_type = get_type ();
TRACE_DISPATCH (this, subtable_type);
@ -476,7 +476,7 @@ struct ChainSubtable
!c->check_range (this, length))
return_trace (false);
return_trace (dispatch (c, c->end));
return_trace (dispatch (c));
}
protected:
@ -496,13 +496,13 @@ struct ChainSubtable
struct Chain
{
inline void apply (hb_ot_apply_context_t *c, const char *end) const
inline void apply (hb_aat_apply_context_t *c) const
{
const ChainSubtable *subtable = &StructAtOffset<ChainSubtable> (featureZ, featureZ[0].static_size * featureCount);
unsigned int count = subtableCount;
for (unsigned int i = 0; i < count; i++)
{
subtable->apply (c, end);
subtable->apply (c);
subtable = &StructAfter<ChainSubtable> (*subtable);
}
}
@ -555,14 +555,13 @@ struct morx
{
static const hb_tag_t tableTag = HB_AAT_TAG_MORX;
inline void apply (hb_ot_apply_context_t *c, unsigned int length) const
inline void apply (hb_aat_apply_context_t *c) const
{
const char *end = (const char *) this + length;
const Chain *chain = chains;
unsigned int count = chainCount;
for (unsigned int i = 0; i < count; i++)
{
chain->apply (c, end);
chain->apply (c);
chain = &StructAfter<Chain> (*chain);
}
}

@ -35,6 +35,6 @@
HB_INTERNAL void
hb_aat_layout_substitute (OT::hb_ot_apply_context_t *c);
hb_aat_layout_substitute (hb_font_t *font, hb_buffer_t *buffer);
#endif /* HB_AAT_LAYOUT_PRIVATE_HH */

@ -68,9 +68,11 @@ _hb_aat_layout_create (hb_face_t *face)
}
void
hb_aat_layout_substitute (OT::hb_ot_apply_context_t *c)
hb_aat_layout_substitute (hb_font_t *font, hb_buffer_t *buffer)
{
unsigned int length;
const AAT::morx& morx = _get_morx (c->face, &length);
morx.apply (c, length);
const AAT::morx& morx = _get_morx (font->face, &length);
AAT::hb_aat_apply_context_t c (font, buffer, (const char *) &morx + length);
morx.apply (&c);
}

@ -619,8 +619,7 @@ hb_ot_substitute_complex (hb_ot_shape_context_t *c)
c->plan->substitute (c->font, buffer);
/* XXX Call morx instead. */
//OT::hb_ot_apply_context_t ac (0, c->font, c->buffer);
//hb_aat_layout_substitute (&ac);
//hb_aat_layout_substitute (c->font, c->buffer);
}
static inline void

Loading…
Cancel
Save