blob: 8a13ba13fcb633b4d1176fb3e2f31cb9ddf26dca (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
<!DOCTYPE html>
<title>Canvas test: 2d.text.fontStretch</title>
<link rel="match" href="canvas.2d.fontStretch-ref.html">
<canvas id="c" class="output"><p class="fallback">FAIL (fallback content)</p></canvas>
<script>
var canvas = document.getElementById("c");
var ctx = canvas.getContext('2d');
// P shows as Pass for fontStretch = expanded and shows as fail for
// fontStretch = fail.
function draw() {
ctx.font = '25px test';
ctx.fontStretch = "expanded";
ctx.fillText("P", 10, 40);
}
var f = new FontFace('test', 'url(/fonts/pass.woff)');
f.stretch = "expanded";
document.fonts.add(f);
var f2 = new FontFace('test', 'url(/fonts/fail.woff)');
document.fonts.add(f2);
Promise.all([f.load(), f2.load()]).then(draw);
</script>
|