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