| 1 | <html> |
| 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"></script> |
| 10 | <script type="text/javascript"> |
| 11 | |
| 12 | dojo.require("dojox.gfx"); |
| 13 | dojo.require("dojox.gfx._gfxBidiSupport"); |
| 14 | |
| 15 | var CPD = 30, t, t2, t3,t4,t5; |
| 16 | |
| 17 | var surface = null; |
| 18 | |
| 19 | makeShapes = function(){ |
| 20 | surfaceLTR = dojox.gfx.createSurface("testLTR", 500, 60); |
| 21 | console.debug("surfaceLTR created"); |
| 22 | var p = surfaceLTR.createPath({}) |
| 23 | .moveTo(0, 15) |
| 24 | .setAbsoluteMode(false) |
| 25 | .curveTo(CPD, 0, 0, 0, 50, 0) |
| 26 | ; |
| 27 | console.debug("p created"); |
| 28 | var t = surfaceLTR.createTextPath({ |
| 29 | text: "\u05d4\u05ea\u05d7\u05dc\u05d4 end." |
| 30 | , align: "start" |
| 31 | , textDir: "ltr" |
| 32 | }) |
| 33 | .moveTo(0, 15) |
| 34 | .setAbsoluteMode(false) |
| 35 | .curveTo(CPD, 0, 0, 0, 100, 0) |
| 36 | .setFont({family: "times", size: "12pt"}) |
| 37 | .setFill("blue") |
| 38 | ; |
| 39 | console.debug("t created"); |
| 40 | var t2 = surfaceLTR.createTextPath({ |
| 41 | text: "Beginning \u05e1\u05d5\u05e3." |
| 42 | , align: "start" |
| 43 | ,textDir: "ltr" |
| 44 | }) |
| 45 | .moveTo(0, 50) |
| 46 | .setAbsoluteMode(false) |
| 47 | .curveTo(CPD, 0, 0, 0, 100, 0) |
| 48 | .setFont({family: "times", size: "12pt"}) |
| 49 | .setFill("blue") |
| 50 | ; |
| 51 | console.debug("t2 created"); |
| 52 | surfaceRTL = dojox.gfx.createSurface("testRTL", 500, 60); |
| 53 | console.debug("surfaceRTL created"); |
| 54 | var p2 = surfaceRTL.createPath({}) |
| 55 | .moveTo(0, 15) |
| 56 | .setAbsoluteMode(false) |
| 57 | .curveTo(CPD, 0, 0, 0, 100, 0) |
| 58 | ; |
| 59 | console.debug("p2 created"); |
| 60 | |
| 61 | var t3 = surfaceRTL.createTextPath({ |
| 62 | text: "\u05d4\u05ea\u05d7\u05dc\u05d4 end. " |
| 63 | , align: "start" |
| 64 | ,textDir: "rtl" |
| 65 | //, rotated: true |
| 66 | }) |
| 67 | .moveTo(0, 15) |
| 68 | .setAbsoluteMode(false) |
| 69 | .curveTo(CPD, 0, 100 - CPD, 0, 100, 0) |
| 70 | .setFont({family: "times", size: "12pt"}) |
| 71 | .setFill("red") |
| 72 | ; |
| 73 | console.debug("t3 created"); |
| 74 | var t4 = surfaceRTL.createTextPath({ |
| 75 | text: "Beginning \u05e1\u05d5\u05e3." |
| 76 | , align: "start" |
| 77 | ,textDir: "rtl" |
| 78 | //, rotated: true |
| 79 | }) |
| 80 | //.setShape(p.shape) |
| 81 | .moveTo(0, 50) |
| 82 | .setAbsoluteMode(false) |
| 83 | .curveTo(CPD, 0, 100 - CPD, 0, 100, 0) |
| 84 | .setFont({family: "times", size: "12pt"}) |
| 85 | .setFill("red") |
| 86 | ; |
| 87 | console.debug("t4 created"); |
| 88 | |
| 89 | surfaceAUTO = dojox.gfx.createSurface("testAUTO", 500, 60); |
| 90 | console.debug("surfaceAUTO created"); |
| 91 | var p3 = surfaceAUTO.createPath({}) |
| 92 | .moveTo(0, 15) |
| 93 | .setAbsoluteMode(false) |
| 94 | .curveTo(CPD, 0, 0, 0, 100, 0) |
| 95 | ; |
| 96 | console.debug("p3 created"); |
| 97 | |
| 98 | var t5 = surfaceAUTO.createTextPath({ |
| 99 | text: "\u05d4\u05ea\u05d7\u05dc\u05d4 end. " |
| 100 | , align: "start" |
| 101 | , textDir: "auto" |
| 102 | //, rotated: true |
| 103 | }) |
| 104 | //.setShape(p.shape) |
| 105 | .moveTo(0, 15) |
| 106 | .setAbsoluteMode(false) |
| 107 | .curveTo(CPD, 0, 100 - CPD, 0, 100, 0) |
| 108 | |
| 109 | .setFont({family: "times", size: "12pt"}) |
| 110 | .setFill("red") |
| 111 | ; |
| 112 | console.debug("t5 created"); |
| 113 | var t6 = surfaceAUTO.createTextPath({ |
| 114 | text: "Beginning \u05e1\u05d5\u05e3." |
| 115 | , align: "start" |
| 116 | , textDir: "auto" |
| 117 | //, rotated: true |
| 118 | }) |
| 119 | //.setShape(p.shape) |
| 120 | .moveTo(0, 50) |
| 121 | .setAbsoluteMode(false) |
| 122 | .curveTo(CPD, 0, 100 - CPD, 0, 100, 0) |
| 123 | .setFont({family: "times", size: "12pt"}) |
| 124 | .setFill("blue") |
| 125 | ; |
| 126 | console.debug("t6 created"); |
| 127 | }; |
| 128 | |
| 129 | dojo.addOnLoad(makeShapes); |
| 130 | |
| 131 | </script> |
| 132 | </head> |
| 133 | <body> |
| 134 | <h1>dojox.gfx Text on a Path test</h1> |
| 135 | <h2>LTR Text Path</h2> |
| 136 | <div id="testLTR" style="width: 500px;"></div> |
| 137 | <h2>RTL Text Path</h2> |
| 138 | <div id="testRTL" style="width: 500px;"></div> |
| 139 | <h2>AUTO Text Path</h2> |
| 140 | <div id="testAUTO" style="width: 500px;"></div> |
| 141 | |
| 142 | <p>That's all Folks!</p> |
| 143 | </body> |
| 144 | </html> |