Source code

Revision control

Copy as Markdown

Other Tools

Test Info:

<!doctype HTML>
<html lang="en-US" class="reftest-wait">
<meta charset="utf-8">
<title>HTML5 Canvas Test: The lang attribute functions in a transferred offscreen</title>
<link rel="match" href="canvas.2d.offscreen.lang-ref.html" />
<link rel="author" href="mailto:schenney@chromium.org"/>
<meta name="assert" content="Verify that setting lang in a transferred offscreen works." />
<script src="/common/reftest-wait.js"></script>
<style>
#canvas-tr {
position: absolute;
top: 10px;
left: 10px;
}
#canvas-en {
position: absolute;
top: 120px;
left: 10px;
}
</style>
<script type="text/javascript">
function drawText(language) {
var canvas = document.getElementById('canvas-' + language);
var ctx = canvas.transferControlToOffscreen().getContext('2d');
ctx.font = '25px Lato-Medium';
ctx.lang = language;
ctx.fillText('fi', 5, 50);
}
function runTest() {
let test_font = new FontFace(
// Lato-Medium is a font with language specific ligatures.
"Lato-Medium",
"url(/fonts/Lato-Medium.ttf)"
);
test_font.load().then((font) => {
document.fonts.add(font);
drawText('tr');
drawText('en');
takeScreenshot();
});
}
</script>
<body onload="runTest()">
<canvas lang="tr" id="canvas-tr" width="300" height="100">
Browser does not support HTML5 Canvas.
</canvas>
<canvas lang="en" id="canvas-en" width="300" height="100">
Browser does not support HTML5 Canvas.
</canvas>
</body>
</html>