| 1 | <html dir="rtl"> |
| 2 | <head> |
| 3 | <title>Testing textpath</title> |
| 4 | <style type="text/css"> |
| 5 | @import "../../../../../dojo/resources/dojo.css"; |
| 6 | @import "../../../../../dijit/tests/css/dijitTests.css"; |
| 7 | </style> |
| 8 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> |
| 9 | <script type="text/javascript" src="../../../../../dojo/dojo.js" data-dojo-config="isDebug: true, gfxRenderer:'silverlight'"></script> |
| 10 | <script type="text/javascript"> |
| 11 | |
| 12 | dojo.require("dojox.gfx"); |
| 13 | dojo.require("dojox.gfx._gfxBidiSupport"); |
| 14 | |
| 15 | var CPD = 30, tp1, tp2, tp3,tp4,tp5, t1, t2, t3, t4, t5, t6; |
| 16 | var g1 = null; |
| 17 | var g2 = null; |
| 18 | |
| 19 | var surfaceLTR = null, surfaceRTL = null, surfaceAUTO = null; |
| 20 | |
| 21 | var placeAnchor = function(surface, x, y){ |
| 22 | surface.createLine({x1: x - 2, y1: y, x2: x + 2, y2: y}); |
| 23 | surface.createLine({x1: x, y1: y - 2, x2: x, y2: y + 2}); |
| 24 | }; |
| 25 | var makeText = function(surface, text, font, fill, stroke){ |
| 26 | var t = surface.createText(text); |
| 27 | if(font) t.setFont(font); |
| 28 | if(fill) t.setFill(fill); |
| 29 | if(stroke) t.setStroke(stroke); |
| 30 | placeAnchor(surface, text.x, text.y); |
| 31 | return t; |
| 32 | }; |
| 33 | |
| 34 | makeShapes = function(){ |
| 35 | var m = dojox.gfx.matrix; |
| 36 | surfaceLTR = dojox.gfx.createSurface("testLTR", 500, 170, "ltr"); |
| 37 | console.debug("surfaceLTR created"); |
| 38 | var p = surfaceLTR.createPath({}) |
| 39 | .moveTo(0, 15) |
| 40 | .setAbsoluteMode(false) |
| 41 | .curveTo(CPD, 0, 0, 0, 50, 0) |
| 42 | ; |
| 43 | console.debug("p created"); |
| 44 | |
| 45 | g1 = surfaceLTR.createGroup(); |
| 46 | t1 = makeText(surfaceLTR, {id: "t1",x: 0, y: 100, text: "1.) \u05e9\u05dc\u05d5\u05dd world!"}, |
| 47 | {family: "Times", size: "18pt"}, "black", "blue") |
| 48 | .setTransform(m.rotategAt(0, 250, 150)); |
| 49 | |
| 50 | t2 = makeText(surfaceLTR, {x: 0, y: 140, text: "1.) Hello \u05e2\u05d5\u05dc\u05dd!"}, |
| 51 | {family: "Times", size: "18pt"}, "black", "blue") |
| 52 | .setTransform(m.rotategAt(0, 250, 100)); |
| 53 | |
| 54 | surfaceRTL = dojox.gfx.createSurface("testRTL", 500, 170); |
| 55 | console.debug("surfaceRTL created"); |
| 56 | var p2 = surfaceRTL.createPath({}) |
| 57 | .moveTo(0, 15) |
| 58 | .setAbsoluteMode(false) |
| 59 | .curveTo(CPD, 0, 0, 0, 100, 0) |
| 60 | ; |
| 61 | console.debug("p2 created"); |
| 62 | |
| 63 | t3 = makeText(surfaceRTL, {id: "t1",x: 0, y: 100, text: "1.) \u05e9\u05dc\u05d5\u05dd world!"}, |
| 64 | {family: "Times", size: "18pt"}, "black", "red") |
| 65 | .setTransform(m.rotategAt(0, 250, 150)); |
| 66 | |
| 67 | t4 = makeText(surfaceRTL, {x: 0, y: 140, text: "1.) Hello \u05e2\u05d5\u05dc\u05dd!"}, |
| 68 | {family: "Times", size: "18pt"}, "black", "red") |
| 69 | .setTransform(m.rotategAt(0, 250, 100)); |
| 70 | |
| 71 | surfaceAUTO = dojox.gfx.createSurface("testAUTO", 500, 170, "auto"); |
| 72 | console.debug("surfaceAUTO created"); |
| 73 | var p3 = surfaceAUTO.createPath({}) |
| 74 | .moveTo(0, 15) |
| 75 | .setAbsoluteMode(false) |
| 76 | .curveTo(CPD, 0, 0, 0, 100, 0) |
| 77 | ; |
| 78 | console.debug("p3 created"); |
| 79 | |
| 80 | t3 = makeText(surfaceAUTO, {id: "t1",x: 0, y: 100, text: "1.) \u05e9\u05dc\u05d5\u05dd world!"}, |
| 81 | {family: "Times", size: "18pt"}, "black", "red") |
| 82 | .setTransform(m.rotategAt(0, 250, 150)); |
| 83 | |
| 84 | t4 = makeText(surfaceAUTO, {x: 0, y: 140, text: "1.) Hello \u05e2\u05d5\u05dc\u05dd!"}, |
| 85 | {family: "Times", size: "18pt"}, "black", "blue") |
| 86 | .setTransform(m.rotategAt(0, 250, 100)); |
| 87 | |
| 88 | }; |
| 89 | |
| 90 | |
| 91 | dojo.addOnLoad(makeShapes); |
| 92 | |
| 93 | </script> |
| 94 | </head> |
| 95 | <body> |
| 96 | <h1>dojox.gfx.Text</h1> |
| 97 | <h2>LTR Text</h2> |
| 98 | <div id="testLTR" style="width: 500px;"></div> |
| 99 | <h2>RTL Text</h2> |
| 100 | <div id="testRTL" style="width: 500px;"></div> |
| 101 | <h2>AUTO Text</h2> |
| 102 | <div id="testAUTO" style="width: 500px;"></div> |
| 103 | |
| 104 | <p>That's all Folks!</p> |
| 105 | </body> |
| 106 | </html> |