| 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 | <script type="text/javascript" src="../../../../dojo/dojo.js" data-dojo-config="isDebug: true"></script> |
| 10 | |
| 11 | <script type="text/javascript"> |
| 12 | dojo.require("dojox.gfx"); |
| 13 | dojo.require("dojox.gfx._gfxBidiSupport"); |
| 14 | |
| 15 | var surface = null, t1, t2, t3, t4, t5; |
| 16 | |
| 17 | var placeAnchor = function(surface, x, y){ |
| 18 | surface.createLine({x1: x - 2, y1: y, x2: x + 2, y2: y}); |
| 19 | surface.createLine({x1: x, y1: y - 2, x2: x, y2: y + 2}); |
| 20 | }; |
| 21 | |
| 22 | var makeText = function(surface, text, font, fill, stroke){ |
| 23 | var t = surface.createText(text); |
| 24 | if(font) t.setFont(font); |
| 25 | if(fill) t.setFill(fill); |
| 26 | if(stroke) t.setStroke(stroke); |
| 27 | placeAnchor(surface, text.x, text.y); |
| 28 | return t; |
| 29 | }; |
| 30 | |
| 31 | makeShapes = function(){ |
| 32 | surface = dojox.gfx.createSurface("test", 700, 500); |
| 33 | var m = dojox.gfx.matrix; |
| 34 | //surface.createLine({x1: 250, y1: 0, x2: 250, y2: 500}).setStroke("green"); |
| 35 | t1 = makeText(surface, {id: "t1",x: 250, y: 50, text: "1.) \u05e9\u05dc\u05d5\u05dd world LTR!", textDir:"ltr"}, |
| 36 | {family: "Times", size: "24pt"}, "black", "red") |
| 37 | .setTransform(m.rotategAt(0, 250, 50)); |
| 38 | |
| 39 | t2 = makeText(surface, {x: 250, y: 100, text: "1.) Hello \u05e2\u05d5\u05dc\u05dd LTR!", textDir:"ltr"}, |
| 40 | {family: "Times", size: "24pt"}, "black", "red") |
| 41 | .setTransform(m.rotategAt(0, 250, 100)); |
| 42 | |
| 43 | t3 = makeText(surface, {x: 250, y: 150, text: "1.) \u05e9\u05dc\u05d5\u05dd world RTL!", textDir:"rtl"}, |
| 44 | {family: "Times", size: "24pt"}, "red", "black") |
| 45 | .setTransform(m.rotategAt(0, 250, 150)); |
| 46 | t4 = makeText(surface, {x: 250, y: 200, text: "1.) Hello \u05e2\u05d5\u05dc\u05dd RTL!", kerning: true,textDir:"rtl"}, |
| 47 | {family: "Times", size: "24pt"}, "red", "black") |
| 48 | .setTransform(m.rotategAt(0, 250, 200)); |
| 49 | t5 = makeText(surface, {x: 250, y: 250, text: "1.) \u05e9\u05dc\u05d5\u05dd world AUTO!", kerning: false,textDir:"auto"}, |
| 50 | {family: "Times", size: "24pt"}, "red", "black") |
| 51 | .setTransform(m.rotategAt(0, 250, 250)); |
| 52 | t6 = makeText(surface, {x: 250, y: 300, text: "1.) Hello \u05e2\u05d5\u05dc\u05dd AUTO!", kerning: false,textDir:"auto"}, |
| 53 | {family: "Times", size: "24pt"}, "black", "red") |
| 54 | .setTransform(m.rotategAt(0, 250, 300)); |
| 55 | |
| 56 | //surface.setTextDir("ltr"); |
| 57 | }; |
| 58 | |
| 59 | dojo.addOnLoad(makeShapes); |
| 60 | |
| 61 | </script> |
| 62 | </head> |
| 63 | <body> |
| 64 | <h1>dojox.gfx Text test</h1> |
| 65 | <div id="test" style="width: 700px; height: 500px;"></div> |
| 66 | |
| 67 | |
| 68 | </body> |
| 69 | </html> |