From fb58cb4b5ca7043fa746b1a01790abf53bedfa86 Mon Sep 17 00:00:00 2001 From: Garret Rieger Date: Wed, 25 Jul 2018 13:39:17 -0700 Subject: [PATCH] [subset] Only used reachable lookups for gsub closure. --- src/hb-subset-plan.cc | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/hb-subset-plan.cc b/src/hb-subset-plan.cc index 55c4e3f61..125668272 100644 --- a/src/hb-subset-plan.cc +++ b/src/hb-subset-plan.cc @@ -56,11 +56,15 @@ _add_gid_and_children (const OT::glyf::accelerator_t &glyf, static void _gsub_closure (hb_face_t *face, hb_set_t *gids_to_retain) { - // TODO(grieger): This uses all lookups, instead collect - // the set of lookups that are relevant. - // See fontTools implementation. + hb_auto_t lookup_indices; + hb_ot_layout_collect_lookups (face, + HB_OT_TAG_GSUB, + nullptr, + nullptr, + nullptr, + &lookup_indices); hb_ot_layout_lookups_substitute_closure (face, - nullptr, + &lookup_indices, gids_to_retain); }