This repository was archived by the owner on Feb 25, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6k
Make GetDefaultFontFamilies return a vector<string> instead of a string. #16928
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -150,11 +150,14 @@ FontCollection::GetMinikinFontCollectionForFamilies( | |
| } | ||
| // Search for default font family if no user font families were found. | ||
| if (minikin_families.empty()) { | ||
| const auto default_font_family = GetDefaultFontFamily(); | ||
| std::shared_ptr<minikin::FontFamily> minikin_family = | ||
| FindFontFamilyInManagers(default_font_family); | ||
| if (minikin_family != nullptr) { | ||
| minikin_families.push_back(minikin_family); | ||
| const auto default_font_families = GetDefaultFontFamilies(); | ||
| for (auto family : default_font_families) { | ||
| std::shared_ptr<minikin::FontFamily> minikin_family = | ||
| FindFontFamilyInManagers(family); | ||
| if (minikin_family != nullptr) { | ||
| minikin_families.push_back(minikin_family); | ||
| break; | ||
| } | ||
| } | ||
| } | ||
| // Default font family also not found. We fail to get a FontCollection. | ||
|
|
@@ -319,7 +322,7 @@ FontCollection::CreateSktFontCollection() { | |
| skt_collection_ = sk_make_sp<skia::textlayout::FontCollection>(); | ||
|
|
||
| skt_collection_->setDefaultFontManager(default_font_manager_, | ||
| GetDefaultFontFamily().c_str()); | ||
| GetDefaultFontFamilies()[0].c_str()); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 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. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 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. |
||
| skt_collection_->setAssetFontManager(asset_font_manager_); | ||
| skt_collection_->setDynamicFontManager(dynamic_font_manager_); | ||
| skt_collection_->setTestFontManager(test_font_manager_); | ||
|
|
||
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
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
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
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
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
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
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
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
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.
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.
Exit the loop here. It should be sufficient to provide the first available default font instead of merging all available default fonts.
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.
Oh, good point! Done.