Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What does the pull request do?
This PR changes the way GlyphTypefaces are cached and makes sure the normal user always uses a cached version.
What is the current behavior?
Currently, a user has to call
FontManager.Current.GetOrAddTypeface
to get a cached Typeface to prevent loading the font multiple times. Most users are not aware of that API and just created Typefaces over and over again. That led to an increased memory footprint and most of the time degraded the overall performance.What is the updated/expected behavior with this PR?
The new way of caching avoids the need to call
FontManager.Current.GetOrAddTypeface
and allows the creation of multiple typefaces that use the same font without loading the actual font multiple times.How was the solution implemented (if it's not obvious)?
Cache GlyphTypeface per Typeface in the FontManager.
Checklist
Breaking changes
Fixed issues