Skip to content

Add boundary check to HarfBuzzTextShaper#20716

Merged
MrJul merged 2 commits intoAvaloniaUI:masterfrom
irihitech:harfbuzz-shaper
Feb 20, 2026
Merged

Add boundary check to HarfBuzzTextShaper#20716
MrJul merged 2 commits intoAvaloniaUI:masterfrom
irihitech:harfbuzz-shaper

Conversation

@rabbitism
Copy link
Contributor

@rabbitism rabbitism commented Feb 19, 2026

What does the pull request do?

Add a basic boundary check, so empty string won't trigger index out of boundary exception.

What is the current behavior?

Shaping an empty text will throw execption

What is the updated/expected behavior with this PR?

How was the solution implemented (if it's not obvious)?

Checklist

Breaking changes

Obsoletions / Deprecations

Fixed issues

Currently there seems no unit test associated with text shapers. please let me know if you need any.

@Gillibald
Copy link
Contributor

Let's cover this with a unit test. We might be able to return earlier, so we do not create an HfBuffer.

@avaloniaui-bot
Copy link

You can test this PR using the following package version. 12.0.999-cibuild0062355-alpha. (feed url: https://nuget-feed-all.avaloniaui.net/v3/index.json) [PRBUILDID]

@rabbitism
Copy link
Contributor Author

woops turns out it's prettt hard to mock a glyph typeface :(

@Gillibald
Copy link
Contributor

Gillibald commented Feb 19, 2026

The point is, you do not need to mock a GlyphTypeface. Our headless tests use actual font files.

https://github.com/AvaloniaUI/Avalonia/blob/master/tests/Avalonia.Base.UnitTests/Media/Fonts/Tables/HeadTableTests.cs#L24

@avaloniaui-bot
Copy link

You can test this PR using the following package version. 12.0.999-cibuild0062361-alpha. (feed url: https://nuget-feed-all.avaloniaui.net/v3/index.json) [PRBUILDID]

Copy link
Contributor

@Gillibald Gillibald left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM Thanks

@MrJul MrJul added this pull request to the merge queue Feb 20, 2026
Merged via the queue into AvaloniaUI:master with commit c9d6efb Feb 20, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

Comments