| 1 |
<html> |
| 2 |
<head> |
| 3 |
<title>DojoX GFX: Vector Text test: draw a font</title> |
| 4 |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> |
| 5 |
<style type="text/css"> |
| 6 |
@import "../../../../dojo/resources/dojo.css"; |
| 7 |
@import "../../../../dijit/tests/css/dijitTests.css"; |
| 8 |
</style> |
| 9 |
|
| 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 |
dojo.require("dojox.gfx.fx"); |
| 17 |
dojo.require("dojox.gfx.VectorText"); |
| 18 |
|
| 19 |
var bg="#181818", fill="#a36e2c"; |
| 20 |
dojo.addOnLoad(function(){ |
| 21 |
var url = dojo.moduleUrl("dojox", "gfx/resources/Gillius.svg"); |
| 22 |
var f = new dojox.gfx.VectorFont(url); |
| 23 |
|
| 24 |
// draw out the glyphs for testing. |
| 25 |
var surface = dojox.gfx.createSurface("test", 600, 400); |
| 26 |
/* SVGWEB { */ |
| 27 |
surface.whenLoaded(function() { |
| 28 |
var rect = surface.createRect({ x: 0, y: 0, width: 600, height: 400 }) |
| 29 |
.setFill(bg); |
| 30 |
|
| 31 |
// draw it up. |
| 32 |
var txtArgs = { |
| 33 |
text: "Now is the time for all good men to come to a rest. Plus, the rain in Spain falls mainly on the plain!", |
| 34 |
x: 0, y: 0, |
| 35 |
width: 560, height: 360, |
| 36 |
align: "start", fitting: dojox.gfx.vectorFontFitting.FIT, |
| 37 |
leading: 1.2 |
| 38 |
}; |
| 39 |
var fontArgs = { |
| 40 |
size: "12pt", family: "Gillius" |
| 41 |
}; |
| 42 |
|
| 43 |
var master = surface.createGroup(); |
| 44 |
var g = f.draw(master, txtArgs, fontArgs, fill); |
| 45 |
|
| 46 |
dojox.gfx.fx.animateTransform({ |
| 47 |
shape: master, |
| 48 |
duration: 1000, |
| 49 |
transform: [ |
| 50 |
{name: "rotategAt", start: [0, 250, 250], end: [360, 350, 350]}, |
| 51 |
{ name: "scale", start: [0.1, 0.1], end:[1, 1 ] } |
| 52 |
] |
| 53 |
}).play(); |
| 54 |
}); |
| 55 |
/* } */ |
| 56 |
}); |
| 57 |
</script> |
| 58 |
</head> |
| 59 |
<body> |
| 60 |
<h1>dojox.gfx Vector Text test: drawing a font</h1> |
| 61 |
<p>This is a test of the new VectorText functionality; we draw a font using flow or fit.</p> |
| 62 |
<div id="test" style="width: 500px; height: 560px;"></div> |
| 63 |
</body> |
| 64 |
</html> |