source: Dev/trunk/src/client/dojox/gfx/tests/test_textpath.html

Last change on this file was 483, checked in by hendrikvanantwerpen, 11 years ago

Added Dojo 1.9.3 release.

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