| 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 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
<script type="text/javascript"> |
| 18 |
dojo.require("dojox.gfx"); |
| 19 |
|
| 20 |
var CPD = 30; |
| 21 |
|
| 22 |
var surface = null; |
| 23 |
|
| 24 |
var 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 |
|
| 33 |
createSurface = function(){ |
| 34 |
surface = dojox.gfx.createSurface("test", 500, 500); |
| 35 |
surface.whenLoaded(makeShapes); |
| 36 |
}; |
| 37 |
|
| 38 |
makeShapes = 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 |
|
| 69 |
dojo.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> |