diff --git a/src/hb-coretext.cc b/src/hb-coretext.cc index e857dfae03ffc7b389e659d63146001dcd22d5d2..86de0becfdc54d611c319976f47fe46dc5ab3d93 100644 --- a/src/hb-coretext.cc +++ b/src/hb-coretext.cc @@ -69,8 +69,8 @@ hb_coretext_face_create (CGFontRef cg_font) } -HB_SHAPER_DATA_ENSURE_DECLARE(coretext, face) -HB_SHAPER_DATA_ENSURE_DECLARE(coretext, font) +HB_SHAPER_DATA_ENSURE_DEFINE(coretext, face) +HB_SHAPER_DATA_ENSURE_DEFINE(coretext, font) /* diff --git a/src/hb-directwrite.cc b/src/hb-directwrite.cc index d63bc04737993a46152ff0ba6ff506bd2578c9e9..ab07d8a309836ecbe3deb3a15aac09be57cd8881 100644 --- a/src/hb-directwrite.cc +++ b/src/hb-directwrite.cc @@ -34,8 +34,8 @@ #define HB_DEBUG_DIRECTWRITE (HB_DEBUG+0) #endif -HB_SHAPER_DATA_ENSURE_DECLARE(directwrite, face) -HB_SHAPER_DATA_ENSURE_DECLARE(directwrite, font) +HB_SHAPER_DATA_ENSURE_DEFINE(directwrite, face) +HB_SHAPER_DATA_ENSURE_DEFINE(directwrite, font) /* diff --git a/src/hb-fallback-shape.cc b/src/hb-fallback-shape.cc index e5a80ee3263bd77a1bace44db8a91e391710c1d8..4b60c6c34916ece2f8535f01296b9a9121d89608 100644 --- a/src/hb-fallback-shape.cc +++ b/src/hb-fallback-shape.cc @@ -28,6 +28,10 @@ #include "hb-shaper-impl-private.hh" +HB_SHAPER_DATA_ENSURE_DEFINE(fallback, face) +HB_SHAPER_DATA_ENSURE_DEFINE(fallback, font) + + /* * shaper face data */ diff --git a/src/hb-graphite2.cc b/src/hb-graphite2.cc index a2d90db878f532dd2bc4b51d7eb9e99536f8279c..68f0817d01e4374678b539152fbea2c7d6cf0669 100644 --- a/src/hb-graphite2.cc +++ b/src/hb-graphite2.cc @@ -35,8 +35,8 @@ #include -HB_SHAPER_DATA_ENSURE_DECLARE(graphite2, face) -HB_SHAPER_DATA_ENSURE_DECLARE(graphite2, font) +HB_SHAPER_DATA_ENSURE_DEFINE(graphite2, face) +HB_SHAPER_DATA_ENSURE_DEFINE(graphite2, font) /* diff --git a/src/hb-ot-layout-private.hh b/src/hb-ot-layout-private.hh index 8c348beb17cb1e76f3b66ca6d55cdb31289dcd23..071a439d60c31c1e996e68aba89b09b658f5d734 100644 --- a/src/hb-ot-layout-private.hh +++ b/src/hb-ot-layout-private.hh @@ -623,5 +623,4 @@ _hb_buffer_assert_gsubgpos_vars (hb_buffer_t *buffer) #undef lig_props #undef glyph_props - #endif /* HB_OT_LAYOUT_PRIVATE_HH */ diff --git a/src/hb-ot-layout.cc b/src/hb-ot-layout.cc index 580397bd3472cf8e86db45a63ab27190554ff6bb..a1682a5f97c349c2cb78a5c4b68b8e3f14b419b2 100644 --- a/src/hb-ot-layout.cc +++ b/src/hb-ot-layout.cc @@ -39,8 +39,6 @@ #include "hb-ot-map-private.hh" -HB_SHAPER_DATA_ENSURE_DECLARE(ot, face) - hb_ot_layout_t * _hb_ot_layout_create (hb_face_t *face) { diff --git a/src/hb-ot-math.cc b/src/hb-ot-math.cc index 2d7e6792a58639a8378f28841558a1c6343019e7..f82a07353c95565ee0be450369d835d232b8f60c 100644 --- a/src/hb-ot-math.cc +++ b/src/hb-ot-math.cc @@ -26,10 +26,9 @@ #include "hb-open-type-private.hh" +#include "hb-ot-layout-private.hh" #include "hb-ot-math-table.hh" -HB_SHAPER_DATA_ENSURE_DECLARE(ot, face) - static inline const OT::MATH& _get_math (hb_face_t *face) { diff --git a/src/hb-ot-shape.cc b/src/hb-ot-shape.cc index 6b38739c91b6942c3cd8032ce9701528ad031074..2eacb34c4d90e48c1021482fcedc0dd597f94b47 100644 --- a/src/hb-ot-shape.cc +++ b/src/hb-ot-shape.cc @@ -128,6 +128,8 @@ hb_ot_shape_collect_features (hb_ot_shape_planner_t *planner, * shaper face data */ +HB_SHAPER_DATA_ENSURE_DEFINE(ot, face) + hb_ot_shaper_face_data_t * _hb_ot_shaper_face_data_create (hb_face_t *face) { @@ -145,6 +147,8 @@ _hb_ot_shaper_face_data_destroy (hb_ot_shaper_face_data_t *data) * shaper font data */ +HB_SHAPER_DATA_ENSURE_DEFINE(ot, font) + struct hb_ot_shaper_font_data_t {}; hb_ot_shaper_font_data_t * diff --git a/src/hb-ot-var.cc b/src/hb-ot-var.cc index b0d37900e9648ec770e6815ae2d6368d0635d8d6..691196d9bb6b8470ddd5b2805059e243655c6d59 100644 --- a/src/hb-ot-var.cc +++ b/src/hb-ot-var.cc @@ -32,8 +32,6 @@ #include "hb-ot-var-mvar-table.hh" #include "hb-ot-var.h" -HB_SHAPER_DATA_ENSURE_DECLARE(ot, face) - /* * fvar/avar */ diff --git a/src/hb-shape-plan.cc b/src/hb-shape-plan.cc index 600faaeb18c04a8d97e1e5026bed6b34fc303489..1ac77bef7508a6c1e893b725a51f84ba21ca2073 100644 --- a/src/hb-shape-plan.cc +++ b/src/hb-shape-plan.cc @@ -35,13 +35,6 @@ #endif -#define HB_SHAPER_IMPLEMENT(shaper) \ - HB_SHAPER_DATA_ENSURE_DECLARE(shaper, face) \ - HB_SHAPER_DATA_ENSURE_DECLARE(shaper, font) -#include "hb-shaper-list.hh" -#undef HB_SHAPER_IMPLEMENT - - static void hb_shape_plan_plan (hb_shape_plan_t *shape_plan, const hb_feature_t *user_features, diff --git a/src/hb-shaper-private.hh b/src/hb-shaper-private.hh index 95358416ce569d2162f7acf49b246cbca4adf296..381398a61710ecd8785b3e9df0eac12285c47189 100644 --- a/src/hb-shaper-private.hh +++ b/src/hb-shaper-private.hh @@ -71,22 +71,25 @@ struct hb_shaper_data_t { #define HB_SHAPER_DATA(shaper, object) HB_SHAPER_DATA_INSTANCE(shaper, object, object) #define HB_SHAPER_DATA_CREATE_FUNC(shaper, object) _hb_##shaper##_shaper_##object##_data_create #define HB_SHAPER_DATA_DESTROY_FUNC(shaper, object) _hb_##shaper##_shaper_##object##_data_destroy +#define HB_SHAPER_DATA_ENSURE_FUNC(shaper, object) hb_##shaper##_shaper_##object##_data_ensure #define HB_SHAPER_DATA_PROTOTYPE(shaper, object) \ HB_SHAPER_DATA_TYPE (shaper, object); /* Type forward declaration. */ \ extern "C" HB_INTERNAL HB_SHAPER_DATA_TYPE (shaper, object) * \ HB_SHAPER_DATA_CREATE_FUNC (shaper, object) (hb_##object##_t *object HB_SHAPER_DATA_CREATE_FUNC_EXTRA_ARGS); \ extern "C" HB_INTERNAL void \ - HB_SHAPER_DATA_DESTROY_FUNC (shaper, object) (HB_SHAPER_DATA_TYPE (shaper, object) *data) + HB_SHAPER_DATA_DESTROY_FUNC (shaper, object) (HB_SHAPER_DATA_TYPE (shaper, object) *data); \ + extern "C" HB_INTERNAL bool \ + HB_SHAPER_DATA_ENSURE_FUNC (shaper, object) (hb_##object##_t *object) #define HB_SHAPER_DATA_DESTROY(shaper, object) \ if (HB_SHAPER_DATA_TYPE (shaper, object) *data = HB_SHAPER_DATA (shaper, object)) \ if (data != HB_SHAPER_DATA_INVALID && data != HB_SHAPER_DATA_SUCCEEDED) \ HB_SHAPER_DATA_DESTROY_FUNC (shaper, object) (data); -#define HB_SHAPER_DATA_ENSURE_DECLARE(shaper, object) \ -static inline bool \ -hb_##shaper##_shaper_##object##_data_ensure (hb_##object##_t *object) \ +#define HB_SHAPER_DATA_ENSURE_DEFINE(shaper, object) \ +bool \ +HB_SHAPER_DATA_ENSURE_FUNC(shaper, object) (hb_##object##_t *object) \ {\ retry: \ HB_SHAPER_DATA_TYPE (shaper, object) *data = (HB_SHAPER_DATA_TYPE (shaper, object) *) hb_atomic_ptr_get (&HB_SHAPER_DATA (shaper, object)); \ diff --git a/src/hb-uniscribe.cc b/src/hb-uniscribe.cc index 6e4db01495f6a7618ee14b5099f2e3f60bf5b2f8..58f983dbec1e5d9b122ab48743a104d13844bf7c 100644 --- a/src/hb-uniscribe.cc +++ b/src/hb-uniscribe.cc @@ -293,8 +293,8 @@ struct range_record_t { unsigned int index_last; /* == end - 1 */ }; -HB_SHAPER_DATA_ENSURE_DECLARE(uniscribe, face) -HB_SHAPER_DATA_ENSURE_DECLARE(uniscribe, font) +HB_SHAPER_DATA_ENSURE_DEFINE(uniscribe, face) +HB_SHAPER_DATA_ENSURE_DEFINE(uniscribe, font) /*