Choose one shaper per plan

This commit is contained in:
Behdad Esfahbod 2012-07-27 02:49:39 -04:00
parent e82061e8db
commit c5b668fb92
2 changed files with 10 additions and 11 deletions

View File

@ -42,7 +42,7 @@ struct hb_shape_plan_t
hb_face_t *face; hb_face_t *face;
hb_segment_properties_t props; hb_segment_properties_t props;
hb_shape_func_t *shapers[HB_SHAPERS_COUNT]; hb_shape_func_t *shaper_func;
struct hb_shaper_data_t shaper_data; struct hb_shaper_data_t shaper_data;
}; };

View File

@ -62,7 +62,6 @@ hb_shape_plan_plan (hb_shape_plan_t *shape_plan,
const char * const *shaper_list) const char * const *shaper_list)
{ {
const hb_shaper_pair_t *shapers = _hb_shapers_get (); const hb_shaper_pair_t *shapers = _hb_shapers_get ();
unsigned num_shapers = 0;
#define HB_SHAPER_PLAN(shaper) \ #define HB_SHAPER_PLAN(shaper) \
HB_STMT_START { \ HB_STMT_START { \
@ -71,11 +70,10 @@ hb_shape_plan_plan (hb_shape_plan_t *shape_plan,
HB_SHAPER_DATA_CREATE_FUNC (shaper, shape_plan) (shape_plan, user_features, num_user_features); \ HB_SHAPER_DATA_CREATE_FUNC (shaper, shape_plan) (shape_plan, user_features, num_user_features); \
if (data) { \ if (data) { \
HB_SHAPER_DATA (shaper, shape_plan) = data; \ HB_SHAPER_DATA (shaper, shape_plan) = data; \
shape_plan->shapers[num_shapers++] = _hb_##shaper##_shape; \ shape_plan->shaper_func = _hb_##shaper##_shape; \
} \
if (false /* shaper never fails */) \
return; \ return; \
} \ } \
} \
} HB_STMT_END } HB_STMT_END
if (likely (!shaper_list)) { if (likely (!shaper_list)) {
@ -140,7 +138,7 @@ hb_shape_plan_get_empty (void)
NULL, /* face */ NULL, /* face */
_HB_BUFFER_PROPS_DEFAULT, /* props */ _HB_BUFFER_PROPS_DEFAULT, /* props */
{NULL}, /* shapers */ NULL, /* shaper_func */
{ {
#define HB_SHAPER_IMPLEMENT(shaper) HB_SHAPER_DATA_INVALID, #define HB_SHAPER_IMPLEMENT(shaper) HB_SHAPER_DATA_INVALID,
@ -186,13 +184,14 @@ hb_shape_plan_execute (hb_shape_plan *shape_plan,
if (hb_##shaper##_font_data_ensure (font) && \ if (hb_##shaper##_font_data_ensure (font) && \
_hb_##shaper##_shape (shape_plan, font, buffer, features, num_features)) \ _hb_##shaper##_shape (shape_plan, font, buffer, features, num_features)) \
return true; \ return true; \
else \
return false; \
} HB_STMT_END } HB_STMT_END
for (hb_shape_func_t **shaper_func = shape_plan->shapers; *shaper_func; shaper_func++)
if (0) if (0)
; ;
#define HB_SHAPER_IMPLEMENT(shaper) \ #define HB_SHAPER_IMPLEMENT(shaper) \
else if (*shaper_func == _hb_##shaper##_shape) \ else if (shape_plan->shaper_func == _hb_##shaper##_shape) \
HB_SHAPER_EXECUTE (shaper); HB_SHAPER_EXECUTE (shaper);
#include "hb-shaper-list.hh" #include "hb-shaper-list.hh"
#undef HB_SHAPER_IMPLEMENT #undef HB_SHAPER_IMPLEMENT