Added buhin(99) drawing mode.
authorKoichi KAMICHI <kamichi@fonts.jp>
Tue, 21 Feb 2006 06:20:28 +0000 (06:20 +0000)
committerKoichi KAMICHI <kamichi@fonts.jp>
Tue, 21 Feb 2006 06:20:28 +0000 (06:20 +0000)
engine/buhin.js
engine/kage.js

index 455d274..02abd4b 100755 (executable)
@@ -14,6 +14,7 @@ function Buhin(number){
         return this.array[i].data;\r
       }\r
     }\r
+    return ""; // no data\r
   }\r
   Buhin.prototype.search = search;\r
   \r
index 1386ecb..0a91bb7 100755 (executable)
@@ -1,25 +1,63 @@
 function Kage(){\r
-  // method\r
-  function drawFont(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
-        //buhin\r
-      }\r
-    }\r
+       // method\r
+       function drawFont(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
+                               }\r
+                       }\r
+               }\r
+       }\r
+       Kage.prototype.drawFont = drawFont;\r
+       \r
+  function drawBuhin(polygons, glyph, x1, y1, x2, y2){\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]),\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
+                               }\r
+                       }\r
+               }\r
   }\r
-  Kage.prototype.drawFont = drawFont;\r
+  Kage.prototype.drawBuhin = drawBuhin;\r
   \r
   //properties\r
   Kage.prototype.kMincho = 0;\r