Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion flow/layers/performance_overlay_layer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,19 @@ sk_sp<SkTextBlob> PerformanceOverlayLayer::MakeStatisticsText(
SkFont font;
sk_sp<SkFontMgr> font_mgr = txt::GetDefaultFontManager();
if (font_path == "") {
font = SkFont(font_mgr->matchFamilyStyle(nullptr, {}), 15);
if (sk_sp<SkTypeface> face = font_mgr->matchFamilyStyle(nullptr, {})) {
font = SkFont(face, 15);
} else {
// In Skia's Android fontmgr, matchFamilyStyle can return null instead
// of falling back to a default typeface. If that's the case, we can use
// legacyMakeTypeface, which *does* use that default typeface.
font = SkFont(font_mgr->legacyMakeTypeface(nullptr, {}), 15);
}
} else {
font = SkFont(font_mgr->makeFromFile(font_path.c_str()), 15);
}
// Make sure there's not an empty typeface returned, or we won't see any text.
FML_DCHECK(font.getTypeface()->countGlyphs() > 0);

double max_ms_per_frame = stopwatch.MaxDelta().ToMillisecondsF();
double average_ms_per_frame = stopwatch.AverageDelta().ToMillisecondsF();
Expand Down