Moved test.js to sample.js. Deleted Japanese comment from kage.js.
authorKoichi KAMICHI <kamichi@fonts.jp>
Mon, 9 Feb 2009 04:33:17 +0000 (04:33 +0000)
committerKoichi KAMICHI <kamichi@fonts.jp>
Mon, 9 Feb 2009 04:33:17 +0000 (04:33 +0000)
engine/kage.js
engine/sample.js [new file with mode: 0644]
engine/test.js [deleted file]

index cc233c3..bc97a5a 100755 (executable)
@@ -65,10 +65,10 @@ function Kage(){
   \r
        function adjustUroko(strokesArray){ // strokesArray\r
     for(var i = 0; i < strokesArray.length; i++){\r
-      if(strokesArray[i][0] == 1 && strokesArray[i][2] == 0){ // \8fc\82Í\83E\83\8d\83R\82È\82¢\82Ì\82Å\96³\8e\8b\81B\82Å\82à\8cv\8eZ\97Ê\82ª\96³\91Ê\r
+      if(strokesArray[i][0] == 1 && strokesArray[i][2] == 0){ // no operation for TATE\r
         for(var k = 0; k < this.kAdjustUrokoLengthStep; k++){\r
           var tx, ty, tlen;\r
-          if(strokesArray[i][4] == strokesArray[i][6]){ // \89¡\r
+          if(strokesArray[i][4] == strokesArray[i][6]){ // YOKO\r
             tx = strokesArray[i][5] - this.kAdjustUrokoLine[k];\r
             ty = strokesArray[i][6] - 0.5;\r
             tlen = strokesArray[i][5] - strokesArray[i][3];\r
@@ -223,17 +223,17 @@ function Kage(){
   this.kL2RDfatten = 1.1;\r
   this.kMage = 10;\r
        \r
-  this.kAdjustKakatoL = ([14, 9, 5, 2]); // \92²\90®\8dÏ\82Ý\83J\83J\83g\97p 000,100,200,300\r
-  this.kAdjustKakatoR = ([8, 6, 4, 2]); // \92²\90®\8dÏ\82Ý\83J\83J\83g\97p 000,100,200,300\r
-  this.kAdjustKakatoRangeX = 20; // \89e\8b¿\94»\92è\8bé\8c`\82Ì\91å\82«\82³\r
-  this.kAdjustKakatoRangeY = ([1, 19, 24, 30]); // \89e\8b¿\94»\92è\8bé\8c`\82Ì\91å\82«\82³\8b«\8aE\81i3\97Ì\88æ\81j\r
-  this.kAdjustKakatoStep = 3; // \89e\8b¿\94»\92è\8bé\8c`\82Ì\92i\8aK\r
+  this.kAdjustKakatoL = ([14, 9, 5, 2]); // for KAKATO adjustment 000,100,200,300\r
+  this.kAdjustKakatoR = ([8, 6, 4, 2]); // for KAKATO adjustment 000,100,200,300\r
+  this.kAdjustKakatoRangeX = 20; // check area width\r
+  this.kAdjustKakatoRangeY = ([1, 19, 24, 30]); // 3 steps of checking\r
+  this.kAdjustKakatoStep = 3; // number of steps\r
        \r
-  this.kAdjustUrokoX = ([24, 20, 16, 12]); // \92²\90®\8dÏ\82Ý\83T\83C\83Y 000,100,200,300\r
-  this.kAdjustUrokoY = ([12, 11, 9, 8]); // \92²\90®\8dÏ\82Ý\83T\83C\83Y 000,100,200,300\r
-  this.kAdjustUrokoLength = ([22, 36, 50]); // \89e\8b¿\94»\92è\92·\82³\82Ì\92i\8aK\r
-  this.kAdjustUrokoLengthStep = 3; // \89e\8b¿\94»\92è\92·\82³\82Ì\92i\8aK\r
-  this.kAdjustUrokoLine = ([22, 26, 30]); // \8cð\8d·\82Ì\89e\8b¿\94»\92è\81BLength\82Æ\91Î\89\9e\r
+  this.kAdjustUrokoX = ([24, 20, 16, 12]); // for UROKO adjustment 000,100,200,300\r
+  this.kAdjustUrokoY = ([12, 11, 9, 8]); // for UROKO adjustment 000,100,200,300\r
+  this.kAdjustUrokoLength = ([22, 36, 50]); // length for checking\r
+  this.kAdjustUrokoLengthStep = 3; // number of steps\r
+  this.kAdjustUrokoLine = ([22, 26, 30]); // check for crossing. corresponds to length\r
        \r
   this.kBuhin = new Buhin();\r
   \r
diff --git a/engine/sample.js b/engine/sample.js
new file mode 100644 (file)
index 0000000..6e23da3
--- /dev/null
@@ -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 (file)
index fa9a5f7..0000000
+++ /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());