From d2c96819de9a7428b65ef0adf794416224221f36 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Thu, 2 May 2013 18:18:24 -0400 Subject: [PATCH] Move code around --- src/hb-ot-layout.cc | 52 +++++++++++++++++++++++++++++++++++++++++++++ src/hb-ot-map.cc | 43 ------------------------------------- 2 files changed, 52 insertions(+), 43 deletions(-) diff --git a/src/hb-ot-layout.cc b/src/hb-ot-layout.cc index 76a6256e4..a944a95fe 100644 --- a/src/hb-ot-layout.cc +++ b/src/hb-ot-layout.cc @@ -34,6 +34,8 @@ #include "hb-ot-layout-gsub-table.hh" #include "hb-ot-layout-gpos-table.hh" +#include "hb-ot-map-private.hh" + #include #include @@ -783,3 +785,53 @@ hb_ot_layout_get_size_params (hb_face_t *face, return false; } + + +/* + * Parts of hb-ot-map are implemented here such that they have direct + * access to GSUB/GPOS lookups. + */ + + +inline void hb_ot_map_t::apply (unsigned int table_index, + const hb_ot_shape_plan_t *plan, + hb_font_t *font, + hb_buffer_t *buffer) const +{ + unsigned int i = 0; + + for (unsigned int stage_index = 0; stage_index < stages[table_index].len; stage_index++) { + const stage_map_t *stage = &stages[table_index][stage_index]; + for (; i < stage->last_lookup; i++) + switch (table_index) + { + case 0: + hb_ot_layout_substitute_lookup (font, buffer, lookups[table_index][i].index, + lookups[table_index][i].mask, + lookups[table_index][i].auto_zwj); + break; + + case 1: + hb_ot_layout_position_lookup (font, buffer, lookups[table_index][i].index, + lookups[table_index][i].mask, + lookups[table_index][i].auto_zwj); + break; + } + + if (stage->pause_func) + { + buffer->clear_output (); + stage->pause_func (plan, font, buffer); + } + } +} + +void hb_ot_map_t::substitute (const hb_ot_shape_plan_t *plan, hb_font_t *font, hb_buffer_t *buffer) const +{ + apply (0, plan, font, buffer); +} + +void hb_ot_map_t::position (const hb_ot_shape_plan_t *plan, hb_font_t *font, hb_buffer_t *buffer) const +{ + apply (1, plan, font, buffer); +} diff --git a/src/hb-ot-map.cc b/src/hb-ot-map.cc index dd26afc8e..43856fa37 100644 --- a/src/hb-ot-map.cc +++ b/src/hb-ot-map.cc @@ -102,49 +102,6 @@ void hb_ot_map_builder_t::add_feature (hb_tag_t tag, unsigned int value, info->stage[1] = current_stage[1]; } -inline void hb_ot_map_t::apply (unsigned int table_index, - const hb_ot_shape_plan_t *plan, - hb_font_t *font, - hb_buffer_t *buffer) const -{ - unsigned int i = 0; - - for (unsigned int stage_index = 0; stage_index < stages[table_index].len; stage_index++) { - const stage_map_t *stage = &stages[table_index][stage_index]; - for (; i < stage->last_lookup; i++) - switch (table_index) - { - case 0: - hb_ot_layout_substitute_lookup (font, buffer, lookups[table_index][i].index, - lookups[table_index][i].mask, - lookups[table_index][i].auto_zwj); - break; - - case 1: - hb_ot_layout_position_lookup (font, buffer, lookups[table_index][i].index, - lookups[table_index][i].mask, - lookups[table_index][i].auto_zwj); - break; - } - - if (stage->pause_func) - { - buffer->clear_output (); - stage->pause_func (plan, font, buffer); - } - } -} - -void hb_ot_map_t::substitute (const hb_ot_shape_plan_t *plan, hb_font_t *font, hb_buffer_t *buffer) const -{ - apply (0, plan, font, buffer); -} - -void hb_ot_map_t::position (const hb_ot_shape_plan_t *plan, hb_font_t *font, hb_buffer_t *buffer) const -{ - apply (1, plan, font, buffer); -} - void hb_ot_map_t::collect_lookups (unsigned int table_index, hb_set_t *lookups_out) const {