haikuwebkit/LayoutTests/fast/text/canvas-color-fonts/stroke-gradient-COLR-5.html

39 lines
1.0 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<style>
@font-face {
font-family: "WebFont";
src: url("resources/Ahem-COLR.ttf") format("truetype");
}
</style>
</head>
<body>
<canvas id="canvas" width="700" height="500" style="width: 700px; height; 500px;"></canvas>
<script>
if (window.testRunner)
testRunner.waitUntilDone();
let font = "100px 'WebFont'";
document.fonts.load(font).then(function() {
let canvas = document.getElementById("canvas");
let context = canvas.getContext("2d");
context.lineWidth = 2;
context.font = font;
let gradient = context.createLinearGradient(100, 200, 400, 200);
gradient.addColorStop(0, "rgb(255, 0, 128)");
gradient.addColorStop(1, "rgb(255, 153, 51)");
context.strokeStyle = gradient;
context.strokeText("BAB", 100, 100);
context.strokeStyle = "white";
context.strokeRect(100, 20, 100, 100);
context.strokeRect(200, 20, 100, 100);
context.strokeRect(220, 20, 20, 100);
if (window.testRunner)
testRunner.notifyDone();
});
</script>
</body>
</html>