mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
[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 ----  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:
parent
3dcce9d779
commit
94df47fedc
2
DEPS
2
DEPS
@ -956,7 +956,7 @@ deps = {
|
||||
'packages': [
|
||||
{
|
||||
'package': 'flutter/flutter_font_fallbacks',
|
||||
'version': 'ba9a3d16939f9576afa67273198d779270cd768ae2867209ff3d72bab9acd3f6'
|
||||
'version': '14d38cffa1a2c9d4380094957aa63aee811b613b0dc53fd909557f61f6a9068c'
|
||||
}
|
||||
],
|
||||
'dep_type': 'cipd',
|
||||
|
||||
@ -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',
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -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',
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user