This repository was archived by the owner on Feb 25, 2025. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -37,7 +37,7 @@ AssetFontStyleSet* AssetDataProvider::MatchFamily(
3737 if (found == registered_families_.end ()) {
3838 return nullptr ;
3939 }
40- return &found->second ;
40+ return SkRef ( &found->second ) ;
4141}
4242
4343void AssetDataProvider::RegisterTypeface (sk_sp<SkTypeface> typeface) {
Original file line number Diff line number Diff line change @@ -31,7 +31,7 @@ SkTypeface* AssetFontStyleSet::createTypeface(int index) {
3131 if (index_cast >= typefaces_.size ()) {
3232 return nullptr ;
3333 }
34- return typefaces_[index_cast].get ();
34+ return SkRef ( typefaces_[index_cast].get () );
3535}
3636
3737SkTypeface* AssetFontStyleSet::matchStyle (const SkFontStyle& pattern) {
@@ -42,7 +42,7 @@ SkTypeface* AssetFontStyleSet::matchStyle(const SkFontStyle& pattern) {
4242 if (typeface->fontStyle () == pattern)
4343 return typeface.get ();
4444
45- return typefaces_[0 ].get ();
45+ return SkRef ( typefaces_[0 ].get () );
4646}
4747
4848} // namespace txt
Original file line number Diff line number Diff line change @@ -100,7 +100,7 @@ FontCollection::GetMinikinFontCollectionForFamily(const std::string& family) {
100100 }
101101
102102 for (sk_sp<SkFontMgr>& manager : GetFontManagerOrder ()) {
103- auto font_style_set = manager->matchFamily (family.c_str ());
103+ sk_sp<SkFontStyleSet> font_style_set ( manager->matchFamily (family.c_str () ));
104104 if (font_style_set == nullptr || font_style_set->count () == 0 ) {
105105 continue ;
106106 }
@@ -111,8 +111,8 @@ FontCollection::GetMinikinFontCollectionForFamily(const std::string& family) {
111111 for (int i = 0 , style_count = font_style_set->count (); i < style_count;
112112 ++i) {
113113 // Create the skia typeface.
114- auto skia_typeface =
115- sk_ref_sp <SkTypeface>(font_style_set->createTypeface (i));
114+ sk_sp<SkTypeface> skia_typeface (
115+ sk_sp <SkTypeface>(font_style_set->createTypeface (i) ));
116116 if (skia_typeface == nullptr ) {
117117 continue ;
118118 }
You can’t perform that action at this time.
0 commit comments