From 4fa5788cfd068fa694b91e01b74a7c818c41bbac Mon Sep 17 00:00:00 2001 From: Garret Rieger Date: Tue, 8 Jul 2025 21:29:48 +0000 Subject: [PATCH] [repacker] fix bug with original count in liga splitting. --- src/graph/ligature-graph.hh | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/src/graph/ligature-graph.hh b/src/graph/ligature-graph.hh index 85fb0644e..3c837335c 100644 --- a/src/graph/ligature-graph.hh +++ b/src/graph/ligature-graph.hh @@ -77,11 +77,25 @@ struct LigatureSubstFormat1 : public OT::Layout::GSUB_impl::LigatureSubstFormat1 c, this, c.graph.duplicate_if_shared (parent_index, this_index), + total_number_ligas(c, this_index), }; return actuate_subtable_split (split_context, split_points); } private: + unsigned total_number_ligas(gsubgpos_graph_context_t& c, unsigned this_index) const { + unsigned total = 0; + for (unsigned i = 0; i < ligatureSet.len; i++) + { + auto liga_set = c.graph.as_table(this_index, &ligatureSet[i]); + if (!liga_set.table) { + return 0; + } + total += liga_set.table->ligature.len; + } + return total; + } + hb_vector_t compute_split_points(gsubgpos_graph_context_t& c, unsigned parent_index, unsigned this_index) const @@ -137,19 +151,11 @@ struct LigatureSubstFormat1 : public OT::Layout::GSUB_impl::LigatureSubstFormat1 gsubgpos_graph_context_t& c; LigatureSubstFormat1* thiz; unsigned this_index; + unsigned original_count_; unsigned original_count () { - unsigned total = 0; - for (unsigned i = 0; i < thiz->ligatureSet.len; i++) - { - auto liga_set = c.graph.as_table(this_index, &thiz->ligatureSet[i]); - if (!liga_set.table) { - return 0; - } - total += liga_set.table->ligature.len; - } - return total; + return original_count_; } unsigned clone_range (unsigned start, unsigned end)