Skip to content

Conversation

@Gillibald
Copy link
Contributor

@Gillibald Gillibald commented Nov 25, 2025

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:

  • Adds a FontFamilyMappings property to IFontManagerImpl2 that 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.TryGetGlyphTypeface to use these mappings to cache typefaces under both the requested and actual family names

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

Copy link
Contributor

Copilot AI left a 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 FontFamilyMappings property to IFontManagerImpl2 that 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.TryGetGlyphTypeface to 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.

@IsaMorphic
Copy link
Contributor

IsaMorphic commented Dec 1, 2025

Fixes #20190.

@Gillibald
Copy link
Contributor Author

Superseeded by: #19852

@Gillibald Gillibald closed this Dec 2, 2025
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.

2 participants