Files
openlayers/master/examples/textpathBidi.html
Éric Lemoine 5d14b9e2d4 Updated
2013-02-20 10:38:25 +01:00

145 lines
4.0 KiB
HTML

<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" djConfig="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>