mirror of
https://github.com/storytold/harfbuzz.git
synced 2026-11-26 01:11:25 +01:00
[repacker] Reset graph state before assigning spaces
Overflow resolution can retry GSUB/GPOS specialization on an already modified graph. Clear derived space and priority state before assigning spaces again so retries do not accumulate stale space identifiers. Use the full signed range available to the packed distance key instead of saturating valid distances as the number of spaces grows. Assisted-by: OpenAI Codex <codex@openai.com>
This commit is contained in:
1 parent
22248564c1
commit
4cf1474dfa
1 file changed
+13
-1
+13
-1
@@ -476,7 +476,8 @@ struct graph_t
|
||||
// it's parent where possible.
|
||||
|
||||
int64_t modified_distance =
|
||||
hb_clamp (distance + distance_modifier (), (int64_t) 0, 0x7FFFFFFFFFF);
|
||||
hb_clamp (distance + distance_modifier (), (int64_t) 0,
|
||||
hb_int_max (int64_t) >> 18);
|
||||
if (has_max_priority ()) {
|
||||
modified_distance = 0;
|
||||
}
|
||||
@@ -938,6 +939,17 @@ public:
|
||||
{
|
||||
TRY (update_parents ());
|
||||
|
||||
for (auto& vertex : vertices_.writer ())
|
||||
{
|
||||
vertex.space = 0;
|
||||
vertex.priority = 0;
|
||||
}
|
||||
num_roots_for_space_.resize (1);
|
||||
TRY (graph_result_t<void>::from (num_roots_for_space_, ALLOCATION_FAILURE));
|
||||
num_roots_for_space_[0] = 1;
|
||||
distance_invalid = true;
|
||||
positions_invalid = true;
|
||||
|
||||
hb_set_t visited;
|
||||
hb_set_t roots;
|
||||
TRY (find_space_roots (visited, roots));
|
||||
|
||||
Reference in new issue
Block a user