Debian Codegraph @

dojox/gfx/tests/svgweb/test_textpath.html

raw symbols SCIP
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 <!-- SVGWEB { -->
10 <meta name="svg.render.forceflash" content="true"/>
11 <script src="svgweb/src/svg.js" data-path="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 dojo.require("dojox.gfx");
16
17 var CPD = 30;
18
19 var surface = null;
20
21 var makeText = function(surface, text, font, fill, stroke){
22 var t = surface.createText(text);
23 if(font) t.setFont(font);
24 if(fill) t.setFill(fill);
25 if(stroke) t.setStroke(stroke);
26 placeAnchor(surface, text.x, text.y);
27 return t;
28 };
29
30 makeShapes = function(){
31 surface = dojox.gfx.createSurface("test", 500, 500);
32 /* SVGWEB { */
33 surface.whenLoaded(function() {
34 var p = surface.createPath({})
35 .setStroke("green")
36 .moveTo(0, 100)
37 .setAbsoluteMode(false)
38 .curveTo(CPD, 0, 100 - CPD, 300, 100, 300)
39 .curveTo(CPD, 0, 100 - CPD, -300, 100, -300)
40 .curveTo(CPD, 0, 100 - CPD, 300, 100, 300)
41 .curveTo(CPD, 0, 100 - CPD, -300, 100, -300)
42 .curveTo(CPD, 0, 100 - CPD, 300, 100, 300)
43 ;
44 console.debug(p);
45 var t = surface.createTextPath({
46 text: "Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Praesent erat. " +
47 "In malesuada ultricies velit. Vestibulum tempor odio vitae diam. " +
48 "Morbi arcu lectus, laoreet eget, nonummy at, elementum a, quam."
49 , align: "middle"
50 //, rotated: true
51 })
52 //.setShape(p.shape)
53 .moveTo(0, 100)
54 .setAbsoluteMode(false)
55 .curveTo(CPD, 0, 100 - CPD, 300, 100, 300)
56 .curveTo(CPD, 0, 100 - CPD, -300, 100, -300)
57 .curveTo(CPD, 0, 100 - CPD, 300, 100, 300)
58 .curveTo(CPD, 0, 100 - CPD, -300, 100, -300)
59 .curveTo(CPD, 0, 100 - CPD, 300, 100, 300)
60 .setFont({family: "times", size: "12pt"})
61 .setFill("blue")
62 ;
63 console.debug(t);
64 });
65 /* } */
66 };
67
68 dojo.addOnLoad(makeShapes);
69
70 </script>
71 </head>
72 <body>
73 <h1>dojox.gfx Text on a Path test</h1>
74 <div id="test" style="width: 500px; height: 500px;"></div>
75 <p>That's all Folks!</p>
76 </body>
77 </html>