Debian Codegraph @

dojox/gfx/tests/_gfxBidiSupport/svgWeb/inheritFromSurfaceSvgWeb.html

raw symbols SCIP
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 <!-- SVGWEB { -->
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
16 dojo.require("dojox.gfx");
17 dojo.require("dojox.gfx._gfxBidiSupport");
18
19 var CPD = 30, tp1, tp2, tp3,tp4,tp5, t1, t2, t3, t4, t5, t6;
20 var g1 = null;
21 var g2 = null;
22
23 var surfaceLTR = null, surfaceRTL = null, surfaceAUTO = null;
24
25 var placeAnchor = function(surface, x, y){
26 surface.createLine({x1: x - 2, y1: y, x2: x + 2, y2: y});
27 surface.createLine({x1: x, y1: y - 2, x2: x, y2: y + 2});
28 };
29 var makeText = function(surface, text, font, fill, stroke){
30 var t = surface.createText(text);
31 if(font) t.setFont(font);
32 if(fill) t.setFill(fill);
33 if(stroke) t.setStroke(stroke);
34 placeAnchor(surface, text.x, text.y);
35 return t;
36 };
37
38 makeShapes = function(){
39 var m = dojox.gfx.matrix;
40 surfaceLTR = dojox.gfx.createSurface("testLTR", 500, 170, "ltr");
41 surfaceLTR.whenLoaded(function() {
42 console.debug("surfaceLTR created");
43 var p = surfaceLTR.createPath({})
44 .moveTo(0, 15)
45 .setAbsoluteMode(false)
46 .curveTo(CPD, 0, 0, 0, 50, 0)
47 ;
48 console.debug("p created");
49 tp1 = surfaceLTR.createTextPath({
50 text: "\u05d4\u05ea\u05d7\u05dc\u05d4 end. "
51 , align: "start"
52 })
53 .moveTo(0, 15)
54 .setAbsoluteMode(false)
55 .curveTo(CPD, 0, 0, 0, 100, 0)
56 .setFont({family: "times", size: "12pt"})
57 .setFill("blue")
58 ;
59 console.debug("tp1 created");
60 tp2 = surfaceLTR.createTextPath({
61 text: "Beginning \u05e1\u05d5\u05e3."
62 , align: "start"
63
64 })
65 .moveTo(0, 50)
66 .setAbsoluteMode(false)
67 .curveTo(CPD, 0, 0, 0, 100, 0)
68 .setFont({family: "times", size: "12pt"})
69 .setFill("blue")
70 ;
71 console.debug("tp2 created");
72 g1 = surfaceLTR.createGroup();
73 t1 = makeText(surfaceLTR, {id: "t1",x: 0, y: 100, text: "\u05d4\u05ea\u05d7\u05dc\u05d4 end."},
74 {family: "Times", size: "18pt"}, "black", "blue")
75 .setTransform(m.rotategAt(0, 250, 150));
76
77 t2 = makeText(surfaceLTR, {x: 0, y: 140, text: "Beginning \u05e1\u05d5\u05e3."},
78 {family: "Times", size: "18pt"}, "black", "blue")
79 .setTransform(m.rotategAt(0, 250, 100));
80 });
81 surfaceRTL = dojox.gfx.createSurface("testRTL", 500, 170);
82 console.debug("surfaceRTL created");
83 surfaceRTL.whenLoaded(function() {
84 var p2 = surfaceRTL.createPath({})
85 .moveTo(0, 15)
86 .setAbsoluteMode(false)
87 .curveTo(CPD, 0, 0, 0, 100, 0)
88 ;
89 console.debug("p2 created");
90 tp3 = surfaceRTL.createTextPath({
91 text: "\u05d4\u05ea\u05d7\u05dc\u05d4 end. "
92 , align: "start"
93 //, rotated: true
94 })
95 .moveTo(0, 15)
96 .setAbsoluteMode(false)
97 .curveTo(CPD, 0, 100 - CPD, 0, 100, 0)
98 .setFont({family: "times", size: "12pt"})
99 .setFill("red")
100 ;
101 console.debug("tp3 created");
102 tp4 = surfaceRTL.createTextPath({
103 text: "Beginning \u05e1\u05d5\u05e3."
104 , align: "start"
105
106 //, rotated: true
107 })
108 //.setShape(p.shape)
109 .moveTo(0, 50)
110 .setAbsoluteMode(false)
111 .curveTo(CPD, 0, 100 - CPD, 0, 100, 0)
112 .setFont({family: "times", size: "12pt"})
113 .setFill("red")
114 ;
115 console.debug("tp4 created");
116
117 t3 = makeText(surfaceRTL, {id: "t1",x: 0, y: 100, text: "\u05d4\u05ea\u05d7\u05dc\u05d4 end."},
118 {family: "Times", size: "18pt"}, "black", "red")
119 .setTransform(m.rotategAt(0, 250, 150));
120
121 t4 = makeText(surfaceRTL, {x: 0, y: 140, text: "Beginning \u05e1\u05d5\u05e3."},
122 {family: "Times", size: "18pt"}, "black", "red")
123 .setTransform(m.rotategAt(0, 250, 100));
124 });
125 surfaceAUTO = dojox.gfx.createSurface("testAUTO", 500, 170,"auto");
126 console.debug("surfaceAUTO created");
127
128 surfaceAUTO.whenLoaded(function() {
129 var p3 = surfaceAUTO.createPath({})
130 .moveTo(0, 15)
131 .setAbsoluteMode(false)
132 .curveTo(CPD, 0, 0, 0, 100, 0)
133 ;
134 console.debug("p3 created");
135
136 var tp5 = surfaceAUTO.createTextPath({
137 text: "\u05d4\u05ea\u05d7\u05dc\u05d4 end. "
138 , align: "start"
139
140 //, rotated: true
141 })
142 //.setShape(p.shape)
143 .moveTo(0, 15)
144 .setAbsoluteMode(false)
145 .curveTo(CPD, 0, 100 - CPD, 0, 100, 0)
146
147 .setFont({family: "times", size: "12pt"})
148 .setFill("red")
149 ;
150 console.debug("tp5 created");
151 var tp6 = surfaceAUTO.createTextPath({
152 text: "Beginning \u05e1\u05d5\u05e3."
153 , align: "start"
154
155 //, rotated: true
156 })
157 //.setShape(p.shape)
158 .moveTo(0, 50)
159 .setAbsoluteMode(false)
160 .curveTo(CPD, 0, 100 - CPD, 0, 100, 0)
161 .setFont({family: "times", size: "12pt"})
162 .setFill("blue")
163 ;
164 console.debug("tp6 created");
165
166 t3 = makeText(surfaceAUTO, {id: "t1",x: 0, y: 100, text: "\u05d4\u05ea\u05d7\u05dc\u05d4 end."},
167 {family: "Times", size: "18pt"}, "black", "red")
168 .setTransform(m.rotategAt(0, 250, 150));
169
170 t4 = makeText(surfaceAUTO, {x: 0, y: 140, text: "Beginning \u05e1\u05d5\u05e3."},
171 {family: "Times", size: "18pt"}, "black", "blue")
172 .setTransform(m.rotategAt(0, 250, 100));
173 });
174 };
175
176
177 dojo.addOnLoad(makeShapes);
178
179 </script>
180 </head>
181 <body>
182 <h1>dojox.gfx Text on a Path test</h1>
183 <h2>LTR TextPath and Text first two are TextPath and two others are Text</h2>
184 <div id="testLTR" style="width: 500px;"></div>
185 <h2>RTL Text Path and Text first two are TextPath and two others are Text</h2>
186 <div id="testRTL" style="width: 500px;"></div>
187 <h2>AUTO Text Path and Text first two are TextPath and two others are Text</h2>
188 <div id="testAUTO" style="width: 500px;"></div>
189
190 <p>That's all Folks!</p>
191 </body>
192 </html>