From 69913e012e6031ea614f43f6088ae99907ce2427 Mon Sep 17 00:00:00 2001 From: Garret Rieger Date: Fri, 29 Jul 2022 20:45:56 +0000 Subject: [PATCH] [repacker] Update repacker api method to take a table tag. This is needed to allow table specific optimizations to be performed during repacking. --- src/hb-subset-repacker.cc | 10 ++++++++-- src/hb-subset-repacker.h | 3 ++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/hb-subset-repacker.cc b/src/hb-subset-repacker.cc index 99dc69b4e..55ca48d70 100644 --- a/src/hb-subset-repacker.cc +++ b/src/hb-subset-repacker.cc @@ -25,18 +25,24 @@ #include "hb-repacker.hh" #ifdef HB_EXPERIMENTAL_API + /** * hb_subset_repack_or_fail: + * @table_tag: tag of the table being packed, needed to allow table specific optimizations. * @hb_objects: raw array of struct hb_object_t, which provides * object graph info * @num_hb_objs: number of hb_object_t in the hb_objects array. * * Given the input object graph info, repack a table to eliminate * offset overflows. A nullptr is returned if the repacking attempt fails. + * Table specific optimizations (eg. extension promotion in GSUB/GPOS) may be performed. + * Passing HB_TAG_NONE will disable table specific optimizations. * * Since: EXPERIMENTAL **/ -hb_blob_t* hb_subset_repack_or_fail (hb_object_t* hb_objects, unsigned num_hb_objs) +hb_blob_t* hb_subset_repack_or_fail (hb_tag_t table_tag, + hb_object_t* hb_objects, + unsigned num_hb_objs) { hb_vector_t packed; packed.alloc (num_hb_objs + 1); @@ -45,7 +51,7 @@ hb_blob_t* hb_subset_repack_or_fail (hb_object_t* hb_objects, unsigned num_hb_ob packed.push (&(hb_objects[i])); return hb_resolve_overflows (packed, - HB_OT_TAG_GSUB, + table_tag, 20, true); } diff --git a/src/hb-subset-repacker.h b/src/hb-subset-repacker.h index e28f87936..245cf6076 100644 --- a/src/hb-subset-repacker.h +++ b/src/hb-subset-repacker.h @@ -70,7 +70,8 @@ struct hb_object_t typedef struct hb_object_t hb_object_t; HB_EXTERN hb_blob_t* -hb_subset_repack_or_fail (hb_object_t* hb_objects, +hb_subset_repack_or_fail (hb_tag_t table_tag, + hb_object_t* hb_objects, unsigned num_hb_objs); #endif