提交 046690a4 编写于 作者: B Behdad Esfahbod

[aat] Add hb_aat_apply_context_t

上级 fd034490
...@@ -691,6 +691,29 @@ struct StateTableDriver ...@@ -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 */ } /* namespace AAT */
......
...@@ -148,7 +148,7 @@ struct RearrangementSubtable ...@@ -148,7 +148,7 @@ struct RearrangementSubtable
unsigned int last_zero_before_start; 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); TRACE_APPLY (this);
...@@ -245,7 +245,7 @@ struct ContextualSubtable ...@@ -245,7 +245,7 @@ struct ContextualSubtable
const UnsizedOffsetListOf<Lookup<GlyphID>, HBUINT32> &subs; 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); TRACE_APPLY (this);
...@@ -326,7 +326,7 @@ struct LigatureSubtable ...@@ -326,7 +326,7 @@ struct LigatureSubtable
private: private:
}; };
inline bool apply (hb_ot_apply_context_t *c) const inline bool apply (hb_aat_apply_context_t *c) const
{ {
TRACE_APPLY (this); TRACE_APPLY (this);
...@@ -360,7 +360,7 @@ struct LigatureSubtable ...@@ -360,7 +360,7 @@ struct LigatureSubtable
struct NoncontextualSubtable 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); TRACE_APPLY (this);
...@@ -396,7 +396,7 @@ struct NoncontextualSubtable ...@@ -396,7 +396,7 @@ struct NoncontextualSubtable
struct InsertionSubtable 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); TRACE_APPLY (this);
/* TODO */ /* TODO */
...@@ -448,13 +448,13 @@ struct ChainSubtable ...@@ -448,13 +448,13 @@ struct ChainSubtable
Insertion = 5 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> 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 (); unsigned int subtable_type = get_type ();
TRACE_DISPATCH (this, subtable_type); TRACE_DISPATCH (this, subtable_type);
...@@ -476,7 +476,7 @@ struct ChainSubtable ...@@ -476,7 +476,7 @@ struct ChainSubtable
!c->check_range (this, length)) !c->check_range (this, length))
return_trace (false); return_trace (false);
return_trace (dispatch (c, c->end)); return_trace (dispatch (c));
} }
protected: protected:
...@@ -496,13 +496,13 @@ struct ChainSubtable ...@@ -496,13 +496,13 @@ struct ChainSubtable
struct Chain 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); const ChainSubtable *subtable = &StructAtOffset<ChainSubtable> (featureZ, featureZ[0].static_size * featureCount);
unsigned int count = subtableCount; unsigned int count = subtableCount;
for (unsigned int i = 0; i < count; i++) for (unsigned int i = 0; i < count; i++)
{ {
subtable->apply (c, end); subtable->apply (c);
subtable = &StructAfter<ChainSubtable> (*subtable); subtable = &StructAfter<ChainSubtable> (*subtable);
} }
} }
...@@ -555,14 +555,13 @@ struct morx ...@@ -555,14 +555,13 @@ struct morx
{ {
static const hb_tag_t tableTag = HB_AAT_TAG_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; const Chain *chain = chains;
unsigned int count = chainCount; unsigned int count = chainCount;
for (unsigned int i = 0; i < count; i++) for (unsigned int i = 0; i < count; i++)
{ {
chain->apply (c, end); chain->apply (c);
chain = &StructAfter<Chain> (*chain); chain = &StructAfter<Chain> (*chain);
} }
} }
......
...@@ -35,6 +35,6 @@ ...@@ -35,6 +35,6 @@
HB_INTERNAL void 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 */ #endif /* HB_AAT_LAYOUT_PRIVATE_HH */
...@@ -68,9 +68,11 @@ _hb_aat_layout_create (hb_face_t *face) ...@@ -68,9 +68,11 @@ _hb_aat_layout_create (hb_face_t *face)
} }
void 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; unsigned int length;
const AAT::morx& morx = _get_morx (c->face, &length); const AAT::morx& morx = _get_morx (font->face, &length);
morx.apply (c, 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) ...@@ -619,8 +619,7 @@ hb_ot_substitute_complex (hb_ot_shape_context_t *c)
c->plan->substitute (c->font, buffer); c->plan->substitute (c->font, buffer);
/* XXX Call morx instead. */ /* XXX Call morx instead. */
//OT::hb_ot_apply_context_t ac (0, c->font, c->buffer); //hb_aat_layout_substitute (c->font, c->buffer);
//hb_aat_layout_substitute (&ac);
} }
static inline void static inline void
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册