layout/reftests/canvas/text-font-lang.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/layout/reftests/canvas/text-font-lang.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,56 @@
     1.4 +<!DOCTYPE HTML>
     1.5 +<html>
     1.6 +<head>
     1.7 +<title>Test for language-sensitive font prefs on canvas</title>
     1.8 +<script type="text/javascript">
     1.9 +function test(canvasID) {
    1.10 +  var canvas = document.getElementById(canvasID);
    1.11 +  var ctx = canvas.getContext('2d');
    1.12 +
    1.13 +  var str = 'Hello world! \u4F60\u597D\u5417\uFF1F';
    1.14 +  ctx.font = '2em sans-serif';
    1.15 +  ctx.fillStyle = 'black';
    1.16 +  ctx.textAlign = 'left';
    1.17 +  ctx.textBaseline = 'top';
    1.18 +  ctx.fillText(str, 10, 10);
    1.19 +};
    1.20 +</script>
    1.21 +</head>
    1.22 +<body>
    1.23 +
    1.24 +<!--
    1.25 +  In the reference, all divs are tagged with lang="en".
    1.26 +  The expectation is that at least some of them will resolve
    1.27 +  "sans-serif" to different fonts according to language.
    1.28 +-->
    1.29 +
    1.30 +<div lang="ar" style="margin:20px; height:100px;">
    1.31 +<canvas id="c1" width="400" height="50"></canvas>
    1.32 +<script type="text/javascript">
    1.33 +  test("c1");
    1.34 +</script>
    1.35 +</div>
    1.36 +
    1.37 +<div lang="ja" style="margin:20px; height:100px;">
    1.38 +<canvas id="c2" width="400" height="50"></canvas>
    1.39 +<script type="text/javascript">
    1.40 +  test("c2");
    1.41 +</script>
    1.42 +</div>
    1.43 +
    1.44 +<div lang="zh-TW" style="margin:20px; height:100px;">
    1.45 +<canvas id="c3" width="400" height="50"></canvas>
    1.46 +<script type="text/javascript">
    1.47 +  test("c3");
    1.48 +</script>
    1.49 +</div>
    1.50 +
    1.51 +<div lang="en" style="margin:20px; height:100px;">
    1.52 +<canvas id="c4" width="400" height="50"></canvas>
    1.53 +<script type="text/javascript">
    1.54 +  test("c4");
    1.55 +</script>
    1.56 +</div>
    1.57 +
    1.58 +</body>
    1.59 +</html>

mercurial