[repacker] count subtable size in each group of consecutive layers for extension promotion decisions.
Enforce that the following groups are all <64k in size:
- LookupList + Lookups
- Lookups + SubTables
- SubTables + Descendants
diff --git a/src/graph/graph.hh b/src/graph/graph.hh
index 5c5b5a4..f760448 100644
--- a/src/graph/graph.hh
+++ b/src/graph/graph.hh
@@ -484,15 +484,18 @@
find_subgraph (link.objidx, subgraph);
}
- size_t find_subgraph_size (unsigned node_idx, hb_set_t& subgraph)
+ size_t find_subgraph_size (unsigned node_idx, hb_set_t& subgraph, unsigned max_depth = -1)
{
if (subgraph.has (node_idx)) return 0;
subgraph.add (node_idx);
const auto& o = vertices_[node_idx].obj;
size_t size = o.tail - o.head;
+ if (max_depth == 0)
+ return size;
+
for (const auto& link : o.all_links ())
- size += find_subgraph_size (link.objidx, subgraph);
+ size += find_subgraph_size (link.objidx, subgraph, max_depth - 1);
return size;
}