-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ability to configure font features #14157
Conversation
1c7dd41
to
ae398b7
Compare
You can test this PR using the following package version. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your contribution. I have added some comments.
In general, we should try to let Harfbuzz parse features/tags or just copy the parsing logic from HarfBuzzSharp
Something like this should be possible:
<TextElement.FontFeatures>
<FontFeatureCollection>
<FontFeature Tag="liga" Value="0"/>
<FontFeatureCollection>
</TextElement.FontFeatures>
src/Avalonia.Base/Media/TextFormatting/GenericTextRunProperties.cs
Outdated
Show resolved
Hide resolved
src/Avalonia.Base/Media/TextFormatting/GenericTextRunProperties.cs
Outdated
Show resolved
Hide resolved
src/Avalonia.Base/Media/TextFormatting/GenericTextRunProperties.cs
Outdated
Show resolved
Hide resolved
tests/Avalonia.Skia.UnitTests/Media/TextFormatting/TextLineTests.cs
Outdated
Show resolved
Hide resolved
@HermanKirshin Are you able to continue working on this or should I take over? |
@Gillibald Hi! Thanks for the review. Sorry for the delay, I'm a bit overwhelmed by work tasks currently, but assume that will be able to fix this PR on the weekend. But if you prefer to take over I wont mind either. |
I just wanted to make sure this is still being worked on take your time |
f23df82
to
4b05118
Compare
You can test this PR using the following package version. |
@Gillibald Here are the fixes. I squashed commits for cleaner history. |
4b05118
to
6e4fd2f
Compare
You can test this PR using the following package version. |
I have made some adjustments myself but I am not able to push to your fork Here are the changes: https://github.com/AvaloniaUI/Avalonia/tree/pull/14157 |
|
6f26a30
to
63c02d4
Compare
Merged pull/14157 into the fork |
You can test this PR using the following package version. |
63c02d4
to
304dc09
Compare
You can test this PR using the following package version. |
Thank you for your contribution |
What does the pull request do?
Added ability to configure font features.
What is the current behavior?
Default font configuration is used. For example in case of Inter by default it will automatically replace -> with arrow, 'x' between numbers to mathematical multiply sign and numbers are not tabular (this makes tables hardly readable).
See attached screenshot - current behavior is under 'Default'. Actual text specified in TextBlock.Text is
What is the updated/expected behavior with this PR?
Text elements now have property FontFeatures that allow to specify comma-separated feature values that configures the font (feature syntax is for example here). Property can be specified either on Run, or on TextBlock or on TextBox or on container (as attached), absolutely same as other font-related properties like size etc: