Updated.
authorkamichi <kamichi@fonts.jp>
Wed, 6 Aug 2014 01:53:01 +0000 (10:53 +0900)
committerkamichi <kamichi@fonts.jp>
Wed, 6 Aug 2014 01:53:01 +0000 (10:53 +0900)
engine/buhin.js [changed mode: 0755->0644]
engine/kage.js [changed mode: 0755->0644]
engine/kagecd.js [changed mode: 0755->0644]
engine/kagedf.js [changed mode: 0755->0644]
engine/polygon.js [changed mode: 0755->0644]
engine/polygons.js [changed mode: 0755->0644]
engine/sample.html
engine/sample.js

old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
index d2fc215..c58fda5
@@ -2,19 +2,56 @@ function Kage(size){
   // method\r
   function makeGlyph(polygons, buhin){ // void\r
     var glyphData = this.kBuhin.search(buhin);\r
-    if(glyphData != ""){\r
-       this.drawStrokesArray(polygons, this.adjustKirikuchi(this.adjustUroko2(this.adjustUroko(this.adjustKakato(this.adjustTate(this.adjustMage(this.adjustHane(this.getEachStrokes(glyphData)))))))));\r
-    }\r
+    this.makeGlyph2(polygons, glyphData);\r
   }\r
   Kage.prototype.makeGlyph = makeGlyph;\r
   \r
   function makeGlyph2(polygons, data){ // void\r
-    if(data != ""){\r
-       this.drawStrokesArray(polygons, this.adjustKirikuchi(this.adjustUroko2(this.adjustUroko(this.adjustKakato(this.adjustTate(this.adjustMage(this.adjustHane(this.getEachStrokes(data)))))))));\r
-    }\r
+      if(data != ""){\r
+         var strokesArray = this.adjustKirikuchi(this.adjustUroko2(this.adjustUroko(this.adjustKakato(this.adjustTate(this.adjustMage(this.adjustHane(this.getEachStrokes(data))))))));\r
+         for(var i = 0; i < strokesArray.length; i++){\r
+             dfDrawFont(this, polygons,\r
+                        strokesArray[i][0],\r
+                        strokesArray[i][1],\r
+                        strokesArray[i][2],\r
+                        strokesArray[i][3],\r
+                        strokesArray[i][4],\r
+                        strokesArray[i][5],\r
+                        strokesArray[i][6],\r
+                        strokesArray[i][7],\r
+                        strokesArray[i][8],\r
+                        strokesArray[i][9],\r
+                        strokesArray[i][10]);\r
+         }\r
+      }\r
   }\r
   Kage.prototype.makeGlyph2 = makeGlyph2;\r
   \r
+  function makeGlyph3(data){ // void\r
+      var result = new Array();\r
+      if(data != ""){\r
+         var strokesArray = this.adjustKirikuchi(this.adjustUroko2(this.adjustUroko(this.adjustKakato(this.adjustTate(this.adjustMage(this.adjustHane(this.getEachStrokes(data))))))));\r
+         for(var i = 0; i < strokesArray.length; i++){\r
+             var polygons = new Polygons();\r
+             dfDrawFont(this, polygons,\r
+                        strokesArray[i][0],\r
+                        strokesArray[i][1],\r
+                        strokesArray[i][2],\r
+                        strokesArray[i][3],\r
+                        strokesArray[i][4],\r
+                        strokesArray[i][5],\r
+                        strokesArray[i][6],\r
+                        strokesArray[i][7],\r
+                        strokesArray[i][8],\r
+                        strokesArray[i][9],\r
+                        strokesArray[i][10]);\r
+             result.push(polygons);\r
+         }\r
+      }\r
+      return result;\r
+  }\r
+  Kage.prototype.makeGlyph3 = makeGlyph3;\r
+  \r
   function getEachStrokes(glyphData){ // strokes array\r
     var strokesArray = new Array();\r
     var strokes = glyphData.split("$");\r
@@ -270,56 +307,6 @@ function Kage(size){
   }\r
   Kage.prototype.adjustKakato = adjustKakato;\r
   \r
-  function drawStrokesArray(polygons, strokesArray){\r
-    for(var i = 0; i < strokesArray.length; i++){\r
-      dfDrawFont(this, polygons,\r
-                 strokesArray[i][0],\r
-                 strokesArray[i][1],\r
-                 strokesArray[i][2],\r
-                 strokesArray[i][3],\r
-                 strokesArray[i][4],\r
-                 strokesArray[i][5],\r
-                 strokesArray[i][6],\r
-                 strokesArray[i][7],\r
-                 strokesArray[i][8],\r
-                 strokesArray[i][9],\r
-                 strokesArray[i][10]);\r
-    }\r
-  }\r
-  Kage.prototype.drawStrokesArray = drawStrokesArray;\r
-  \r
-  function drawGlyph(polygons, glyph){ // void\r
-    // [glyph] : [stroke]$[stroke]$.....\r
-    // [stroke] : [column]:[column]:.....\r
-    var strokes = glyph.split("$");\r
-    for(var i = 0; i < strokes.length; i++){\r
-      var columns = strokes[i].split(":");\r
-      if(Math.floor(columns[0]) != 99){\r
-        dfDrawFont(this, polygons,\r
-                   Math.floor(columns[0]),\r
-                   Math.floor(columns[1]), Math.floor(columns[2]),\r
-                   Math.floor(columns[3]), Math.floor(columns[4]),\r
-                   Math.floor(columns[5]), Math.floor(columns[6]),\r
-                   Math.floor(columns[7]), Math.floor(columns[8]),\r
-                   Math.floor(columns[9]), Math.floor(columns[10]));\r
-      } else {\r
-        var buhin = this.kBuhin.search(columns[7]);\r
-        if(buhin != ""){\r
-          this.drawBuhin(polygons, buhin,\r
-                         Math.floor(columns[3]),\r
-                         Math.floor(columns[4]),\r
-                         Math.floor(columns[5]),\r
-                         Math.floor(columns[6]),\r
-                         Math.floor(columns[1]),\r
-                         Math.floor(columns[2]),\r
-                         Math.floor(columns[9]),\r
-                         Math.floor(columns[10]));\r
-        }\r
-      }\r
-    }\r
-  }\r
-  Kage.prototype.drawGlyph = drawGlyph;\r
-  \r
   function getBox(glyph){ // minX, minY, maxX, maxY\r
       var a = new Object();\r
       a.minX = 200;\r
@@ -373,62 +360,6 @@ function Kage(size){
   }\r
   Kage.prototype.stretch = stretch;\r
 \r
-  function drawBuhin(polygons, glyph, x1, y1, x2, y2, sx, sy, sx2, sy2){ // void\r
-    var strokes = glyph.split("$");\r
-    var box = this.getBox(glyph);\r
-      if(sx != 0 || sy != 0){\r
-         if(sx > 100){\r
-             sx -= 200; // Ç¤°ÕÅÀ¥â¡¼¥É\r
-         } else {\r
-             sx2 = 0; // Ãæ¿´ÅÀ¥â¡¼¥É\r
-             sy2 = 0;\r
-         }\r
-      }\r
-    for(var i = 0; i < strokes.length; i++){\r
-      var columns = strokes[i].split(":");\r
-       if(sx != 0 || sy != 0){\r
-           columns[3] = stretch(sx, sx2, columns[3], box.minX, box.maxX);\r
-           columns[4] = stretch(sy, sy2, columns[4], box.minY, box.maxY);\r
-           columns[5] = stretch(sx, sx2, columns[5], box.minX, box.maxX);\r
-           columns[6] = stretch(sy, sy2, columns[6], box.minY, box.maxY);\r
-           if(columns[0] != 99){\r
-               columns[7] = stretch(sx, sx2, columns[7], box.minX, box.maxX);\r
-               columns[8] = stretch(sy, sy2, columns[8], box.minY, box.maxY);\r
-               columns[9] = stretch(sx, sx2, columns[9], box.minX, box.maxX);\r
-               columns[10] = stretch(sy, sy2, columns[10], box.minY, box.maxY);\r
-           }\r
-       }\r
-      if(Math.floor(columns[0]) != 99){\r
-        dfDrawFont(this, polygons,\r
-                   Math.floor(columns[0]),\r
-                   Math.floor(columns[1]),\r
-                   Math.floor(columns[2]),\r
-                   x1 + Math.floor(columns[3]) * (x2 - x1) / 200,\r
-                   y1 + Math.floor(columns[4]) * (y2 - y1) / 200,\r
-                   x1 + Math.floor(columns[5]) * (x2 - x1) / 200,\r
-                   y1 + Math.floor(columns[6]) * (y2 - y1) / 200,\r
-                   x1 + Math.floor(columns[7]) * (x2 - x1) / 200,\r
-                   y1 + Math.floor(columns[8]) * (y2 - y1) / 200,\r
-                   x1 + Math.floor(columns[9]) * (x2 - x1) / 200,\r
-                   y1 + Math.floor(columns[10]) * (y2 - y1) / 200);\r
-      } else {\r
-        var buhin = this.kBuhin.search(columns[7]);\r
-        if(buhin != ""){\r
-          this.drawBuhin(polygons, buhin,\r
-                         x1 + Math.floor(columns[3]) * (x2 - x1) / 200,\r
-                         y1 + Math.floor(columns[4]) * (y2 - y1) / 200,\r
-                         x1 + Math.floor(columns[5]) * (x2 - x1) / 200,\r
-                         y1 + Math.floor(columns[6]) * (y2 - y1) / 200,\r
-                        Math.floor(columns[1]),\r
-                        Math.floor(columns[2]),\r
-                        Math.floor(columns[9]),\r
-                        Math.floor(columns[10]));\r
-        }\r
-      }\r
-    }\r
-  }\r
-  Kage.prototype.drawBuhin = drawBuhin;\r
-  \r
   //properties\r
   Kage.prototype.kMincho = 0;\r
   Kage.prototype.kGothic = 1;\r
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
index 7c26c5e..9ff8299 100644 (file)
@@ -8,7 +8,7 @@
   <script type="text/javascript" src="kagedf.js"></script>\r
   <script type="text/javascript" src="polygon.js"></script>\r
   <script type="text/javascript" src="polygons.js"></script>\r
-  <script type="application/x-javascript">\r
+  <script type="text/javascript">\r
 function draw() {\r
  var canvas = document.getElementById("canvas");\r
  var ctx = canvas.getContext("2d");\r
@@ -17,11 +17,10 @@ function draw() {
  kage.kUseCurve = false;\r
  var polygons = new Polygons();\r
  \r
- kage.kBuhin.push("u6f22", "99:0:0:9:12:73:200:u6c35-07$99:0:0:54:10:190:199:u26c29-07");\r
- 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");\r
- 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");\r
+ kage.kBuhin.push("u9ebb", "1:0:2:40:37:143:37$4:22:5:143:37:12:169:170:169:175:171");\r
+ kage.kBuhin.push("u9ebb-2", "99:0:0:0:0:200:200:u9ebb:0:0:0");\r
  \r
- kage.makeGlyph(polygons, "u6f22");\r
+ kage.makeGlyph(polygons, "u9ebb-2");\r
  \r
  ctx.fillStyle = "rgb(0, 0, 0)";\r
  \r
index 271f668..0b1375e 100644 (file)
@@ -16,7 +16,7 @@ var kage = new Kage();
 kage.kUseCurve = true;
 var 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("u6f22", "99:150:0:9:12:73:200:u6c35-07:0:-10:50$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");