[subset] add a CFF specific accelerator object.

This allows CFF specific accelerator structures to be isolated to the CFF code.
This commit is contained in:
Garret Rieger 2022-11-23 20:51:51 +00:00
parent 73046d53e5
commit 48b6837074
2 changed files with 33 additions and 1 deletions

View File

@ -35,6 +35,10 @@
extern HB_INTERNAL hb_user_data_key_t _hb_subset_accelerator_user_data_key;
namespace CFF {
struct cff_subset_accelerator_t;
}
struct hb_subset_accelerator_t
{
static hb_user_data_key_t* user_data_key()
@ -62,11 +66,17 @@ struct hb_subset_accelerator_t
hb_subset_accelerator_t(const hb_map_t& unicode_to_gid_,
const hb_set_t& unicodes_)
: unicode_to_gid(unicode_to_gid_), unicodes(unicodes_) {}
: unicode_to_gid(unicode_to_gid_), unicodes(unicodes_),
has_seac(false), cff_accelerator(nullptr) {}
// Generic
const hb_map_t unicode_to_gid;
const hb_set_t unicodes;
// CFF
bool has_seac;
CFF::cff_subset_accelerator_t* cff_accelerator;
// TODO(garretrieger): cumulative glyf checksum map
// TODO(garretrieger): sanitized table cache.

View File

@ -402,6 +402,28 @@ struct parsed_cs_str_vec_t : hb_vector_t<parsed_cs_str_t>
typedef hb_vector_t<parsed_cs_str_t> SUPER;
};
struct cff_subset_accelerator_t
{
static cff_subset_accelerator_t* create() {
cff_subset_accelerator_t* accel =
(cff_subset_accelerator_t*) hb_malloc (sizeof(cff_subset_accelerator_t));
new (accel) cff_subset_accelerator_t ();
return accel;
}
static void destroy(void* value) {
if (!value) return;
cff_subset_accelerator_t* accel = (cff_subset_accelerator_t*) value;
accel->~cff_subset_accelerator_t ();
hb_free (accel);
}
parsed_cs_str_t parsed_charstring;
parsed_cs_str_vec_t parsed_global_subrs;
parsed_cs_str_vec_t parsed_local_subrs;
};
struct subr_subset_param_t
{
subr_subset_param_t (parsed_cs_str_t *parsed_charstring_,