This commit is contained in:
joshualitt
2023-03-18 14:19:35 -07:00
committed by GitHub
parent bcd76e922d
commit 701d09605a
2 changed files with 26 additions and 1 deletions

View File

@@ -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()

View File

@@ -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', () {