File tree Expand file tree Collapse file tree 2 files changed +17
-11
lines changed Expand file tree Collapse file tree 2 files changed +17
-11
lines changed Original file line number Diff line number Diff line change @@ -315,19 +315,20 @@ void FontCollection::ClearFontFamilyCache() {
315315
316316sk_sp<skia::textlayout::FontCollection>
317317FontCollection::CreateSktFontCollection () {
318- sk_sp<skia::textlayout::FontCollection> skt_collection =
319- sk_make_sp<skia::textlayout::FontCollection>();
320-
321- skt_collection->setDefaultFontManager (default_font_manager_,
322- GetDefaultFontFamily ().c_str ());
323- skt_collection->setAssetFontManager (asset_font_manager_);
324- skt_collection->setDynamicFontManager (dynamic_font_manager_);
325- skt_collection->setTestFontManager (test_font_manager_);
326- if (!enable_font_fallback_) {
327- skt_collection->disableFontFallback ();
318+ if (!skt_collection_) {
319+ skt_collection_ = sk_make_sp<skia::textlayout::FontCollection>();
320+
321+ skt_collection_->setDefaultFontManager (default_font_manager_,
322+ GetDefaultFontFamily ().c_str ());
323+ skt_collection_->setAssetFontManager (asset_font_manager_);
324+ skt_collection_->setDynamicFontManager (dynamic_font_manager_);
325+ skt_collection_->setTestFontManager (test_font_manager_);
326+ if (!enable_font_fallback_) {
327+ skt_collection_->disableFontFallback ();
328+ }
328329 }
329330
330- return skt_collection ;
331+ return skt_collection_ ;
331332}
332333
333334#endif // FLUTTER_ENABLE_SKSHAPER
Original file line number Diff line number Diff line change @@ -107,6 +107,11 @@ class FontCollection : public std::enable_shared_from_this<FontCollection> {
107107 fallback_fonts_for_locale_;
108108 bool enable_font_fallback_;
109109
110+ #if FLUTTER_ENABLE_SKSHAPER
111+ // An equivalent font collection usable by the Skia text shaper library.
112+ sk_sp<skia::textlayout::FontCollection> skt_collection_;
113+ #endif
114+
110115 // Performs the actual work of MatchFallbackFont. The result is cached in
111116 // fallback_match_cache_.
112117 const std::shared_ptr<minikin::FontFamily>& DoMatchFallbackFont (
You can’t perform that action at this time.
0 commit comments