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

Fri, 16 Jan 2015 18:13:44 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Fri, 16 Jan 2015 18:13:44 +0100
branch
TOR_BUG_9701
changeset 14
925c144e1f1f
permissions
-rw-r--r--

Integrate suggestion from review to improve consistency with existing code.

     1 <!DOCTYPE HTML>
     2 <html>
     3 <head>
     4 <title>Test for language-sensitive font prefs on canvas</title>
     5 <script type="text/javascript">
     6 function test(canvasID) {
     7   var canvas = document.getElementById(canvasID);
     8   var ctx = canvas.getContext('2d');
    10   var str = 'Hello world! \u4F60\u597D\u5417\uFF1F';
    11   ctx.font = '2em sans-serif';
    12   ctx.fillStyle = 'black';
    13   ctx.textAlign = 'left';
    14   ctx.textBaseline = 'top';
    15   ctx.fillText(str, 10, 10);
    16 };
    17 </script>
    18 </head>
    19 <body>
    21 <!--
    22   In the reference, all divs are tagged with lang="en".
    23   The expectation is that at least some of them will resolve
    24   "sans-serif" to different fonts according to language.
    25 -->
    27 <div lang="ar" style="margin:20px; height:100px;">
    28 <canvas id="c1" width="400" height="50"></canvas>
    29 <script type="text/javascript">
    30   test("c1");
    31 </script>
    32 </div>
    34 <div lang="ja" style="margin:20px; height:100px;">
    35 <canvas id="c2" width="400" height="50"></canvas>
    36 <script type="text/javascript">
    37   test("c2");
    38 </script>
    39 </div>
    41 <div lang="zh-TW" style="margin:20px; height:100px;">
    42 <canvas id="c3" width="400" height="50"></canvas>
    43 <script type="text/javascript">
    44   test("c3");
    45 </script>
    46 </div>
    48 <div lang="en" style="margin:20px; height:100px;">
    49 <canvas id="c4" width="400" height="50"></canvas>
    50 <script type="text/javascript">
    51   test("c4");
    52 </script>
    53 </div>
    55 </body>
    56 </html>

mercurial