Prevent broken glyph assemblies when font data is incorrect (#6688)

This commit is contained in:
Max 2025-08-01 10:55:37 +00:00 committed by GitHub
parent ef862654c2
commit cd1a786539
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 12 additions and 1 deletions

View File

@ -739,7 +739,9 @@ fn assemble(
}
advance -= max_overlap;
growable += max_overlap - min_overlap;
// In case we have that max_overlap < min_overlap, ensure we
// don't decrease the value of growable.
growable += (max_overlap - min_overlap).max(Abs::zero());
}
full += advance;

Binary file not shown.

After

Width:  |  Height:  |  Size: 585 B

View File

@ -91,3 +91,12 @@ $ body^"text" $
}
$body^"long text"$
}
--- math-stretch-min-overlap-exceeds-max ---
// Test that glyph assembly doesn't end up with negative lengths if the max
// overlap calculated is less than the minConnectorOverlap.
#show math.equation: set text(font: "STIX Two Math")
// Warning: glyph has assembly parts with overlap less than minConnectorOverlap
// Hint: its rendering may appear broken - this is probably a font bug
// Hint: please file an issue at https://github.com/typst/typst/issues
$ stretch(->)^"Gauss-Jordan Elimination" $