mirror of
https://github.com/storytold/harfbuzz.git
synced 2026-11-23 07:51:10 +01:00
[trak] Saturate tracking advances
AAT tracking adds the selected tracking value to the first glyph of each grapheme. Saturate horizontal and vertical advance updates so an extreme scale or repeated application cannot overflow hb_position_t. This is part of the complete position-overflow fix for issue #6151. Testing: meson test -C build --print-errorlogs Assisted-by: Codex <codex@openai.com>
This commit is contained in:
1 parent
d9bd6e9895
commit
91b07e93d4
1 file changed
+2
-2
@@ -230,13 +230,13 @@ struct trak
|
||||
{
|
||||
hb_position_t advance_to_add = get_h_tracking (c->font, track);
|
||||
foreach_grapheme (buffer, start, end)
|
||||
buffer->pos[start].x_advance += advance_to_add;
|
||||
buffer->pos[start].x_advance = hb_saturate_add (buffer->pos[start].x_advance, advance_to_add);
|
||||
}
|
||||
else
|
||||
{
|
||||
hb_position_t advance_to_add = get_v_tracking (c->font, track);
|
||||
foreach_grapheme (buffer, start, end)
|
||||
buffer->pos[start].y_advance += advance_to_add;
|
||||
buffer->pos[start].y_advance = hb_saturate_add (buffer->pos[start].y_advance, advance_to_add);
|
||||
}
|
||||
|
||||
return_trace (true);
|
||||
|
||||
Reference in new issue
Block a user