subset VVAR & outer indices
This commit is contained in:
parent
2d545e1e86
commit
5d781f62ba
|
@ -122,6 +122,7 @@ struct DeltaSetIndexMap
|
||||||
struct index_map_subset_plan_t
|
struct index_map_subset_plan_t
|
||||||
{
|
{
|
||||||
void init (const DeltaSetIndexMap &index_map,
|
void init (const DeltaSetIndexMap &index_map,
|
||||||
|
hb_map2_t &outer_remap,
|
||||||
hb_vector_t<hb_map2_t> &inner_remaps,
|
hb_vector_t<hb_map2_t> &inner_remaps,
|
||||||
const hb_subset_plan_t *plan)
|
const hb_subset_plan_t *plan)
|
||||||
{
|
{
|
||||||
|
@ -171,6 +172,7 @@ struct index_map_subset_plan_t
|
||||||
unsigned int v = index_map.map (old_gid);
|
unsigned int v = index_map.map (old_gid);
|
||||||
unsigned int outer = v >> 16;
|
unsigned int outer = v >> 16;
|
||||||
unsigned int inner = v & 0xFFFF;
|
unsigned int inner = v & 0xFFFF;
|
||||||
|
outer_remap.add (outer);
|
||||||
if (inner > max_inners[outer]) max_inners[outer] = inner;
|
if (inner > max_inners[outer]) max_inners[outer] = inner;
|
||||||
inner_remaps[outer].add (inner);
|
inner_remaps[outer].add (inner);
|
||||||
}
|
}
|
||||||
|
@ -184,10 +186,12 @@ struct index_map_subset_plan_t
|
||||||
|
|
||||||
void remap (const hb_subset_plan_t *plan,
|
void remap (const hb_subset_plan_t *plan,
|
||||||
const DeltaSetIndexMap *input_map,
|
const DeltaSetIndexMap *input_map,
|
||||||
|
const hb_map2_t &outer_remap,
|
||||||
const hb_vector_t<hb_map2_t> &inner_remaps)
|
const hb_vector_t<hb_map2_t> &inner_remaps)
|
||||||
{
|
{
|
||||||
for (unsigned int i = 0; i < max_inners.length; i++)
|
for (unsigned int i = 0; i < max_inners.length; i++)
|
||||||
{
|
{
|
||||||
|
if (inner_remaps[i].get_count () == 0) continue;
|
||||||
unsigned int bit_count = hb_bit_storage (inner_remaps[i][max_inners[i]]);
|
unsigned int bit_count = hb_bit_storage (inner_remaps[i][max_inners[i]]);
|
||||||
if (bit_count > inner_bit_count) inner_bit_count = bit_count;
|
if (bit_count > inner_bit_count) inner_bit_count = bit_count;
|
||||||
}
|
}
|
||||||
|
@ -199,7 +203,7 @@ struct index_map_subset_plan_t
|
||||||
(void)plan->old_gid_for_new_gid (gid, &old_gid);
|
(void)plan->old_gid_for_new_gid (gid, &old_gid);
|
||||||
unsigned int v = input_map->map (old_gid);
|
unsigned int v = input_map->map (old_gid);
|
||||||
unsigned int outer = v >> 16;
|
unsigned int outer = v >> 16;
|
||||||
output_map[gid] = (outer << 16) | (inner_remaps[outer][v & 0xFFFF]);
|
output_map[gid] = (outer_remap[outer] << 16) | (inner_remaps[outer][v & 0xFFFF]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -240,13 +244,14 @@ struct hvarvvar_subset_plan_t
|
||||||
inner_remaps[i].init ();
|
inner_remaps[i].init ();
|
||||||
|
|
||||||
for (unsigned int i = 0; i < index_maps.length; i++)
|
for (unsigned int i = 0; i < index_maps.length; i++)
|
||||||
index_map_plans[i].init (*index_maps[i], inner_remaps, plan);
|
index_map_plans[i].init (*index_maps[i], outer_remap, inner_remaps, plan);
|
||||||
|
|
||||||
|
outer_remap.reorder ();
|
||||||
for (unsigned int i = 0; i < inner_remaps.length; i++)
|
for (unsigned int i = 0; i < inner_remaps.length; i++)
|
||||||
if (inner_remaps[i].get_count () > 0) inner_remaps[i].reorder ();
|
if (inner_remaps[i].get_count () > 0) inner_remaps[i].reorder ();
|
||||||
|
|
||||||
for (unsigned int i = 0; i < index_maps.length; i++)
|
for (unsigned int i = 0; i < index_maps.length; i++)
|
||||||
index_map_plans[i].remap (plan, index_maps[i], inner_remaps);
|
index_map_plans[i].remap (plan, index_maps[i], outer_remap, inner_remaps);
|
||||||
}
|
}
|
||||||
|
|
||||||
void fini (void)
|
void fini (void)
|
||||||
|
@ -255,6 +260,7 @@ struct hvarvvar_subset_plan_t
|
||||||
index_map_plans.fini_deep ();
|
index_map_plans.fini_deep ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
hb_map2_t outer_remap;
|
||||||
hb_vector_t<hb_map2_t> inner_remaps;
|
hb_vector_t<hb_map2_t> inner_remaps;
|
||||||
hb_vector_t<index_map_subset_plan_t>
|
hb_vector_t<index_map_subset_plan_t>
|
||||||
index_map_plans;
|
index_map_plans;
|
||||||
|
@ -294,19 +300,26 @@ struct HVARVVAR
|
||||||
rsbMap.sanitize (c, this));
|
rsbMap.sanitize (c, this));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void listup_index_maps (hb_vector_t<const DeltaSetIndexMap *> &index_maps) const
|
||||||
|
{
|
||||||
|
index_maps.push (&(this+advMap));
|
||||||
|
index_maps.push (&(this+lsbMap));
|
||||||
|
index_maps.push (&(this+rsbMap));
|
||||||
|
}
|
||||||
|
|
||||||
bool serialize_index_maps (hb_serialize_context_t *c,
|
bool serialize_index_maps (hb_serialize_context_t *c,
|
||||||
const hb_array_t<index_map_subset_plan_t> &im_plans)
|
const hb_array_t<index_map_subset_plan_t> &im_plans)
|
||||||
{
|
{
|
||||||
TRACE_SUBSET (this);
|
TRACE_SUBSET (this);
|
||||||
if (im_plans[ADV_INDEX].get_map_count () == 0)
|
if (!im_plans[ADV_INDEX].get_map_count ())
|
||||||
advMap.set (0);
|
advMap.set (0);
|
||||||
else if (unlikely (!advMap.serialize (c, this).serialize (c, im_plans[ADV_INDEX])))
|
else if (unlikely (!advMap.serialize (c, this).serialize (c, im_plans[ADV_INDEX])))
|
||||||
return_trace (false);
|
return_trace (false);
|
||||||
if (im_plans[LSB_INDEX].get_map_count () == 0)
|
if (!im_plans[LSB_INDEX].get_map_count ())
|
||||||
lsbMap.set (0);
|
lsbMap.set (0);
|
||||||
else if (unlikely (!lsbMap.serialize (c, this).serialize (c, im_plans[LSB_INDEX])))
|
else if (unlikely (!lsbMap.serialize (c, this).serialize (c, im_plans[LSB_INDEX])))
|
||||||
return_trace (false);
|
return_trace (false);
|
||||||
if (im_plans[RSB_INDEX].get_map_count () == 0)
|
if (!im_plans[RSB_INDEX].get_map_count ())
|
||||||
rsbMap.set (0);
|
rsbMap.set (0);
|
||||||
else if (unlikely (!rsbMap.serialize (c, this).serialize (c, im_plans[RSB_INDEX])))
|
else if (unlikely (!rsbMap.serialize (c, this).serialize (c, im_plans[RSB_INDEX])))
|
||||||
return_trace (false);
|
return_trace (false);
|
||||||
|
@ -322,9 +335,7 @@ struct HVARVVAR
|
||||||
hb_vector_t<const DeltaSetIndexMap *>
|
hb_vector_t<const DeltaSetIndexMap *>
|
||||||
index_maps;
|
index_maps;
|
||||||
|
|
||||||
index_maps.push (&(this+advMap));
|
((T*)this)->listup_index_maps (index_maps);
|
||||||
index_maps.push (&(this+lsbMap));
|
|
||||||
index_maps.push (&(this+rsbMap));
|
|
||||||
hvar_plan.init (index_maps.as_array (), this+varStore, c->plan);
|
hvar_plan.init (index_maps.as_array (), this+varStore, c->plan);
|
||||||
|
|
||||||
T *out = c->serializer->allocate_min<T> ();
|
T *out = c->serializer->allocate_min<T> ();
|
||||||
|
@ -380,6 +391,26 @@ struct VVAR : HVARVVAR {
|
||||||
vorgMap.sanitize (c, this));
|
vorgMap.sanitize (c, this));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void listup_index_maps (hb_vector_t<const DeltaSetIndexMap *> &index_maps) const
|
||||||
|
{
|
||||||
|
HVARVVAR::listup_index_maps (index_maps);
|
||||||
|
index_maps.push (&(this+vorgMap));
|
||||||
|
}
|
||||||
|
|
||||||
|
bool serialize_index_maps (hb_serialize_context_t *c,
|
||||||
|
const hb_array_t<index_map_subset_plan_t> &im_plans)
|
||||||
|
{
|
||||||
|
TRACE_SUBSET (this);
|
||||||
|
if (unlikely (!HVARVVAR::serialize_index_maps (c, im_plans)))
|
||||||
|
return_trace (false);
|
||||||
|
if (!im_plans[VORG_INDEX].get_map_count ())
|
||||||
|
vorgMap.set (0);
|
||||||
|
else if (unlikely (!vorgMap.serialize (c, this).serialize (c, im_plans[VORG_INDEX])))
|
||||||
|
return_trace (false);
|
||||||
|
|
||||||
|
return_trace (true);
|
||||||
|
}
|
||||||
|
|
||||||
bool subset (hb_subset_context_t *c) const { return HVARVVAR::_subset<VVAR> (c); }
|
bool subset (hb_subset_context_t *c) const { return HVARVVAR::_subset<VVAR> (c); }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
|
@ -202,6 +202,9 @@ _subset_table (hb_subset_plan_t *plan,
|
||||||
case HB_OT_TAG_HVAR:
|
case HB_OT_TAG_HVAR:
|
||||||
result = _subset2<const OT::HVAR> (plan);
|
result = _subset2<const OT::HVAR> (plan);
|
||||||
break;
|
break;
|
||||||
|
case HB_OT_TAG_VVAR:
|
||||||
|
result = _subset2<const OT::VVAR> (plan);
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
hb_blob_t *source_table = hb_face_reference_table (plan->source, tag);
|
hb_blob_t *source_table = hb_face_reference_table (plan->source, tag);
|
||||||
|
|
Loading…
Reference in New Issue