From 466b3e58bdc64229dab08c6e0e0079c789540370 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Fri, 3 Feb 2017 16:43:25 -0800 Subject: [PATCH] Shuffle things around a bit --- src/hb-coretext.cc | 4 ++-- src/hb-directwrite.cc | 4 ++-- src/hb-fallback-shape.cc | 4 ++++ src/hb-graphite2.cc | 4 ++-- src/hb-ot-layout-private.hh | 1 - src/hb-ot-layout.cc | 2 -- src/hb-ot-math.cc | 3 +-- src/hb-ot-shape.cc | 4 ++++ src/hb-ot-var.cc | 2 -- src/hb-shape-plan.cc | 7 ------- src/hb-shaper-private.hh | 11 +++++++---- src/hb-uniscribe.cc | 4 ++-- 12 files changed, 24 insertions(+), 26 deletions(-) diff --git a/src/hb-coretext.cc b/src/hb-coretext.cc index e857dfae0..86de0becf 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 d63bc0473..ab07d8a30 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 e5a80ee32..4b60c6c34 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 a2d90db87..68f0817d0 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 8c348beb1..071a439d6 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 580397bd3..a1682a5f9 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 2d7e6792a..f82a07353 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 6b38739c9..2eacb34c4 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 b0d37900e..691196d9b 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 600faaeb1..1ac77bef7 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 95358416c..381398a61 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 6e4db0149..58f983dbe 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) /*