[instancer] add composite_new_gids set in subset plan

This is only used by iup delta optimization where we need to know
whether glyph is composite or not
pull/4563/head
Qunxin Liu 1 year ago
parent a3e3473cc8
commit 52c3cda31b
  1. 3
      src/OT/glyf/CompositeGlyph.hh
  2. 3
      src/OT/glyf/Glyph.hh
  3. 3
      src/hb-subset-plan-member-list.hh
  4. 11
      src/hb-subset-plan.cc

@ -240,7 +240,8 @@ struct CompositeGlyphRecord
}
if (is_anchored ()) tx = ty = 0;
trans.init ((float) tx, (float) ty);
/* set is_end_point flag to true, used by IUP delta optimization */
trans.init ((float) tx, (float) ty, true);
{
const F2DOT14 *points = (const F2DOT14 *) p;

@ -103,6 +103,9 @@ struct Glyph
}
}
bool is_composite () const
{ return type == COMPOSITE; }
bool get_all_points_without_var (const hb_face_t *face,
contour_point_vector_t &points /* OUT */) const
{

@ -140,6 +140,9 @@ HB_SUBSET_PLAN_MEMBER (mutable hb_vector_t<unsigned>, bounds_height_vec)
//map: new_gid -> contour points vector
HB_SUBSET_PLAN_MEMBER (mutable hb_hashmap_t E(<hb_codepoint_t, contour_point_vector_t>), new_gid_contour_points_map)
//new gids set for composite glyphs
HB_SUBSET_PLAN_MEMBER (hb_set_t, composite_new_gids)
#ifdef HB_EXPERIMENTAL_API
// name table overrides map: hb_ot_name_record_ids_t-> name string new value or
// None to indicate should remove

@ -1073,8 +1073,8 @@ _update_instance_metrics_map_from_cff2 (hb_subset_plan_t *plan)
static bool
_get_instance_glyphs_contour_points (hb_subset_plan_t *plan)
{
/* contour_points vector only needed for updating gvar table (infer delta)
* during partial instancing */
/* contour_points vector only needed for updating gvar table (infer delta and
* iup delta optimization) during partial instancing */
if (plan->user_axes_location.is_empty () || plan->all_axes_pinned)
return true;
@ -1092,10 +1092,15 @@ _get_instance_glyphs_contour_points (hb_subset_plan_t *plan)
}
hb_codepoint_t old_gid = _.second;
if (unlikely (!glyf.glyph_for_gid (old_gid).get_all_points_without_var (plan->source, all_points)))
auto glyph = glyf.glyph_for_gid (old_gid);
if (unlikely (!glyph.get_all_points_without_var (plan->source, all_points)))
return false;
if (unlikely (!plan->new_gid_contour_points_map.set (new_gid, all_points)))
return false;
/* composite new gids are only needed by iup delta optimization */
if ((plan->flags & HB_SUBSET_FLAGS_IUP_DELTA_OPT) && glyph.is_composite ())
plan->composite_new_gids.add (new_gid);
}
return true;
}

Loading…
Cancel
Save