This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Make GetDefaultFontFamilies return a vector<string> instead of a string.#16928
Merged
gspencergoog merged 4 commits intoflutter:masterfrom Mar 4, 2020
Merged
Make GetDefaultFontFamilies return a vector<string> instead of a string.#16928gspencergoog merged 4 commits intoflutter:masterfrom
gspencergoog merged 4 commits intoflutter:masterfrom
Conversation
e2d581f to
859b851
Compare
859b851 to
1019b90
Compare
Contributor
Author
|
/cc @stuartmorgan |
|
|
||
| skt_collection_->setDefaultFontManager(default_font_manager_, | ||
| GetDefaultFontFamily().c_str()); | ||
| GetDefaultFontFamilies()[0].c_str()); |
Member
There was a problem hiding this comment.
The SkParagraph FontCollection API in Skia will need to be extended to handle multiple default fonts. I'll look into this.
Contributor
Author
There was a problem hiding this comment.
Yeah, I wasn't sure what to do about that yet, so I just punted and provided the first one. I suppose I could do a similar thing to what I did above and just supply the first existing one.
| FindFontFamilyInManagers(family); | ||
| if (minikin_family != nullptr) { | ||
| minikin_families.push_back(minikin_family); | ||
| } |
Member
There was a problem hiding this comment.
Exit the loop here. It should be sufficient to provide the first available default font instead of merging all available default fonts.
Contributor
Author
There was a problem hiding this comment.
Oh, good point! Done.
jason-simmons
approved these changes
Mar 4, 2020
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/flutter
that referenced
this pull request
Mar 5, 2020
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
On Linux, there is rarely just one default font that can reasonably be expected to be on the platform. This PR changes the
GetDefaultFontFamilycall to beGetDefaultFontFamilies, and it now returns avector<string>so that the font collection code can look up all of them, and if any of them exist, add them to the fallback list.For Linux, I supplied the list "Ubuntu", "Cantarell", "DejaVu Sans", "Liberation Sans", and "Arial", which should cover a large proportion of linux machines. For the other platforms, I supplied a list of length one, containing the one fallback font that used to be defined. On Windows, I added "Segoe UI" as a default, since that is the default system font on newer Windows.
The goal of this function is to provide at least one font family that is installed, since otherwise linux (or any platform) will just have no font at all if the default font isn't found.