From: Koichi KAMICHI Date: Mon, 9 Feb 2009 04:33:17 +0000 (+0000) Subject: Moved test.js to sample.js. Deleted Japanese comment from kage.js. X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=b485352f1d0ca3af79f47442e399a9337db4b5ba;p=chise%2Fkage.git Moved test.js to sample.js. Deleted Japanese comment from kage.js. --- diff --git a/engine/kage.js b/engine/kage.js index cc233c3..bc97a5a 100755 --- a/engine/kage.js +++ b/engine/kage.js @@ -65,10 +65,10 @@ function Kage(){ function adjustUroko(strokesArray){ // strokesArray for(var i = 0; i < strokesArray.length; i++){ - if(strokesArray[i][0] == 1 && strokesArray[i][2] == 0){ // c‚̓EƒƒR‚È‚¢‚Ì‚Å–³Ž‹B‚Å‚àŒvŽZ—Ê‚ª–³‘Ê + if(strokesArray[i][0] == 1 && strokesArray[i][2] == 0){ // no operation for TATE for(var k = 0; k < this.kAdjustUrokoLengthStep; k++){ var tx, ty, tlen; - if(strokesArray[i][4] == strokesArray[i][6]){ // ‰¡ + if(strokesArray[i][4] == strokesArray[i][6]){ // YOKO tx = strokesArray[i][5] - this.kAdjustUrokoLine[k]; ty = strokesArray[i][6] - 0.5; tlen = strokesArray[i][5] - strokesArray[i][3]; @@ -223,17 +223,17 @@ function Kage(){ this.kL2RDfatten = 1.1; this.kMage = 10; - this.kAdjustKakatoL = ([14, 9, 5, 2]); // ’²®Ï‚݃JƒJƒg—p 000,100,200,300 - this.kAdjustKakatoR = ([8, 6, 4, 2]); // ’²®Ï‚݃JƒJƒg—p 000,100,200,300 - this.kAdjustKakatoRangeX = 20; // ‰e‹¿”»’è‹éŒ`‚Ì‘å‚«‚³ - this.kAdjustKakatoRangeY = ([1, 19, 24, 30]); // ‰e‹¿”»’è‹éŒ`‚Ì‘å‚«‚³‹«ŠEi3—̈æj - this.kAdjustKakatoStep = 3; // ‰e‹¿”»’è‹éŒ`‚Ì’iŠK + this.kAdjustKakatoL = ([14, 9, 5, 2]); // for KAKATO adjustment 000,100,200,300 + this.kAdjustKakatoR = ([8, 6, 4, 2]); // for KAKATO adjustment 000,100,200,300 + this.kAdjustKakatoRangeX = 20; // check area width + this.kAdjustKakatoRangeY = ([1, 19, 24, 30]); // 3 steps of checking + this.kAdjustKakatoStep = 3; // number of steps - this.kAdjustUrokoX = ([24, 20, 16, 12]); // ’²®Ï‚݃TƒCƒY 000,100,200,300 - this.kAdjustUrokoY = ([12, 11, 9, 8]); // ’²®Ï‚݃TƒCƒY 000,100,200,300 - this.kAdjustUrokoLength = ([22, 36, 50]); // ‰e‹¿”»’è’·‚³‚Ì’iŠK - this.kAdjustUrokoLengthStep = 3; // ‰e‹¿”»’è’·‚³‚Ì’iŠK - this.kAdjustUrokoLine = ([22, 26, 30]); // Œð·‚̉e‹¿”»’èBLength‚ƑΉž + this.kAdjustUrokoX = ([24, 20, 16, 12]); // for UROKO adjustment 000,100,200,300 + this.kAdjustUrokoY = ([12, 11, 9, 8]); // for UROKO adjustment 000,100,200,300 + this.kAdjustUrokoLength = ([22, 36, 50]); // length for checking + this.kAdjustUrokoLengthStep = 3; // number of steps + this.kAdjustUrokoLine = ([22, 26, 30]); // check for crossing. corresponds to length this.kBuhin = new Buhin(); diff --git a/engine/sample.js b/engine/sample.js new file mode 100644 index 0000000..6e23da3 --- /dev/null +++ b/engine/sample.js @@ -0,0 +1,24 @@ +// KAGE engine sample script for JavaScript engine +// +// % js sample.js > result.svg (SpiderMonkey) +// % java -jar js.jar sample.js > result.svg (Rhino) + +load("2d.js"); +load("buhin.js"); +load("kage.js"); +load("kagecd.js"); +load("kagedf.js"); +load("polygon.js"); +load("polygons.js"); + +kage = new Kage(); +polygons = new Polygons(); + +kage.kBuhin.push("u6f22", "99:0:0:9:12:73:200:u6c35-07$99:0:0:54:10:190:199:u26c29-07"); +kage.kBuhin.push("u6c35-07", "2:7:8:42:12:99:23:124:35$2:7:8:20:62:75:71:97:85$2:7:8:12:123:90:151:81:188$2:2:7:63:144:109:118:188:51"); +kage.kBuhin.push("u26c29-07", "1:0:0:18:29:187:29$1:0:0:73:10:73:48$1:0:0:132:10:132:48$1:12:13:44:59:44:87$1:2:2:44:59:163:59$1:22:23:163:59:163:87$1:2:2:44:87:163:87$1:0:0:32:116:176:116$1:0:0:21:137:190:137$7:32:7:102:59:102:123:102:176:10:190$2:7:0:105:137:126:169:181:182"); + +kage.makeGlyph(polygons, "u6f22"); + +print(polygons.generateSVG()); + diff --git a/engine/test.js b/engine/test.js deleted file mode 100644 index fa9a5f7..0000000 --- a/engine/test.js +++ /dev/null @@ -1,20 +0,0 @@ -// KAGE engine sample for SpiderMonkey -// -// use like ... %js test.js > a.svg - -load("polygon.js"); -load("polygons.js"); -load("buhin.js"); -load("kage.js"); -load("kagecd.js"); -load("kagedf.js"); -load("2d.js"); - -kage = new Kage(); -polygons = new Polygons(); - -kage.kBuhin.push("test", "2:7:8:66:2:95:16:110:33$1:0:2:28:56:102:56$1:22:4:103:56:103:196$1:0:2:3:92:66:92$2:22:7:66:92:48:146:1:178$2:0:7:186:66:163:89:125:112$2:7:0:107:60:130:144:196:182"); - -kage.makeGlyph(polygons, "test"); - -print(polygons.generateSVG());