提交 97e5913d 编写于 作者: B Behdad Esfahbod

Move more code

上级 c8f2d933
...@@ -2612,6 +2612,23 @@ struct Extension ...@@ -2612,6 +2612,23 @@ struct Extension
* GSUB/GPOS Common * GSUB/GPOS Common
*/ */
struct hb_ot_layout_lookup_accelerator_t
{
template <typename TLookup>
inline void init (const TLookup &lookup)
{
digest.init ();
lookup.add_coverage (&digest);
}
inline void fini (void) {}
inline bool may_have (hb_codepoint_t g) const
{ return digest.may_have (g); }
private:
hb_set_digest_t digest;
};
struct GSUBGPOS struct GSUBGPOS
{ {
inline bool has_data (void) const { return version.to_int () != 0; } inline bool has_data (void) const { return version.to_int () != 0; }
......
...@@ -1094,7 +1094,7 @@ struct GSUBProxy ...@@ -1094,7 +1094,7 @@ struct GSUBProxy
accels (hb_ot_face_data (face)->GSUB->accels) {} accels (hb_ot_face_data (face)->GSUB->accels) {}
const OT::GSUB &table; const OT::GSUB &table;
const hb_ot_layout_lookup_accelerator_t *accels; const OT::hb_ot_layout_lookup_accelerator_t *accels;
}; };
struct GPOSProxy struct GPOSProxy
...@@ -1108,13 +1108,13 @@ struct GPOSProxy ...@@ -1108,13 +1108,13 @@ struct GPOSProxy
accels (hb_ot_face_data (face)->GPOS->accels) {} accels (hb_ot_face_data (face)->GPOS->accels) {}
const OT::GPOS &table; const OT::GPOS &table;
const hb_ot_layout_lookup_accelerator_t *accels; const OT::hb_ot_layout_lookup_accelerator_t *accels;
}; };
static inline bool static inline bool
apply_forward (OT::hb_ot_apply_context_t *c, apply_forward (OT::hb_ot_apply_context_t *c,
const hb_ot_layout_lookup_accelerator_t &accel, const OT::hb_ot_layout_lookup_accelerator_t &accel,
const OT::hb_get_subtables_context_t::array_t &subtables) const OT::hb_get_subtables_context_t::array_t &subtables)
{ {
bool ret = false; bool ret = false;
...@@ -1144,7 +1144,7 @@ apply_forward (OT::hb_ot_apply_context_t *c, ...@@ -1144,7 +1144,7 @@ apply_forward (OT::hb_ot_apply_context_t *c,
static inline bool static inline bool
apply_backward (OT::hb_ot_apply_context_t *c, apply_backward (OT::hb_ot_apply_context_t *c,
const hb_ot_layout_lookup_accelerator_t &accel, const OT::hb_ot_layout_lookup_accelerator_t &accel,
const OT::hb_get_subtables_context_t::array_t &subtables) const OT::hb_get_subtables_context_t::array_t &subtables)
{ {
bool ret = false; bool ret = false;
...@@ -1174,7 +1174,7 @@ template <typename Proxy> ...@@ -1174,7 +1174,7 @@ template <typename Proxy>
static inline void static inline void
apply_string (OT::hb_ot_apply_context_t *c, apply_string (OT::hb_ot_apply_context_t *c,
const typename Proxy::Lookup &lookup, const typename Proxy::Lookup &lookup,
const hb_ot_layout_lookup_accelerator_t &accel) const OT::hb_ot_layout_lookup_accelerator_t &accel)
{ {
hb_buffer_t *buffer = c->buffer; hb_buffer_t *buffer = c->buffer;
...@@ -1270,7 +1270,7 @@ void hb_ot_map_t::position (const hb_ot_shape_plan_t *plan, hb_font_t *font, hb_ ...@@ -1270,7 +1270,7 @@ void hb_ot_map_t::position (const hb_ot_shape_plan_t *plan, hb_font_t *font, hb_
void void
hb_ot_layout_substitute_lookup (OT::hb_ot_apply_context_t *c, hb_ot_layout_substitute_lookup (OT::hb_ot_apply_context_t *c,
const OT::SubstLookup &lookup, const OT::SubstLookup &lookup,
const hb_ot_layout_lookup_accelerator_t &accel) const OT::hb_ot_layout_lookup_accelerator_t &accel)
{ {
apply_string<GSUBProxy> (c, lookup, accel); apply_string<GSUBProxy> (c, lookup, accel);
} }
...@@ -112,32 +112,16 @@ hb_ot_layout_substitute_start (hb_font_t *font, ...@@ -112,32 +112,16 @@ hb_ot_layout_substitute_start (hb_font_t *font,
hb_buffer_t *buffer); hb_buffer_t *buffer);
struct hb_ot_layout_lookup_accelerator_t
{
template <typename TLookup>
inline void init (const TLookup &lookup)
{
digest.init ();
lookup.add_coverage (&digest);
}
inline void fini (void) {}
inline bool may_have (hb_codepoint_t g) const
{ return digest.may_have (g); }
private:
hb_set_digest_t digest;
};
namespace OT { namespace OT {
struct hb_ot_apply_context_t; struct hb_ot_apply_context_t;
struct SubstLookup; struct SubstLookup;
struct hb_ot_layout_lookup_accelerator_t;
} }
HB_INTERNAL void HB_INTERNAL void
hb_ot_layout_substitute_lookup (OT::hb_ot_apply_context_t *c, hb_ot_layout_substitute_lookup (OT::hb_ot_apply_context_t *c,
const OT::SubstLookup &lookup, const OT::SubstLookup &lookup,
const hb_ot_layout_lookup_accelerator_t &accel); const OT::hb_ot_layout_lookup_accelerator_t &accel);
/* Should be called before all the position_lookup's are done. */ /* Should be called before all the position_lookup's are done. */
......
...@@ -201,7 +201,7 @@ struct arabic_fallback_plan_t ...@@ -201,7 +201,7 @@ struct arabic_fallback_plan_t
hb_mask_t mask_array[ARABIC_FALLBACK_MAX_LOOKUPS]; hb_mask_t mask_array[ARABIC_FALLBACK_MAX_LOOKUPS];
OT::SubstLookup *lookup_array[ARABIC_FALLBACK_MAX_LOOKUPS]; OT::SubstLookup *lookup_array[ARABIC_FALLBACK_MAX_LOOKUPS];
hb_ot_layout_lookup_accelerator_t accel_array[ARABIC_FALLBACK_MAX_LOOKUPS]; OT::hb_ot_layout_lookup_accelerator_t accel_array[ARABIC_FALLBACK_MAX_LOOKUPS];
}; };
#if (defined(_WIN32) || defined(__CYGWIN__)) && !defined(HB_NO_WIN1256) #if (defined(_WIN32) || defined(__CYGWIN__)) && !defined(HB_NO_WIN1256)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册