[glyf] Remove hardcoded HB_MAX_COMPOSITE_OPERATIONS
This commit is contained in:
parent
36373ee15c
commit
b4a0c30d98
|
@ -347,19 +347,19 @@ _populate_unicodes_to_retain (const hb_set_t *unicodes,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef HB_MAX_COMPOSITE_OPERATIONS
|
#ifndef HB_COMPOSITE_OPERATIONS_PER_GLYPH
|
||||||
#define HB_MAX_COMPOSITE_OPERATIONS 100000
|
#define HB_COMPOSITE_OPERATIONS_PER_GLYPH 64
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static unsigned
|
static unsigned
|
||||||
_glyf_add_gid_and_children (const OT::glyf_accelerator_t &glyf,
|
_glyf_add_gid_and_children (const OT::glyf_accelerator_t &glyf,
|
||||||
hb_codepoint_t gid,
|
hb_codepoint_t gid,
|
||||||
hb_set_t *gids_to_retain,
|
hb_set_t *gids_to_retain,
|
||||||
unsigned depth = 0,
|
int operation_count,
|
||||||
unsigned operation_count = 0)
|
unsigned depth = 0)
|
||||||
{
|
{
|
||||||
if (unlikely (depth++ > HB_MAX_NESTING_LEVEL)) return operation_count;
|
if (unlikely (depth++ > HB_MAX_NESTING_LEVEL)) return operation_count;
|
||||||
if (unlikely (operation_count++ > HB_MAX_COMPOSITE_OPERATIONS)) return operation_count;
|
if (unlikely (--operation_count < 0)) return operation_count;
|
||||||
/* Check if is already visited */
|
/* Check if is already visited */
|
||||||
if (gids_to_retain->has (gid)) return operation_count;
|
if (gids_to_retain->has (gid)) return operation_count;
|
||||||
|
|
||||||
|
@ -370,8 +370,8 @@ _glyf_add_gid_and_children (const OT::glyf_accelerator_t &glyf,
|
||||||
_glyf_add_gid_and_children (glyf,
|
_glyf_add_gid_and_children (glyf,
|
||||||
item.get_glyph_index (),
|
item.get_glyph_index (),
|
||||||
gids_to_retain,
|
gids_to_retain,
|
||||||
depth,
|
operation_count,
|
||||||
operation_count);
|
depth);
|
||||||
|
|
||||||
return operation_count;
|
return operation_count;
|
||||||
}
|
}
|
||||||
|
@ -427,7 +427,8 @@ _populate_gids_to_retain (hb_subset_plan_t* plan,
|
||||||
* composite glyphs. */
|
* composite glyphs. */
|
||||||
if (glyf.has_data ())
|
if (glyf.has_data ())
|
||||||
for (hb_codepoint_t gid : cur_glyphset)
|
for (hb_codepoint_t gid : cur_glyphset)
|
||||||
_glyf_add_gid_and_children (glyf, gid, plan->_glyphset);
|
_glyf_add_gid_and_children (glyf, gid, plan->_glyphset,
|
||||||
|
cur_glyphset.get_population () * HB_COMPOSITE_OPERATIONS_PER_GLYPH);
|
||||||
else
|
else
|
||||||
plan->_glyphset->union_ (cur_glyphset);
|
plan->_glyphset->union_ (cur_glyphset);
|
||||||
#ifndef HB_NO_SUBSET_CFF
|
#ifndef HB_NO_SUBSET_CFF
|
||||||
|
|
Loading…
Reference in New Issue