Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Merged
Changes from 1 commit
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
Prev Previous commit
temporary flag
  • Loading branch information
LongCatIsLooong committed Mar 14, 2023
commit efe1904c5cc77a059dfcc84270a15ce1549a7677
29 changes: 21 additions & 8 deletions runtime/test_font_data.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1621,23 +1621,36 @@ namespace flutter {
std::vector<sk_sp<SkTypeface>> GetTestFontData() {
std::vector<sk_sp<SkTypeface>> typefaces;
#if EMBED_TEST_FONT_DATA
typefaces.push_back(SkTypeface::MakeFromStream(
SkMemoryStream::MakeDirect(kFlutterTestFont, kFlutterTestFontLength)));
typefaces.push_back(SkTypeface::MakeFromStream(
SkMemoryStream::MakeDirect(kAhemFont, kAhemFontLength)));
const bool defaultsToAhem =
std::getenv("FLUTTER_ROOT") && !std::getenv("USE_FLUTTER_TEST_FONT");
if (defaultsToAhem) {
typefaces.push_back(SkTypeface::MakeFromStream(
SkMemoryStream::MakeDirect(kAhemFont, kAhemFontLength)));
typefaces.push_back(SkTypeface::MakeFromStream(
SkMemoryStream::MakeDirect(kFlutterTestFont, kFlutterTestFontLength)));
} else {
typefaces.push_back(SkTypeface::MakeFromStream(
SkMemoryStream::MakeDirect(kFlutterTestFont, kFlutterTestFontLength)));
typefaces.push_back(SkTypeface::MakeFromStream(
SkMemoryStream::MakeDirect(kAhemFont, kAhemFontLength)));
}
typefaces.push_back(SkTypeface::MakeFromStream(
SkMemoryStream::MakeDirect(kCoughFont, kCoughFontLength)));
#endif // EMBED_TEST_FONT_DATA
return typefaces;
}

std::vector<std::string> GetTestFontFamilyNames() {
#if EMBED_TEST_FONT_DATA
std::vector<std::string> names = {"FlutterTest", "Ahem", "Cough"};
#else // EMBED_TEST_FONT_DATA
std::vector<std::string> names;
#if EMBED_TEST_FONT_DATA
const bool defaultsToAhem =
std::getenv("FLUTTER_ROOT") && !std::getenv("USE_FLUTTER_TEST_FONT");
if (defaultsToAhem) {
names = {"Ahem", "FlutterTest", "Cough"};
} else {
names = {"FlutterTest", "Ahem", "Cough"};
}
#endif // EMBED_TEST_FONT_DATA
return names;
}

} // namespace flutter