Skip to content
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

Add TypographicFamilyName to GlyphTypeface and use it for FontCollection #16844

Merged
merged 3 commits into from
Aug 30, 2024

Conversation

Gillibald
Copy link
Contributor

@Gillibald Gillibald commented Aug 28, 2024

What does the pull request do?

Font files have a primary family name which might include some typeface name (like "Light" or "Bold") as we can see in the XAML below. In addition to that there is a typographic family name which groups all these fonts so then can be resolved with the primary name (in the XAML below that is "Manrope").

This PR adds TypographicFamilyName to the IGlyphTypeface2 interface and uses it in the FontCollection implementations to load fonts via their TypographicFamilyName instead of the regular FamilyName which might include the weight name.

Using this PR users can write e.g, "Manrope" and the font manager will resolve the family name. Previously the font manager wasn't aware of the typographic family name and therefore wasn't able to resolve the expected typeface.

See #16607 for further information about the spec.

What is the current behavior?

What is the updated/expected behavior with this PR?

<StackPanel>
       <TextBlock FontFamily="/#Manrope" Text="Manrope Light" FontWeight="Light"/>
       <TextBlock FontFamily="/#Manrope" Text="Manrope" FontWeight="Normal"/>
       <TextBlock FontFamily="/#Manrope" Text="Manrope Medium" FontWeight="Medium"/>
       <TextBlock FontFamily="/#Manrope" Text="Manrope SemiBold" FontWeight="SemiBold"/>
       <TextBlock FontFamily="/#Manrope" Text="Manrope Bold" FontWeight="Bold"/>
</StackPanel>

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

Checklist

Breaking changes

Obsoletions / Deprecations

Fixed issues

Fixes: #16607

@avaloniaui-bot
Copy link

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

@maxkatz6 maxkatz6 added the bug label Aug 30, 2024
@grokys grokys added this pull request to the merge queue Aug 30, 2024
@grokys grokys added backport-candidate-11.1.x Consider this PR for backporting to 11.1 branch customer-priority Issue reported by a customer with a support agreement. labels Aug 30, 2024
Merged via the queue into AvaloniaUI:master with commit 4f2dd67 Aug 30, 2024
11 checks passed
@Gillibald Gillibald deleted the fixes/glyphTypefaceNameing branch September 2, 2024 09:18
@grokys grokys removed the backport-candidate-11.1.x Consider this PR for backporting to 11.1 branch label Oct 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug customer-priority Issue reported by a customer with a support agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

GlyphTypeface.Name does not represents the correct family name for extended families
4 participants