Move code around

This commit is contained in:
Behdad Esfahbod 2013-05-02 18:18:24 -04:00
parent 45fd9424c7
commit d2c96819de
2 changed files with 52 additions and 43 deletions

View File

@ -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 <stdlib.h>
#include <string.h>
@ -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);
}

View File

@ -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
{