7 <script type=
"text/javascript">
8 var testFont
= '40px sans-serif';
10 function test(x
, y
, text
, style
, rotation
) {
11 var canvas
= document
.createElement("canvas");
14 canvas
.style
.cssText
= 'position:absolute;' + style
;
15 document
.getElementsByTagName('body')[0].appendChild(canvas
);
16 var ctx
= canvas
.getContext('2d');
17 ctx
.globalAlpha
= 0.5;
19 ctx
.moveTo(x
- 20, y
); ctx
.lineTo(x
+ 20, y
);
20 ctx
.moveTo(x
, y
- 20); ctx
.lineTo(x
, y
+ 20);
22 ctx
.globalAlpha
= 1.0;
29 ctx
.fillText(text
, x
, y
);
32 // Testcase: vertical text with orientation:sideways-right
33 // test(100, 50, 'Hello', 'writing-mode:vertical-lr;text-orientation:sideways-right', 0);
35 // Reference: horizontal text with 90° rotation
36 // test(100, 50, 'Hello', 'writing-mode:horizontal-tb', Math.PI/2);
38 // Non-reference: vertical text with orientation:mixed
39 test(100, 50, 'Hello', 'writing-mode:vertical-lr;text-orientation:mixed', 0);