[subset] fix use of lazy static constructor.
This commit is contained in:
parent
d4c7939eb7
commit
6a149a09e7
|
@ -78,25 +78,11 @@ using OT::Layout::GSUB::GSUB;
|
|||
* retain glyph ids option and configure the subset to pass through the layout tables untouched.
|
||||
*/
|
||||
|
||||
static bool _table_is_empty (const hb_face_t *face, hb_tag_t tag)
|
||||
{
|
||||
hb_blob_t* blob = hb_face_reference_table (face, tag);
|
||||
bool result = (blob == hb_blob_get_empty ());
|
||||
hb_blob_destroy (blob);
|
||||
return result;
|
||||
}
|
||||
|
||||
static unsigned int
|
||||
_get_table_tags (const hb_subset_plan_t* plan,
|
||||
unsigned int start_offset,
|
||||
unsigned int *table_count, /* IN/OUT */
|
||||
hb_tag_t *table_tags /* OUT */)
|
||||
{
|
||||
/*
|
||||
* The list of tables in the open type spec. Used to check for tables that may need handling
|
||||
* if we are unable to list the tables in a face.
|
||||
*/
|
||||
static hb_set_t known_tables {
|
||||
static hb_tag_t known_tables[] {
|
||||
HB_TAG ('a', 'v', 'a', 'r'),
|
||||
HB_OT_TAG_BASE,
|
||||
HB_OT_TAG_CBDT,
|
||||
|
@ -146,9 +132,23 @@ _get_table_tags (const hb_subset_plan_t* plan,
|
|||
HB_OT_TAG_VORG,
|
||||
HB_OT_TAG_VVAR,
|
||||
HB_OT_TAG_name,
|
||||
HB_OT_TAG_OS2,
|
||||
HB_OT_TAG_OS2
|
||||
};
|
||||
|
||||
static bool _table_is_empty (const hb_face_t *face, hb_tag_t tag)
|
||||
{
|
||||
hb_blob_t* blob = hb_face_reference_table (face, tag);
|
||||
bool result = (blob == hb_blob_get_empty ());
|
||||
hb_blob_destroy (blob);
|
||||
return result;
|
||||
}
|
||||
|
||||
static unsigned int
|
||||
_get_table_tags (const hb_subset_plan_t* plan,
|
||||
unsigned int start_offset,
|
||||
unsigned int *table_count, /* IN/OUT */
|
||||
hb_tag_t *table_tags /* OUT */)
|
||||
{
|
||||
unsigned num_tables = hb_face_get_table_tags (plan->source, 0, nullptr, nullptr);
|
||||
if (num_tables)
|
||||
return hb_face_get_table_tags (plan->source, start_offset, table_count, table_tags);
|
||||
|
@ -158,10 +158,11 @@ _get_table_tags (const hb_subset_plan_t* plan,
|
|||
// checking each table type we can handle for existence instead.
|
||||
auto it =
|
||||
hb_concat (
|
||||
+ known_tables.iter ()
|
||||
+ hb_array (known_tables)
|
||||
| hb_filter ([&] (hb_tag_t tag) {
|
||||
return !_table_is_empty (plan->source, tag) && !plan->no_subset_tables->has (tag);
|
||||
}),
|
||||
})
|
||||
| hb_map ([] (hb_tag_t tag) -> hb_tag_t { return tag; }),
|
||||
|
||||
plan->no_subset_tables->iter ()
|
||||
| hb_filter([&] (hb_tag_t tag) {
|
||||
|
|
Loading…
Reference in New Issue