This repository was archived by the owner on Feb 25, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -76,10 +76,19 @@ sk_sp<SkTextBlob> PerformanceOverlayLayer::MakeStatisticsText(
76
76
SkFont font;
77
77
sk_sp<SkFontMgr> font_mgr = txt::GetDefaultFontManager ();
78
78
if (font_path == " " ) {
79
- font = SkFont (font_mgr->matchFamilyStyle (nullptr , {}), 15 );
79
+ if (sk_sp<SkTypeface> face = font_mgr->matchFamilyStyle (nullptr , {})) {
80
+ font = SkFont (face, 15 );
81
+ } else {
82
+ // In Skia's Android fontmgr, matchFamilyStyle can return null instead
83
+ // of falling back to a default typeface. If that's the case, we can use
84
+ // legacyMakeTypeface, which *does* use that default typeface.
85
+ font = SkFont (font_mgr->legacyMakeTypeface (nullptr , {}), 15 );
86
+ }
80
87
} else {
81
88
font = SkFont (font_mgr->makeFromFile (font_path.c_str ()), 15 );
82
89
}
90
+ // Make sure there's not an empty typeface returned, or we won't see any text.
91
+ FML_DCHECK (font.getTypeface ()->countGlyphs () > 0 );
83
92
84
93
double max_ms_per_frame = stopwatch.MaxDelta ().ToMillisecondsF ();
85
94
double average_ms_per_frame = stopwatch.AverageDelta ().ToMillisecondsF ();
You can’t perform that action at this time.
0 commit comments