| 1 |
<html> |
| 2 |
<head> |
| 3 |
<title>Testing text</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/svgweb/src/svg.js" data-path="../../svgweb/svgweb/src"></script> |
| 12 |
<script src="../../../../../dojo/dojo.js" data-dojo-config="isDebug:true,forceGfxRenderer:'svg'" type="text/javascript"></script> |
| 13 |
|
| 14 |
|
| 15 |
<script type="text/javascript"> |
| 16 |
dojo.require("dojox.gfx"); |
| 17 |
dojo.require("dojox.gfx._gfxBidiSupport"); |
| 18 |
|
| 19 |
var ROTATION = 30; |
| 20 |
|
| 21 |
var surface = null, t1; |
| 22 |
|
| 23 |
var placeAnchor = function(surface, x, y){ |
| 24 |
surface.createLine({x1: x - 2, y1: y, x2: x + 2, y2: y}); |
| 25 |
surface.createLine({x1: x, y1: y - 2, x2: x, y2: y + 2}); |
| 26 |
}; |
| 27 |
|
| 28 |
var makeText = function(surface, text, font, fill, stroke){ |
| 29 |
var t = surface.createText(text); |
| 30 |
if(font) t.setFont(font); |
| 31 |
if(fill) t.setFill(fill); |
| 32 |
if(stroke) t.setStroke(stroke); |
| 33 |
placeAnchor(surface, text.x, text.y); |
| 34 |
return t; |
| 35 |
}; |
| 36 |
|
| 37 |
makeShapes = function(){ |
| 38 |
surface = dojox.gfx.createSurface("test", 500, 200); |
| 39 |
surface.whenLoaded(function() { |
| 40 |
var m = dojox.gfx.matrix; |
| 41 |
//surface.createLine({x1: 250, y1: 0, x2: 250, y2: 500}).setStroke("green"); |
| 42 |
t1 = makeText(surface, {id: "t1",x: 250, y: 50, text:"Hello!", textDir:"ltr"}, |
| 43 |
{family: "Times", size: "24pt"}, "black", "red") |
| 44 |
.setTransform(m.rotategAt(0, 250, 50)); |
| 45 |
}); |
| 46 |
|
| 47 |
} |
| 48 |
|
| 49 |
dojo.addOnLoad(makeShapes); |
| 50 |
|
| 51 |
</script> |
| 52 |
</head> |
| 53 |
<body> |
| 54 |
<h1>dojox.gfx Text test</h1> |
| 55 |
<div id="test" style="width: 500px; height: 200px;"></div> |
| 56 |
|
| 57 |
<label>write inside to test dojox.gfx.Text with BidiEngine</label> |
| 58 |
<br> |
| 59 |
<textarea id="inputF" |
| 60 |
onkeyup="dealInput();" |
| 61 |
>write in me to test dojox.gfx.Text with BidiEngine</textarea> |
| 62 |
|
| 63 |
<script> |
| 64 |
function dealInput(){ |
| 65 |
var v = inputF.value ? inputF.value : ""; |
| 66 |
t1.setShape({text: v}); |
| 67 |
} |
| 68 |
</script> |
| 69 |
|
| 70 |
<br> |
| 71 |
<input id="SHALOM" type="button" value="click on me to write a Hebrew word!" |
| 72 |
onclick="t1.setShape({text:'\u05e9\u05dc\u05d5\u05dd!'}); inputF.value = '\u05e9\u05dc\u05d5\u05dd!'" |
| 73 |
/> |
| 74 |
|
| 75 |
<br> |
| 76 |
<br> |
| 77 |
|
| 78 |
<input id="textDirLTR" type="button" value="change textDir to 'LTR'" |
| 79 |
onclick="t1.setShape({textDir:'ltr'});" |
| 80 |
/> |
| 81 |
<input id="textDirRTL" type="button" value="change textDir to 'RTL'" |
| 82 |
onclick="t1.setShape({textDir:'rtl'});" |
| 83 |
/> |
| 84 |
<input id="textDirAUTO" type="button" value="change textDir to 'AUTO'" |
| 85 |
onclick="t1.setShape({textDir:'auto'});" |
| 86 |
/> |
| 87 |
|
| 88 |
</body> |
| 89 |
</html> |