UNPKG

dojox

Version:

Dojo eXtensions, a rollup of many useful sub-projects and varying states of maturity – from very stable and robust, to alpha and experimental. See individual projects contain README files for details.

145 lines (133 loc) 4 kB
<html> <head> <title>Testing textpath</title> <style type="text/css"> @import "../../../../dojo/resources/dojo.css"; @import "../../../../dijit/tests/css/dijitTests.css"; </style> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <script type="text/javascript" src="../../../../dojo/dojo.js" data-dojo-config="isDebug: true"></script> <script type="text/javascript"> dojo.require("dojox.gfx"); dojo.require("dojox.gfx._gfxBidiSupport"); var CPD = 30, t, t2, t3,t4,t5; var surface = null; makeShapes = function(){ surfaceLTR = dojox.gfx.createSurface("testLTR", 500, 60); console.debug("surfaceLTR created"); var p = surfaceLTR.createPath({}) .moveTo(0, 15) .setAbsoluteMode(false) .curveTo(CPD, 0, 0, 0, 50, 0) ; console.debug("p created"); var t = surfaceLTR.createTextPath({ text: "\u05d4\u05ea\u05d7\u05dc\u05d4 end." , align: "start" , textDir: "ltr" }) .moveTo(0, 15) .setAbsoluteMode(false) .curveTo(CPD, 0, 0, 0, 100, 0) .setFont({family: "times", size: "12pt"}) .setFill("blue") ; console.debug("t created"); var t2 = surfaceLTR.createTextPath({ text: "Beginning \u05e1\u05d5\u05e3." , align: "start" ,textDir: "ltr" }) .moveTo(0, 50) .setAbsoluteMode(false) .curveTo(CPD, 0, 0, 0, 100, 0) .setFont({family: "times", size: "12pt"}) .setFill("blue") ; console.debug("t2 created"); surfaceRTL = dojox.gfx.createSurface("testRTL", 500, 60); console.debug("surfaceRTL created"); var p2 = surfaceRTL.createPath({}) .moveTo(0, 15) .setAbsoluteMode(false) .curveTo(CPD, 0, 0, 0, 100, 0) ; console.debug("p2 created"); var t3 = surfaceRTL.createTextPath({ text: "\u05d4\u05ea\u05d7\u05dc\u05d4 end. " , align: "start" ,textDir: "rtl" //, rotated: true }) .moveTo(0, 15) .setAbsoluteMode(false) .curveTo(CPD, 0, 100 - CPD, 0, 100, 0) .setFont({family: "times", size: "12pt"}) .setFill("red") ; console.debug("t3 created"); var t4 = surfaceRTL.createTextPath({ text: "Beginning \u05e1\u05d5\u05e3." , align: "start" ,textDir: "rtl" //, rotated: true }) //.setShape(p.shape) .moveTo(0, 50) .setAbsoluteMode(false) .curveTo(CPD, 0, 100 - CPD, 0, 100, 0) .setFont({family: "times", size: "12pt"}) .setFill("red") ; console.debug("t4 created"); surfaceAUTO = dojox.gfx.createSurface("testAUTO", 500, 60); console.debug("surfaceAUTO created"); var p3 = surfaceAUTO.createPath({}) .moveTo(0, 15) .setAbsoluteMode(false) .curveTo(CPD, 0, 0, 0, 100, 0) ; console.debug("p3 created"); var t5 = surfaceAUTO.createTextPath({ text: "\u05d4\u05ea\u05d7\u05dc\u05d4 end. " , align: "start" , textDir: "auto" //, rotated: true }) //.setShape(p.shape) .moveTo(0, 15) .setAbsoluteMode(false) .curveTo(CPD, 0, 100 - CPD, 0, 100, 0) .setFont({family: "times", size: "12pt"}) .setFill("red") ; console.debug("t5 created"); var t6 = surfaceAUTO.createTextPath({ text: "Beginning \u05e1\u05d5\u05e3." , align: "start" , textDir: "auto" //, rotated: true }) //.setShape(p.shape) .moveTo(0, 50) .setAbsoluteMode(false) .curveTo(CPD, 0, 100 - CPD, 0, 100, 0) .setFont({family: "times", size: "12pt"}) .setFill("blue") ; console.debug("t6 created"); }; dojo.addOnLoad(makeShapes); </script> </head> <body> <h1>dojox.gfx Text on a Path test</h1> <h2>LTR Text Path</h2> <div id="testLTR" style="width: 500px;"></div> <h2>RTL Text Path</h2> <div id="testRTL" style="width: 500px;"></div> <h2>AUTO Text Path</h2> <div id="testAUTO" style="width: 500px;"></div> <p>That's all Folks!</p> </body> </html>