-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Typeface simulation fixes #17399
Typeface simulation fixes #17399
Conversation
You can test this PR using the following package version. |
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.
By reading the code I assume that this PR now applies font simulations to embedded fonts? Should we add some render test to ensure we don't regress this?
@@ -12,6 +12,7 @@ namespace Avalonia.Media.Fonts | |||
public abstract class FontCollectionBase : IFontCollection | |||
{ | |||
protected readonly ConcurrentDictionary<string, ConcurrentDictionary<FontCollectionKey, IGlyphTypeface?>> _glyphTypefaceCache = new(); | |||
protected IFontManagerImpl? _fontManager; |
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.
I don't think we should expose such a field publicly (same for _glyphTypefaceCache
above, but that ship has sailed - it should probably be removed in v12).
Instead, TryCreateSynthethicGlyphTypeface()
could be static and take an extra IFontManagerImpl
parameter. Each of SystemFontCollection
and EmbeddedFontCollection
can keep their existing private field.
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.
Y you are right these members should be hidden behind some limited public API
The font collection feature should have been marked unstable because it needed frequent changes.
@@ -80,6 +81,47 @@ IEnumerator IEnumerable.GetEnumerator() | |||
return GetEnumerator(); | |||
} | |||
|
|||
protected bool TryCreateSyntheticGlyphTypeface(IGlyphTypeface glyphTypeface, FontStyle style, FontWeight weight, |
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.
Should probably be private protected
so it isn't part of the public API.
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.
I have moved that method to FontManger and made it internal
43faf03
to
a215d97
Compare
This should no longer have any public API changes |
You can test this PR using the following package version. |
You can test this PR using the following package version. |
You can test this PR using the following package version. |
Co-authored-by: Julien Lebosquain <[email protected]>
What does the pull request do?
This PR ensures the system font collection tries to create a synthetic typeface if no match is found. This matches what the embedded font collection did in the past.
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