| 1 |
<html> |
| 2 |
<head> |
| 3 |
<title>Testing text</title> |
| 4 |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> |
| 5 |
<style type="text/css"> |
| 6 |
@import "../../../../../dojo/resources/dojo.css"; |
| 7 |
@import "../../../../../dijit/tests/css/dijitTests.css"; |
| 8 |
</style> |
| 9 |
|
| 10 |
<meta name="svg.render.forceflash" content="true"/> |
| 11 |
<script src="../../svgweb/svgweb/src/svg.js" data-path="../../svgweb/svgweb/src"></script> |
| 12 |
<script src="../../../../../dojo/dojo.js" data-dojo-config="isDebug:true,forceGfxRenderer:'svg'" type="text/javascript"></script> |
| 13 |
|
| 14 |
<script type="text/javascript"> |
| 15 |
dojo.require("dojox.gfx"); |
| 16 |
dojo.require("dojox.gfx._gfxBidiSupport"); |
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
var surface = null, t1, t2, t3, t4, t5; |
| 21 |
|
| 22 |
var placeAnchor = function(surface, x, y){ |
| 23 |
surface.createLine({x1: x - 2, y1: y, x2: x + 2, y2: y}); |
| 24 |
surface.createLine({x1: x, y1: y - 2, x2: x, y2: y + 2}); |
| 25 |
}; |
| 26 |
|
| 27 |
var makeText = function(surface, text, font, fill, stroke){ |
| 28 |
var t = surface.createText(text); |
| 29 |
if(font) t.setFont(font); |
| 30 |
if(fill) t.setFill(fill); |
| 31 |
if(stroke) t.setStroke(stroke); |
| 32 |
placeAnchor(surface, text.x, text.y); |
| 33 |
return t; |
| 34 |
}; |
| 35 |
|
| 36 |
makeShapes = function(){ |
| 37 |
surface = dojox.gfx.createSurface("test", 500, 500); |
| 38 |
surface.whenLoaded(function() { |
| 39 |
|
| 40 |
var m = dojox.gfx.matrix; |
| 41 |
//surface.createLine({x1: 250, y1: 0, x2: 250, y2: 500}).setStroke("green"); |
| 42 |
t1 = makeText(surface, {id: "t1",x: 250, y: 50, text: "@ \u05e9\u05dc\u05d5\u05dd world LTR!", textDir:"ltr"}, |
| 43 |
{family: "Times", size: "24pt"}, "black", "red") |
| 44 |
.setTransform(m.rotategAt(0, 250, 50)); |
| 45 |
|
| 46 |
t2 = makeText(surface, {x: 250, y: 100, text: "@ Hello \u05e2\u05d5\u05dc\u05dd LTR!", textDir:"ltr"}, |
| 47 |
{family: "Times", size: "24pt"}, "black", "red") |
| 48 |
.setTransform(m.rotategAt(0, 250, 100)); |
| 49 |
|
| 50 |
t3 = makeText(surface, {x: 250, y: 150, text: "@ \u05e9\u05dc\u05d5\u05dd world RTL!", textDir:"rtl"}, |
| 51 |
{family: "Times", size: "24pt"}, "red", "black") |
| 52 |
.setTransform(m.rotategAt(0, 250, 150)); |
| 53 |
t4 = makeText(surface, {x: 250, y: 200, text: "@ Hello \u05e2\u05d5\u05dc\u05dd RTL!", kerning: true,textDir:"rtl"}, |
| 54 |
{family: "Times", size: "24pt"}, "red", "black") |
| 55 |
.setTransform(m.rotategAt(0, 250, 200)); |
| 56 |
t5 = makeText(surface, {x: 250, y: 250, text: "@ \u05e9\u05dc\u05d5\u05dd world AUTO!", kerning: false,textDir:"auto"}, |
| 57 |
{family: "Times", size: "24pt"}, "red", "black") |
| 58 |
.setTransform(m.rotategAt(0, 250, 250)); |
| 59 |
t6 = makeText(surface, {x: 250, y: 300, text: "@ Hello \u05e2\u05d5\u05dc\u05dd AUTO!", kerning: false,textDir:"auto"}, |
| 60 |
{family: "Times", size: "24pt"}, "black", "red") |
| 61 |
.setTransform(m.rotategAt(0, 250, 300)); |
| 62 |
}); |
| 63 |
}; |
| 64 |
|
| 65 |
dojo.addOnLoad(makeShapes); |
| 66 |
|
| 67 |
</script> |
| 68 |
</head> |
| 69 |
<body> |
| 70 |
<h1>dojox.gfx Text test</h1> |
| 71 |
|
| 72 |
<h2>The black colored sentences should be in LTR layout</h2> |
| 73 |
<h2>The red colored sentences should be in RTL layout</h2> |
| 74 |
|
| 75 |
<div id="test" style="width: 700px; height: 500px;"></div> |
| 76 |
|
| 77 |
|
| 78 |
|
| 79 |
</body> |
| 80 |
</html> |