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

Simplify Typeface usage #4627

Merged
merged 6 commits into from Sep 10, 2020
Merged

Conversation

Gillibald
Copy link
Contributor

@Gillibald Gillibald commented Sep 8, 2020

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

@Gillibald Gillibald changed the title [WIP] Make sure GlyphTypefaces are always cached Simplify Typeface usage Sep 9, 2020
Copy link
Member

@danwalmsley danwalmsley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants