static void
-collect_features_arabic (const hb_ot_complex_shaper_t *shaper,
- hb_ot_map_builder_t *map,
- const hb_segment_properties_t *props)
+collect_features_arabic (hb_ot_shape_planner_t *plan)
{
+ hb_ot_map_builder_t *map = &plan->map;
+
/* For Language forms (in ArabicOT speak), we do the iso/fina/medi/init together,
* then rlig and calt each in their own stage. This makes IranNastaliq's ALLAH
* ligature work correctly. It's unfortunate though...
map->add_gsub_pause (NULL, NULL);
- unsigned int num_features = props->script == HB_SCRIPT_SYRIAC ? SYRIAC_NUM_FEATURES : COMMON_NUM_FEATURES;
+ unsigned int num_features = plan->props.script == HB_SCRIPT_SYRIAC ? SYRIAC_NUM_FEATURES : COMMON_NUM_FEATURES;
for (unsigned int i = 0; i < num_features; i++)
map->add_bool_feature (arabic_syriac_features[i], false);
}
static void
-setup_masks_arabic (const hb_ot_complex_shaper_t *shaper,
- const hb_ot_map_t *map,
- hb_buffer_t *buffer,
- hb_font_t *font)
+setup_masks_arabic (const hb_ot_shape_plan_t *plan,
+ hb_buffer_t *buffer,
+ hb_font_t *font)
{
unsigned int count = buffer->len;
unsigned int prev = 0, state = 0;
hb_mask_t total_masks = 0;
unsigned int num_masks = buffer->props.script == HB_SCRIPT_SYRIAC ? SYRIAC_NUM_FEATURES : COMMON_NUM_FEATURES;
for (unsigned int i = 0; i < num_masks; i++) {
- mask_array[i] = map->get_1_mask (arabic_syriac_features[i]);
+ mask_array[i] = plan->map.get_1_mask (arabic_syriac_features[i]);
total_masks |= mask_array[i];
}
void *user_data HB_UNUSED);
static void
-collect_features_indic (const hb_ot_complex_shaper_t *shaper,
- hb_ot_map_builder_t *map,
- const hb_segment_properties_t *props)
+collect_features_indic (hb_ot_shape_planner_t *plan)
{
+ hb_ot_map_builder_t *map = &plan->map;
+
map->add_bool_feature (HB_TAG('l','o','c','l'));
/* The Indic specs do not require ccmp, but we apply it here since if
* there is a use of it, it's typically at the beginning. */
}
static void
-override_features_indic (const hb_ot_complex_shaper_t *shaper,
- hb_ot_map_builder_t *map,
- const hb_segment_properties_t *props)
+override_features_indic (hb_ot_shape_planner_t *plan)
{
/* Uniscribe does not apply 'kern'. */
if (indic_options ().uniscribe_bug_compatible)
- map->add_feature (HB_TAG('k','e','r','n'), 0, true);
+ plan->map.add_feature (HB_TAG('k','e','r','n'), 0, true);
}
static void
-setup_masks_indic (const hb_ot_complex_shaper_t *shaper,
- const hb_ot_map_t *map,
- hb_buffer_t *buffer,
- hb_font_t *font HB_UNUSED)
+setup_masks_indic (const hb_ot_shape_plan_t *plan HB_UNUSED,
+ hb_buffer_t *buffer,
+ hb_font_t *font HB_UNUSED)
{
HB_BUFFER_ALLOCATE_VAR (buffer, indic_category);
HB_BUFFER_ALLOCATE_VAR (buffer, indic_position);
};
static void
-collect_features_default (const hb_ot_complex_shaper_t *shaper,
- hb_ot_map_builder_t *map,
- const hb_segment_properties_t *props)
+collect_features_default (hb_ot_shape_planner_t *plan)
{
const hb_tag_t *script_features = NULL;
- switch ((hb_tag_t) props->script)
+ switch ((hb_tag_t) plan->props.script)
{
/* Unicode-1.1 additions */
case HB_SCRIPT_HANGUL:
}
for (; script_features && *script_features; script_features++)
- map->add_bool_feature (*script_features);
+ plan->map.add_bool_feature (*script_features);
}
static hb_ot_shape_normalization_mode_t
-normalization_preference_default (const hb_ot_complex_shaper_t *shaper,
- const hb_segment_properties_t *props)
+normalization_preference_default (const hb_ot_shape_plan_t *plan)
{
- switch ((hb_tag_t) props->script)
+ switch ((hb_tag_t) plan->props.script)
{
/* Unicode-1.1 additions */
case HB_SCRIPT_HANGUL:
/* Thai / Lao shaper */
static void
-setup_masks_thai (const hb_ot_complex_shaper_t *shaper,
- const hb_ot_map_t *map,
- hb_buffer_t *buffer,
- hb_font_t *font)
+setup_masks_thai (const hb_ot_shape_plan_t *plan HB_UNUSED,
+ hb_buffer_t *buffer,
+ hb_font_t *font HB_UNUSED)
{
/* The following is NOT specified in the MS OT Thai spec, however, it seems
* to be what Uniscribe and other engines implement. According to Eric Muller:
#include "hb-private.hh"
-#include "hb-ot-map-private.hh"
+#include "hb-ot-shape-private.hh"
#include "hb-ot-shape-normalize-private.hh"
-/* buffer var allocations, used during the entire shaping process */
-#define unicode_props0() var1.u8[0]
-#define unicode_props1() var1.u8[1]
-
/* buffer var allocations, used by complex shapers */
#define complex_var_persistent_u8_0() var2.u8[2]
#define complex_var_persistent_u8_1() var2.u8[3]
/* collect_features()
* Called during shape_plan().
- * Shapers should use map to add their features and callbacks.
+ * Shapers should use plan->map to add their features and callbacks.
* May be NULL.
*/
- void (*collect_features) (const hb_ot_complex_shaper_t *shaper,
- hb_ot_map_builder_t *map,
- const hb_segment_properties_t *props);
+ void (*collect_features) (hb_ot_shape_planner_t *plan);
/* override_features()
* Called during shape_plan().
- * Shapers should use map to override features and add callbacks after
+ * Shapers should use plan->map to override features and add callbacks after
* common features are added.
* May be NULL.
*/
- void (*override_features) (const hb_ot_complex_shaper_t *shaper,
- hb_ot_map_builder_t *map,
- const hb_segment_properties_t *props);
+ void (*override_features) (hb_ot_shape_planner_t *plan);
/* normalization_preference()
- * Called during shape_execute().
+ * Called during shape().
*/
hb_ot_shape_normalization_mode_t
- (*normalization_preference) (const hb_ot_complex_shaper_t *shaper,
- const hb_segment_properties_t *props);
+ (*normalization_preference) (const hb_ot_shape_plan_t *plan);
/* setup_masks()
- * Called during shape_execute().
+ * Called during shape().
* Shapers should use map to get feature masks and set on buffer.
*/
- void (*setup_masks) (const hb_ot_complex_shaper_t *shaper,
- const hb_ot_map_t *map,
- hb_buffer_t *buffer,
- hb_font_t *font);
+ void (*setup_masks) (const hb_ot_shape_plan_t *plan,
+ hb_buffer_t *buffer,
+ hb_font_t *font);
bool zero_width_attached_marks;
};
#include "hb-private.hh"
#include "hb-ot-map-private.hh"
-#include "hb-ot-shape-complex-private.hh"
+
+
+
+/* buffer var allocations, used during the entire shaping process */
+#define unicode_props0() var1.u8[0]
+#define unicode_props1() var1.u8[1]
+
struct hb_ot_shape_plan_t
{
- const hb_ot_complex_shaper_t *shaper;
+ hb_segment_properties_t props;
+ const struct hb_ot_complex_shaper_t *shaper;
hb_ot_map_t map;
};
/* In the order that they are filled in. */
hb_face_t *face;
hb_segment_properties_t props;
- const hb_ot_complex_shaper_t *shaper;
+ const struct hb_ot_complex_shaper_t *shaper;
hb_ot_map_builder_t map;
hb_ot_shape_planner_t (const hb_shape_plan_t *master_plan) :
inline void compile (hb_ot_shape_plan_t &plan)
{
+ plan.props = props;
plan.shaper = shaper;
map.compile (face, &props, plan.map);
}
#include "hb-ot-shape-private.hh"
#include "hb-ot-shape-normalize-private.hh"
+#include "hb-ot-shape-complex-private.hh"
#include "hb-ot-layout-private.hh"
#include "hb-set-private.hh"
} HB_STMT_END
if (planner->shaper->collect_features)
- planner->shaper->collect_features (planner->shaper, &planner->map, props);
+ planner->shaper->collect_features (planner);
ADD_FEATURES (common_features);
ADD_FEATURES (vertical_features);
if (planner->shaper->override_features)
- planner->shaper->override_features (planner->shaper, &planner->map, props);
+ planner->shaper->override_features (planner);
#undef ADD_FEATURES
c->buffer->reset_masks (global_mask);
if (c->plan->shaper->setup_masks)
- c->plan->shaper->setup_masks (c->plan->shaper, &c->plan->map, c->buffer, c->font);
+ c->plan->shaper->setup_masks (c->plan, c->buffer, c->font);
for (unsigned int i = 0; i < c->num_user_features; i++)
{
_hb_ot_shape_normalize (c->font, c->buffer,
c->plan->shaper->normalization_preference ?
- c->plan->shaper->normalization_preference (c->plan->shaper, &c->buffer->props) :
+ c->plan->shaper->normalization_preference (c->plan) :
HB_OT_SHAPE_NORMALIZATION_MODE_DEFAULT);
hb_ot_shape_setup_masks (c);