[web] Adds Noto Music fallback font (flutter/engine#46720)

Adds `Noto Music` font as a fallback font, and updates DEPS and font definitions after running the font roller script.

### Issues

Fixes: https://github.com/flutter/devtools/issues/6149

----

![](https://media.giphy.com/media/3ohzAv6kdQ4tukSNK8/giphy-downsized.gif)

I used [the developer API](https://developers.google.com/fonts/docs/developer_api?apix_params=%7B%22family%22%3A%5B%22Noto%20Music%22%5D%7D) to make sure the api works with this font.

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
This commit is contained in:
Daniel Chevalier 2023-10-11 16:46:16 -04:00 committed by GitHub
parent 3dcce9d779
commit 94df47fedc
4 changed files with 1352 additions and 1361 deletions

2
DEPS
View File

@ -956,7 +956,7 @@ deps = {
'packages': [
{
'package': 'flutter/flutter_font_fallbacks',
'version': 'ba9a3d16939f9576afa67273198d779270cd768ae2867209ff3d72bab9acd3f6'
'version': '14d38cffa1a2c9d4380094957aa63aee811b613b0dc53fd909557f61f6a9068c'
}
],
'dep_type': 'cipd',

View File

@ -334,6 +334,7 @@ const List<String> fallbackFonts = <String>[
'Noto Sans',
'Noto Color Emoji',
'Noto Emoji',
'Noto Music',
'Noto Sans Symbols',
'Noto Sans Symbols 2',
'Noto Sans Adlam',

View File

@ -165,59 +165,55 @@ void testMain() {
// TODO(hterkelsen): https://github.com/flutter/flutter/issues/71520
});
/// Attempts to render [text] and verifies that [expectedFamilies] are downloaded.
///
/// Then it does the same, but asserts that the families aren't downloaded again
/// (because they already exist in memory).
Future<void> checkDownloadedFamiliesForString(String text, List<String> expectedFamilies) async {
// Try rendering text that requires fallback fonts, initially before the fonts are loaded.
ui.ParagraphBuilder pb = ui.ParagraphBuilder(ui.ParagraphStyle());
pb.addText(text);
pb.build().layout(const ui.ParagraphConstraints(width: 1000));
await renderer.fontCollection.fontFallbackManager!.debugWhenIdle();
expect(
downloadedFontFamilies,
expectedFamilies,
);
// Do the same thing but this time with loaded fonts.
downloadedFontFamilies.clear();
pb = ui.ParagraphBuilder(ui.ParagraphStyle());
pb.addText(text);
pb.build().layout(const ui.ParagraphConstraints(width: 1000));
await renderer.fontCollection.fontFallbackManager!.debugWhenIdle();
expect(downloadedFontFamilies, isEmpty);
}
// Regression test for https://github.com/flutter/flutter/issues/75836
// When we had this bug our font fallback resolution logic would end up in an
// infinite loop and this test would freeze and time out.
test(
'Can find fonts for two adjacent unmatched code points from different fonts',
'can find fonts for two adjacent unmatched code points from different fonts',
() async {
// Try rendering text that requires fallback fonts, initially before the fonts are loaded.
ui.ParagraphBuilder pb = ui.ParagraphBuilder(ui.ParagraphStyle());
pb.addText('ヽಠ');
pb.build().layout(const ui.ParagraphConstraints(width: 1000));
await renderer.fontCollection.fontFallbackManager!.debugWhenIdle();
expect(
downloadedFontFamilies,
<String>[
'Noto Sans SC',
'Noto Sans Kannada',
],
);
// Do the same thing but this time with loaded fonts.
downloadedFontFamilies.clear();
pb = ui.ParagraphBuilder(ui.ParagraphStyle());
pb.addText('ヽಠ');
pb.build().layout(const ui.ParagraphConstraints(width: 1000));
await renderer.fontCollection.fontFallbackManager!.debugWhenIdle();
expect(downloadedFontFamilies, isEmpty);
await checkDownloadedFamiliesForString('ヽಠ', <String>[
'Noto Sans SC',
'Noto Sans Kannada',
]);
});
test('can find glyph for 2/3 symbol', () async {
// Try rendering text that requires fallback fonts, initially before the fonts are loaded.
await checkDownloadedFamiliesForString('', <String>[
'Noto Sans',
]);
});
ui.ParagraphBuilder pb = ui.ParagraphBuilder(ui.ParagraphStyle());
pb.addText('');
pb.build().layout(const ui.ParagraphConstraints(width: 1000));
await renderer.fontCollection.fontFallbackManager!.debugWhenIdle();
expect(
downloadedFontFamilies,
<String>[
'Noto Sans',
],
);
// Do the same thing but this time with loaded fonts.
downloadedFontFamilies.clear();
pb = ui.ParagraphBuilder(ui.ParagraphStyle());
pb.addText('');
pb.build().layout(const ui.ParagraphConstraints(width: 1000));
await renderer.fontCollection.fontFallbackManager!.debugWhenIdle();
expect(downloadedFontFamilies, isEmpty);
// https://github.com/flutter/devtools/issues/6149
test('can find glyph for treble clef', () async {
await checkDownloadedFamiliesForString('𝄞', <String>[
'Noto Music',
]);
});
test('findMinimumFontsForCodePoints for all supported code points', () async {
@ -248,8 +244,9 @@ void testMain() {
expect(
testedFonts,
unorderedEquals(<String>{
'Noto Sans',
'Noto Color Emoji',
'Noto Music',
'Noto Sans',
'Noto Sans Symbols',
'Noto Sans Symbols 2',
'Noto Sans Adlam',