Skip to content

Conversation

@Gillibald
Copy link
Contributor

@Gillibald Gillibald commented Aug 21, 2025

What does the pull request do?

This PR removes the combining mark category from the list of categories that are treated as whitespace. Therefore, combining marks are now used to find a matching font and are properly displayed if no other base character is present.

This also changes the font matching logic so it tries to find a match on a grapheme boundary instead of a codepoint boundary. This makes the IsWhitespace check redundant and we solely rely on graphemes.

What is the current behavior?

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

@Gillibald Gillibald changed the title Do not treat spacing combining marks as whitespace [WIP] Do not treat spacing combining marks as whitespace Aug 21, 2025
@Gillibald Gillibald added bug backport-candidate-11.3.x Consider this PR for backporting to 11.3 branch labels Aug 21, 2025
Try to find a matching typeface on a grapheme boundary
@Gillibald Gillibald changed the title [WIP] Do not treat spacing combining marks as whitespace [WIP] Do not treat combining marks as whitespace Aug 21, 2025
@kerams
Copy link
Contributor

kerams commented Aug 21, 2025

Does it mean a combining mark present in one font will be able to properly combine with a base letter in another font? Think I had a problem with this in the past.

@avaloniaui-bot
Copy link

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

@Gillibald
Copy link
Contributor Author

Does it mean a combining mark present in one font will be able to combine with a base letter in another font properly? Think I had a problem with this in the past.

No. A combining mark is usually positioned in combination with a base character. So you always want to share the same font. If there is no base character, the combining mark can be rendered with a different font.

@Gillibald Gillibald changed the title [WIP] Do not treat combining marks as whitespace Do not treat combining marks as whitespace Aug 21, 2025
@avaloniaui-bot
Copy link

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

@Gillibald Gillibald changed the title Do not treat combining marks as whitespace [WIP] Do not treat combining marks as whitespace Aug 21, 2025
@avaloniaui-bot
Copy link

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

@Gillibald Gillibald changed the title [WIP] Do not treat combining marks as whitespace Do not treat combining marks as whitespace Aug 21, 2025
Copy link
Member

@MrJul MrJul left a comment

Choose a reason for hiding this comment

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

LGTM!

@MrJul MrJul added this pull request to the merge queue Aug 21, 2025
Merged via the queue into AvaloniaUI:master with commit da52b72 Aug 21, 2025
11 checks passed
@MrJul MrJul mentioned this pull request Aug 21, 2025
3 tasks
@Gillibald Gillibald deleted the fixes/fontMatchingSpacingCombiningMark branch August 22, 2025 06:52
Gillibald added a commit that referenced this pull request Aug 29, 2025
* Do not treat spacing combining marks as whitespace

* Do not treat combining marks as whitespace
Try to find a matching typeface on a grapheme boundary

* Add embedded font for testing

* Remove using

* Fix naming and remove redundant code

* Apply default until we reach the next base character
@Gillibald Gillibald added backported-11.3.x and removed backport-candidate-11.3.x Consider this PR for backporting to 11.3 branch labels Aug 29, 2025
@miloush
Copy link
Contributor

miloush commented Sep 1, 2025

Relevant: dotnet/wpf#6857

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.

5 participants