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