mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
[SkParagraph] Cache the font collection created for use by the Skia text shaper library (flutter/engine#15317)
This commit is contained in:
parent
a6d41c0bbb
commit
dcc0266219
@ -315,19 +315,20 @@ void FontCollection::ClearFontFamilyCache() {
|
||||
|
||||
sk_sp<skia::textlayout::FontCollection>
|
||||
FontCollection::CreateSktFontCollection() {
|
||||
sk_sp<skia::textlayout::FontCollection> skt_collection =
|
||||
sk_make_sp<skia::textlayout::FontCollection>();
|
||||
if (!skt_collection_) {
|
||||
skt_collection_ = sk_make_sp<skia::textlayout::FontCollection>();
|
||||
|
||||
skt_collection->setDefaultFontManager(default_font_manager_,
|
||||
GetDefaultFontFamily().c_str());
|
||||
skt_collection->setAssetFontManager(asset_font_manager_);
|
||||
skt_collection->setDynamicFontManager(dynamic_font_manager_);
|
||||
skt_collection->setTestFontManager(test_font_manager_);
|
||||
if (!enable_font_fallback_) {
|
||||
skt_collection->disableFontFallback();
|
||||
skt_collection_->setDefaultFontManager(default_font_manager_,
|
||||
GetDefaultFontFamily().c_str());
|
||||
skt_collection_->setAssetFontManager(asset_font_manager_);
|
||||
skt_collection_->setDynamicFontManager(dynamic_font_manager_);
|
||||
skt_collection_->setTestFontManager(test_font_manager_);
|
||||
if (!enable_font_fallback_) {
|
||||
skt_collection_->disableFontFallback();
|
||||
}
|
||||
}
|
||||
|
||||
return skt_collection;
|
||||
return skt_collection_;
|
||||
}
|
||||
|
||||
#endif // FLUTTER_ENABLE_SKSHAPER
|
||||
|
||||
@ -107,6 +107,11 @@ class FontCollection : public std::enable_shared_from_this<FontCollection> {
|
||||
fallback_fonts_for_locale_;
|
||||
bool enable_font_fallback_;
|
||||
|
||||
#if FLUTTER_ENABLE_SKSHAPER
|
||||
// An equivalent font collection usable by the Skia text shaper library.
|
||||
sk_sp<skia::textlayout::FontCollection> skt_collection_;
|
||||
#endif
|
||||
|
||||
// Performs the actual work of MatchFallbackFont. The result is cached in
|
||||
// fallback_match_cache_.
|
||||
const std::shared_ptr<minikin::FontFamily>& DoMatchFallbackFont(
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user