Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
FontManager rework #3234
What does the pull request do?
It changes FontManager to be responsible for caching loaded typefaces. Constructing a typeface can a very costly operation so reuse as much as we can is required.
This also changes how the default FontFamily is defined. Now there is a special instance that indicates that the default should be used.
To get the actual default's name a user has to ask the font manager for the name.
This also removes issues with the initialization order of the platform in combination with the font manager.
What is the current behavior?
Currently, there are multiple places where resources related to the font face are cached.
What is the updated/expected behavior with this PR?
The font manager is now responsible for caching font-related resources.
How was the solution implemented (if it's not obvious)?
Typefaces are not constructed by a FontKey that represents a unique combination of (FontFamily, FontWeight, FontStyle) that way we can avoid creating multiple instances.
@Gillibald #3308 is not fixed for direct2d, although proper typeface is resolved( like in the direct2d fotnmanagerimpl unit test) rendering of formattedtext is using system default font.