-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
[WIP] Expose platform FontFamilyMappings #20140
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
[WIP] Expose platform FontFamilyMappings #20140
Conversation
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.
Pull request overview
This PR introduces a mechanism to track and expose font family name mappings when the platform font manager returns a different font family than the one requested. This handles cases where font names are aliases or when the system provides alternative fonts.
Key changes:
- Adds a
FontFamilyMappingsproperty toIFontManagerImpl2that exposes a read-only dictionary of requested font names to actual resolved font names - Implements automatic detection and caching of font aliases when the platform returns a different font family than requested
- Modifies
SystemFontCollection.TryGetGlyphTypefaceto use these mappings to cache typefaces under both the requested and actual family names
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| src/Skia/Avalonia.Skia/FontManagerImpl.cs | Adds _fontFamilyMappings dictionary, implements FontFamilyMappings property, caches installed font names, and populates mappings when platform returns different font family names |
| src/Avalonia.Base/Platform/IFontManagerImpl.cs | Adds FontFamilyMappings property to IFontManagerImpl2 interface |
| src/Avalonia.Base/Media/Fonts/SystemFontCollection.cs | Removes early cache check and adds logic to use font family mappings to cache typefaces under requested alias names |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Fixes #20190. |
|
Superseeded by: #19852 |
What does the pull request do?
This PR introduces a mechanism to track and expose font family name mappings when the platform font manager returns a different font family than the one requested. This handles cases where font names are aliases or when the system provides alternative fonts.
Key changes:
FontFamilyMappingsproperty toIFontManagerImpl2that exposes a read-only dictionary of requested font names to actual resolved font namesSystemFontCollection.TryGetGlyphTypefaceto use these mappings to cache typefaces under both the requested and actual family namesWhat 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