[web] (flutter/engine#40428)
This commit is contained in:
@@ -1889,7 +1889,7 @@ DomFontFace createDomFontFace(String family, Object source,
|
||||
return DomFontFace._args2(family.toJS, source.toJSAnyShallow);
|
||||
} else {
|
||||
return DomFontFace._args3(
|
||||
family.toJS, source.toJSAnyShallow, descriptors.toJSAnyShallow);
|
||||
family.toJS, source.toJSAnyShallow, descriptors.toJSAnyDeep);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1901,6 +1901,10 @@ extension DomFontFaceExtension on DomFontFace {
|
||||
@JS('family')
|
||||
external JSString? get _family;
|
||||
String? get family => _family?.toDart;
|
||||
|
||||
@JS('weight')
|
||||
external JSString? get _weight;
|
||||
String? get weight => _weight?.toDart;
|
||||
}
|
||||
|
||||
@JS()
|
||||
|
||||
@@ -77,6 +77,27 @@ void testMain() {
|
||||
expect(fontFamilyList.length, equals(1));
|
||||
expect(fontFamilyList.first, 'AhEm');
|
||||
});
|
||||
|
||||
test('Register Asset with descriptor', () async {
|
||||
const String testFontFamily = 'Ahem';
|
||||
final List<String> fontFamilyList = <String>[];
|
||||
|
||||
fontManager.downloadAsset(
|
||||
testFontFamily, 'url($testFontUrl)', const <String, String>{
|
||||
'weight': 'bold',
|
||||
});
|
||||
await fontManager.downloadAllFonts();
|
||||
fontManager.registerDownloadedFonts();
|
||||
domDocument.fonts!
|
||||
.forEach((DomFontFace f, DomFontFace f2, DomFontFaceSet s) {
|
||||
expect(f.weight, 'bold');
|
||||
expect(f2.weight, 'bold');
|
||||
fontFamilyList.add(f.family!);
|
||||
});
|
||||
|
||||
expect(fontFamilyList.length, equals(1));
|
||||
expect(fontFamilyList.first, 'Ahem');
|
||||
});
|
||||
});
|
||||
|
||||
group('fonts with special characters', () {
|
||||
|
||||
Reference in New Issue
Block a user