[OT] Minor refactoring
This commit is contained in:
parent
24eacf17c8
commit
5393e3a62b
|
@ -28,8 +28,6 @@
|
|||
|
||||
#include "hb-ot-map-private.hh"
|
||||
|
||||
#include "hb-ot-shape-private.hh"
|
||||
|
||||
|
||||
void
|
||||
hb_ot_map_t::add_lookups (hb_face_t *face,
|
||||
|
@ -303,5 +301,3 @@ hb_ot_map_builder_t::compile (hb_face_t *face,
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -35,10 +35,36 @@
|
|||
|
||||
struct hb_ot_shape_plan_t
|
||||
{
|
||||
hb_ot_map_t map;
|
||||
const hb_ot_complex_shaper_t *shaper;
|
||||
hb_ot_map_t map;
|
||||
};
|
||||
|
||||
struct hb_ot_shape_planner_t
|
||||
{
|
||||
/* In the order that they are filled in. */
|
||||
hb_face_t *face;
|
||||
hb_segment_properties_t props;
|
||||
const hb_ot_complex_shaper_t *shaper;
|
||||
hb_ot_map_builder_t map;
|
||||
|
||||
hb_ot_shape_planner_t (const hb_shape_plan_t *master_plan) :
|
||||
face (master_plan->face),
|
||||
props (master_plan->props),
|
||||
shaper (NULL),
|
||||
map () {}
|
||||
~hb_ot_shape_planner_t (void) { map.finish (); }
|
||||
|
||||
inline void compile (hb_ot_shape_plan_t &plan)
|
||||
{
|
||||
plan.shaper = shaper;
|
||||
map.compile (face, &props, plan.map);
|
||||
}
|
||||
|
||||
private:
|
||||
NO_COPY (hb_ot_shape_planner_t);
|
||||
};
|
||||
|
||||
|
||||
|
||||
inline void
|
||||
_hb_glyph_info_set_unicode_props (hb_glyph_info_t *info, hb_unicode_funcs_t *unicode)
|
||||
|
|
|
@ -70,26 +70,6 @@ hb_tag_t vertical_features[] = {
|
|||
|
||||
|
||||
|
||||
struct hb_ot_shape_planner_t
|
||||
{
|
||||
hb_ot_map_builder_t map;
|
||||
const hb_ot_complex_shaper_t *shaper;
|
||||
|
||||
hb_ot_shape_planner_t (void) : map () {}
|
||||
~hb_ot_shape_planner_t (void) { map.finish (); }
|
||||
|
||||
inline void compile (hb_face_t *face,
|
||||
const hb_segment_properties_t *props,
|
||||
hb_ot_shape_plan_t &plan)
|
||||
{
|
||||
plan.shaper = shaper;
|
||||
map.compile (face, props, plan.map);
|
||||
}
|
||||
|
||||
private:
|
||||
NO_COPY (hb_ot_shape_planner_t);
|
||||
};
|
||||
|
||||
static void
|
||||
hb_ot_shape_collect_features (hb_ot_shape_planner_t *planner,
|
||||
const hb_segment_properties_t *props,
|
||||
|
@ -188,15 +168,13 @@ _hb_ot_shaper_shape_plan_data_create (hb_shape_plan_t *shape_plan,
|
|||
if (unlikely (!data))
|
||||
return NULL;
|
||||
|
||||
hb_ot_shape_planner_t planner;
|
||||
|
||||
assert (HB_DIRECTION_IS_VALID (shape_plan->props.direction));
|
||||
hb_ot_shape_planner_t planner (shape_plan);
|
||||
|
||||
planner.shaper = hb_ot_shape_complex_categorize (&shape_plan->props);
|
||||
|
||||
hb_ot_shape_collect_features (&planner, &shape_plan->props, user_features, num_user_features);
|
||||
|
||||
planner.compile (shape_plan->face, &shape_plan->props, *data);
|
||||
planner.compile (*data);
|
||||
|
||||
return data;
|
||||
}
|
||||
|
|
|
@ -90,6 +90,8 @@ hb_shape_plan_create (hb_face_t *face,
|
|||
unsigned int num_user_features,
|
||||
const char * const *shaper_list)
|
||||
{
|
||||
assert (props->direction != HB_DIRECTION_INVALID);
|
||||
|
||||
hb_shape_plan_t *shape_plan;
|
||||
|
||||
if (unlikely (!face))
|
||||
|
|
|
@ -87,8 +87,6 @@ hb_shape_full (hb_font_t *font,
|
|||
|
||||
buffer->guess_properties ();
|
||||
|
||||
assert (buffer->props.direction != HB_DIRECTION_INVALID);
|
||||
|
||||
hb_shape_plan_t *shape_plan = hb_shape_plan_create_cached (font->face, &buffer->props, features, num_features, shaper_list);
|
||||
hb_bool_t res = hb_shape_plan_execute (shape_plan, font, buffer, features, num_features);
|
||||
hb_shape_plan_destroy (shape_plan);
|
||||
|
|
Loading…
Reference in New Issue