mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-27 02:05:07 +02:00
LibWeb: Begin implementing FontFaceSet.prototype.load
This implementation is incomplete in that we do not fully implement the steps to match the given font against the fonts in the set. This is used by fonts.google.com to load the fonts used for sample text.
This commit is contained in:
committed by
Andreas Kling
parent
78ecde9923
commit
9bdf2e928c
Notes:
github-actions[bot]
2024-10-24 15:51:17 +00:00
Author: https://github.com/trflynn89 Commit: https://github.com/LadybirdBrowser/ladybird/commit/9bdf2e928c4 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/1937
33
Tests/LibWeb/Text/input/css/FontFaceSet-load.html
Normal file
33
Tests/LibWeb/Text/input/css/FontFaceSet-load.html
Normal file
@@ -0,0 +1,33 @@
|
||||
<script src="../include.js"></script>
|
||||
<script type="text/javascript">
|
||||
asyncTest(async done => {
|
||||
const fontFaceSet = document.fonts;
|
||||
|
||||
const fontFace = new FontFace("Hash Sans", "url(../../../../Ref/assets/HashSans.woff)");
|
||||
fontFaceSet.add(fontFace);
|
||||
|
||||
try {
|
||||
await fontFaceSet.load("invalid");
|
||||
println("Load invalid font: FAIL");
|
||||
} catch (e) {
|
||||
println("Load invalid font: PASS");
|
||||
}
|
||||
|
||||
try {
|
||||
await fontFaceSet.load("revert");
|
||||
println("Load CSS keyword as font: FAIL");
|
||||
} catch (e) {
|
||||
println("Load CSS keyword as font: PASS");
|
||||
}
|
||||
|
||||
try {
|
||||
await fontFaceSet.load("1em Hash Sans");
|
||||
println("Load valid font: PASS");
|
||||
} catch (e) {
|
||||
println("Load valid font: FAIL");
|
||||
println(e);
|
||||
}
|
||||
|
||||
done();
|
||||
});
|
||||
</script>
|
||||
Reference in New Issue
Block a user